Files
dotfiles/plugins/tpl.plugin.zsh
2024-04-27 23:22:50 +03:00

36 lines
568 B
Bash
Executable File

#!/usr/bin/env zsh
SCAFFOLDS_DIR="$DOTFILES/scaffolds"
tpl () {
declare -A tpl_aliases=(
ef "editorfiles"
gh "github"
ghp "github.pnpm"
)
declare -A tpl_no_name=(
editorfiles "1"
gh "1"
ghp "1"
)
key=$1
shift
args="$@"
if [[ ! -z "${tpl_aliases[$key]}" ]]; then
key=${tpl_aliases[$key]}
fi
if [[ "${tpl_no_name[$key]}" -eq 1 ]]; then
name="- $args"
else
if [[ -z "$args" ]]; then
echo_red "Usage: tpl $key <name>"
return 1
fi
fi
simple-scaffold -g chenasraf/templates -k $key $args
}