Page MenuHomeSoftware Heritage

core.cli: Fix the create option as flag
ClosedPublic

Authored by ardumont on Dec 13 2018, 4:24 PM.

Details

Summary

Prior to this commit, unexpectedly the option was not a flag:

-C, --no-create TEXT  Do not attempt to create the database

So we would have had to pass along an extra boolean with the option.

Now it's simpler:

-c, --create / --no-create  Attempt to create the database
Test Plan

tox

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

douardda added inline comments.
swh/core/cli.py
24–28

if you change the flag default value (thus meaning), use lower case short flag (here -c)

Makes no sense to keep it uppercase here.

Also the is_flag is not needed since you use the complete long version form for a flag '--create/--no-create'

This revision now requires changes to proceed.Dec 13 2018, 5:12 PM
  • core.cli: Use lower case short option and remove useless is_flag
ardumont retitled this revision from core.cli: Fix the create option as flag and keep original behavior to core.cli: Fix the create option as flag.Dec 13 2018, 5:16 PM
ardumont edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Dec 13 2018, 5:16 PM
This revision was automatically updated to reflect the committed changes.