import os import os.path from wizard import command, shell def main(argv, baton): options, args = parse_args(argv, baton) if not os.path.exists(".git"): raise Exception("Not in root directory of Git working copy") os.mkdir(".scripts") open(".scripts/.htaccess", "w").write("Deny from all\n") shell.call("git", "add", ".scripts") def parse_args(argv, baton): usage = """usage: %prog prepare-new Creates a .scripts directory and standard files that live in it. """ parser = command.WizardOptionParser(usage) options, args = parser.parse_all(argv) if len(args): parser.error("too many arguments") return options, args