# shelve_interpreter.py import plac, ishelve @plac.annotations( interactive=('start interactive interface', 'flag'), subcommands='the commands of the underlying ishelve interpreter') def main(interactive, *subcommands): """ This script works both interactively and non-interactively. Use .help to see the internal commands. """ if interactive: plac.Interpreter(ishelve.main).interact() else: for out in plac.call(ishelve.main, subcommands): print(out) if __name__ == '__main__': plac.call(main)