diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-10-17 10:33:02 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-10-17 10:33:02 +0100 |
| commit | 744196884e26dd927cff383ab642c781569a77b5 (patch) | |
| tree | 9489f3c473cfde6151780aa8762c2fea616ba9b4 | |
| parent | 3289ea747250c254bd11a98fbc18df598ea42b68 (diff) | |
Nicer help again.
| -rwxr-xr-x | cdist | 32 |
1 files changed, 25 insertions, 7 deletions
@@ -564,8 +564,29 @@ def devel_to_git(project, filename): # def main(): + + commands = { + "build": "build project", + "package": "package and build project", + "release": "release a project using its next version number (changing wscript and tagging)", + "pot": "build the project's .pot files", + "changelog": "generate a simple HTML changelog", + "manual": "build the project's manual", + "doxygen": "build the project's Doxygen documentation", + "latest": "print out the latest version", + "test": "run the project's unit tests", + "shell": "build the project then start a shell in its chroot", + "revision": "print the head git revision number" + } + + one_of = "Command is one of:\n" + summary = "" + for k, v in commands.iteritems(): + one_of += "\t%s\t%s\n" % (k, v) + summary += k + " " + parser = argparse.ArgumentParser() - parser.add_argument('command') + parser.add_argument('command', help=summary) parser.add_argument('-p', '--project', help='project name') parser.add_argument('-d', '--directory', help='directory within project repo', default='.') parser.add_argument('--minor', help='minor version number bump', action='store_true') @@ -592,12 +613,9 @@ def main(): project = Project(args.project, args.directory, args.checkout) - commands = ['build', 'package', 'release', 'pot', 'changelog', 'manual', 'doxygen', 'latest', 'test', 'shell', 'revision'] - if globals.command not in commands: - e = 'command must be one of: ' - for c in commands: - e += '%s ' % c - raise Error(e) + if not globals.command in commands: + e = 'command must be one of:\n' + one_of + raise Error('command must be one of:\n%s' % one_of) if globals.command == 'build': if args.target is None: |
