Skip to content

Commit

Permalink
no args now shows help
Browse files Browse the repository at this point in the history
  • Loading branch information
jamespo committed Oct 1, 2024
1 parent 407b18e commit c8bf3d4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cron2db/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@click.option('--stderr', help='Path to stderr file')
@click.option('--stdout', help='Path to stdout file')
@click.option('--start', help='start time (epoch seconds)', type=int)
@click.option('--end', help='start time (epoch seconds)', type=int)
@click.option('--end', help='end time (epoch seconds)', type=int)
@click.option('--rc', help='return code', type=int)
@click.argument('mode', default='add')
def main(mode, cmd, stderr, stdout, rc, start, end):
Expand All @@ -16,9 +16,11 @@ def main(mode, cmd, stderr, stdout, rc, start, end):
cj = CronDB(engine=cf.config['cron2db']['database'])
if mode in ('list', 'ls'):
print(list(cj.return_all()))
elif mode == 'add':
cj.add(cmd, stderr, stdout, rc, start, end)
elif mode in ('init', 'initialize'):
pass
elif mode == 'add' and cmd is not None:
cj.add(cmd, stderr, stdout, rc, start, end)
else:
raise ValueError
ctx = click.get_current_context()
click.echo(ctx.get_help())
ctx.exit()

0 comments on commit c8bf3d4

Please sign in to comment.