Files
plac/doc/shelve_interpreter.py
2010-09-06 01:32:36 -04:00

20 lines
561 B
Python

# 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)