diff options
Diffstat (limited to 'files')
-rw-r--r-- | files/dmtool.bash | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/files/dmtool.bash b/files/dmtool.bash index 43aba72..0d7116f 100644 --- a/files/dmtool.bash +++ b/files/dmtool.bash @@ -70,6 +70,11 @@ _dmtool_abilities() echo -e "str\ndex\ncon\nint\nwis\ncha" } +_dmtool_dmgtypes() +{ + echo -e "slashing\npiercing\nbludgeoning\npoison\nacid\nfire\ncold\nradiant\nnecrotic\nlightning\nthunder\nforce\npsychic" +} + _dmtool_complete_skills_abilities() { local IFS=$'\n' @@ -81,7 +86,7 @@ _dmtool() { COMPREPLY=() local cur="${COMP_WORDS[COMP_CWORD]}" - local commands="ls cp mkdir mv rm attacks roll attack damage heal reset set edit add del spellcasting help git" + local commands="ls cp mkdir mv rm attacks roll attack damage heal save 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 +98,23 @@ _dmtool() _dmtool_complete_entries fi ;; - attacks|roll|attack|damage|heal|set|edit|del|spellcasting) + save) + if [[ $COMP_CWORD -eq 2 ]]; then + local IFS=$'\n' + COMPREPLY+=($(compgen -W "$(_dmtool_abilities)" -- ${cur})) + elif [[ "$lastarg" == "--type" ]]; then + local IFS=$'\n' + COMPREPLY+=($(compgen -W "$(_dmtool_dmgtypes)" -- ${cur})) + elif [[ "$lastarg" == "--damage" ]]; then + : + elif [[ $COMP_CWORD -eq 4 ]]; then + _dmtool_complete_entries + elif [[ $COMP_CWORD -ge 5 ]]; then + COMPREPLY+=($(compgen -W "--magical -m --silvered -s --adamantine -a --damage --type --halves" -- ${cur})) + _dmtool_complete_entries + fi + ;; + attacks|roll|attack|damage|heal|save|set|edit|del|spellcasting) if [[ $COMP_CWORD -le 2 ]]; then _dmtool_complete_entries else @@ -118,7 +139,8 @@ _dmtool() damage) COMPREPLY+=($(compgen -W "--magical -m --silvered -s --adamantine -a" -- ${cur})) if [[ $COMP_CWORD -eq 4 ]]; then - COMPREPLY+=($(compgen -W "slashing piercing bludgeoning poison acid fire cold radiant necrotic lightning thunder force psychic" -- ${cur})) + local IFS=$'\n' + COMPREPLY+=($(compgen -W "$(_dmtool_dmgtypes)" -- ${cur})) fi ;; set) |