From 38e33d8756a5b652965be8ada478b5c4238b857c Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 18 May 2021 16:26:49 -0400 Subject: Added spellcasting command --- files/dmtool.bash | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'files') diff --git a/files/dmtool.bash b/files/dmtool.bash index ffc75f7..f683e05 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 help" + local commands="ls cp mkdir mv rm attacks roll damage heal reset set edit add del spellcasting help" 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) + attacks|roll|damage|heal|set|edit|del|spellcasting) if [[ $COMP_CWORD -le 2 ]]; then _dmtool_complete_entries else @@ -126,6 +126,14 @@ _dmtool() #TODO: Add items and spells _dmtool_complete_skills_abilities ;; + spellcasting) + if [[ $COMP_CWORD -eq 3 ]]; then + COMPREPLY+=($(compgen -W "init ability level" -- ${cur})) + elif [[ "$lastarg" == "ability" ]]; then + local IFS=$'\n' + COMPREPLY+=($(compgen -W "$(_dmtool_abilities)" -- ${cur})) + fi + ;; esac fi ;; -- cgit v1.2.3