Add history command to searchor cli #125
Merged
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.
Improvement to Searchor CLI
I have added a new feature to the CLI/CLT, which is the
history
command.The
history
command will allow users to view all previous URLs generated from the CLI,the command will still be improved later on, but its currently capable of the most basic functionality, which is showing searchor URL history.
To make this work I created the
history.py
file, to be used as a module inmain.py
with functions for updating, clearing and viewing history data.The history data will be stored in JSON format, and the data file will be located in the user's HOME directory as
.searchor_history.json
.I chose JSON because I thought it would be an easy way to store all the important aspects of URL creation that might influence how history data will be viewed, without the need for extra string processing like if it was a .txt file.
To further explain, using the JSON format, I can store the URL, engine, query, time, and date of creation for each URL generated. This would actually be useful for when I'm trying to extend the functionality of the
history
command, Like arranging URLs according to date created, or engine used.What will this Pull Request Affect?
changes were made to
main.py
, I included exception handling to take care of AttributeErrors, and functions from the history module were imported to be used in their respective commands.In setup.py I added
click
as a dependency.feel free to test out the new features and make improvements.