vis: clone plugins with shell script, update visrc.lua
This commit is contained in:
60
vis/.config/vis/plugins.sh
Executable file
60
vis/.config/vis/plugins.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo 'error: argument required (action), one of: clone, fetch, merge' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ACTION="$1"
|
||||
PLUGINS_DIR=$(dirname $(realpath "$0"))/plugins
|
||||
|
||||
cd "$PLUGINS_DIR"
|
||||
|
||||
action() {
|
||||
case "$1" in
|
||||
*:*)
|
||||
P="$1"
|
||||
|
||||
;;
|
||||
*)
|
||||
P="https://github.com/$1"
|
||||
;;
|
||||
esac
|
||||
B=$(basename "$1")
|
||||
B="${B%.git}"
|
||||
case "$ACTION" in
|
||||
clone)
|
||||
if [ ! -e "$B" ]; then
|
||||
echo "$ACTION $B"
|
||||
git clone "$P"
|
||||
fi
|
||||
;;
|
||||
fetch)
|
||||
if [ -e "$B" ]; then
|
||||
echo "$ACTION $B"
|
||||
git -C "$B" fetch
|
||||
fi
|
||||
;;
|
||||
merge)
|
||||
if [ -e "$B" ]; then
|
||||
echo "$ACTION $B"
|
||||
git -C "$B" merge
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "error: unsupported action: $ACTION" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
for plugin in \
|
||||
'https://gitlab.com/muhq/vis-lspc' \
|
||||
'lutobler/vis-commentary' \
|
||||
'https://repo.or.cz/vis-surround.git' \
|
||||
'peaceant/vis-fzf-mru' \
|
||||
'https://gitlab.com/muhq/vis-build' \
|
||||
'erf/vis-cursors'; \
|
||||
do
|
||||
action "$plugin"
|
||||
done
|
||||
Reference in New Issue
Block a user