From aa304cbd3d3f55fb61914bf123eac573ba190698 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 24 Mar 2020 20:10:08 +0100 Subject: [PATCH] Restore directory completions for subcommands Fixes #6798 This re-adds some false positives: functions, builtins and abbreviations are suggested after commands like sudo but I don't think anyone had complained about that. --- share/functions/__fish_complete_external_command.fish | 2 +- share/functions/__fish_complete_subcommand.fish | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/functions/__fish_complete_external_command.fish b/share/functions/__fish_complete_external_command.fish index 2790c61e7..6d9a25609 100644 --- a/share/functions/__fish_complete_external_command.fish +++ b/share/functions/__fish_complete_external_command.fish @@ -1,3 +1,3 @@ function __fish_complete_external_command - command find $PATH/ -maxdepth 1 -perm -u+x 2>&- | string match -r '[^/]*$' + complete -C "$argv[1]" end diff --git a/share/functions/__fish_complete_subcommand.fish b/share/functions/__fish_complete_subcommand.fish index ea249ef21..c0dfaefe2 100644 --- a/share/functions/__fish_complete_subcommand.fish +++ b/share/functions/__fish_complete_subcommand.fish @@ -49,7 +49,7 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowin end if test $allow_functions_and_builtins = false && test (count $subcommand) -eq 1 - __fish_complete_external_command + __fish_complete_external_command "$subcommand" else printf "%s\n" (complete -C "$subcommand") end