]> arthur.barton.de Git - bup.git/blobdiff - cmd-init.py
Refactored client stuff into client.py; now cmd-save and cmd-init use it too.
[bup.git] / cmd-init.py
index cbcdad002e9b918b24ae391aa702852ff1ef0b60..3febc73134bd0e00634a994f5964603e7557aa71 100755 (executable)
@@ -1,9 +1,11 @@
 #!/usr/bin/env python2.5
-import git, options
+import git, options, client
 from helpers import *
 
 optspec = """
-[BUP_DIR=...] bup init
+[BUP_DIR=...] bup init [-r host:path]
+--
+r,remote=  remote repository path
 """
 o = options.Options('bup init', optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
@@ -12,5 +14,12 @@ if extra:
     log("bup init: no arguments expected\n")
     o.usage()
 
-exit(git.init_repo())
 
+if opt.remote:
+    git.init_repo()  # local repo
+    git.check_repo_or_die()
+    cli = client.Client(opt.remote, create=True)
+    cli.close()
+    exit(0)  # if close() didn't throw an exception
+else:
+    exit(git.init_repo())