feat: README.md rewrite
This commit is contained in:
parent
3923d20ae9
commit
16b07df33e
1 changed files with 42 additions and 47 deletions
89
README.md
89
README.md
|
|
@ -1081,11 +1081,11 @@ https://example.com/api
|
||||||
</sup>
|
</sup>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[`--key`](#filtering) / `-k`, [`--value`](#filtering) / `-v`, and [`--store`](#filtering) / `-s` filter entries with glob support. All three flags are repeatable, with results matching one-or-more of the patterns per flag. When multiple flags are combined, results must satisfy all of them (AND across flags, OR within the same flag).
|
[`key`](#filtering), [`value`](#filtering), and [`store`](#filtering) flags can be used to filter entries via globs. All three flags are repeatable, with results matching one-or-more of the patterns per flag. When multiple flags are combined, results must satisfy all of them (AND across flags, OR within the same flag).
|
||||||
|
|
||||||
These filters work with [`list`](#listing), [`export`](#import--export), [`import`](#import--export), and [`remove`](#removing). [`--value`](#filtering) is not available on [`import`](#import--export) or [`remove`](#removing).
|
These filters work with [`pda list`](#listing), [`pda export`](#import--export), [`pda import`](#import--export), and [`pda remove`](#removing).
|
||||||
|
|
||||||
[`gobwas/glob`](https://github.com/gobwas/glob) is used for matching. The default separators are `/-_.@:` and space.
|
[`gobwas/glob`](https://github.com/gobwas/glob) is used for matching. The default separators are `/-_.@:` and space. For a detailed guide to globbing, I highly recommend taking a look at the documentation there directly.
|
||||||
|
|
||||||
#### Glob Patterns
|
#### Glob Patterns
|
||||||
|
|
||||||
|
|
@ -1096,63 +1096,69 @@ These filters work with [`list`](#listing), [`export`](#import--export), [`impor
|
||||||
</sup>
|
</sup>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
`*` wildcards a word or series of characters, stopping at separator boundaries:
|
`*` wildcards a word or series of characters, stopping at separator boundaries.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# list all store contents
|
||||||
❯ pda ls
|
❯ pda ls
|
||||||
cat
|
cat
|
||||||
dog
|
|
||||||
cog
|
|
||||||
mouse hotdog
|
|
||||||
mouse house
|
mouse house
|
||||||
foo.bar.baz
|
foo.bar.baz
|
||||||
|
|
||||||
pda ls --key "*"
|
# match any single-word key
|
||||||
# cat, dog, cog (single-segment keys only)
|
❯ pda ls --key "*"
|
||||||
|
cat
|
||||||
|
|
||||||
pda ls --key "* *"
|
# match any two-word key
|
||||||
# mouse hotdog, mouse house
|
❯ pda ls --key "* *"
|
||||||
|
mouse house
|
||||||
|
|
||||||
pda ls --key "foo.*.baz"
|
# match any key starting with "foo." and ending with ".baz", with one word between
|
||||||
# foo.bar.baz
|
❯ pda ls --key "foo.*.baz"
|
||||||
|
foo.bar.baz
|
||||||
```
|
```
|
||||||
|
|
||||||
`**` super-wildcards ignore word boundaries:
|
`**` super-wildcards ignore word boundaries.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pda ls --key "foo**"
|
# match anything beginning with "foo"
|
||||||
# foo.bar.baz
|
❯ pda ls --key "foo**"
|
||||||
|
foo.bar.baz
|
||||||
pda ls --key "**g"
|
|
||||||
# dog, cog, mouse hotdog
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`?` matches a single character:
|
`?` matches a single character:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pda ls --key "?og"
|
# match anything beginning with any letter, and ending with "og"
|
||||||
# dog, cog
|
❯ pda ls --key "?og"
|
||||||
|
dog
|
||||||
|
cog
|
||||||
```
|
```
|
||||||
|
|
||||||
`[abc]` matches one of the characters in the brackets:
|
`[abc]` matches one of the characters in the brackets.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pda ls --key "[dc]og"
|
# match anything beginning with "d" or "c", and ending with "og"
|
||||||
# dog, cog
|
❯ pda ls --key "[dc]og"
|
||||||
|
dog
|
||||||
|
cog
|
||||||
|
|
||||||
# negate with '!'
|
# negate with '!'
|
||||||
pda ls --key "[!dc]og"
|
❯ pda ls --key "[!dc]og"
|
||||||
# bog (if it exists)
|
bog
|
||||||
```
|
```
|
||||||
|
|
||||||
`[a-c]` matches a range:
|
`[a-c]` matches a range:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pda ls --key "[a-g]ag"
|
# match anything beginning with "a" to "g", and ending with "ag"
|
||||||
# bag, gag
|
❯ pda ls --key "[a-g]ag"
|
||||||
|
bag
|
||||||
|
gag
|
||||||
|
|
||||||
pda ls --key "[!a-g]ag"
|
# negate with '!'
|
||||||
# wag
|
❯ pda ls --key "[!a-g]ag"
|
||||||
|
wag
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Filtering by Key
|
#### Filtering by Key
|
||||||
|
|
@ -1165,14 +1171,13 @@ pda ls --key "[!a-g]ag"
|
||||||
</sup>
|
</sup>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[`--key`](#filtering) / `-k` filters entries by key name:
|
[`key`](#filtering) filters entries by key name. Multiple `key` patterns are OR'd. An entry matches if it matches any of them.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pda ls --key "db*"
|
pda ls --key "db*"
|
||||||
pda ls --key "session*" --key "token*"
|
pda ls --key "session*" --key "token*"
|
||||||
```
|
```
|
||||||
|
|
||||||
Multiple `--key` patterns are OR'd — an entry matches if it matches any of them.
|
|
||||||
|
|
||||||
#### Filtering by Value
|
#### Filtering by Value
|
||||||
|
|
||||||
|
|
@ -1184,24 +1189,14 @@ Multiple `--key` patterns are OR'd — an entry matches if it matches any of the
|
||||||
</sup>
|
</sup>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[`--value`](#filtering) / `-v` filters by value content using the same glob syntax:
|
[`value`](#filtering) filters by value. Multiple `value` patterns are OR'd.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ pda ls --value "**localhost**"
|
❯ pda ls --value "**localhost**"
|
||||||
Key Value
|
|
||||||
db-url postgres://localhost:5432
|
|
||||||
```
|
|
||||||
|
|
||||||
Multiple `--value` patterns are OR'd:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
❯ pda ls --value "**world**" --value "42"
|
❯ pda ls --value "**world**" --value "42"
|
||||||
Key Value
|
|
||||||
greeting hello world
|
|
||||||
number 42
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Locked (encrypted without an available identity) and non-UTF-8 (binary) entries are silently excluded from `--value` matching.
|
Locked (encrypted without an available identity) and non-UTF-8 (binary) entries are silently excluded from `value` matching.
|
||||||
|
|
||||||
#### Filtering by Store
|
#### Filtering by Store
|
||||||
|
|
||||||
|
|
@ -1213,7 +1208,7 @@ Locked (encrypted without an available identity) and non-UTF-8 (binary) entries
|
||||||
</sup>
|
</sup>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[`--store`](#filtering) / `-s` filters by store name:
|
[`store`](#filtering) filters by store name. Multiple `store` patterns are OR'd.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pda ls --store "prod*"
|
pda ls --store "prod*"
|
||||||
|
|
@ -1229,13 +1224,13 @@ pda export --store "dev*"
|
||||||
</sup>
|
</sup>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Combine key, value, and store filters. Results must match all flags (AND), with OR within each flag:
|
`key`, `value`, and `store` filters can be combined. Results must match at least one of each category of filter used. For example, checking for `key` and two different `value` globs on the same filter: the results must match `key` and at least one of the two `value` globs; the results do not need to match both values.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pda ls --key "db*" --value "**localhost**"
|
pda ls --key "db*" --value "**localhost**"
|
||||||
```
|
```
|
||||||
|
|
||||||
Globs can be arbitrarily complex, and [`--key`](#filtering) can be combined with exact positional args on [`rm`](#removing):
|
Globs can be combined to create some deeply complex queries. For example, [`key`](#filtering) can be combined with exact positional args on [`rm`](#removing) to remove exactly the "cat" key, and any keys beginning with "cat", "dog", or "mouse" followed by zero-or-more additional words.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pda rm cat --key "{mouse,[cd]og}**"
|
pda rm cat --key "{mouse,[cd]og}**"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue