/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/command/init.py

  • Committer: Tim Marston
  • Date: 2016-02-13 14:21:53 UTC
  • Revision ID: tim@ed.am-20160213142153-68g7pzq0au6bejep
fixed init command

Show diffs side-by-side

added added

removed removed

41
41
                print "hostname, it is internally expanded to scp://HOSTNAME/~/.stdhome/REPO)."
42
42
                print
43
43
                print "Options:"
44
 
                print "      --quiet      do not report changes to the home directory"
45
44
                print "  -r, --repo=REPO  select the repo to check-out or create (defaults to 'home')"
46
45
                print "  -v, --verbose    display information about what is being done"
47
46
                print "      --help       display help and exit"
51
50
        def parse_command_line( self ):
52
51
                opts, args = getopt.gnu_getopt(
53
52
                        sys.argv[ 1: ], "r:v",
54
 
                        [ "quiet", "repo=", "verbose", "help" ] )
 
53
                        [ "repo=", "verbose", "help" ] )
55
54
                for opt, optarg in opts:
56
 
                        if opt == "--quiet":
57
 
                                self.quiet = True
58
 
                        elif opt in [ '--repo', '-r' ]:
59
 
                                if not re.search( '^[-a-zA-z0-9.]+$', optarg ):
 
55
                        if opt in [ '--repo', '-r' ]:
 
56
                                if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
60
57
                                        raise the.program.FatalError(
61
58
                                                'invalid repository name: ' + optarg )
62
59
                                the.repo = optarg
87
84
                if self.url:
88
85
 
89
86
                        # expand url if it's a simple hostname
90
 
                        if re.search( '^[0-9a-zA-z.]+$', self.url ):
 
87
                        if re.match( '^[0-9a-zA-z.]+$', self.url ):
91
88
                                self.url = 'bzr+ssh://%s/%s/%s' % \
92
89
                                                   ( self.url, the.dir, the.repo.name )
93
90
 
123
120
                                        'there were conflicts...\n' + message )
124
121
 
125
122
                        # perform deployment
126
 
                        deployment.copy_out( self.quiet )
 
123
                        deployment.copy_out()
127
124
 
128
125
                else:
129
126