Add --checkup mode to check user configuration#1509
Conversation
ad6d66c to
7dc6f45
Compare
7dc6f45 to
3fd95b0
Compare
mycli/main.py
Outdated
| if section_name not in mycli.config_without_package_defaults: | ||
| if not did_output: | ||
| print('\nMissing in user ~/.myclirc:\n') | ||
| print(f'The entire section:\n\n [{section_name}]\n') |
There was a problem hiding this comment.
Due to:
Line 145 in 3fd95b0
This won't ever fire for the [main] or [connection] sections (will just output every option in the section). Likely wouldn't happen for [main] when upgrading, but possible for [connection] since that is newer. Not a big deal, but wanted to point it out in case it matters.
There was a problem hiding this comment.
Great catch, fixed.
mycli/main.py
Outdated
| def do_config_checkup(mycli: MyCli) -> None: | ||
| did_output = False | ||
| for section_name in mycli.config.keys(): | ||
| if section_name not in mycli.config_without_package_defaults: |
There was a problem hiding this comment.
If no user .myclirc exists, it will output every option as missing. Similar vein to the below comment that this may not matter for an upgrade situation, but might be worth adding a check to do nothing if no file exists.
There was a problem hiding this comment.
Great idea! Done.
scottnemes
left a comment
There was a problem hiding this comment.
Verified overall functionality works as expected. Tested by removing an option as well as entire sections, and it output as expected.
Approving as-is, but see comments in case you want to change anything.
f03fe91 to
b81a766
Compare
This helps the user who has upgraded see which new features are silently being set to the package defaults.
b81a766 to
6da86a2
Compare
Description
This helps the user who has upgraded see which new features are silently being set to the package defaults.
Checklist
changelog.mdfile.AUTHORSfile (or it's already there).