1
0
mirror of https://github.com/bmartini/zynq-axis.git synced 2024-09-05 19:19:27 +08:00
zynq-axis/util/zynq-axis-completion.bash
Berin Martini 8082ee8df7 Tab completion script for zynq-axis repo scripts
Move the "util/zynq-axis-completion.bash" file into your home directory
and save it as a 'dot' file. Then add the code snippet in the header of
the file into your dot bashrc file.
2015-01-02 13:03:51 -05:00

54 lines
1.2 KiB
Bash

# Setup tab completion for zynq-axis repo scripts
#
# Move this "zynq-axis-completion.bash" file into your home directory and save
# it as a 'dot' file. Then add the following code snippet into your dot bashrc
# file.
<<"BASHRC_CODE"
if [ -f ~/.zynq-axis-completion.bash ]
then
source ~/.zynq-axis-completion.bash
fi
BASHRC_CODE
_sim-module_complete() {
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local completions="$(find hdl/ -type f \( -name "*.v" ! -name "*_tb.v" \) \
-exec basename {} .v \; | xargs echo)"
COMPREPLY=( $(compgen -W "$completions" -- "$cur") )
}
complete -F _sim-module_complete sim-module
_syn-proj_complete() {
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
# completing an option
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "-h -s" -- $cur ) )
else
local completions="$(find syn/ -maxdepth 1 -type d -name "project-*" \
-exec basename {} \;)"
COMPREPLY=( $(compgen -W "$completions" -- "$cur") )
fi
}
complete -F _syn-proj_complete syn-proj
_syn-proj-prep_complete() {
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
# completing an option
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "-c -h -l -L" -- $cur ) )
fi
}
complete -F _syn-proj-prep_complete syn-proj-prep