/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/the.py

  • Committer: Tim Marston
  • Date: 2014-04-12 13:03:11 UTC
  • Revision ID: tim@ed.am-20140412130311-kwednshmt07i1a26
remove ambiguous argument parsing (the first argument should be the command,
because we can't reliably parse-away options, which may have argument, e.g.,
"stdhome -r test status")

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
# main command
30
30
command = None
31
31
 
32
 
# main repo
33
 
repo = None
 
32
# repo name, set by late_init() to an instance of Repo
 
33
repo = 'home'
34
34
 
35
 
# verbose?
 
35
# verbose level
36
36
verbose = 0
37
37
 
38
38
# data directory
47
47
# fully qualified metadata directory
48
48
full_mddir = util.canonicalise_path( mddir )
49
49
 
50
 
# filesystem directory
51
 
fsdir = '~/test-stdhome'
52
 
 
53
 
# fully qualified filesystem directory
54
 
full_fsdir = util.canonicalise_path( fsdir )
55
 
 
56
 
 
57
 
def set_repo( repo_name ):
 
50
# home directory
 
51
home_dir = '~/'
 
52
 
 
53
# fully qualified home directory, set by late_init()
 
54
full_home_dir = None
 
55
 
 
56
# config file
 
57
config_file = os.path.expanduser( '~/.stdhomerc' )
 
58
 
 
59
 
 
60
def late_init():
 
61
 
 
62
        global home_dir, full_home_dir
 
63
        full_home_dir = util.canonicalise_path( home_dir )
 
64
 
58
65
        global repo
59
66
        from repo import Repo
60
 
        repo = Repo( repo_name if repo_name else 'test' )
61
 
 
 
67
        if isinstance( repo, Repo ):
 
68
                raise RuntimeError( 'logic error: the.repo is already set' )
 
69
        repo = Repo( repo )