def usage(msg=""):
log('Usage: bup [-?|--help] [-d BUP_DIR] [--debug] [--profile] '
- '<command> [options...]\n\n')
+ '<command> [options...]')
+ log('')
common = dict(
ftp = 'Browse backup sets using an ftp-like client',
fsck = 'Check backup sets for damage and add redundancy information',
web = 'Launch a web server to examine backup sets',
)
- log('Common commands:\n')
+ log('Common commands:')
for cmd,synopsis in sorted(common.items()):
- log(' %-10s %s\n' % (cmd, synopsis))
- log('\n')
-
- log('Other available commands:\n')
+ log(' %-10s %s' % (cmd, synopsis))
+ log('')
+
+ log('Other available commands:')
cmds = []
for c in sorted(os.listdir(cmdpath) + os.listdir(exepath)):
if c.startswith('bup-') and c.find('.') < 0:
if cname not in common:
cmds.append(c[4:])
log(columnate(cmds, ' '))
- log('\n')
-
+
log("See 'bup help COMMAND' for more information on " +
- "a specific command.\n")
+ "a specific command.")
if msg:
- log("\n%s\n" % msg)
+ log('')
+ log("%s" % msg)
sys.exit(99)
optspec = ['help', 'version', 'debug', 'profile', 'bup-dir=']
global_args, subcmd = getopt.getopt(argv[1:], '?VDd:', optspec)
except getopt.GetoptError, ex:
- usage('error: %s' % ex.msg)
+ usage('Error: %s!' % ex.msg)
help_requested = None
do_profile = False
elif opt[0] in ['-d', '--bup-dir']:
os.environ['BUP_DIR'] = opt[1]
else:
- usage('error: unexpected option "%s"' % opt[0])
+ usage('Error: Unexpected option "%s"!' % opt[0])
# Make BUP_DIR absolute, so we aren't affected by chdir (i.e. save -C, etc.).
if 'BUP_DIR' in os.environ:
subcmd[0] = subpath(subcmd_name)
if not os.path.exists(subcmd[0]):
- usage('error: unknown command "%s"' % subcmd_name)
+ usage('Error: Unknown command "%s"!' % subcmd_name)
already_fixed = atoi(os.environ.get('BUP_FORCE_TTY'))
if subcmd_name in ['mux', 'ftp', 'help']:
forward_signals = True
def handler(signum, frame):
- debug1('\nbup: signal %d received\n' % signum)
+ debug1('bup: Signal %d received!' % signum)
if not p or not forward_signals:
return
if signum != signal.SIGTSTP:
forward_signals = False
break
except OSError, e:
- log('%s: %s\n' % (subcmd[0], e))
+ log('%s: %s' % (subcmd[0], e))
ret = 98
finally:
if p and p.poll() == None: