Make help message generation robust.
This commit is contained in:
@@ -46,6 +46,14 @@ def validate_sniff(ctx, param, value):
|
||||
return value
|
||||
|
||||
|
||||
def run_pre(pre):
|
||||
pass
|
||||
|
||||
|
||||
def run_post(post):
|
||||
pass
|
||||
|
||||
|
||||
@click.command('sniff', help='Sniff packets with tcpdump')
|
||||
@optgroup.group('Testbed sources')
|
||||
@optgroup.option('--db', '--database', type=str, envvar='IOTTB_DB', show_envvar=True,
|
||||
@@ -79,10 +87,13 @@ def validate_sniff(ctx, param, value):
|
||||
@click.argument('device', required=False)
|
||||
@click.pass_context
|
||||
def sniff(ctx, device, interface, print_pacno, ff, count, monitor_mode, print_ll, address, db, unsafe, guided,
|
||||
app, tcpdump_args, **params):
|
||||
app, tcpdump_args, pre, post, **params):
|
||||
""" Sniff packets from a device """
|
||||
logger.info('sniff command invoked')
|
||||
|
||||
# Step 0: run pre script:
|
||||
if pre:
|
||||
click.echo(f'Running pre command {pre}')
|
||||
run_pre(pre)
|
||||
# Step1: Load Config
|
||||
config = ctx.obj['CONFIG']
|
||||
logger.debug(f'Config loaded: {config}')
|
||||
@@ -325,3 +336,6 @@ def sniff(ctx, device, interface, print_pacno, ff, count, monitor_mode, print_ll
|
||||
json.dump(metadata, f, indent=4)
|
||||
|
||||
click.echo(f'END SNIFF SUBCOMMAND')
|
||||
if post:
|
||||
click.echo(f'Running post command {post}')
|
||||
run_post(post)
|
||||
|
||||
Reference in New Issue
Block a user