/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/program.py

  • Committer: Tim Marston
  • Date: 2014-04-05 19:22:21 UTC
  • Revision ID: tim@ed.am-20140405192221-yl8xgy3qorbahlfw
implemented CopyInWalker in terms of CopyBaseWalker, changed implementation of
the verbose operation print function for readability

Show diffs side-by-side

added added

removed removed

65
65
#               print "  remove        remove a local file from the repository"
66
66
                print "  status        list files that have changed locally"
67
67
                print "  diff          shows changes made to local files"
68
 
                print "  revert        undo changes made to local files"
 
68
#               print "  revert        undo changes made to a local file"
69
69
#               print "  stage-add     add (but don't commit) files/changes to local repository"
70
70
#               print "  stage-remove  delete *but don't comit) files from the local repository"
71
71
                print "  stage-revert  revert changes in the local repository"
123
123
                return None
124
124
 
125
125
 
 
126
        def get_command_argument( self, args ):
 
127
                """
 
128
                Find the first program argument what isn't an option argument.
 
129
 
 
130
        Arguments:
 
131
        - `args`: the program arguments
 
132
        """
 
133
                while args:
 
134
                        if args[ 0 ] == '--':
 
135
                                return args[ 1 ] if len( args ) > 1 else None
 
136
                        if args[ 0 ][ 0 : 1 ] != '-':
 
137
                                return args[ 0 ]
 
138
                        args = args[ 1 : ]
 
139
                return None
 
140
 
 
141
 
126
142
        def run( self ):
127
143
                # make an initial attempt to parse the command line, looking only for
128
144
                # --help and --version, so that they have the chance to run without a
148
164
                # read program configuration
149
165
                self.read_config()
150
166
 
151
 
                # the first argument should be the command
152
 
                the.command = sys.argv[ 1 ] if len( sys.argv ) > 1 else None
 
167
                # find the first non-option argument (the command)
 
168
                the.command = self.get_command_argument( sys.argv[ 1: ] )
153
169
                if the.command == None:
154
170
                        self.print_usage( "missing command" )
155
171