Currently, passing multiple arguments to ls causes it to print
them all in a single list, which can be very confusing as it'll
even columnate them together.
Make this match real ls behaviour (at least as observed on my
system) that prints which path it's giving the output for.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
ret = 0
pending = []
- for path in opt.paths:
- path = posixpath.join(pwd, path)
+ last_n = len(opt.paths) - 1
+ for n, printpath in enumerate(opt.paths):
+ path = posixpath.join(pwd, printpath)
try:
+ if last_n > 0:
+ out.write(b'%s:\n' % printpath)
+
if opt.directory:
resolved = vfs.resolve(repo, path, follow=False)
else:
log('bup: %s\n' % ex)
ret = 1
- if pending:
- out.write(columnate(pending, b''))
+ if pending:
+ out.write(columnate(pending, b''))
+ pending = []
+
+ if n < last_n:
+ out.write(b'\n')
return ret