code-activator/activator.plugin.zsh

41 lines
1.1 KiB
Bash
Raw Normal View History

2021-09-14 03:31:48 +00:00
#!/bin/zsh
2022-01-03 22:08:13 +00:00
###################################################################
2021-09-14 03:31:48 +00:00
# #
2022-01-03 22:08:13 +00:00
# code-activator() : a terminal-based navigation utility #
2021-09-14 03:31:48 +00:00
# #
2022-01-03 22:08:13 +00:00
###################################################################
2021-09-14 03:31:48 +00:00
_CA__VERSION=1.0.1
2022-01-03 22:08:13 +00:00
_CA__DEPENDENCIES=(code-activator fzf jq git)
2021-09-14 03:31:48 +00:00
#####################################################################
2022-01-03 22:08:13 +00:00
export _CA=${0:a:h}
2021-09-14 03:31:48 +00:00
2022-01-03 22:08:13 +00:00
source $_CA/global.zsh || return 1
source $_CA/config.zsh || return 1
2021-09-14 03:31:48 +00:00
2022-01-03 22:08:13 +00:00
for Z in $(ls $_CA/zsh/*); do source $Z || return 1; done
2021-09-14 03:31:48 +00:00
#####################################################################
2022-01-03 22:08:13 +00:00
code-activator() {
_CA__CHECK_DEPENDENCIES $_CA__DEPENDENCIES || return 1
2021-09-14 03:31:48 +00:00
2022-01-03 22:08:13 +00:00
local COMMAND ARGS
2021-09-14 03:31:48 +00:00
case $1 in
2022-01-03 22:08:13 +00:00
deactivate ) COMMAND=DEACTIVATE ;;
2021-09-14 03:31:48 +00:00
2022-01-03 22:08:13 +00:00
clone ) COMMAND=CLONE; ARGS=(${@:2}) ;;
new ) COMMAND=NEW; ARGS=(${@:2}) ;;
2022-01-03 22:08:13 +00:00
* ) COMMAND=ACTIVATE; ARGS=(${@:1}) ;;
esac
2022-01-03 22:08:13 +00:00
_CA_$COMMAND $ARGS
}
2022-01-03 22:08:13 +00:00
source $_CA/activator.completion.zsh
source $_CA/activator.bindings.zsh