def client_options(): client_parser = KmsParser(description = clt_description, epilog = 'version: ' + clt_version, add_help = False) client_parser.add_argument("ip", nargs = "?", action = "store", default = clt_options['ip']['def'], help = clt_options['ip']['help'], type = str) client_parser.add_argument("port", nargs = "?", action = "store", default = clt_options['port']['def'], help = clt_options['port']['help'], type = int) client_parser.add_argument("-m", "--mode", dest = clt_options['mode']['des'], default = clt_options['mode']['def'], choices = clt_options['mode']['choi'], help = clt_options['mode']['help'], type = str) client_parser.add_argument("-c", "--cmid", dest = clt_options['cmid']['des'], default = clt_options['cmid']['def'], help = clt_options['cmid']['help'], type = str) client_parser.add_argument("-n", "--name", dest = clt_options['name']['des'] , default = clt_options['name']['def'], help = clt_options['name']['help'], type = str) client_parser.add_argument("-t0", "--timeout-idle", action = "store", dest = clt_options['time0']['des'], default = clt_options['time0']['def'], help = clt_options['time0']['help'], type = str) client_parser.add_argument("-t1", "--timeout-sndrcv", action = "store", dest = clt_options['time1']['des'], default = clt_options['time1']['def'], help = clt_options['time1']['help'], type = str) client_parser.add_argument("-y", "--async-msg", action = "store_true", dest = clt_options['asyncmsg']['des'], default = clt_options['asyncmsg']['def'], help = clt_options['asyncmsg']['help']) client_parser.add_argument("-V", "--loglevel", dest = clt_options['llevel']['des'], action = "store", choices = clt_options['llevel']['choi'], default = clt_options['llevel']['def'], help = clt_options['llevel']['help'], type = str) client_parser.add_argument("-F", "--logfile", nargs = "+", action = "store", dest = clt_options['lfile']['des'], default = clt_options['lfile']['def'], help = clt_options['lfile']['help'], type = str) client_parser.add_argument("-S", "--logsize", dest = clt_options['lsize']['des'], action = "store", default = clt_options['lsize']['def'], help = clt_options['lsize']['help'], type = float) client_parser.add_argument("-D", "--discovery", dest = clt_options['discovery']['des'], action = "store", default = clt_options['discovery']['def'], help = clt_options['discovery']['help'], type = str) client_parser.add_argument("-h", "--help", action = "help", help = "show this help message and exit") try: userarg = sys.argv[1:] # Run help. if any(arg in ["-h", "--help"] for arg in userarg): KmsParserHelp().printer(parsers = [client_parser]) # Get stored arguments. pykmsclt_zeroarg, pykmsclt_onearg = kms_parser_get(client_parser) # Update pykms options for dict client config. kms_parser_check_optionals(userarg, pykmsclt_zeroarg, pykmsclt_onearg, msg = 'optional py-kms client', exclude_opt_len = ['-F', '--logfile']) kms_parser_check_positionals(clt_config, client_parser.parse_args, msg = 'positional py-kms client') except KmsParserException as e: pretty_printer(put_text = "{reverse}{red}{bold}%s. Exiting...{end}" %str(e), to_exit = True, where = "clt")
def server_options(): server_parser = KmsParser(description = srv_description, epilog = 'version: ' + srv_version, add_help = False) server_parser.add_argument("ip", nargs = "?", action = "store", default = srv_options['ip']['def'], help = srv_options['ip']['help'], type = str) server_parser.add_argument("port", nargs = "?", action = "store", default = srv_options['port']['def'], help = srv_options['port']['help'], type = int) server_parser.add_argument("-e", "--epid", action = "store", dest = srv_options['epid']['des'], default = srv_options['epid']['def'], help = srv_options['epid']['help'], type = str) server_parser.add_argument("-l", "--lcid", action = "store", dest = srv_options['lcid']['des'], default = srv_options['lcid']['def'], help = srv_options['lcid']['help'], type = int) server_parser.add_argument("-c", "--client-count", action = "store", dest = srv_options['count']['des'] , default = srv_options['count']['def'], help = srv_options['count']['help'], type = str) server_parser.add_argument("-a", "--activation-interval", action = "store", dest = srv_options['activation']['des'], default = srv_options['activation']['def'], help = srv_options['activation']['help'], type = int) server_parser.add_argument("-r", "--renewal-interval", action = "store", dest = srv_options['renewal']['des'], default = srv_options['renewal']['def'], help = srv_options['renewal']['help'], type = int) server_parser.add_argument("-s", "--sqlite", action = "store_true", dest = srv_options['sql']['des'], default = srv_options['sql']['def'], help = srv_options['sql']['help']) server_parser.add_argument("-w", "--hwid", action = "store", dest = srv_options['hwid']['des'], default = srv_options['hwid']['def'], help = srv_options['hwid']['help'], type = str) server_parser.add_argument("-t0", "--timeout-idle", action = "store", dest = srv_options['time0']['des'], default = srv_options['time0']['def'], help = srv_options['time0']['help'], type = str) server_parser.add_argument("-y", "--async-msg", action = "store_true", dest = srv_options['asyncmsg']['des'], default = srv_options['asyncmsg']['def'], help = srv_options['asyncmsg']['help']) server_parser.add_argument("-V", "--loglevel", action = "store", dest = srv_options['llevel']['des'], choices = srv_options['llevel']['choi'], default = srv_options['llevel']['def'], help = srv_options['llevel']['help'], type = str) server_parser.add_argument("-F", "--logfile", nargs = "+", action = "store", dest = srv_options['lfile']['des'], default = srv_options['lfile']['def'], help = srv_options['lfile']['help'], type = str) server_parser.add_argument("-S", "--logsize", action = "store", dest = srv_options['lsize']['des'], default = srv_options['lsize']['def'], help = srv_options['lsize']['help'], type = float) server_parser.add_argument("-h", "--help", action = "help", help = "show this help message and exit") daemon_parser = KmsParser(description = "daemon options inherited from Etrigan", add_help = False) daemon_subparser = daemon_parser.add_subparsers(dest = "mode") etrigan_parser = daemon_subparser.add_parser("etrigan", add_help = False) etrigan_parser.add_argument("-g", "--gui", action = "store_const", dest = 'gui', const = True, default = False, help = "Enable py-kms GUI usage.") etrigan_parser = Etrigan_parser(parser = etrigan_parser) try: userarg = sys.argv[1:] # Run help. if any(arg in ["-h", "--help"] for arg in userarg): KmsParserHelp().printer(parsers = [server_parser, daemon_parser, etrigan_parser]) # Get stored arguments. pykmssrv_zeroarg, pykmssrv_onearg = kms_parser_get(server_parser) etrigan_zeroarg, etrigan_onearg = kms_parser_get(etrigan_parser) pykmssrv_zeroarg += ['etrigan'] # add subparser # Set defaults for config. # example case: # python3 pykms_Server.py srv_config.update(vars(server_parser.parse_args([]))) try: # Eventually set daemon options for dict server config. pos = sys.argv[1:].index('etrigan') # example cases: # python3 pykms_Server.py etrigan start # python3 pykms_Server.py etrigan start --daemon_optionals # python3 pykms_Server.py 1.2.3.4 etrigan start # python3 pykms_Server.py 1.2.3.4 etrigan start --daemon_optionals # python3 pykms_Server.py 1.2.3.4 1234 etrigan start # python3 pykms_Server.py 1.2.3.4 1234 etrigan start --daemon_optionals # python3 pykms_Server.py --pykms_optionals etrigan start # python3 pykms_Server.py --pykms_optionals etrigan start --daemon_optionals # python3 pykms_Server.py 1.2.3.4 --pykms_optionals etrigan start # python3 pykms_Server.py 1.2.3.4 --pykms_optionals etrigan start --daemon_optionals # python3 pykms_Server.py 1.2.3.4 1234 --pykms_optionals etrigan start # python3 pykms_Server.py 1.2.3.4 1234 --pykms_optionals etrigan start --daemon_optionals kms_parser_check_optionals(userarg[0:pos], pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len = ['-F', '--logfile']) kms_parser_check_positionals(srv_config, server_parser.parse_args, arguments = userarg[0:pos]) kms_parser_check_optionals(userarg[pos:], etrigan_zeroarg, etrigan_onearg, msg = 'optional etrigan') kms_parser_check_positionals(srv_config, daemon_parser.parse_args, arguments = userarg[pos:], msg = 'positional etrigan') except ValueError: # Update pykms options for dict server config. # example cases: # python3 pykms_Server.py 1.2.3.4 # python3 pykms_Server.py 1.2.3.4 --pykms_optionals # python3 pykms_Server.py 1.2.3.4 1234 # python3 pykms_Server.py 1.2.3.4 1234 --pykms_optionals # python3 pykms_Server.py --pykms_optionals kms_parser_check_optionals(userarg, pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len = ['-F', '--logfile']) kms_parser_check_positionals(srv_config, server_parser.parse_args) except KmsParserException as e: pretty_printer(put_text = "{reverse}{red}{bold}%s. Exiting...{end}" %str(e), to_exit = True)
def server_options(): server_parser = KmsParser(description=srv_description, epilog='version: ' + srv_version, add_help=False) server_parser.add_argument("ip", nargs="?", action="store", default=srv_options['ip']['def'], help=srv_options['ip']['help'], type=str) server_parser.add_argument("port", nargs="?", action="store", default=srv_options['port']['def'], help=srv_options['port']['help'], type=int) server_parser.add_argument("-e", "--epid", action="store", dest=srv_options['epid']['des'], default=srv_options['epid']['def'], help=srv_options['epid']['help'], type=str) server_parser.add_argument("-l", "--lcid", action="store", dest=srv_options['lcid']['des'], default=srv_options['lcid']['def'], help=srv_options['lcid']['help'], type=int) server_parser.add_argument("-c", "--client-count", action="store", dest=srv_options['count']['des'], default=srv_options['count']['def'], help=srv_options['count']['help'], type=str) server_parser.add_argument("-a", "--activation-interval", action="store", dest=srv_options['activation']['des'], default=srv_options['activation']['def'], help=srv_options['activation']['help'], type=int) server_parser.add_argument("-r", "--renewal-interval", action="store", dest=srv_options['renewal']['des'], default=srv_options['renewal']['def'], help=srv_options['renewal']['help'], type=int) server_parser.add_argument("-s", "--sqlite", nargs="?", dest=srv_options['sql']['des'], const=True, default=srv_options['sql']['def'], help=srv_options['sql']['help'], type=str) server_parser.add_argument("-w", "--hwid", action="store", dest=srv_options['hwid']['des'], default=srv_options['hwid']['def'], help=srv_options['hwid']['help'], type=str) server_parser.add_argument("-t0", "--timeout-idle", action="store", dest=srv_options['time0']['des'], default=srv_options['time0']['def'], help=srv_options['time0']['help'], type=str) server_parser.add_argument("-t1", "--timeout-sndrcv", action="store", dest=srv_options['time1']['des'], default=srv_options['time1']['def'], help=srv_options['time1']['help'], type=str) server_parser.add_argument("-y", "--async-msg", action="store_true", dest=srv_options['asyncmsg']['des'], default=srv_options['asyncmsg']['def'], help=srv_options['asyncmsg']['help']) server_parser.add_argument("-V", "--loglevel", action="store", dest=srv_options['llevel']['des'], choices=srv_options['llevel']['choi'], default=srv_options['llevel']['def'], help=srv_options['llevel']['help'], type=str) server_parser.add_argument("-F", "--logfile", nargs="+", action="store", dest=srv_options['lfile']['des'], default=srv_options['lfile']['def'], help=srv_options['lfile']['help'], type=str) server_parser.add_argument("-S", "--logsize", action="store", dest=srv_options['lsize']['des'], default=srv_options['lsize']['def'], help=srv_options['lsize']['help'], type=float) server_parser.add_argument("-h", "--help", action="help", help="show this help message and exit") ## Daemon (Etrigan) parsing. daemon_parser = KmsParser( description="daemon options inherited from Etrigan", add_help=False) daemon_subparser = daemon_parser.add_subparsers(dest="mode") etrigan_parser = daemon_subparser.add_parser("etrigan", add_help=False) etrigan_parser.add_argument("-g", "--gui", action="store_const", dest='gui', const=True, default=False, help="Enable py-kms GUI usage.") etrigan_parser = Etrigan_parser(parser=etrigan_parser) ## Connection parsing. connection_parser = KmsParser(description="connect options", add_help=False) connection_subparser = connection_parser.add_subparsers(dest="mode") connect_parser = connection_subparser.add_parser("connect", add_help=False) connect_parser.add_argument("-n", "--listen", action="append", dest=srv_options['listen']['des'], default=[], help=srv_options['listen']['help'], type=str) connect_parser.add_argument("-b", "--backlog", action="append", dest=srv_options['backlog']['des'], default=[], help=srv_options['backlog']['help'], type=int) connect_parser.add_argument("-u", "--no-reuse", action="append_const", dest=srv_options['reuse']['des'], const=False, default=[], help=srv_options['reuse']['help']) connect_parser.add_argument("-d", "--dual", action="store_true", dest=srv_options['dual']['des'], default=srv_options['dual']['def'], help=srv_options['dual']['help']) try: userarg = sys.argv[1:] # Run help. if any(arg in ["-h", "--help"] for arg in userarg): KmsParserHelp().printer(parsers=[ server_parser, ( daemon_parser, etrigan_parser), (connection_parser, connect_parser) ]) # Get stored arguments. pykmssrv_zeroarg, pykmssrv_onearg = kms_parser_get(server_parser) etrigan_zeroarg, etrigan_onearg = kms_parser_get(etrigan_parser) connect_zeroarg, connect_onearg = kms_parser_get(connect_parser) subdict = { 'etrigan': (etrigan_zeroarg, etrigan_onearg, daemon_parser.parse_args), 'connect': (connect_zeroarg, connect_onearg, connection_parser.parse_args) } subpars = list(subdict.keys()) pykmssrv_zeroarg += subpars # add subparsers exclude_kms = ['-F', '--logfile'] exclude_dup = ['-n', '--listen', '-b', '--backlog', '-u', '--no-reuse'] # Set defaults for server dict config. # example case: # python3 pykms_Server.py srv_config.update(vars(server_parser.parse_args([]))) subindx = sorted([(userarg.index(pars), pars) for pars in subpars if pars in userarg], key=lambda x: x[0]) if subindx: # Set `daemon options` and/or `connect options` for server dict config. # example cases: # 1 python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] etrigan daemon_positional [--daemon_optionals] \ # connect [--connect_optionals] # # 2 python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] connect [--connect_optionals] etrigan \ # daemon_positional [--daemon_optionals] # # 3 python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] etrigan daemon_positional [--daemon_optionals] # 4 python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] connect [--connect_optionals] first = subindx[0][0] # initial. kms_parser_check_optionals(userarg[0:first], pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len=exclude_kms) kms_parser_check_positionals(srv_config, server_parser.parse_args, arguments=userarg[0:first], force_parse=True) # middle. for i in range(len(subindx) - 1): posi, posf, typ = subindx[i][0], subindx[i + 1][0], subindx[i][1] kms_parser_check_optionals( userarg[posi:posf], subdict[typ][0], subdict[typ][1], msg='optional %s' % typ, exclude_opt_dup=(exclude_dup if typ == 'connect' else [])) kms_parser_check_positionals(srv_config, subdict[typ][2], arguments=userarg[posi:posf], msg='positional %s' % typ) # final. pos, typ = subindx[-1] kms_parser_check_optionals( userarg[pos:], subdict[typ][0], subdict[typ][1], msg='optional %s' % typ, exclude_opt_dup=(exclude_dup if typ == 'connect' else [])) kms_parser_check_positionals(srv_config, subdict[typ][2], arguments=userarg[pos:], msg='positional %s' % typ) if len(subindx) > 1: srv_config['mode'] = '+'.join(elem[1] for elem in subindx) else: # Update `pykms options` for server dict config. # example case: # 5 python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] kms_parser_check_optionals(userarg, pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len=exclude_kms) kms_parser_check_positionals(srv_config, server_parser.parse_args) kms_parser_check_connect(srv_config, srv_options, userarg, connect_zeroarg, connect_onearg) except KmsParserException as e: pretty_printer(put_text="{reverse}{red}{bold}%s. Exiting...{end}" % str(e), to_exit=True)
def server_options(): server_parser = KmsParser(description = srv_description, epilog = 'version: ' + srv_version, add_help = False) server_parser.add_argument("ip", nargs = "?", action = "store", default = srv_options['ip']['def'], help = srv_options['ip']['help'], type = str) server_parser.add_argument("port", nargs = "?", action = "store", default = srv_options['port']['def'], help = srv_options['port']['help'], type = int) server_parser.add_argument("-e", "--epid", action = "store", dest = srv_options['epid']['des'], default = srv_options['epid']['def'], help = srv_options['epid']['help'], type = str) server_parser.add_argument("-l", "--lcid", action = "store", dest = srv_options['lcid']['des'], default = srv_options['lcid']['def'], help = srv_options['lcid']['help'], type = int) server_parser.add_argument("-c", "--client-count", action = "store", dest = srv_options['count']['des'] , default = srv_options['count']['def'], help = srv_options['count']['help'], type = str) server_parser.add_argument("-a", "--activation-interval", action = "store", dest = srv_options['activation']['des'], default = srv_options['activation']['def'], help = srv_options['activation']['help'], type = int) server_parser.add_argument("-r", "--renewal-interval", action = "store", dest = srv_options['renewal']['des'], default = srv_options['renewal']['def'], help = srv_options['renewal']['help'], type = int) server_parser.add_argument("-s", "--sqlite", nargs = "?", dest = srv_options['sql']['des'], const = True, default = srv_options['sql']['def'], help = srv_options['sql']['help'], type = str) server_parser.add_argument("-w", "--hwid", action = "store", dest = srv_options['hwid']['des'], default = srv_options['hwid']['def'], help = srv_options['hwid']['help'], type = str) server_parser.add_argument("-t0", "--timeout-idle", action = "store", dest = srv_options['time0']['des'], default = srv_options['time0']['def'], help = srv_options['time0']['help'], type = str) server_parser.add_argument("-t1", "--timeout-sndrcv", action = "store", dest = srv_options['time1']['des'], default = srv_options['time1']['def'], help = srv_options['time1']['help'], type = str) server_parser.add_argument("-y", "--async-msg", action = "store_true", dest = srv_options['asyncmsg']['des'], default = srv_options['asyncmsg']['def'], help = srv_options['asyncmsg']['help']) server_parser.add_argument("-V", "--loglevel", action = "store", dest = srv_options['llevel']['des'], choices = srv_options['llevel']['choi'], default = srv_options['llevel']['def'], help = srv_options['llevel']['help'], type = str) server_parser.add_argument("-F", "--logfile", nargs = "+", action = "store", dest = srv_options['lfile']['des'], default = srv_options['lfile']['def'], help = srv_options['lfile']['help'], type = str) server_parser.add_argument("-S", "--logsize", action = "store", dest = srv_options['lsize']['des'], default = srv_options['lsize']['def'], help = srv_options['lsize']['help'], type = float) server_parser.add_argument("-h", "--help", action = "help", help = "show this help message and exit") ## Daemon (Etrigan) parsing. daemon_parser = KmsParser(description = "daemon options inherited from Etrigan", add_help = False) daemon_subparser = daemon_parser.add_subparsers(dest = "mode") etrigan_parser = daemon_subparser.add_parser("etrigan", add_help = False) etrigan_parser.add_argument("-g", "--gui", action = "store_const", dest = 'gui', const = True, default = False, help = "Enable py-kms GUI usage.") etrigan_parser = Etrigan_parser(parser = etrigan_parser) ## Connection parsing. connection_parser = KmsParser(description = "connect options", add_help = False) connection_subparser = connection_parser.add_subparsers(dest = "mode") connect_parser = connection_subparser.add_parser("connect", add_help = False) connect_parser.add_argument("-n", "--listen", action = "append", dest = srv_options['listen']['des'], default = [], help = srv_options['listen']['help'], type = str) connect_parser.add_argument("-b", "--backlog", action = "append", dest = srv_options['backlog']['des'], default = [], help = srv_options['backlog']['help'], type = int) connect_parser.add_argument("-u", "--no-reuse", action = "append_const", dest = srv_options['reuse']['des'], const = False, default = [], help = srv_options['reuse']['help']) connect_parser.add_argument("-d", "--dual", action = "store_true", dest = srv_options['dual']['des'], default = srv_options['dual']['def'], help = srv_options['dual']['help']) try: userarg = sys.argv[1:] # Run help. if any(arg in ["-h", "--help"] for arg in userarg): KmsParserHelp().printer(parsers = [server_parser, (daemon_parser, etrigan_parser), (connection_parser, connect_parser)]) # Get stored arguments. pykmssrv_zeroarg, pykmssrv_onearg = kms_parser_get(server_parser) etrigan_zeroarg, etrigan_onearg = kms_parser_get(etrigan_parser) connect_zeroarg, connect_onearg = kms_parser_get(connect_parser) subpars = ['etrigan', 'connect'] pykmssrv_zeroarg += subpars # add subparsers exclude_kms = ['-F', '--logfile'] exclude_dup = ['-n', '--listen', '-b', '--backlog', '-u', '--no-reuse'] # Set defaults for server dict config. # example case: # python3 pykms_Server.py srv_config.update(vars(server_parser.parse_args([]))) if all(pars in userarg for pars in subpars): ## Set `daemon options` and `connect options` for server dict config. pos_etr = userarg.index('etrigan') pos_con = userarg.index('connect') pos = min(pos_etr, pos_con) kms_parser_check_optionals(userarg[0 : pos], pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len = exclude_kms) kms_parser_check_positionals(srv_config, server_parser.parse_args, arguments = userarg[0 : pos], force_parse = True) if pos == pos_etr: # example case: # python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] etrigan daemon_positional [--daemon_optionals] \ # connect [--connect_optionals] kms_parser_check_optionals(userarg[pos : pos_con], etrigan_zeroarg, etrigan_onearg, msg = 'optional etrigan') kms_parser_check_positionals(srv_config, daemon_parser.parse_args, arguments = userarg[pos : pos_con], msg = 'positional etrigan') kms_parser_check_optionals(userarg[pos_con:], connect_zeroarg, connect_onearg, msg = 'optional connect', exclude_opt_dup = exclude_dup) kms_parser_check_positionals(srv_config, connection_parser.parse_args, arguments = userarg[pos_con:], msg = 'positional connect') elif pos == pos_con: # example case: # python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] connect [--connect_optionals] etrigan \ # daemon_positional [--daemon_optionals] kms_parser_check_optionals(userarg[pos : pos_etr], connect_zeroarg, connect_onearg, msg = 'optional connect', exclude_opt_dup = exclude_dup) kms_parser_check_positionals(srv_config, connection_parser.parse_args, arguments = userarg[pos : pos_etr], msg = 'positional connect') kms_parser_check_optionals(userarg[pos_etr:], etrigan_zeroarg, etrigan_onearg, msg = 'optional etrigan') kms_parser_check_positionals(srv_config, daemon_parser.parse_args, arguments = userarg[pos_etr:], msg = 'positional etrigan') srv_config['mode'] = 'etrigan+connect' elif any(pars in userarg for pars in subpars): if 'etrigan' in userarg: pos = userarg.index('etrigan') elif 'connect' in userarg: pos = userarg.index('connect') kms_parser_check_optionals(userarg[0 : pos], pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len = exclude_kms) kms_parser_check_positionals(srv_config, server_parser.parse_args, arguments = userarg[0 : pos], force_parse = True) if 'etrigan' in userarg: ## Set daemon options for server dict config. # example case: # python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] etrigan daemon_positional [--daemon_optionals] kms_parser_check_optionals(userarg[pos:], etrigan_zeroarg, etrigan_onearg, msg = 'optional etrigan') kms_parser_check_positionals(srv_config, daemon_parser.parse_args, arguments = userarg[pos:], msg = 'positional etrigan') elif 'connect' in userarg: ## Set connect options for server dict config. # example case: # python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] connect [--connect_optionals] kms_parser_check_optionals(userarg[pos:], connect_zeroarg, connect_onearg, msg = 'optional connect', exclude_opt_dup = exclude_dup) kms_parser_check_positionals(srv_config, connection_parser.parse_args, arguments = userarg[pos:], msg = 'positional connect') else: # Update pykms options for dict server config. # example case: # python3 pykms_Server.py [1.2.3.4] [1234] [--pykms_optionals] kms_parser_check_optionals(userarg, pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len = exclude_kms) kms_parser_check_positionals(srv_config, server_parser.parse_args) kms_parser_check_connect(srv_config, srv_options, userarg, connect_zeroarg, connect_onearg) except KmsParserException as e: pretty_printer(put_text = "{reverse}{red}{bold}%s. Exiting...{end}" %str(e), to_exit = True)