]> arthur.barton.de Git - bup.git/blobdiff - cmd/ftp-cmd.py
cmd/ftp: only import readline if necessary.
[bup.git] / cmd / ftp-cmd.py
index c6f26af7700eb1eab8be62317416cb09fbcc8913..0dd825ab3568f7c38712d290be26987fbe7d11c4 100755 (executable)
@@ -3,13 +3,6 @@ import sys, os, re, stat, fnmatch
 from bup import options, git, shquote, vfs
 from bup.helpers import *
 
-try:
-    import readline
-except ImportError:
-    log('* readline module not available: line editing disabled.\n')
-    readline = None
-
-
 def node_name(text, n):
     if stat.S_ISDIR(n.mode):
         return '%s/' % text
@@ -116,7 +109,7 @@ def completer(text, state):
 
 
 optspec = """
-bup ftp
+bup ftp [commands...]
 """
 o = options.Options('bup ftp', optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
@@ -130,6 +123,12 @@ rv = 0
 if extra:
     lines = extra
 else:
+    try:
+        import readline
+    except ImportError:
+        log('* readline module not available: line editing disabled.\n')
+        readline = None
+
     if readline:
         readline.set_completer_delims(' \t\n\r/')
         readline.set_completer(completer)