#! /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