"""Print usage string to stderr and abort."""
sys.stderr.write(self._usagestr)
if msg:
- sys.stderr.write(msg)
+ sys.stderr.write("\n" + msg)
e = self._onabort and self._onabort(msg) or None
if e:
raise e
def fatal(self, msg):
"""Print an error message to stderr and abort with usage string."""
- msg = '\nerror: %s\n' % msg
+ msg = 'Error: %s!' % msg
return self.usage(msg)
def parse(self, args):
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)
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: