]> scripts.mit.edu Git - wizard.git/blob - wizard/command/prepare_new.py
Doc update, fix bug in prepare-new.
[wizard.git] / wizard / command / prepare_new.py
1 import os
2 import os.path
3
4 from wizard import command, shell
5
6 def main(argv, baton):
7     options, args = parse_args(argv, baton)
8     if not os.path.exists(".git"):
9         raise Exception("Not in root directory of Git working copy")
10     os.mkdir(".scripts")
11     open(".scripts/.htaccess", "w").write("Deny from all\n")
12     shell.call("git", "add", ".scripts")
13
14 def parse_args(argv, baton):
15     usage = """usage: %prog prepare-new
16
17 Creates a .scripts directory and standard files that live in it.
18 """
19     parser = command.WizardOptionParser(usage)
20     options, args = parser.parse_all(argv)
21     if len(args):
22         parser.error("too many arguments")
23     return options, args