From 7653c56f8b6a1f1bfb0c9989fedcb9241d7d5ad4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 6 Nov 2014 12:52:41 -0500 Subject: [PATCH] A step towards more commands. --- .gitignore | 1 + src | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f8c52b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.src diff --git a/src b/src index 8b4c0df..f0d7ce0 100755 --- a/src +++ b/src @@ -12,7 +12,7 @@ def announce(msg): def complain(msg): sys.stderr.write("src: " + msg + "\n") -debug = 0 +debug = 1 DEBUG_COMMANDS = 1 # Show commands as they are executed def do_or_die(dcmd, legend=b""): @@ -119,10 +119,22 @@ def add_method(*args): do_or_die("ci -l %s && mv %s,v .src" % (arg, arg)) announce("%s: 1" % arg) +def commit_method(*args): + "Commit changes to files." + for arg in args: + if not os.path.exists(arg): + complain("I see no '%s' here." % arg) + elif not os.path.exists(".src/%s,v"): + complain("%s is not registered.") + else: + do_or_die("mv .src/{0},v . && ci -l {0} && mv {0},v .src".format(arg)) + #announce("%s: 1" % arg) + dispatch = { "help": help_method, "init": init_method, "add": add_method, + "commit": add_method, } if __name__ == "__main__": -- 2.43.0