/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-23 19:35:21 UTC
  • Revision ID: tim@ed.am-20160223193521-2vgtxbfos50rrpku
renamed version -> VERSION

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 )