Created
June 4, 2019 05:32
-
-
Save nlimpid/225d8022c8a9c10915cc7c486a758109 to your computer and use it in GitHub Desktop.
bash complete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_foo() | |
{ | |
local cur prev | |
cur=${COMP_WORDS[COMP_CWORD]} | |
prev=${COMP_WORDS[COMP_CWORD-1]} | |
case ${COMP_CWORD} in | |
1) | |
COMPREPLY=($(compgen -W "configure show" -- ${cur})) | |
;; | |
2) | |
case ${prev} in | |
configure) | |
COMPREPLY=($(compgen -W "CM DSP NPU" -- ${cur})) | |
;; | |
show) | |
COMPREPLY=($(compgen -W "some other args" -- ${cur})) | |
;; | |
esac | |
;; | |
*) | |
COMPREPLY=() | |
;; | |
esac | |
} | |
complete -F _foo foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment