parent
595ac566ea
commit
8b85cf7c9e
12 changed files with 373 additions and 47 deletions
38
scripts/fzf-wikis
Executable file
38
scripts/fzf-wikis
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue