]> arthur.barton.de Git - bup.git/blob - cmd/init-cmd.py
--remote parameter requires a colon
[bup.git] / cmd / init-cmd.py
1 #!/usr/bin/env python
2 from bup import git, options, client
3 from bup.helpers import *
4
5 optspec = """
6 [BUP_DIR=...] bup init [-r host:path]
7 --
8 r,remote=  remote repository path
9 """
10 o = options.Options('bup init', optspec)
11 (opt, flags, extra) = o.parse(sys.argv[1:])
12
13 if extra:
14     o.fatal("no arguments expected")
15
16
17 if opt.remote:
18     if opt.remote and opt.remote.find(":") == -1:
19         o.fatal("--remote argument must contain a colon")
20     git.init_repo()  # local repo
21     git.check_repo_or_die()
22     try:
23         cli = client.Client(opt.remote, create=True)
24     except client.ClientError:
25         o.fatal("server exited unexpectedly; see errors above")
26     cli.close()
27 else:
28     git.init_repo()