zk/tests/cmd-graph.tesh
2022-01-10 14:28:14 +01:00

79 lines
12 KiB
Plaintext

$ cd full-sample
# Print help for `zk graph`
$ zk graph --help
>Usage: zk graph --format=STRING [<path> ...]
>
>Produce a graph of the notes matching the given criteria.
>
>Arguments:
> [<path> ...] Find notes matching the given path, including its descendants.
>
>Flags:
> -h, --help Show context-sensitive help.
> --notebook-dir=PATH Turn off notebook auto-discovery and set manually
> the notebook where commands are run.
> -W, --working-dir=PATH Run as if zk was started in <PATH> instead of the
> current working directory.
> --no-input Never prompt or ask for confirmation.
>
>Formatting
> -f, --format=STRING Format of the graph among: json.
> -q, --quiet Do not print the total number of notes found.
>
>Filtering
> -i, --interactive Select notes interactively with fzf.
> -n, --limit=COUNT Limit the number of notes found.
> -m, --match=QUERY Terms to search for in the notes.
> -e, --exact-match Search for exact occurrences of the --match
> argument (case insensitive).
> -x, --exclude=PATH,... Ignore notes matching the given path, including
> its descendants.
> -t, --tag=TAG,... Find notes tagged with the given tags.
> --mention=PATH,... Find notes mentioning the title of the given
> ones.
> --mentioned-by=PATH,... Find notes whose title is mentioned in the
> given ones.
> -l, --link-to=PATH,... Find notes which are linking to the given ones.
> --no-link-to=PATH,... Find notes which are not linking to the given
> notes.
> -L, --linked-by=PATH,... Find notes which are linked by the given ones.
> --no-linked-by=PATH,... Find notes which are not linked by the given
> ones.
> --orphan Find notes which are not linked by any other
> note.
> --related=PATH,... Find notes which might be related to the given
> ones.
> --max-distance=COUNT Maximum distance between two linked notes.
> -r, --recursive Follow links recursively.
> --created=DATE
> --created-before=DATE Find notes created before the given date.
> --created-after=DATE Find notes created after the given date.
> --modified=DATE Find notes modified on the given date.
> --modified-before=DATE Find notes modified before the given date.
> --modified-after=DATE Find notes modified after the given date.
>
>Sorting
> -s, --sort=TERM,... Order the notes by the given criterion.
# Format is required
1$ zk graph
2>zk: error: missing flags: --format=STRING
# Test the JSON format.
$ zk graph -qn5 --format json
>{
> "notes": [
> {"filename":"uxjt.md","filenameStem":"uxjt","path":"uxjt.md","absPath":"{{working-dir}}/uxjt.md","title":"Buy low, sell high","link":"[Buy low, sell high](uxjt)","lead":"It's better to invest when the prices are low, because it will usually go up on the long term, despite the fact that [financial markets are random](fa2k).","body":"It's better to invest when the prices are low, because it will usually go up on the long term, despite the fact that [financial markets are random](fa2k).\n\nDon't wait until you think the stocks are at their lowest ([speculation](pywo)), instead buy some when the prices are dropping, and buy more every month if the prices continue to drop.\n\nInvesting a constant amount of money regularly (e.g. monthly) is a simple way to make sure you buy less stocks when the prices are high, and more when they are low. [Compound interests will work for you over time](smdc).\n\n:finance:","snippets":["It's better to invest when the prices are low, because it will usually go up on the long term, despite the fact that [financial markets are random](fa2k)."],"rawContent":"# Buy low, sell high\n\nIt's better to invest when the prices are low, because it will usually go up on the long term, despite the fact that [financial markets are random](fa2k).\n\nDon't wait until you think the stocks are at their lowest ([speculation](pywo)), instead buy some when the prices are dropping, and buy more every month if the prices continue to drop.\n\nInvesting a constant amount of money regularly (e.g. monthly) is a simple way to make sure you buy less stocks when the prices are high, and more when they are low. [Compound interests will work for you over time](smdc).\n\n:finance:\n","wordCount":103,"tags":["finance"],"metadata":{},"created":"{{match '[\-T\.\:0-9]+'}}Z","modified":"{{match '[\-T\.\:0-9]+'}}Z","checksum":"cc0e1a9cad8b526254ac1d87f1534c010c2ffe5d399a7c1af1da636a734b60c2"},
> {"filename":"fwsj.md","filenameStem":"fwsj","path":"fwsj.md","absPath":"{{working-dir}}/fwsj.md","title":"Channel","link":"[Channel](fwsj)","lead":"* Channels are a great approach for safe concurrency.\n* It's an implementation of the [message passing](4oma) pattern.","body":"* Channels are a great approach for safe concurrency.\n* It's an implementation of the [message passing](4oma) pattern.\n\n:programming:","snippets":["* Channels are a great approach for safe concurrency.\n* It's an implementation of the [message passing](4oma) pattern."],"rawContent":"# Channel\n\n* Channels are a great approach for safe concurrency.\n* It's an implementation of the [message passing](4oma) pattern.\n\n:programming:\n","wordCount":21,"tags":["programming"],"metadata":{},"created":"{{match '[\-T\.\:0-9]+'}}Z","modified":"{{match '[\-T\.\:0-9]+'}}Z","checksum":"cafbb0c69c39729a2e7da6800c97fc5a1f1caa5667ab04c11e06a749610ca4e4"},
> {"filename":"smdc.md","filenameStem":"smdc","path":"smdc.md","absPath":"{{working-dir}}/smdc.md","title":"Compound interests make you rich","link":"[Compound interests make you rich](smdc)","lead":"Since the growth is exponential, time is more important than the amount of money you invest with compound interests. Start investing right now!","body":"Since the growth is exponential, time is more important than the amount of money you invest with compound interests. Start investing right now!\n\nThis also means that small interest percentages add up to big amount. So [beware of financial products](4yib) eating your interests.\n\nBuy new shares with the interests to benefit from the compound interests, e.g. after a unique investment of $1,000 with a 10% interest rate:\n\n- without reinvesting the dividends:\n\t- 40 yrs = $5,000\n\t- 50 yrs = $6,000\n\t\n- with compound interest:\n\t- 40 yrs = $45,000\n\t- 50 yrs = $117,000\n\t\n## References\n\n- [These 3 Charts Show The Amazing Power Of Compound Interest](https://www.businessinsider.com/personal-finance/amazing-power-of-compound-interest-2014-7?r=DE\u0026IR=T)\n\n:finance:","snippets":["Since the growth is exponential, time is more important than the amount of money you invest with compound interests. Start investing right now!"],"rawContent":"# Compound interests make you rich\n\nSince the growth is exponential, time is more important than the amount of money you invest with compound interests. Start investing right now!\n\nThis also means that small interest percentages add up to big amount. So [beware of financial products](4yib) eating your interests.\n\nBuy new shares with the interests to benefit from the compound interests, e.g. after a unique investment of $1,000 with a 10% interest rate:\n\n- without reinvesting the dividends:\n\t- 40 yrs = $5,000\n\t- 50 yrs = $6,000\n\t\n- with compound interest:\n\t- 40 yrs = $45,000\n\t- 50 yrs = $117,000\n\t\n## References\n\n- [These 3 Charts Show The Amazing Power Of Compound Interest](https://www.businessinsider.com/personal-finance/amazing-power-of-compound-interest-2014-7?r=DE\u0026IR=T)\n\n:finance:\n","wordCount":116,"tags":["finance"],"metadata":{},"created":"{{match '[\-T\.\:0-9]+'}}Z","modified":"{{match '[\-T\.\:0-9]+'}}Z","checksum":"c14982f5c20b58fdbbdcf6430308ee732ebd04b4c4814ded011698d12d0aff6b"},
> {"filename":"g7qa.md","filenameStem":"g7qa","path":"g7qa.md","absPath":"{{working-dir}}/g7qa.md","title":"Concurrency in Rust","link":"[Concurrency in Rust](g7qa)","lead":"* Thanks to the [Ownership pattern](88el), Rust has a model of [Fearless concurrency](2cl7).\n* Rust aims to have a small runtime, so it doesn't support [green threads](inbox/my59).\n * Crates exist to add support for green threads if needed.\n * Instead, Rust relies on the OS threads, a model called 1-1.","body":"* Thanks to the [Ownership pattern](88el), Rust has a model of [Fearless concurrency](2cl7).\n* Rust aims to have a small runtime, so it doesn't support [green threads](inbox/my59).\n * Crates exist to add support for green threads if needed.\n * Instead, Rust relies on the OS threads, a model called 1-1.\n\n* Rust offers a number of constructs for sharing data between threads:\n * [Channel](fwsj) for a safe [message passing](4oma) approach.\n * [Mutex](inbox/er4k) for managing shared state.\n\n:rust:programming:","snippets":["* Thanks to the [Ownership pattern](88el), Rust has a model of [Fearless concurrency](2cl7).\n* Rust aims to have a small runtime, so it doesn't support [green threads](inbox/my59).\n * Crates exist to add support for green threads if needed.\n * Instead, Rust relies on the OS threads, a model called 1-1."],"rawContent":"# Concurrency in Rust\n\n* Thanks to the [Ownership pattern](88el), Rust has a model of [Fearless concurrency](2cl7).\n* Rust aims to have a small runtime, so it doesn't support [green threads](inbox/my59).\n * Crates exist to add support for green threads if needed.\n * Instead, Rust relies on the OS threads, a model called 1-1.\n\n* Rust offers a number of constructs for sharing data between threads:\n * [Channel](fwsj) for a safe [message passing](4oma) approach.\n * [Mutex](inbox/er4k) for managing shared state.\n\n:rust:programming:\n","wordCount":81,"tags":["programming","rust"],"metadata":{},"created":"{{match '[\-T\.\:0-9]+'}}Z","modified":"{{match '[\-T\.\:0-9]+'}}Z","checksum":"03be1317b6917839ca3a6d1f8c60eab97086cfc2f4637f95f122522476ed0155"},
> {"filename":"3cut.md","filenameStem":"3cut","path":"3cut.md","absPath":"{{working-dir}}/3cut.md","title":"Dangling pointers","link":"[Dangling pointers](3cut)","lead":"A *dangling pointer* is a reference that is kept to freed data. With C, reading it causes a *segmentation fault*.","body":"A *dangling pointer* is a reference that is kept to freed data. With C, reading it causes a *segmentation fault*.\n\nRust protects against *dangling pointers* by making sure data is not freed until it goes out of scope ([Ownership in Rust](88el)).\n\n:programming:","snippets":["A *dangling pointer* is a reference that is kept to freed data. With C, reading it causes a *segmentation fault*."],"rawContent":"---\naliases: [dangling reference]\n---\n\n# Dangling pointers\n\nA *dangling pointer* is a reference that is kept to freed data. With C, reading it causes a *segmentation fault*.\n\nRust protects against *dangling pointers* by making sure data is not freed until it goes out of scope ([Ownership in Rust](88el)).\n\n:programming:\n","wordCount":50,"tags":["programming"],"metadata":{"aliases":["dangling reference"]},"created":"{{match '[\-T\.\:0-9]+'}}Z","modified":"{{match '[\-T\.\:0-9]+'}}Z","checksum":"7f4a61afdbc077e286c5e0ac91a71bfdec45b6b0cf3a5e14408aba45bd4d58a8"}
> ],
> "links": [
> {"title":"Channel","href":"fwsj","type":"markdown","isExternal":false,"rels":[],"snippet":"[Channel](fwsj) for a safe [message passing](4oma) approach.","snippetStart":423,"snippetEnd":483,"sourceId":11,"sourcePath":"g7qa.md","targetId":10,"targetPath":"fwsj.md"},
> {"title":"Compound interests will work for you over time","href":"smdc","type":"markdown","isExternal":false,"rels":[],"snippet":"Investing a constant amount of money regularly (e.g. monthly) is a simple way to make sure you buy less stocks when the prices are high, and more when they are low. [Compound interests will work for you over time](smdc).","snippetStart":364,"snippetEnd":584,"sourceId":25,"sourcePath":"uxjt.md","targetId":22,"targetPath":"smdc.md"}
> ]
>}