add zk workflow

fixes #1
This commit is contained in:
Alexander Navarro 2024-09-12 16:55:05 -03:00
parent 595ac566ea
commit 8b85cf7c9e
Signed by untrusted user who does not match committer: anavarro
GPG key ID: 6426043E9FA3E3B5
12 changed files with 373 additions and 47 deletions

38
scripts/fzf-wikis Executable file
View file

@ -0,0 +1,38 @@
#! /usr/bin/env bash
set -e
wikis_path="$HOME/Repos/wikis"
initial_path=$PWD
if [[ -n $1 ]]; then
current_repo_name="$1"
shift
elif git rev-parse --git-dir &>/dev/null; then
current_repo_name=$(git remote get-url origin | rev | cut -d '/' -f -1 | rev | cut -d '.' -f 1)
current_repo_name="$current_repo_name.wiki"
else
echo "The command was not executed in a git repository and a repo name was not provided"
read -rn 1 -p "Press any key to exit..."
exit
fi
path="$wikis_path/$current_repo_name"
if [[ ! -e "$path" ]]; then
echo "The wiki for $current_repo_name doesn't exit, please clone it first to $wikis_path"
read -rn 1 -p "Press any key to exit..."
exit
fi
cd "$path" || exit
if [[ ! -e .zk/config.toml ]]; then
echo "ZK is not initialized in $path"
read -rn 1 -p "Press any key to exit..."
exit
fi
zk e
cd "$initial_path" || exit