commit 824d0e248730ba02dd3f38f747f2f48f871df4cd Author: Tristan Ancelet Date: Mon Nov 6 21:49:11 2023 -0600 initial commit diff --git a/main.sh b/main.sh new file mode 100644 index 0000000..52439de --- /dev/null +++ b/main.sh @@ -0,0 +1,29 @@ +#!/usr/bin/bash + +## Changing to the directory housing this file +cd "${1/*\/}" + +## Including core libs +[[ -f utils/includes.sh ]] && . utils/includes.sh + +include utils/prompts + +# BEGIN: Variables + +## Config file +CONFIG=~/.config/dnd-tools.conf + +declare -A dice( + d2 + d4 + d6 + d8 + d10 + d12 + d20 + d100 + custom +) + +# END: Variables + diff --git a/utils/includes.sh b/utils/includes.sh new file mode 100644 index 0000000..3690c44 --- /dev/null +++ b/utils/includes.sh @@ -0,0 +1,14 @@ +#!/usr/bin/bash + +function include () { + SHELL_SCRIPT_REGEX='\S+\.sh' + local INCLUDE_FILE="${1:?"include : File not provided"}" + local FILENAME="${INCLUDE_FILE/*\/}" + + if [[ -f "$FILENAME" ]]; then + . $FILENAME + else if [[ -f "$FILENAME.sh" ]]; then + . $FILENAME.sh + fi + fi +}