mirror of https://github.com/mickael-menu/zk
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
Plaintext
39 lines
1.0 KiB
Plaintext
3 years ago
|
$ cd blank
|
||
|
|
||
|
# Setup note fixtures.
|
||
|
$ mkdir "red planet"
|
||
|
$ touch "without-title.md"
|
||
|
$ echo "# Yellow sun" > "yellow-sun.md"
|
||
|
$ touch "red planet/blue moon.md"
|
||
|
|
||
|
# Alias to override the default flags of a command.
|
||
|
$ echo "[alias] list = 'zk list --quiet -fpath \$@'" > .zk/config.toml
|
||
|
$ zk list -n2 --sort path-
|
||
|
>yellow-sun.md
|
||
|
>without-title.md
|
||
|
|
||
|
# Shortcut for a native command.
|
||
|
$ echo "[alias] ls = 'zk list \$@'" > .zk/config.toml
|
||
|
$ zk ls --quiet -fpath
|
||
|
>red planet/blue moon.md
|
||
|
>without-title.md
|
||
|
>yellow-sun.md
|
||
|
|
||
|
# Use $*
|
||
|
$ echo "[note] filename = '\{{slug title}}'\n [alias] nt = 'zk new --dry-run --title \"\$*\"'" > .zk/config.toml
|
||
|
$ zk nt Hello world
|
||
|
2>{{working-dir}}/hello-world.md
|
||
|
|
||
|
# Use the `ZK_NOTEBOOK_DIR` env variable.
|
||
|
$ echo "[alias] nbdir = 'echo \$ZK_NOTEBOOK_DIR'" > .zk/config.toml
|
||
|
$ zk nbdir
|
||
|
>{{working-dir}}
|
||
|
|
||
|
# Test the "xargs formula"
|
||
|
$ echo "[alias] xargs = 'zk list --quiet --format path --delimiter0 \$@ | xargs -0 ls -s1'" > .zk/config.toml
|
||
|
$ zk xargs
|
||
|
>0 red planet/blue moon.md
|
||
|
>0 without-title.md
|
||
|
>8 yellow-sun.md
|
||
|
|