refactor: move TUI user input options to a class #297
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.
Redefine all TUI prompts into 3 levels:
basic_prompt.py
for standard prompts likeask_file_path
,enter_to_continue
orask_text
user_prompts.py
for CDL specific prompts likeimport v4 config
orextract cookies from browser
. These prompts could have nested promptsprogram_ui.py
with the classProgramUI
which contains all the custom user prompts of the program as methodsAll prompts are now dynamically created passing a dict with the menu options and a mapping with the function that each option will execute
Remove all prompts that were unnecessary cause they were asking the same values as the config files.
Edit URLs.txt
,Edit current config
,Edit authentication config
andEdit global config
are still present in the UI but now they just open the respective file in notepad or the default text editor of the OSSwitch back to using
os.system('cls')
to clear the screen on Windows.rich.console.clear()
uses ANSI escape codes to clear the terminal and the legacycmd
does not support them. This let to prompts being rendered over leftover characters in the buffer.Browser_Cookies
optionsbrowsers
andsites
are now defined as lists in the config definitionAdd
all
anddefault
as hardcoded internal configs names. The user cannot create configs with those names. The idea with reservingall
is for the user to pass it as a CLI argument to indicate that they want to run all configs sequentially. This will help to collapse some CLI arguments which are essentially duplicated cause they have asingle config
version and anall config
version. None of the logic for this is implemented in this PR, they were just added as a reserved name