parent
595ac566ea
commit
8b85cf7c9e
12 changed files with 373 additions and 47 deletions
20
scripts/fzf-fj
Executable file
20
scripts/fzf-fj
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ╭──────────────────────────────────────────────────────────╮
|
||||
# │ Interactivie Issue management of forgejo │
|
||||
# ╰──────────────────────────────────────────────────────────╯
|
||||
|
||||
host="git.alecodes.page"
|
||||
repo="$(git remote get-url origin | rev | cut -d '/' -f -2 | rev | cut -d '.' -f 1)"
|
||||
cache="$(mktemp --directory)"
|
||||
|
||||
# --preview "[[ -e $cache/{1}.md ]] && bat $cache/{1}.md || fj --host $host issue view \"${repo}$(echo {1} | tr -d ':')\" | tee $cache/{1}.md" \
|
||||
|
||||
# TODO: Add more keybindings to interact with issues
|
||||
fj --host "$host" issue search --repo "$repo" | tail -n +2 |
|
||||
fzf \
|
||||
--preview "id=\"$(echo "{1}" | tr -cd "[:digit:]")\"; [[ -e $cache/$id ]] && bat $cache/$id || fj --host $host issue view ${repo}#$id | tee $cache/$id" \
|
||||
--bind "ctrl-r:execute-silent(rm -f $cache/{1})+refresh-preview" \
|
||||
--bind "ctrl-o:execute-silent(tea open {1})"
|
||||
|
||||
rm -rf "$cache"
|
||||
|
|
@ -6,15 +6,13 @@
|
|||
|
||||
# ────────────────────────────────────────────────────────────
|
||||
|
||||
tea_issue_cache="/tmp/tea-issue-cache"
|
||||
|
||||
mkdir -p "$tea_issue_cache"
|
||||
tea_cache="$(mktemp --directory)"
|
||||
|
||||
# TODO: Add more keybindings to interact with issues
|
||||
tea i -o simple |
|
||||
fzf \
|
||||
--preview "[[ -e $tea_issue_cache/{1} ]] && cat $tea_issue_cache/{1} || tea issue --comments {1} | tee $tea_issue_cache/{1}" \
|
||||
--bind "ctrl-r:execute-silent(rm -f $tea_issue_cache/{1})+refresh-preview" \
|
||||
--preview "[[ -e $tea_cache/{1}.md ]] && bat -l md $tea_cache/{1}.md || tea issue --comments {1} | tee $tea_cache/{1}.md" \
|
||||
--bind "ctrl-r:execute-silent(rm -f $tea_cache/{1})+refresh-preview" \
|
||||
--bind "ctrl-o:execute-silent(tea open {1})"
|
||||
|
||||
rm -rf "$tea_issue_cache"
|
||||
rm -rf "$tea_cache"
|
||||
|
|
|
|||
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