create_manpage_completions: Change "--save" to "--keep"

This commit is contained in:
Fabian Homborg 2020-04-04 14:18:10 +02:00
parent f212aba174
commit 6e95e1d79d

View file

@ -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, SAVE_FILES
VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY, SAVE_FILES = NOT_VERBOSE, False, False, False
global VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY, KEEP_FILES
VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY, KEEP_FILES = NOT_VERBOSE, False, False, False
def add_diagnostic(dgn, msg_verbosity=VERY_VERBOSE):
@ -996,7 +996,7 @@ def get_paths_from_man_locations():
def usage(script_name):
print(
"Usage: {0} [-v, --verbose] [-s, --stdout] [-d, --directory] [-p, --progress] [-s, --save] files...".format(
"Usage: {0} [-v, --verbose] [-s, --stdout] [-d, --directory] [-p, --progress] [-k, --keep] files...".format(
script_name
)
)
@ -1008,9 +1008,7 @@ def usage(script_name):
-d, --directory [dir]\tWrite all completions to the given directory, instead of to ~/.local/share/fish/generated_completions
-m, --manpath\tProcess all man1 and man8 files available in the manpath (as determined by manpath)
-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.
-k, --keep\tDo not remove files from destination directory.
"""
)
@ -1020,7 +1018,7 @@ if __name__ == "__main__":
try:
opts, file_paths = getopt.gnu_getopt(
sys.argv[1:],
"v:sd:hmpc:z",
"v:kd:hmpc:z",
[
"verbose=",
"stdout",
@ -1029,7 +1027,7 @@ if __name__ == "__main__":
"help",
"manpath",
"progress",
"save",
"keep",
],
)
except getopt.GetoptError as err:
@ -1062,8 +1060,8 @@ if __name__ == "__main__":
cleanup_directories.append(value)
elif opt in ("-z",):
DEROFF_ONLY = True
elif opt in ("-s", "--save"):
SAVE_FILES = True
elif opt in ("-k", "--keep"):
KEEP_FILES = True
else:
assert False, "unhandled option"
@ -1092,7 +1090,7 @@ if __name__ == "__main__":
if e.errno != errno.EEXIST:
raise
if not WRITE_TO_STDOUT and not SAVE_FILES:
if not WRITE_TO_STDOUT and not KEEP_FILES:
# Remove old generated files
cleanup_autogenerated_completions_in_directory(output_directory)