mirror of https://github.com/mickael-menu/zk
Support regular expressions with `--match` (#222)
parent
1a05a04432
commit
4b76fbadf1
@ -0,0 +1,17 @@
|
||||
# Exact search match strategy.
|
||||
|
||||
$ cd full-sample
|
||||
|
||||
# Long flag.
|
||||
$ zk list -q --debug-style --match-strategy exact --match '["न", "म", "स्", "ते"]'
|
||||
><title>Strings are a complicated data structure</title> <path>oumc.md</path> (just now)
|
||||
>
|
||||
> - Given the Hindi word "नमस्ते":
|
||||
>
|
||||
|
||||
# Short flag.
|
||||
$ zk list -q --debug-style -Me --match '["न", "म", "स्", "ते"]'
|
||||
><title>Strings are a complicated data structure</title> <path>oumc.md</path> (just now)
|
||||
>
|
||||
> - Given the Hindi word "नमस्ते":
|
||||
>
|
@ -0,0 +1,113 @@
|
||||
# Full-text search match strategy.
|
||||
|
||||
$ cd full-sample
|
||||
|
||||
# Search for a multi-word term.
|
||||
$ zk list -q --debug-style --match '"green thread"'
|
||||
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
|
||||
>
|
||||
> - …Programming language-provided threads are known as <term>green threads</term>, and languages that use these <term>green threads</term> will execute them in…
|
||||
>
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …so it doesn't support [<term>green threads</term>](inbox/my59).
|
||||
> * Crates exist to add support for <term>green threads</term> if needed.
|
||||
> * Instead, Rust relies…
|
||||
>
|
||||
|
||||
# Search for two terms (defaults to AND).
|
||||
$ zk list -q --debug-style --match 'green channel'
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
|
||||
> * Crates exist to add support for <term>green</term> threads if needed.
|
||||
> * Instead, Rust…
|
||||
>
|
||||
|
||||
# Search for two terms with explicit AND.
|
||||
$ zk list -q --debug-style --match 'green AND channel'
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
|
||||
> * Crates exist to add support for <term>green</term> threads if needed.
|
||||
> * Instead, Rust…
|
||||
>
|
||||
|
||||
# Search for two terms with OR.
|
||||
$ zk list -q --debug-style --match 'green OR channel'
|
||||
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
|
||||
>
|
||||
> - …Programming language-provided threads are known as <term>green</term> threads, and languages that use these <term>green</term> threads will execute them in…
|
||||
>
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
|
||||
> * Crates exist to add support for <term>green</term> threads if needed.
|
||||
> * Instead, Rust…
|
||||
>
|
||||
><title>Channel</title> <path>fwsj.md</path> (just now)
|
||||
>
|
||||
> - * <term>Channels</term> are a great approach for safe concurrency.
|
||||
> * It's an implementation of the [message passing](4oma) pattern.
|
||||
>
|
||||
> :programming:
|
||||
>
|
||||
><title>Message passing</title> <path>4oma.md</path> (just now)
|
||||
>
|
||||
> - * A popular approach for safe concurrency is to use *message passing* instead of shared state.
|
||||
> * <term>Channels</term> are an example of…
|
||||
>
|
||||
><title>Mutex</title> <path>inbox/er4k.md</path> (just now)
|
||||
>
|
||||
> - …with a *locking system*.
|
||||
> * Managing mutexes is tricky, using [<term>channels</term>](../fwsj) is an easier alternative.
|
||||
> * The main risk is to…
|
||||
>
|
||||
|
||||
# Exclude a term.
|
||||
$ zk list -q --debug-style --match 'green -channel'
|
||||
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
|
||||
>
|
||||
> - …Programming language-provided threads are known as <term>green</term> threads, and languages that use these <term>green</term> threads will execute them in…
|
||||
>
|
||||
|
||||
# Search in the `title` field.
|
||||
$ zk list -q --debug-style --match 'title:(green thread)'
|
||||
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
|
||||
>
|
||||
> - > Many operating systems provide an API for creating new threads. This model where a language calls the operating system APIs…
|
||||
>
|
||||
|
||||
# Search with a prefix in `title`.
|
||||
$ zk list -q --debug-style --match 'title:^do*'
|
||||
><title>Do not communicate by sharing memory; instead, share memory by communicating</title> <path>ref/7fto.md</path> (just now)
|
||||
>
|
||||
> - * Advocates for the use of [message passing](4oma) instead of shared state.
|
||||
> * A slogan initially coined by Rob Pike ([Effective…
|
||||
>
|
||||
><title>Don't speculate</title> <path>pywo.md</path> (just now)
|
||||
>
|
||||
> - You have more to loose by doing market timing (jumping in and out of the stocks market). Remember, [the less…
|
||||
>
|
||||
|
||||
# Search with a prefix.
|
||||
$ zk list -q --debug-style --match 'mut*'
|
||||
><title>Mutex</title> <path>inbox/er4k.md</path> (just now)
|
||||
>
|
||||
> - * Abbreviation of *<term>mutual</term> exclusion*.
|
||||
> * An approach to manage safely shared state by allowing only a single thread to access a…
|
||||
>
|
||||
><title>Data race error</title> <path>3403.md</path> (just now)
|
||||
>
|
||||
> - …Rust prevents *data races* by allowing only a single <term>mutable</term> reference of a value per scope.
|
||||
>
|
||||
> :programming:
|
||||
>
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …data between threads:
|
||||
> * [Channel](fwsj) for a safe [message passing](4oma) approach.
|
||||
> * [<term>Mutex</term>](inbox/er4k) for managing shared state.
|
||||
>
|
||||
> :rust:programming:
|
||||
>
|
@ -0,0 +1,17 @@
|
||||
# Regular expression match strategy.
|
||||
|
||||
$ cd full-sample
|
||||
|
||||
# Long flag.
|
||||
$ zk list -q --debug-style --match-strategy re --match 'न.*ते'
|
||||
><title>Strings are a complicated data structure</title> <path>oumc.md</path> (just now)
|
||||
>
|
||||
> - Given the Hindi word "नमस्ते":
|
||||
>
|
||||
|
||||
# Short flag.
|
||||
$ zk list -q --debug-style -Mr --match 'न.*ते'
|
||||
><title>Strings are a complicated data structure</title> <path>oumc.md</path> (just now)
|
||||
>
|
||||
> - Given the Hindi word "नमस्ते":
|
||||
>
|
@ -1,126 +1,9 @@
|
||||
$ cd full-sample
|
||||
$ cd blank
|
||||
|
||||
# Search for a multi-word term.
|
||||
$ zk list -q --debug-style --match '"green thread"'
|
||||
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
|
||||
>
|
||||
> - …Programming language-provided threads are known as <term>green threads</term>, and languages that use these <term>green threads</term> will execute them in…
|
||||
>
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …so it doesn't support [<term>green threads</term>](inbox/my59).
|
||||
> * Crates exist to add support for <term>green threads</term> if needed.
|
||||
> * Instead, Rust relies…
|
||||
>
|
||||
|
||||
# Search for two terms (defaults to AND).
|
||||
$ zk list -q --debug-style --match 'green channel'
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
|
||||
> * Crates exist to add support for <term>green</term> threads if needed.
|
||||
> * Instead, Rust…
|
||||
>
|
||||
|
||||
# Search for two terms with explicit AND.
|
||||
$ zk list -q --debug-style --match 'green AND channel'
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
|
||||
> * Crates exist to add support for <term>green</term> threads if needed.
|
||||
> * Instead, Rust…
|
||||
>
|
||||
|
||||
# Search for two terms with OR.
|
||||
$ zk list -q --debug-style --match 'green OR channel'
|
||||
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
|
||||
>
|
||||
> - …Programming language-provided threads are known as <term>green</term> threads, and languages that use these <term>green</term> threads will execute them in…
|
||||
>
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
|
||||
> * Crates exist to add support for <term>green</term> threads if needed.
|
||||
> * Instead, Rust…
|
||||
>
|
||||
><title>Channel</title> <path>fwsj.md</path> (just now)
|
||||
>
|
||||
> - * <term>Channels</term> are a great approach for safe concurrency.
|
||||
> * It's an implementation of the [message passing](4oma) pattern.
|
||||
>
|
||||
> :programming:
|
||||
>
|
||||
><title>Message passing</title> <path>4oma.md</path> (just now)
|
||||
>
|
||||
> - * A popular approach for safe concurrency is to use *message passing* instead of shared state.
|
||||
> * <term>Channels</term> are an example of…
|
||||
>
|
||||
><title>Mutex</title> <path>inbox/er4k.md</path> (just now)
|
||||
>
|
||||
> - …with a *locking system*.
|
||||
> * Managing mutexes is tricky, using [<term>channels</term>](../fwsj) is an easier alternative.
|
||||
> * The main risk is to…
|
||||
>
|
||||
|
||||
# Exclude a term.
|
||||
$ zk list -q --debug-style --match 'green -channel'
|
||||
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
|
||||
>
|
||||
> - …Programming language-provided threads are known as <term>green</term> threads, and languages that use these <term>green</term> threads will execute them in…
|
||||
>
|
||||
|
||||
# Search in the `title` field.
|
||||
$ zk list -q --debug-style --match 'title:(green thread)'
|
||||
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
|
||||
>
|
||||
> - > Many operating systems provide an API for creating new threads. This model where a language calls the operating system APIs…
|
||||
>
|
||||
|
||||
# Search with a prefix in `title`.
|
||||
$ zk list -q --debug-style --match 'title:^do*'
|
||||
><title>Do not communicate by sharing memory; instead, share memory by communicating</title> <path>ref/7fto.md</path> (just now)
|
||||
>
|
||||
> - * Advocates for the use of [message passing](4oma) instead of shared state.
|
||||
> * A slogan initially coined by Rob Pike ([Effective…
|
||||
>
|
||||
><title>Don't speculate</title> <path>pywo.md</path> (just now)
|
||||
>
|
||||
> - You have more to loose by doing market timing (jumping in and out of the stocks market). Remember, [the less…
|
||||
>
|
||||
|
||||
# Search with a prefix.
|
||||
$ zk list -q --debug-style --match 'mut*'
|
||||
><title>Mutex</title> <path>inbox/er4k.md</path> (just now)
|
||||
>
|
||||
> - * Abbreviation of *<term>mutual</term> exclusion*.
|
||||
> * An approach to manage safely shared state by allowing only a single thread to access a…
|
||||
>
|
||||
><title>Data race error</title> <path>3403.md</path> (just now)
|
||||
>
|
||||
> - …Rust prevents *data races* by allowing only a single <term>mutable</term> reference of a value per scope.
|
||||
>
|
||||
> :programming:
|
||||
>
|
||||
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
|
||||
>
|
||||
> - …data between threads:
|
||||
> * [Channel](fwsj) for a safe [message passing](4oma) approach.
|
||||
> * [<term>Mutex</term>](inbox/er4k) for managing shared state.
|
||||
>
|
||||
> :rust:programming:
|
||||
>
|
||||
|
||||
# Search for an exact match.
|
||||
$ zk list -q --debug-style --exact-match --match '["न", "म", "स्", "ते"]'
|
||||
><title>Strings are a complicated data structure</title> <path>oumc.md</path> (just now)
|
||||
>
|
||||
> - Given the Hindi word "नमस्ते":
|
||||
>
|
||||
|
||||
# Search for an exact match (short flag).
|
||||
$ zk list -q --debug-style -em '["न", "म", "स्", "ते"]'
|
||||
><title>Strings are a complicated data structure</title> <path>oumc.md</path> (just now)
|
||||
>
|
||||
> - Given the Hindi word "नमस्ते":
|
||||
>
|
||||
# --exact-match is deprecated.
|
||||
1$ zk list -q --exact-match
|
||||
2>zk: error: incorrect criteria: the --exact-match (-e) option is deprecated, use --match-strategy=exact (-Me) instead
|
||||
|
||||
# --exact-match is deprecated (short flag).
|
||||
1$ zk list -q -e
|
||||
2>zk: error: incorrect criteria: the --exact-match (-e) option is deprecated, use --match-strategy=exact (-Me) instead
|
||||
|
Loading…
Reference in New Issue