forked from FotoCoder/Backuppy
Show message on Ctrl+C
- CLI-mode: Show text "Programm interrupted by user." instead of error message when Ctrl+C was pressed. - CLI-mode: Removed obsolete trace messages
This commit is contained in:
parent
21f6b4b3ac
commit
b24dabf203
2 changed files with 68 additions and 55 deletions
|
@ -1,5 +1,10 @@
|
|||
# Changelog Backuppy
|
||||
|
||||
## [0.8.1] - 2021-05-10
|
||||
### Fixed
|
||||
- CLI-mode: Show text "Programm interrupted by user." instead of error message when Ctrl+C was pressed.
|
||||
- CLI-mode: Removed obsolete trace messages
|
||||
|
||||
## [0.8] - 2021-05-07
|
||||
### Added
|
||||
- GUI-mode: Introduce "Browse"-button on directory-selection dialogs
|
||||
|
|
24
install.py
24
install.py
|
@ -35,8 +35,16 @@ def set_language(language):
|
|||
global LANGUAGE
|
||||
LANGUAGE = language
|
||||
|
||||
def trace(message_txt):
|
||||
""" Print a formatted message to std out. """
|
||||
def trace(message_txt, prefix_crlf=False):
|
||||
""" Print a formatted message to std out.
|
||||
|
||||
:param "message_txt" [in] The message text that should be displayed.
|
||||
:param "prefix_crlf" [in] If True, a carriage return/line feed will be done prior to the message text.
|
||||
|
||||
"""
|
||||
|
||||
if prefix_crlf:
|
||||
print("\n")
|
||||
print("[ OK ] " + message_txt)
|
||||
|
||||
def get_lang_text(search_str: str):
|
||||
|
@ -48,6 +56,7 @@ def get_lang_text(search_str: str):
|
|||
return return_str
|
||||
|
||||
def main_install_cli():
|
||||
try:
|
||||
language = input("Hello, first of all, which language do you prefer: German [DE] or English [EN]?\n> ")
|
||||
if language.upper() == "DE":
|
||||
set_language(LANG_DE)
|
||||
|
@ -108,6 +117,11 @@ def main_install_cli():
|
|||
|
||||
return True, EXCLUDE, RSYNC_CMD
|
||||
|
||||
except KeyboardInterrupt:
|
||||
trace("Programm interrupted by user.", prefix_crlf=True)
|
||||
return False, None, None
|
||||
|
||||
|
||||
def create_exclude_file(directory, exclude_file):
|
||||
exclude_file = os.path.join(directory, exclude_file)
|
||||
with open(exclude_file, "w") as fExclude:
|
||||
|
@ -170,12 +184,6 @@ def main(argv):
|
|||
else:
|
||||
trace("Starting CLI-version.\n")
|
||||
is_finalized, is_exclude, rsync_cmd = main_install_cli() # collect user input via CLI and store in env. variables
|
||||
if is_finalized:
|
||||
print("CLI finalized.")
|
||||
if is_exclude:
|
||||
print("exclude is true.")
|
||||
if rsync_cmd:
|
||||
print("rsync command returned: " + rsync_cmd)
|
||||
|
||||
if is_finalized:
|
||||
do_the_install(is_exclude, rsync_cmd)
|
||||
|
|
Loading…
Reference in a new issue