Skip to content

Commit

Permalink
refactor: replace compgen -c -d with _comp_compgen_commands
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Jun 1, 2023
1 parent b9c7b5d commit b42b79b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -2581,8 +2581,7 @@ _comp_command_offset()
_comp_get_words cur

if ((COMP_CWORD == 0)); then
compopt -o filenames
_comp_compgen -- -d -c
_comp_compgen_commands
else
_comp_dequote "${COMP_WORDS[0]}" || ret=${COMP_WORDS[0]}
local cmd=$ret compcmd=$ret
Expand Down
3 changes: 1 addition & 2 deletions completions/_su
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ _comp_cmd_su()
return
;;
-c | --command | --session-command)
compopt -o filenames
_comp_compgen -- -d -c
_comp_compgen_commands
return
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion completions/gdb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ _comp_cmd_gdb()
if _comp_looks_like_path "$cur"; then
# compgen -c works as expected if $cur contains any slashes.
local PATH="$PATH:."
_comp_compgen -- -d -c
_comp_compgen_commands
else
# otherwise compgen -c contains Bash's built-in commands,
# functions and aliases. Thus we need to retrieve the program
Expand Down

0 comments on commit b42b79b

Please sign in to comment.