This module combines the Python standard library modules argparse and cmd to provided a unified way to make cli programs that can also be interactive when invoked in "shell" mode.
The main benefit to using this package is streamlined command hierarchy when you want to have rich set of subcommands along with a pretty powerful tab completion layer that parses argparse arguments automagically.
- None more black!
python3 ./setup.py build
python3 ./setup.py install
- Python 3.4+
- Documentation
- Documentation
- Documentation
TBD
Hello World
A requisite Hello World..
import shellish
class Hello(shellish.Command):
""" I am a required docstring used to document the --help output! """
name = 'hello'
def __init__(self, *args, **kwargs):
self.add_subcommand(World, default=True)
def run(self, args):
shellish.Shell(self).cmdloop()
class World(shellish.Command):
""" Say something. """
name = 'world'
def run(self, args):
print('Hello World')
if __name__ == '__main__':
root = Hello()
args = root.argparser.parse_args()
try:
root.invoke(args)
except KeyboardInterrupt:
sys.exit(1)
python3 ./hello.py hello world