From 2bbad22248caafdf839a7229d127287db6be08c4 Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Sat, 7 Nov 2015 18:25:16 +0100 Subject: Remove autogenerated files before generating the new ones Currently if there is a conflict with two manpages having the same name, one completion will override the other. But if one can be parsed and the other can't the one with parsed results will always have a higher priority. --- share/tools/create_manpage_completions.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'share/tools') diff --git a/share/tools/create_manpage_completions.py b/share/tools/create_manpage_completions.py index fe9c52c3..2b0a04c9 100755 --- a/share/tools/create_manpage_completions.py +++ b/share/tools/create_manpage_completions.py @@ -817,15 +817,7 @@ def parse_manpage_at_path(manpage_path, output_directory): parser_names = ', '.join(p.name() for p in parsersToTry) #add_diagnostic('%s contains no options or is unparsable' % manpage_path, BRIEF_VERBOSE) add_diagnostic('%s contains no options or is unparsable (tried parser %s)' % (manpage_path, parser_names), BRIEF_VERBOSE) - # Make sure we delete any old completion - if not WRITE_TO_STDOUT: - fullpath = os.path.join(output_directory, CMDNAME + '.fish') - try: - os.remove(fullpath) - except (OSError, IOError): - # Ignore failure - pass - + return success def parse_and_output_man_pages(paths, output_directory, show_progress): @@ -983,4 +975,8 @@ if __name__ == "__main__": if e.errno != errno.EEXIST: raise + if not WRITE_TO_STDOUT: + # Remove old generated files + cleanup_autogenerated_completions_in_directory(output_directory) + parse_and_output_man_pages(file_paths, output_directory, show_progress) -- cgit v1.2.3