diff options
Diffstat (limited to 'files')
-rw-r--r-- | files/dmtool.bash | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/files/dmtool.bash b/files/dmtool.bash index 8bbd673..43aba72 100644 --- a/files/dmtool.bash +++ b/files/dmtool.bash @@ -81,7 +81,7 @@ _dmtool() { COMPREPLY=() local cur="${COMP_WORDS[COMP_CWORD]}" - local commands="ls cp mkdir mv rm attacks roll damage heal reset set edit add del spellcasting help git" + local commands="ls cp mkdir mv rm attacks roll attack damage heal reset set edit add del spellcasting help git" if [[ $COMP_CWORD -gt 1 ]]; then local lastarg="${COMP_WORDS[$COMP_CWORD-1]}" case "${COMP_WORDS[1]}" in @@ -93,7 +93,7 @@ _dmtool() _dmtool_complete_entries fi ;; - attacks|roll|damage|heal|set|edit|del|spellcasting) + attacks|roll|attack|damage|heal|set|edit|del|spellcasting) if [[ $COMP_CWORD -le 2 ]]; then _dmtool_complete_entries else @@ -105,6 +105,16 @@ _dmtool() opts="$(${COMP_WORDS[0]} attacks ${COMP_WORDS[2]})" COMPREPLY+=($(compgen -W "$opts" -- ${cur})) ;; + attack) + COMPREPLY+=($(compgen -W "-1 -2" -- ${cur})) + if [[ $COMP_CWORD -eq 3 ]]; then + local IFS=$'\n' + opts="$(${COMP_WORDS[0]} attacks ${COMP_WORDS[2]})" + COMPREPLY+=($(compgen -W "$opts" -- ${cur})) + elif [[ $COMP_CWORD -eq 4 ]]; then + _dmtool_complete_entries + fi + ;; damage) COMPREPLY+=($(compgen -W "--magical -m --silvered -s --adamantine -a" -- ${cur})) if [[ $COMP_CWORD -eq 4 ]]; then |