'Process command line options specified in args.  It is safe to
call this multiple times.  We try to be compatible with SQLite shell
argument parsing.
:param args: A list of string options.  Do not include the
program as args[0]
:returns: A tuple of (databasefilename, initfiles,
sqlncommands).  This is provided for informational purposes
only - they have already been acted upon.  An example use
is that the SQLite shell does not enter the main interactive
loop if any sql/commands were provided.
The first non-option is the database file name.  Each
remaining non-option is treated as a complete input (ie it
isn\'t joined with others looking for a trailing semi-colon).
The SQLite shell uses single dash in front of options.  We
allow both single and double dashes.  When an unrecognized
argument is encountered then
:meth:`process_unknown_args` is called.'

def process_args(self, args):

    if (not args):
        return (None, [], [])
    options = True
    havedbname = False
    inits = []
    sqls = []
    while args:
        if ((not options) or (not args[0].startswith('-'))):
            options = False
            if (not havedbname):
                self.db = (None, args[0])
                havedbname = True
            else:
                sqls.append(args[0])
            args = args[1:]
            continue
        args[0] = args[0][1:]
        if args[0].startswith('-'):
            args[0] = args[0][1:]
        if (args[0] == 'init'):
            if (len(args) < 2):
                raise self.Error('You    need    to    specify    a    filename    after    -init')
            inits.append(args[1])
            args = args[2:]
            continue
        if ((args[0] == 'header') or (args[0] == 'noheader')):
            self.header = (args[0] == 'header')
            args = args[1:]
            continue
        if (args[0] in ('echo', 'bail', 'interactive')):
            setattr(self, args[0], True)
            args = args[1:]
            continue
        if (args[0] == 'batch'):
            self.interactive = False
            args = args[1:]
            continue
        if (args[0] in ('separator', 'nullvalue', 'encoding')):
            if (len(args) < 2):
                raise self.Error(('You    need    to    specify    a    value    after    -' + args[0]))
            getattr(self, ('command_' + args[0]))([args[1]])
            args = args[2:]
            continue
        if (args[0] == 'version'):
            self.write(self.stdout, (apsw.sqlitelibversion() + '\n'))
            sys.exit(0)
        if (args[0] == 'help'):
            self.write(self.stderr, self.usage())
            sys.exit(0)
        if (args[0] in ('no-colour', 'no-color', 'nocolour', 'nocolor')):
            self.colour_scheme = 'off'
            self._out_colour()
            args = args[1:]
            continue
        if getattr(self, ('output_' + args[0]), None):
            self.command_mode(args[:1])
            args = args[1:]
            continue
        newargs = self.process_unknown_args(args)
        if (newargs is None):
            raise self.Error((("Unrecognized    argument    '" + args[0]) + "'"))
        args = newargs
    for f in inits:
        self.command_read([f])
    for s in sqls:
        self.process_complete_line(s)
    return (self.dbfilename, inits, sqls)
