(self,args)
return
keepass.cli [options] [cmd [options]] [...]

        The command line consists of general options followed by zero
        or more commands and their options.
keepass.cli [options] [cmd [options]] [...]
keepass . cli [ options ] [ cmd [ options ]] [ ... ]
def parse_args(self,args):
        '''
        keepass.cli [options] [cmd [options]] [...]

        The command line consists of general options followed by zero
        or more commands and their options.

        '''

        def splitopts(argv):
            'Split optional command and its args removing them from input'
            if not argv: return None

            cmd=""
            if argv[0][0] != '-':
                if argv[0] not in Cli.commands:
                    raise ValueError,'Unknown command: "%s"'%argv[0]
                cmd = argv.pop(0)
                pass
            copy = list(argv)
            cmdopts = []
            for arg in copy:
                if arg in Cli.commands: break
                cmdopts.append(argv.pop(0))
                continue
            return [cmd,cmdopts]

        cmdline = []
        copy = list(args)
        while copy:
            chunk = splitopts(copy)
            if not chunk: break

            if not chunk[0]: chunk[0] = 'general'
            meth = eval('self._%s_op'%chunk[0])
            self.ops[chunk[0]] = meth()
            cmdline.append(chunk)
            continue

        self.command_line = cmdline

        return
def parse_args ( self , args ) : def splitopts ( argv ) : 'Split optional command and its args removing them from input' if not argv : return None cmd = "" if argv [ 0 ] [ 0 ] != '-' : if argv [ 0 ] not in Cli . commands : raise ValueError , 'Unknown command: "%s"' % argv [ 0 ] cmd = argv . pop ( 0 ) pass copy = list ( argv ) cmdopts = [ ] for arg in copy : if arg in Cli . commands : break cmdopts . append ( argv . pop ( 0 ) ) continue return [ cmd , cmdopts ] cmdline = [ ] copy = list ( args ) while copy : chunk = splitopts ( copy ) if not chunk : break if not chunk [ 0 ] : chunk [ 0 ] = 'general' meth = eval ( 'self._%s_op' % chunk [ 0 ] ) self . ops [ chunk [ 0 ] ] = meth ( ) cmdline . append ( chunk ) continue self . command_line = cmdline return