Permalink
Browse files

Switching to command line flag code from unitedstates/congress and un…

…itedstates/congress-legislators (use -- dashes)
  • Loading branch information...
1 parent 56b4ca7 commit 4043bc0bb5c80dbffaff69d8a33eff00f9604d67 @konklone konklone committed Apr 2, 2013
Showing with 11 additions and 6 deletions.
  1. +11 −6 run
View
@@ -12,12 +12,17 @@ task_name = sys.argv[1]
options = {}
args = sys.argv[2:]
for arg in args:
- if "=" in arg:
- key, value = arg.split('=')
- if key and value:
- if value == 'True': value = True
- elif value == 'False': value = False
- options[key.lower()] = value
+ if arg.startswith("--"):
+
+ if "=" in arg:
+ key, value = arg.split('=')
+ else:
+ key, value = arg, True
+
+ key = key.split("--")[1]
+ if value == 'True': value = True
+ elif value == 'False': value = False
+ options[key.lower()] = value
# store original raw args array after task name
options['argv'] = args

0 comments on commit 4043bc0

Please sign in to comment.