Permalink
Browse files

Add a -m flag to allow specifying manifest files.

  • Loading branch information...
1 parent 920efcc commit bae373e9bc143bae6b94707aeb820a4bfb3ee326 Chad Metcalf committed Jun 3, 2010
Showing with 14 additions and 2 deletions.
  1. +14 −2 crepo.py
View
@@ -11,10 +11,14 @@
import trace
LOADED_MANIFEST = None
+
+MANIFEST_PATH = 'manifest.json'
+
def load_manifest():
global LOADED_MANIFEST
+ global MANIFEST_PATH
if not LOADED_MANIFEST:
- LOADED_MANIFEST = manifest.Manifest.from_json_file("manifest.json")
+ LOADED_MANIFEST = manifest.Manifest.from_json_file(MANIFEST_PATH)
return LOADED_MANIFEST
def help(args):
@@ -449,7 +453,7 @@ def update_indirect(args):
}
def usage():
- print >>sys.stderr, "you screwed up. here are the commands:"
+ print >>sys.stderr, "%s -m <manifest> COMMAND" % sys.argv[0]
print >>sys.stderr
max_comlen = 0
@@ -477,7 +481,15 @@ def usage():
sys.exit(1)
def main():
+ global MANIFEST_PATH
+
args = sys.argv[1:]
+
+ if args.count('-m') > 0:
+ MANIFEST_PATH = args[args.index('-m') + 1]
+ args.remove('-m')
+ args.remove(MANIFEST_PATH)
+
if len(args) == 0 or args[0] not in COMMANDS:
usage()
command = COMMANDS[args[0]]

0 comments on commit bae373e

Please sign in to comment.