Skip to content

Commit cbb02f7

Browse files
authored
Merge pull request #74 from wpyoga/help-shortform
Enable `-h` as short form of `--help`
2 parents da1e8b5 + 62ed96e commit cbb02f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

wsdiscovery/cmdline.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
DEFAULT_LOGLEVEL = "INFO"
1515

16+
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
17+
18+
1619
@contextmanager
1720
def discovery(capture=None, unicast_num=UNICAST_UDP_REPEAT,
1821
multicast_num=MULTICAST_UDP_REPEAT):
@@ -40,7 +43,7 @@ def setup_logger(name, loglevel):
4043
return logging.getLogger(name)
4144

4245

43-
@click.command()
46+
@click.command(context_settings=CONTEXT_SETTINGS)
4447
@click.option('--scope', '-s', help='Full scope URI, eg. onvif://www.onvif.org/Model/')
4548
@click.option('--address', '-a', help='Service address')
4649
@click.option('--port', '-p', type=int, help='Service port')
@@ -71,7 +74,7 @@ def discover(scope, address, port, loglevel, capture, timeout, unicast_num,
7174
print(" - %s\n" % "\n - ".join([str(s) for s in service.getScopes()]))
7275

7376

74-
@click.command()
77+
@click.command(context_settings=CONTEXT_SETTINGS)
7578
@click.option('--scope', '-s', help='Full scope URI, eg. onvif://www.onvif.org/Model/')
7679
@click.option('--typename', '-t', help='Qualified type name, eg. https://myservicesns:myservice_type')
7780
@click.option('--address', '-a', help='Service IP address')

0 commit comments

Comments
 (0)