-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding functionality for handling and expired URI
I am addressing issue #45 which asks for functionality to deal with an expired URI, which is found in the form of a locally saved json file `user_prefs.json`. We want the user to be notified that the URI is now invalid and to allow them to enter a new URI or reuse the expired URI. Along with this functionality are some code refactors that increase usability and readability hab/user_prefs.py: - Added a data class (UriObj) to handle passing URI related data to the cli - Changed `uri_reason()` to `uri_check()` which now populates a UriObj object with the URI and timedout data - Adding a check to UriObj to make sure that __str__ returns a string even if the uri is None. hab/cli.py: - Added click.prompt to ask the user to enter a new URI plus giving them the option to use the previous URI if one has been saved. - Adding `err=True` to all click.echo and click.prompt calls in UriArgument - Added __uri_prompt() for better cli formatting and to add extra arguments for to support the changes. - Moved some error echo calls behind the logger - Cleaned up the CLI display for the user prompt for an expire URI - Cleaned up the docstrings to reflect these changes. tests/test_user_prefs.py: - Modified the timedout tests so that they match the changes made in user_prefs.py. They now simply check for True or False against UriObj.timedout - Added a test to `UriObj.__str__()` to make sure that all aspects of the UriObj class are touched. .gitignore: - Adding ignores for .venv and .code-workspace README.md: - Added documentation for the expired URI changes and some spelling fixes
- Loading branch information
1 parent
ad77a53
commit 5f77fba
Showing
5 changed files
with
106 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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