-
-
Notifications
You must be signed in to change notification settings - Fork 1
Added CLI command for listing configurations. #4
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
Merged
Merged
Changes from all commits
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
67f376f
Tests passing need to work on other checks.
BatuhanSA 0ff308a
Worked on linting and typing.
BatuhanSA b6148cf
Changed the Mapping import.
BatuhanSA d4556b9
Added an option to specify the config file name.
BatuhanSA cca8ea6
Reordered some checks.
BatuhanSA 588f452
Generalizes the use case to edq.
BatuhanSA f34c44f
Revised unittest.
BatuhanSA bf98083
Revised config and config tests.
BatuhanSA 03a7d64
resolved conflicts.
BatuhanSA e550e8b
pointed to defualt config file name in tests.
BatuhanSA aa14f7f
Revised the first pass.
BatuhanSA 3b22855
Passed in the msg for unittesting.
BatuhanSA 9f0be06
Reviewd the PR, need to work on testing comments.
BatuhanSA a9efa0b
Reviewed testing.
BatuhanSA 769527c
Resolved conflicts.
BatuhanSA ee3d21b
Revised questions in mind and added missing config directory.
BatuhanSA c06b6fc
Testing Windows permission error on directories when loading JSON.
BatuhanSA 0f61041
Changed the way equals returns for ConfigSource object.
BatuhanSA 4cc295b
Tested all combinations of 4 config labels.
BatuhanSA 9d25595
Revised the structure of tests, need to go over them.
BatuhanSA bcaa609
Revised testcases and added file tree creation when testing.
BatuhanSA 05b7966
Removing files that need to be in the next PR.
BatuhanSA 24f240e
Reviewed previous PR comments.
BatuhanSA cdeee74
Revised the second pass, need to work on testing and README.
BatuhanSA 67634ee
Changed the order of the test structure. Made a single temp_dir for a…
BatuhanSA f2ef098
Added config on README
BatuhanSA 707a351
Got rid of points for Global config.
BatuhanSA 683140b
Polished of the README.
BatuhanSA 97d16d9
Fixed the url for platformdir.
BatuhanSA cf20ac6
Fixed the url for platformdir.
BatuhanSA 5edb54a
Made the local config description better.
BatuhanSA aed3ffb
Made the local config description better.
BatuhanSA 7c905b5
Revised for 3rd pass
BatuhanSA 078eaee
Corrected inconsistencies.
BatuhanSA c6c7a0a
Revised 4th pass.
BatuhanSA 53d8bf4
Revised the README, converted the table format.
BatuhanSA 22797db
Got rid of a inconsistency.
BatuhanSA c753729
2nd revision of README
BatuhanSA 629f110
Revised it again.
BatuhanSA f223a92
Added error description.
BatuhanSA 418b6cb
Added examples to the README.
BatuhanSA 869d963
Made clarifications.
BatuhanSA 033d119
Revised the overriding on skip keys.
BatuhanSA 51c139b
Moved config from util to core.
BatuhanSA b15cbd0
Revised the README with 5th pass.
BatuhanSA 568830f
Added 'only' to local and global config description.
BatuhanSA 1aed3d7
Adding CLI for config list.
BatuhanSA f9155d6
Merge branch 'main' into cli
BatuhanSA 7e73dd7
Renamed the functions for list cli.
BatuhanSA 6273d49
Adding cli tests.
BatuhanSA 2ecf78b
Fixed import order.
BatuhanSA 1428e59
Added --config flag functionality to get_tierd_config().
BatuhanSA e57b662
Added more CLI tests for config list.
BatuhanSA 39dabdb
Revised for PR.
BatuhanSA 815f904
Revised it one last time before the PR.
BatuhanSA e07f887
Corrected an inaccruacy on a comment.
BatuhanSA 77476bf
Made CLI flags descriptions better.
BatuhanSA 8257ca8
Reviewed 1st pass.
BatuhanSA d4495bb
Reviwed the 1st pass one last time.
BatuhanSA cdf293c
Changed the name of the post parsing function for config.
BatuhanSA 61d69de
Revised 2nd pass.
BatuhanSA 04636f7
Added more test cases.
BatuhanSA bf08974
Moved config list test under list directory.
BatuhanSA 8af6f7e
Moved some test from cli test to config test side.
BatuhanSA f8986f8
Made password test case consisten on cli side.
BatuhanSA 648b4be
Added ignore-config flag.
BatuhanSA 4cdc050
Fixed issues with helpand error messages.
BatuhanSA fdb1aba
Embedded global config path in to cli arguments.
BatuhanSA 9303bf1
Added tests and updated the help message for ignore config.
BatuhanSA 3052836
Added non-existing key test for ignore config.
BatuhanSA 3901239
Got rid of extra space.
BatuhanSA 234d4a6
Increaed the max module lines for format.
BatuhanSA a00427a
Done with 3rd pass.
BatuhanSA 2241faa
Simplified str conversion, chnaged the numeric value test.
BatuhanSA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| """ | ||
| List current configuration options. | ||
| """ | ||
|
|
||
| import argparse | ||
| import sys | ||
|
|
||
| import edq.core.argparser | ||
|
|
||
| CONFIG_FIELD_SEPARATOR: str = "\t" | ||
|
|
||
| def run_cli(args: argparse.Namespace) -> int: | ||
| """ Run the CLI. """ | ||
|
|
||
| rows = [] | ||
|
|
||
| for (key, value) in args._config.items(): | ||
| row = [key, str(value)] | ||
| if (args.show_origin): | ||
| config_source_obj = args._config_sources.get(key) | ||
|
|
||
| origin = config_source_obj.path | ||
| if (origin is None): | ||
| origin = config_source_obj.label | ||
|
|
||
| row.append(origin) | ||
|
|
||
| rows.append(CONFIG_FIELD_SEPARATOR.join(row)) | ||
|
|
||
| rows.sort() | ||
|
|
||
| if (not args.skip_header): | ||
| header = ["Key", "Value"] | ||
| if (args.show_origin): | ||
| header.append("Origin") | ||
|
|
||
| rows.insert(0, (CONFIG_FIELD_SEPARATOR.join(header))) | ||
|
|
||
| print("\n".join(rows)) | ||
| return 0 | ||
|
|
||
| def main() -> int: | ||
| """ Get a parser, parse the args, and call run. """ | ||
|
|
||
| return run_cli(_get_parser().parse_args()) | ||
|
|
||
| def _get_parser() -> edq.core.argparser.Parser: | ||
| """ Get a parser and add addition flags. """ | ||
|
|
||
| parser = edq.core.argparser.get_default_parser(__doc__.strip()) | ||
|
|
||
| parser.add_argument("--show-origin", dest = 'show_origin', | ||
| action = 'store_true', | ||
| help = "Display where each configuration's value was obtained from.", | ||
| ) | ||
|
|
||
| parser.add_argument("--skip-header", dest = 'skip_header', | ||
| action = 'store_true', | ||
| help = 'Skip headers when displaying configs.', | ||
| ) | ||
|
|
||
| return parser | ||
|
|
||
| if (__name__ == '__main__'): | ||
| sys.exit(main()) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.