From: Gabriel Filion Date: Thu, 2 Dec 2010 22:58:42 +0000 (-0500) Subject: ls-cmd: hide files with a leading dot by default X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=74d28e77366dba1eefbfa2beeda34bcaa835dc58;p=packages%2Fb%2Fbup.git ls-cmd: hide files with a leading dot by default 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 --- diff --git a/cmd/ls-cmd.py b/cmd/ls-cmd.py index 57f4275..bbc0432 100755 --- a/cmd/ls-cmd.py +++ b/cmd/ls-cmd.py @@ -19,6 +19,7 @@ optspec = """ bup ls -- 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