DISCLAIMER: This is not yet ready for production, not in the slightest bit
from simpleparse import setup_parser
import commands
def main():
p = setup_parser(
parser = <parser>,
subcommands = <subcommands>,
funcs = vars(commands)
)
args = p.parse_args(sys.argv[1:])
if (args.fun):
args.fun(args)
if __name__ == '__main__':
main()** Still a work in progress **
from simpleparse import setup_parser
def main():
p = setup_parser(__file__)
p.parse()
res = p.execute()
if __name__ == '__main__':
main()By default, will look for parser and subparser in arguments.py Will import commands from "commands" inside module directory.
This contains configuration for argument parsers as a list of dictionaries
from simpleparse import PARSER, SUBPARSERS
PARSER = [
{
}
]
SUBPARSERS = [
{
}
]This contains the commands executed by parser and subparser. By default, each command executes a function as the same name as the cmd