def main():
    import argparse

    parser = argparse.ArgumentParser(prog="pyservice", add_help=False)
    parser.add_argument("-v", "--version",
        action="version", version="%(prog)s, v.{}".format(__version__))
    parser.add_argument("-h", "--help", 
        action="store_true", help="show program's help text and exit")
    parser.add_argument("process", nargs='?', help="""
        process class path to run (modulename.ProcessClass) or
        configuration file path to use (/path/to/config.py)
        """.strip())
    parser.add_argument("action", nargs='?', 
        choices="start stop restart status".split()) 
    
    try:        
        args = parser.parse_args()
    except __HOLE__:
        parser.print_help()
        return
        
    if args.help:
        parser.print_help()
        return

    if args.process and args.action in "start stop restart status".split():
        if not args.process:
            parser.error("You need to specify a process for {}".format(args.action))
        service(args.process, args.action)
    else:
        parser.print_help()
dataset/ETHPy150Open ownport/pyservice/pyservice.py/main