mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 03:23:05 +00:00
1c9ffde3ec
Fixes #317
87 lines
No EOL
2.2 KiB
Text
87 lines
No EOL
2.2 KiB
Text
; author: CI/CD
|
|
|
|
% test, ci/cd
|
|
|
|
# escape code + subshell
|
|
echo -ne "\033]0;$(hostname)\007"
|
|
|
|
# env var
|
|
echo "$HOME"
|
|
|
|
# multi + column
|
|
myfn() {
|
|
for i in $@; do
|
|
echo -e "arg: $i\n"
|
|
done
|
|
}
|
|
folders=($(echo "<multi_col>"))
|
|
myfn "${folders[@]}"
|
|
|
|
# second column: default delimiter
|
|
echo "<table_elem> is cool"
|
|
|
|
# second column: custom delimiter
|
|
echo "<table_elem2> is cool"
|
|
|
|
# return multiple results: single words
|
|
echo "I like these languages: "$(printf '%s' "<langs>" | tr '\n' ',' | sed 's/,/, /g')""
|
|
|
|
# return multiple results: multiple words
|
|
echo "I like these examples: "$(printf '%s' "<examples>" | sed 's/^..*$/"&"/' | awk 1 ORS=', ' | sed 's/, $//')""
|
|
|
|
# multiple replacements -> "foo"
|
|
echo "<x> <y> <x> <z>"
|
|
|
|
# with preview
|
|
cat "<file>"
|
|
|
|
# with map
|
|
echo "<mapped>"
|
|
|
|
# empty
|
|
echo "http://google.com?q=<query>"
|
|
|
|
# fzf
|
|
ls / | fzf
|
|
|
|
#
|
|
echo description space
|
|
|
|
#
|
|
echo description blank
|
|
|
|
# x
|
|
echo description one character
|
|
|
|
# map can be used to expand into multiple arguments
|
|
for l in <phrases>; do echo "line: $l"; done
|
|
|
|
# x
|
|
echo <with_overrides>
|
|
|
|
# Concatenate pdf files
|
|
files=($(echo "<files>"))
|
|
echo pdftk "${files[@]:-}" cat output <pdf_output>
|
|
|
|
$ files: echo 'file1.pdf file2.pdf file3.pdf' | tr ' ' '\n' --- --multi --fzf-overrides '--tac'
|
|
$ x: echo '1 2 3' | tr ' ' '\n'
|
|
$ y: echo 'a b c' | tr ' ' '\n'
|
|
$ z: echo 'foo bar' | tr ' ' '\n'
|
|
$ table_elem: echo -e '0 rust rust-lang.org\n1 clojure clojure.org' --- --column 2
|
|
$ table_elem2: echo -e '0;rust;rust-lang.org\n1;clojure;clojure.org' --- --column 2 --delimiter ';'
|
|
$ multi_col: ls -la | awk '{print $1, $9}' --- --column 2 --delimiter '\s' --multi
|
|
$ langs: echo 'clojure rust javascript' | tr ' ' '\n' --- --multi
|
|
$ mapped: echo 'true false' | tr ' ' '\n' --- --map "grep -q t && echo 1 || echo 0"
|
|
$ examples: echo -e 'foo bar\nlorem ipsum\ndolor sit' --- --multi
|
|
$ multiword: echo -e 'foo bar\nlorem ipsum\ndolor sit\nbaz'i
|
|
$ file: ls . --- --preview 'cat {}' --preview-window 'right:50%'
|
|
$ phrases: echo -e "foo bar\nlorem ipsum\ndolor sit" --- --multi --map "navi fn map::expand"
|
|
$ with_overrides: echo -e "foo bar\nlorem ipsum\ndolor sit" --- --fzf-overrides "--margin=15% --bind=ctrl-u:replace-query"
|
|
|
|
# this should be displayed
|
|
echo hi
|
|
|
|
%
|
|
|
|
# Without tag
|
|
echo hi 1 2 3 |