]> arthur.barton.de Git - bup.git/commitdiff
ls-cmd: hide files with a leading dot by default
authorGabriel Filion <lelutin@gmail.com>
Thu, 2 Dec 2010 22:58:42 +0000 (17:58 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Mon, 3 Jan 2011 04:41:35 +0000 (20:41 -0800)
All of the frontends currently don't show hidden files by default (named with a
leading dot).

Make ls-cmd hide those files by default and add an option, '-a' or '--all', to
make it possible to show hidden files.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
cmd/ls-cmd.py

index 57f4275cf84a28cf0ebb1270de62f0d77d7f02ea..bbc0432987530946aefdb489b1c749e5b4ad8626 100755 (executable)
@@ -19,6 +19,7 @@ optspec = """
 bup ls <dirs...>
 --
 s,hash   show hash for each file
+a,all    show hidden files
 """
 o = options.Options('bup ls', optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
@@ -35,9 +36,11 @@ for d in extra:
         n = top.lresolve(d)
         if stat.S_ISDIR(n.mode):
             for sub in n:
-                print_node(sub.name, sub)
+                if opt.all or not sub.name.startswith('.'):
+                    print_node(sub.name, sub)
         else:
-            print_node(d, n)
+            if opt.all or not sub.name.startswith('.'):
+                print_node(d, n)
     except vfs.NodeError, e:
         log('error: %s\n' % e)
         ret = 1