On Fri, Nov 4, 2022 at 11:18 PM Eric Blake <eblake@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