Logo Search packages:      
Sourcecode: jockey version File versions  Download package

def jockey::ui::AbstractUI::parse_argv (   self  ) 

Parse command line arguments, and return (options, args) pair.

Definition at line 172 of file ui.py.

00172                         :
        '''Parse command line arguments, and return (options, args) pair.'''

        # --check can have an optional numeric argument which sleeps for the
        # given number of seconds; this is mostly useful for the XDG autostart
        # .desktop file, to not do expensive operations right at session start
        def check_option_callback(option, opt_str, value, parser):
            if len(parser.rargs) > 0 and parser.rargs[0].isdigit():
                setattr(parser.values, 'check', int(parser.rargs.pop(0)))
                setattr(parser.values, 'check', 0)

        parser = optparse.OptionParser()
        parser.add_option ('-c', '--check', action='callback',
                help=self._('Check for newly used or usable drivers and notify the user.'))
        parser.add_option ('-u', '--update-db', action='store_true',
                dest='update_db', default=False,
                help=self._('Query driver databases for newly available or updated drivers.'))
        parser.add_option ('-l', '--list', action='store_true',
                dest='list', default=False,
                help=self._('List available drivers and their status.'))
        parser.add_option ('-e', '--enable', type='string',
                dest='enable', default=None, metavar='DRIVER',
                help=self._('Enable a driver'))
        parser.add_option ('-d', '--disable', type='string',
                dest='disable', default=None, metavar='DRIVER',
                help=self._('Disable a driver'))
        parser.add_option ('--confirm', action='store_true',
                dest='confirm', default=False,
                help=self._('Ask for confirmation for --enable/--disable'))
        parser.add_option ('-C', '--check-composite', action='store_true',
                dest='check_composite', default=False,
                help=self._('Check if there is a graphics driver available that supports composite and offer to enable it'))
        parser.add_option ('-H', '--handler-dir',
                type='string', dest='handler_dir', metavar='DIR', default=None,
                help=self._('Add a custom handler directory.'))
        parser.add_option ('-m', '--mode',
                type='choice', dest='mode', default='any',
                choices=['free', 'nonfree', 'any'],
                help=self._('Only manage free/nonfree drivers. By default, all'
                ' available drivers with any license are presented.'))
        parser.add_option ('--debug', action='store_true',
                dest='debug', default=False,
                help=self._('Enable debugging messages.'))

        (opts, args) = parser.parse_args()

        # transform mode string into constant
        modes = {
            'free': detection.MODE_FREE,
            'nonfree': detection.MODE_NONFREE,
            'any': detection.MODE_ANY
        opts.mode = modes[opts.mode]

        return (opts, args)

    def run(self):

Generated by  Doxygen 1.6.0   Back to index