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

use match statement instead of ifs #56

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/facere_sensum/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,18 @@ def main():
sys.exit(1)

log = config['log']
if args.command == 'create':
command_create(config, log)
elif args.command == 'update':
command_update(config, log, datetime.date.today())
print('\nSee you next time!')
elif args.command == 'chart':
command_chart(config)
else: # pragma: no cover
# Should never get here given that all the actions are processed above.
print('Something weird happened.',
'Please submit an issue at https://github.com/lunarserge/facere-sensum/issues/new',
'with the command that led here.')
sys.exit(1)
match args.command:
case 'create':
command_create(config, log)
case 'update':
command_update(config, log, datetime.date.today())
print('\nSee you next time!')
case 'chart':
command_chart(config)
case _: # pragma: no cover
# Should never get here given that all the actions are processed above.
print('Something weird happened.',
'Please submit an issue at',
'https://github.com/lunarserge/facere-sensum/issues/new',
'with the command that led here.')
sys.exit(1)
Loading