I'm trying to build an associative array in a function from a list pass in via an arg, but It just isn't working:
#!/usr/bin/env bash
function cwd {
echo "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
}
function list_commands {
local root="$1"
local command_list="${*:2}"
declare -A cmds
for cmd in $command_list; do
cmds["#{$cmd}"]+="$root/scripts/displays/$cmd.sh #{pane_current_path} #{pane_id}"
done
echo "$cmds"
}
PLUGIN_ROOT_DIR="$(cwd)"
declare -A cmds=$(list_commands "$PLUGIN_ROOT_DIR" "rbenv_ruby_ver githud")
main "$cmds"
I'm not sure what to do, bash scripting isn't my strong suit (though I'm getting better at it)
what can I do to make this work?
Bear in mind this will be executed in tmux as part of a tpm tmux plugin.