Fix preview

This commit is contained in:
Denis Isidoro 2019-09-22 12:10:51 -03:00
parent 77acda383d
commit 638a3d2fc9
3 changed files with 13 additions and 3 deletions

View File

@ -29,7 +29,7 @@ git add <filename>
git add .
# Saves the changes to a file in a commit
git commit -m "<message>"
git commit -m <message>
# Pushes committed changes to remote repository
git push -u <remote_name> <branch_name>

2
navi
View File

@ -35,7 +35,7 @@ source "${SCRIPT_DIR}/src/main.sh"
##? full docs
##? Please refer to the README at https://github.com/denisidoro/navi
VERSION="0.8.0"
VERSION="0.8.1"
opts::eval "$@"
main "$@"

View File

@ -6,6 +6,16 @@ opts::extract_help() {
grep "^##?" "$file" | cut -c 5-
}
opts::preview_hack() {
local readonly arg="$1"
if [ ${arg:0:1} = "'" ]; then
echo "${arg:1:${#arg}-2}"
else
echo "$arg"
fi
}
opts::eval() {
local readonly wait_for=""
@ -17,7 +27,7 @@ opts::eval() {
for arg in "$@"; do
case $wait_for in
path) NAVI_PATH="$arg"; wait_for="" ;;
preview) query="$(echo "$arg" | tr "^" " ")"; wait_for=""; break ;;
preview) query="$(opts::preview_hack "$arg" | tr "^" " ")"; wait_for=""; break ;;
search) query="$arg"; wait_for=""; export NAVI_PATH="${NAVI_PATH}:$(search::full_path "$query")"; ;;
query) query="$arg"; wait_for="" ;;
esac