mirror of https://git.envs.net/envs/burrow.git
autocomplete is super smart for gophermap
This commit is contained in:
parent
487574e053
commit
3fed90daef
2
burrow
2
burrow
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
version="v1.7.0"
|
||||
version="v1.7.1"
|
||||
|
||||
configfiles="$HOME/.config/burrow/config $HOME/.config/burrow $HOME/.burrow"
|
||||
|
||||
|
|
2
burrow.1
2
burrow.1
|
@ -1,4 +1,4 @@
|
|||
.TH BURROW 1 "24 Sep 2018" "version 1.7.0"
|
||||
.TH BURROW 1 "24 Sep 2018" "version 1.7.1"
|
||||
.SH NAME
|
||||
burrow \- a helper for building and managing a gopher hole
|
||||
.SH SYNOPSIS
|
||||
|
|
18
burrow.d
18
burrow.d
|
@ -12,13 +12,25 @@ _burrow()
|
|||
gopher_dir=$(burrow gopherdir)
|
||||
search_dir=${gopher_dir}
|
||||
if [ -n "${COMP_WORDS[2]}" ]; then
|
||||
if [ -d "${gopher_dir}${COMP_WORDS[2]}" ]; then
|
||||
search_dir="${gopher_dir}${COMP_WORDS[2]}"
|
||||
partial_search_dir="${gopher_dir}${COMP_WORDS[2]}"
|
||||
if [ -d "$partial_search_dir" ]; then
|
||||
search_dir="$partial_search_dir"
|
||||
else
|
||||
partial_search_dir=$(dirname "$partial_search_dir")
|
||||
if [ -d "$partial_search_dir" ]; then
|
||||
search_dir="$partial_search_dir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
gophermaps=$(find "$search_dir" -mindepth 1 -maxdepth 1 -type f -name "gophermap" -print | sed "s|$gopher_dir||" | sed "s|gophermap$||" )
|
||||
directories=$(find "$search_dir" -mindepth 1 -maxdepth 1 -type d -print | sed "s|$gopher_dir||" )
|
||||
COMPREPLY=( $( compgen -W "$gophermaps $directories" -- "$cur" ) )
|
||||
local suggestions=( $( compgen -W "$gophermaps $directories" -- "$cur" ) )
|
||||
if [ "${#suggestions[@]}" == "1" ]; then
|
||||
local resp=$(echo ${suggestions[0]/%\ */})
|
||||
COMPREPLY=("$resp")
|
||||
else
|
||||
COMPREPLY=("${suggestions[@]}")
|
||||
fi
|
||||
else
|
||||
local helplist
|
||||
helplist=$(burrow shortlist)
|
||||
|
|
Loading…
Reference in New Issue