mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-09 20:21:16 -03:00
Allow not to remove files from destination dir
Signed-off-by: JanczarKnurek <jacek@beit.tech>
This commit is contained in:
committed by
Fabian Homborg
parent
30459b053f
commit
f212aba174
@@ -48,8 +48,8 @@ diagnostic_indent = 0
|
||||
VERY_VERBOSE, BRIEF_VERBOSE, NOT_VERBOSE = 2, 1, 0
|
||||
|
||||
# Pick some reasonable default values for settings
|
||||
global VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY
|
||||
VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY = NOT_VERBOSE, False, False
|
||||
global VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY, SAVE_FILES
|
||||
VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY, SAVE_FILES = NOT_VERBOSE, False, False, False
|
||||
|
||||
|
||||
def add_diagnostic(dgn, msg_verbosity=VERY_VERBOSE):
|
||||
@@ -996,8 +996,9 @@ def get_paths_from_man_locations():
|
||||
|
||||
def usage(script_name):
|
||||
print(
|
||||
"Usage: {0} [-v, --verbose] [-s, --stdout] [-d, --directory] [-p, --progress]"
|
||||
" [-c, --cleanup-in] [-z] files...".format(script_name)
|
||||
"Usage: {0} [-v, --verbose] [-s, --stdout] [-d, --directory] [-p, --progress] [-s, --save] files...".format(
|
||||
script_name
|
||||
)
|
||||
)
|
||||
print(
|
||||
"""Command options are:
|
||||
@@ -1009,6 +1010,7 @@ def usage(script_name):
|
||||
-p, --progress\tShow progress
|
||||
-c, --cleanup-in\tRemove all .fish files out of a given directory.
|
||||
-z\t\tParse using only Deroff parser.
|
||||
-s, --save\tDo not remove files from destination directory.
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -1027,6 +1029,7 @@ if __name__ == "__main__":
|
||||
"help",
|
||||
"manpath",
|
||||
"progress",
|
||||
"save",
|
||||
],
|
||||
)
|
||||
except getopt.GetoptError as err:
|
||||
@@ -1059,6 +1062,8 @@ if __name__ == "__main__":
|
||||
cleanup_directories.append(value)
|
||||
elif opt in ("-z",):
|
||||
DEROFF_ONLY = True
|
||||
elif opt in ("-s", "--save"):
|
||||
SAVE_FILES = True
|
||||
else:
|
||||
assert False, "unhandled option"
|
||||
|
||||
@@ -1087,7 +1092,7 @@ if __name__ == "__main__":
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
if not WRITE_TO_STDOUT:
|
||||
if not WRITE_TO_STDOUT and not SAVE_FILES:
|
||||
# Remove old generated files
|
||||
cleanup_autogenerated_completions_in_directory(output_directory)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user