/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: 2016-02-16 00:26:53 UTC
  • Revision ID: tim@ed.am-20160216002653-oa8dgponknyislg3
added home directory change reporting to CopyOutWalker; added --quiet option to
update, resolve, revert and init commands; replace use of re.match with
re.search for clarity (and fixed related bug in FileMatcher); added BzrVcs.run
command output when verbose >= 2

Show diffs side-by-side

added added

removed removed

141
141
 
142
142
        def run( self ):
143
143
                # make an initial attempt to parse the command line, looking only for
144
 
                # --help and --version so that they have the chance to run without a
145
 
                # command being specified
 
144
                # --help, --version and --verbose, so that they have the chance to run
 
145
                # without a command being specified
146
146
                try:
147
147
                        opts, args = getopt.gnu_getopt(
148
 
                                sys.argv[ 1: ], "",
149
 
                                [ "help", "version" ] )
 
148
                                sys.argv[ 1: ], "v",
 
149
                                [ "verbose", "help", "version" ] )
150
150
 
151
151
                        for opt, optarg in opts:
152
152
                                # we only show help if there are no non-option arguments (e.g.,
153
153
                                # a command) specified.  If a command has been specified it will
154
154
                                # have to be parsed and --help will be handled by it, instead)
155
 
                                if opt == "--help" and len( args ) == 0:
 
155
                                if opt in [ '--verbose', '-v' ]:
 
156
                                        the.verbose += 1
 
157
                                elif opt == "--help" and len( args ) == 0:
156
158
                                        self.print_help()
157
159
                                elif opt == "--version":
158
160
                                        self.print_version()
209
211
                except Vcs.VcsError as e:
210
212
                        message = e.msg.rstrip()
211
213
                        if the.verbose >= 1:
212
 
                                message += '\n\nVCS OUTPUT:\n' + e.output.rstrip()
 
214
                                message += '\n\nOUTPUT:\n' + e.output.rstrip()
213
215
                        self.die( message )
214
216
                except self.FatalError as e:
215
217
                        self.die( e.msg )