add main HPI executable

This commit is contained in:
Dima Gerasimov 2020-05-14 22:55:58 +01:00 committed by karlicoss
parent 6235e6ffae
commit 647b6087dd
3 changed files with 32 additions and 0 deletions

30
my/__main__.py Normal file
View file

@ -0,0 +1,30 @@
class Modes:
HELLO = 'hello'
def parser():
from argparse import ArgumentParser
p = ArgumentParser('Human Programming Interface', epilog='''
Tool for HPI.
Work in progress, will be used for config management, troubleshooting & introspection
''')
sp = p.add_subparsers(dest='mode')
sp.add_parser(Modes.HELLO, help='TODO just a stub, remove later')
return p
def main():
p = parser()
args = p.parse_args()
mode = args.mode
if mode == Modes.HELLO:
print('hi')
else:
import sys
p.print_usage()
sys.exit(1)
if __name__ == '__main__':
main()