Permalink
Browse files

Added functionality for listing valid mode names.

  • Loading branch information...
1 parent 8def5c0 commit 01dec1e468b298a54b18c42ecb40a269ff4abb48 Stephan Sokolow committed Aug 26, 2009
Showing with 5 additions and 2 deletions.
  1. +5 −2 timeclock.py
View
@@ -296,10 +296,13 @@ def doSave(self):
# default=False, help="Increase verbosity")
parser.add_option('-m', '--initial-mode',
action="store", dest="mode", default="sleep",
- metavar="MODE", help="start in MODE")
+ metavar="MODE", help="start in MODE. (Use 'help' for a list)")
opts, args = parser.parse_args()
- if (opts.mode not in MODE_NAMES):
+ if opts.mode == 'help':
+ print "Valid mode names are: %s" % ', '.join(MODE_NAMES)
+ parser.exit(0)
+ elif (opts.mode not in MODE_NAMES):
print "Mode '%s' not recognized, defaulting to sleep." % opts.mode
opts.mode = "sleep"
app = TimeClock(default_mode=opts.mode)

0 comments on commit 01dec1e

Please sign in to comment.