mirror of
https://github.com/mas-cli/mas
synced 2024-11-28 22:40:24 +00:00
7fe27fc693
homebrew allows using gnu coreutils on MacOS. Therefore we should comply with posix standards ```bash $ mas help | tail +3 tail: cannot open '+3' for reading: No such file or directory $ type tail tail is /usr/local/opt/coreutils/libexec/gnubin/tail ``` Switching to posix compliant `-n` syntax is compatible with UNIX and GNU tooling. ```bash $ mas help | /usr/bin/tail -n +3 | wc -l 18 $ mas help | tail -n +3 | wc -l 18 ```
17 lines
371 B
Bash
17 lines
371 B
Bash
#!/usr/bin/env bash
|
|
|
|
_mas() {
|
|
local cur prev words cword
|
|
if declare -F _init_completions >/dev/null 2>&1; then
|
|
_init_completion
|
|
else
|
|
COMPREPLY=()
|
|
_get_comp_words_by_ref cur prev words cword
|
|
fi
|
|
if [[ $cword -eq 1 ]]; then
|
|
COMPREPLY=($(compgen -W "$(mas help | tail -n +3 | awk '{print $1}')" -- "$cur"))
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
complete -F _mas mas
|