Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"--help"、“-h” can't work with current trunk #139

Open
chengshuangliu opened this issue Apr 29, 2020 · 1 comment
Open

"--help"、“-h” can't work with current trunk #139

chengshuangliu opened this issue Apr 29, 2020 · 1 comment

Comments

@chengshuangliu
Copy link

root@python-stack-server:~# snmpsim-command-responder -h
Traceback (most recent call last):
File "/usr/local/bin/snmpsim-command-responder", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/snmpsim/commands/responder.py", line 401, in main
snmp_helper.print_usage(sys.stderr)
File "/usr/lib/python3.5/argparse.py", line 2362, in print_usage
self._print_message(self.format_usage(), file)
File "/usr/lib/python3.5/argparse.py", line 2328, in format_usage
return formatter.format_help()
File "/usr/lib/python3.5/argparse.py", line 287, in format_help
help = self._root_section.format_help()
File "/usr/lib/python3.5/argparse.py", line 217, in format_help
func(*args)
File "/usr/lib/python3.5/argparse.py", line 338, in _format_usage
assert ' '.join(opt_parts) == opt_usage
AssertionError

some code in argparse.py:
part_regexp = r'(.?)+|[.?]+|\S+'
opt_usage = format(optionals, groups)
pos_usage = format(positionals, groups)
opt_parts = _re.findall(part_regexp, opt_usage)
pos_parts = _re.findall(part_regexp, pos_usage)

error point :
assert ' '.join(opt_parts) == opt_usage
assert ' '.join(pos_parts) == pos_usage

reason:

the re "part_regexp " split args error when double "[[]]" in some string like "[--logging-method =<syslog|null|stderr|file|stdout[:args]>]]".

@gainskills
Copy link

gainskills commented Aug 3, 2020

Hi,
Please try with the latest version to see if this resolved or not.

snmpsim-command-responder -h 
usage: snmpsim-command-responder [-v] [-h] [--help] [--quiet] [--debug {io,dsp,msgproc,secmod,mibbuild,mibview,mibinstrum,acl,proxy,app,all}]
                                 [--debug-asn1 {none,encoder,decoder,all}] [--logging-method =<syslog|file|stdout|stderr|null[:args]>]]
                                 [--log-level {debug,info,error}] [--reporting-method =<null|fulljson|minimaljson[:args]>]] [--daemonize]
                                 [--process-user PROCESS_USER] [--process-group PROCESS_GROUP] [--pid-file <FILE>] [--cache-dir <DIR>]
                                 [--force-index-rebuild] [--validate-data] [--variation-modules-dir <DIR>]
                                 [--variation-module-options <module[=alias][:args]>] [--v3-only] [--transport-id-offset TRANSPORT_ID_OFFSET]
                                 [--max-var-binds MAX_VAR_BINDS] [--args-from-file <FILE>] [--v3-engine-id <HEX|auto>] [--v3-user <STRING>]
                                 [--v3-auth-key V3_AUTH_KEY] [--v3-auth-proto {MD5,SHA,SHA224,SHA256,SHA384,SHA512,NONE}]
                                 [--v3-priv-key V3_PRIV_KEY] [--v3-priv-proto {DES,3DES,AES,AES128,AES192,AES192BLMT,AES256,AES256BLMT,NONE}]
                                 [--v3-context-engine-id V3_CONTEXT_ENGINE_ID] [--v3-context-name V3_CONTEXT_NAME]
                                 [--agent-udpv4-endpoint <[X.X.X.X]:NNNNN>] [--agent-udpv6-endpoint <[X:X:..X]:NNNNN>] [--data-dir <DIR>]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants