mirror of
https://github.com/denisidoro/navi
synced 2024-11-24 20:43:06 +00:00
Remove dep order from outputs (#163)
`: <foo> <bar>; echo <foo> <bar>` → `echo <foo> <bar>`
This commit is contained in:
parent
1c2dca3284
commit
42ac8dae9c
6 changed files with 20 additions and 4 deletions
2
navi
2
navi
|
@ -4,7 +4,7 @@ set -euo pipefail
|
||||||
export NAVI_HOME="$(cd "$(dirname "$0")" && pwd)"
|
export NAVI_HOME="$(cd "$(dirname "$0")" && pwd)"
|
||||||
source "${NAVI_HOME}/src/main.sh"
|
source "${NAVI_HOME}/src/main.sh"
|
||||||
|
|
||||||
VERSION="0.15.4"
|
VERSION="0.15.5"
|
||||||
NAVI_ENV="${NAVI_ENV:-prod}"
|
NAVI_ENV="${NAVI_ENV:-prod}"
|
||||||
|
|
||||||
opts::eval "$@"
|
opts::eval "$@"
|
||||||
|
|
|
@ -46,7 +46,7 @@ cmd::finish() {
|
||||||
if [[ "$key" = "ctrl-y" ]]; then
|
if [[ "$key" = "ctrl-y" ]]; then
|
||||||
clip::set "$cmd"
|
clip::set "$cmd"
|
||||||
elif $print || [ -n "$unresolved_arg" ]; then
|
elif $print || [ -n "$unresolved_arg" ]; then
|
||||||
echo "$cmd"
|
echo "$cmd" | ui::remove_dep_order
|
||||||
else
|
else
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -73,6 +73,10 @@ ui::width() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui::remove_dep_order() {
|
||||||
|
sed -E 's/^[^;]+; //'
|
||||||
|
}
|
||||||
|
|
||||||
ui::print_preview() {
|
ui::print_preview() {
|
||||||
local -r selection="$1"
|
local -r selection="$1"
|
||||||
|
|
||||||
|
@ -87,5 +91,5 @@ ui::print_preview() {
|
||||||
printf "\033[${comment_color}m# "; echo -n "$comment"
|
printf "\033[${comment_color}m# "; echo -n "$comment"
|
||||||
printf " \033[${tag_color}m["; echo -n "$tags"; echo "]"
|
printf " \033[${tag_color}m["; echo -n "$tags"; echo "]"
|
||||||
printf "\033[${snippet_color}m"
|
printf "\033[${snippet_color}m"
|
||||||
echo "$snippet"
|
echo "$snippet" | ui::remove_dep_order
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
assert_docker_cheat() {
|
assert_docker_cheat() {
|
||||||
cheat::find | grep -q "docker.cheat"
|
cheat::find | test::contains "docker.cheat"
|
||||||
}
|
}
|
||||||
|
|
||||||
test::set_suite "cheat"
|
test::set_suite "cheat"
|
||||||
|
|
10
test/core.sh
10
test/core.sh
|
@ -53,6 +53,16 @@ test::equals() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test::contains() {
|
||||||
|
local -r actual="$(cat)"
|
||||||
|
local -r regex="$(echo "${1:-}")"
|
||||||
|
|
||||||
|
if ! echo "$actual" | grep -qE "$regex"; then
|
||||||
|
log::error "Expected to contain '${regex}' but got '${actual}'"
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
test::finish() {
|
test::finish() {
|
||||||
echo
|
echo
|
||||||
if [ $SKIPPED -gt 0 ]; then
|
if [ $SKIPPED -gt 0 ]; then
|
||||||
|
|
2
test/run
2
test/run
|
@ -6,6 +6,8 @@ source "${NAVI_HOME}/test/core.sh"
|
||||||
|
|
||||||
tests="$(find "$NAVI_HOME/test" -iname "${1:-}*_test.sh")"
|
tests="$(find "$NAVI_HOME/test" -iname "${1:-}*_test.sh")"
|
||||||
|
|
||||||
|
NAVI_PATH="${NAVI_HOME}/cheats"
|
||||||
|
|
||||||
for test in $tests; do
|
for test in $tests; do
|
||||||
source "$test"
|
source "$test"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue