Skip to content

Commit

Permalink
consistent help messages from bcfg2-admin/bcfg2-info (bug #1033)
Browse files Browse the repository at this point in the history
  • Loading branch information
stpierre committed Jan 10, 2012
1 parent e7dcc44 commit 81296e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/sbin/bcfg2-admin
Expand Up @@ -44,6 +44,9 @@ def main():
'verbose': Bcfg2.Options.VERBOSE,
}
setup = Bcfg2.Options.OptionParser(optinfo)
# override default help message to include description of all modes
setup.hm = "Usage:\n %s\n%s" % (setup.buildHelpMessage(),
create_description())
setup.parse(sys.argv[1:])

log_args = dict(to_syslog=False, to_console=logging.WARNING)
Expand All @@ -58,8 +61,7 @@ def main():
setup['args'] = [setup['args'][1], setup['args'][0]]
else:
# Print short help for all modes
print("Usage:\n %s" % setup.buildHelpMessage())
print(create_description())
print(setup.hm)
raise SystemExit(0)

if setup['args'][0] in get_modes():
Expand Down
5 changes: 4 additions & 1 deletion src/sbin/bcfg2-info
Expand Up @@ -518,9 +518,12 @@ if __name__ == '__main__':
'logging': Bcfg2.Options.LOGGING_FILE_PATH
})
setup = Bcfg2.Options.OptionParser(optinfo)
setup.hm = "Usage:\n %s\n%s" % (setup.buildHelpMessage(),
USAGE)

setup.parse(sys.argv[1:])
if setup['args'] and setup['args'][0] == 'help':
print(USAGE)
print(setup.hm)
sys.exit(0)
elif setup['profile'] and have_profile:
prof = profile.Profile()
Expand Down

0 comments on commit 81296e4

Please sign in to comment.