[Libguestfs] [libnbd PATCH v2 3/3] nbdsh: Improve --help and initial banner contents.

Nir Soffer nsoffer at redhat.com
Sat Nov 5 01:39:26 UTC 2022


On Fri, Nov 4, 2022 at 11:18 PM Eric Blake <eblake at redhat.com> wrote:
[...]

> @@ -127,7 +129,10 @@ def __call__(self, parser, namespace, values,
> option_string=None):
>          os.environ["LIBNBD_DEBUG"] = "1"
>
>      # Create the handle.
> -    if not args.n:
> +    if args.n:
> +        pass
> +    else:
>

Why add useless branch?


> +        global h
>          h = nbd.NBD()
>          h.set_handle_name("nbdsh")
>
> @@ -165,21 +170,35 @@ def line(x): lines.append(x)
>      def blank(): line("")
>      def example(ex, desc): line("%-34s # %s" % (ex, desc))
>
> +    connect_hint = False
> +    go_hint = False
>      blank()
>      line("Welcome to nbdsh, the shell for interacting with")
>      line("Network Block Device (NBD) servers.")
>      blank()
> -    if not args.n:
> -        line("The ‘nbd’ module has already been imported and there")
> -        line("is an open NBD handle called ‘h’.")
> -        blank()
> -    else:
> +    if args.n:
>          line("The ‘nbd’ module has already been imported.")
>          blank()
>          example("h = nbd.NBD()", "Create a new handle.")
> -    if False:  # args.uri is None:
>

Good that this was removed, but it will be better to remove in the previous
patch.

Nir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20221105/b6a250aa/attachment.htm>


More information about the Libguestfs mailing list