mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 10:40:44 -06:00
46 lines
1.3 KiB
Text
46 lines
1.3 KiB
Text
|
#!/usr/bin/env bash
|
||
|
|
||
|
# VERSION = $(git describe --tags --always --dirty=-dev | sed 's/^v//g')
|
||
|
|
||
|
function task:venv {
|
||
|
: "setup up pdm venv"
|
||
|
pdm install
|
||
|
}
|
||
|
|
||
|
function task:dev-install {
|
||
|
: "symlink development version"
|
||
|
ln -sf "$(PWD)/src/viv/viv.py" ~/.local/share/viv/viv.py
|
||
|
}
|
||
|
|
||
|
function task:_black {
|
||
|
: "generate black example shim"
|
||
|
rm -f examples/black
|
||
|
viv shim black -y -s -f -o examples/black
|
||
|
}
|
||
|
|
||
|
function task:clean {
|
||
|
: "clean build artifacts"
|
||
|
rm -rf build dist
|
||
|
}
|
||
|
|
||
|
function task:examples {
|
||
|
: "run examples to generate vivenvs"
|
||
|
examples="cli sys_path exe_specific frozen_import named_env scrape"
|
||
|
for f in $examples; do
|
||
|
python "examples/$f.py"
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function task:_help-logo {
|
||
|
FORCE_COLOR=1 viv --help | yartsu -t 'viv --help' -w 70 -o assets/viv-help.svg
|
||
|
}
|
||
|
|
||
|
# ---- do-task boilerplate ----
|
||
|
function task:help {
|
||
|
: "Show this help"
|
||
|
echo "do:";w=$(("$(compgen -A function | wc -L)" - 3));while read -r name; do [[ ! $name =~ ^task:_ ]] && [[ $name =~ ^task: ]] && paste <(printf '\033[1;32m%*s\033[0m\n' "$w" "${name#task:}") <(type "$name" | sed -nEe 's/^[[:space:]]*: ?"(.*)";/\1/p'); done < <(compgen -A function)
|
||
|
}
|
||
|
while read -r name; do [[ $name == "task:$1" ]] && { shift; task="$name"; }; done < <(compgen -A function)
|
||
|
[[ -n "$1" && -z "$task" ]] && printf "\033[1;31m%s\033\0[m is not a task\n" "$1"
|
||
|
"${task:-task:help}" "$@" && exit "$?"
|