Add dryrun flag.
This commit is contained in:
parent
4059b9b6dd
commit
d3895cd43d
1 changed files with 6 additions and 2 deletions
6
main.py
6
main.py
|
@ -114,7 +114,8 @@ def init_logging(level: str):
|
|||
@click.command()
|
||||
@click.option('--level', '-l', envvar='WP_CAL_LEVEL', default=':WARNING,wp_cal:INFO', help='The log level for the application')
|
||||
@click.option('--config', '-c', envvar='WP_CAL_CONFIG', default='-', help='The configuration file')
|
||||
def main(level, config):
|
||||
@click.option('--dryrun', '-d', envvar='WP_CAL_DRYRUN', is_flag=True, help="Don't actually post any data, just show it")
|
||||
def main(level, config, dryrun):
|
||||
logging.basicConfig()
|
||||
init_logging(level)
|
||||
|
||||
|
@ -149,6 +150,9 @@ def main(level, config):
|
|||
events = g.get_events()
|
||||
logger.info("syncing %d events", len(events))
|
||||
w.login()
|
||||
if dryrun:
|
||||
logger.info("dryrun; would post events: %s", events)
|
||||
else:
|
||||
w.post_events(events)
|
||||
logger.info("done")
|
||||
|
||||
|
|
Loading…
Reference in a new issue