mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 03:23:05 +00:00
Correctly escape % in cheatsheets (#94)
This commit is contained in:
parent
4bf6c981f4
commit
d55b5725d4
5 changed files with 25 additions and 4 deletions
2
navi
2
navi
|
@ -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.10.0"
|
||||
VERSION="0.10.1"
|
||||
NAVI_ENV="${NAVI_ENV:-prod}"
|
||||
|
||||
opts::eval "$@"
|
||||
|
|
|
@ -41,7 +41,7 @@ dict::assoc() {
|
|||
local -r input="$(cat)"
|
||||
|
||||
if [ -z $key ]; then
|
||||
printf "$input"
|
||||
printf "$(echo "$input" | tr '%' '\v')" | tr '\v' '%'
|
||||
return
|
||||
fi
|
||||
|
||||
|
|
|
@ -19,6 +19,13 @@ dict_assoc() {
|
|||
| test::equals "foo: 42"
|
||||
}
|
||||
|
||||
dict_assoc_perc() {
|
||||
dict::new \
|
||||
| dict::assoc "foo" "42 %" bar "% 7" \
|
||||
| dict::get bar \
|
||||
| test::equals "% 7"
|
||||
}
|
||||
|
||||
dict_assoc_multiple() {
|
||||
dict::new \
|
||||
| dict::assoc "foo" "42" "bar" "5" \
|
||||
|
@ -102,6 +109,7 @@ dict_update() {
|
|||
|
||||
test::set_suite "dict"
|
||||
test::run "We can assoc a value" dict_assoc
|
||||
test::run "We can assoc values with %" dict_assoc_perc
|
||||
test::run "We can assoc multiple values" dict_assoc_multiple
|
||||
test::skip "We can assoc a nested value" dict_assoc_nested
|
||||
test::run "We can dissoc a value" dict_dissoc
|
||||
|
|
|
@ -38,10 +38,20 @@ assert_query() {
|
|||
| test::equals "2 12"
|
||||
}
|
||||
|
||||
export HAS_FZF="$(command_exists fzf && echo true || echo false)"
|
||||
|
||||
test::fzf() {
|
||||
if $HAS_FZF; then
|
||||
test::run "$@"
|
||||
else
|
||||
test::skip "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
test::set_suite "integration"
|
||||
export -f fzf_mock
|
||||
test::run "version" assert_version
|
||||
test::run "help" assert_help
|
||||
test::run "home" assert_home
|
||||
test::skip "best" assert_best # FZF setup needed in CircleCI
|
||||
test::skip "query" assert_query # FZF setup needed in CircleCI
|
||||
test::fzf "best" assert_best # FZF setup needed in CircleCI
|
||||
test::fzf "query" assert_query # FZF setup needed in CircleCI
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
# this should be the first test. single and double quotes + newlines
|
||||
echo <x> <y>
|
||||
|
||||
# use %
|
||||
coll::new 1 2 3 | xargs -I% echo "hello %"
|
||||
|
||||
# return a constant number
|
||||
echo 42
|
||||
|
||||
|
|
Loading…
Reference in a new issue