completion/getopt: `shfmt`

pull/1985/head^2
John D Pell 2022-01-16 11:28:59 -08:00
parent 8cdd226cf3
commit 9d4b23b992
1 changed files with 29 additions and 27 deletions

View File

@ -1,4 +1,6 @@
__getopt() { # shellcheck shell=bash
function _getopt() {
local OPTIONS=('-a' '--alternative' local OPTIONS=('-a' '--alternative'
'-h' '--help' '-h' '--help'
'-l' '--longoptions' '-l' '--longoptions'
@ -17,10 +19,10 @@ __getopt() {
local previous=$3 local previous=$3
case $previous in case $previous in
-s|--shell) -s | --shell)
readarray -t COMPREPLY < <(compgen -W "${SHELL_ARGS[*]}" -- "$current") readarray -t COMPREPLY < <(compgen -W "${SHELL_ARGS[*]}" -- "$current")
;; ;;
-n|--name) -n | --name)
readarray -t COMPREPLY < <(compgen -A function -- "$current") readarray -t COMPREPLY < <(compgen -A function -- "$current")
;; ;;
*) *)
@ -29,4 +31,4 @@ __getopt() {
esac esac
} }
complete -F __getopt getopt complete -F _getopt getopt