How to use the plac.Interpreter.call function in plac

To help you get started, we’ve selected a few plac examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github micheles / plac / doc / sql_interface.py View on Github external
def SELECT(self, argstring):
        sql = 'SELECT ' + argstring
        for row in self.soup.bind.execute(sql):
            yield str(row)  # the formatting can be much improved


rl_input = plac.ReadlineInput(
    COMPLETIONS, histfile=os.path.expanduser('~/.sql_interface.history'),
    case_sensitive=False)


def split_on_first_space(line, commentchar):
    return line.strip().split(' ', 1)  # ignoring comments

if __name__ == '__main__':
    plac.Interpreter.call(SqlInterface, split=split_on_first_space,
                          stdin=rl_input, prompt='sql> ')
github davidenunes / exp / exp / grid / cli.py View on Github external
print("no files found matching {}".format(regex_fname), file=sys.stderr)
        else:
            try:
                for f in files:
                    if os.path.isfile(f):
                        print("submitting ", f)
                        subprocess.call(args=["qsub", f])
            except FileNotFoundError:
                print("qsub command not found", file=sys.stderr)

    def __missing__(self, name):
        print("command not found {cmd}".format(cmd=name))


if __name__ == '__main__':
    plac.Interpreter.call(GridCli)

plac

The smartest command line arguments parser in the world

BSD-2-Clause
Latest version published 9 months ago

Package Health Score

71 / 100
Full package analysis