mirror of
https://github.com/kennethreitz-archive/plac.git
synced 2026-06-17 22:20:57 +00:00
20 lines
561 B
Python
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)
|