turn true even if there # are no completions found. This is because fish will perform the last # completion command, even if its condition is false, if no other # completion command was triggered return (not set --query __%[1]s_comp_do_file_comp) end # Remove any pre-existing completions for the program since we will be handling all of them # TODO this cleanup is not sufficient. Fish completions are only loaded once the user triggers # them, so the below deletion will not work as it is run too early. What else can we do? complete -c %[1]s -e # The order in which the below two lines are defined is very important so that __%[1]s_prepare_completions # is called first. It is __%[1]s_prepare_completions that sets up the __%[1]s_comp_do_file_comp variable. # # This completion will be run second as complete commands are added FILO. # It triggers file completion choices when __%[1]s_comp_do_file_comp is set. complete -c %[1]s -n 'set --query __%[1]s_comp_do_file_comp' # This completion will be run first as complete commands are added FILO. # The call to __%[1]s_prepare_completions will setup both __%[1]s_comp_results abd __%[1]s_comp_do_file_comp. # It provides the program's completion choices. complete -c %[1]s -n '__%[1]s_prepare_completions' -f -a '$__%[1]s_comp_results' ---