onyo get
Return values of the requested KEYs for matching assets.
If no KEYs are given, the path and all keys in the asset name are printed (see
onyo.assets.name-format). If no PATHs are given, the current working directory is used.In addition to keys in asset contents, PSEUDO-KEYS can be queried and matched.
is_asset_directory: is the asset an Asset Directory
directory: parent directory of the asset relative to repo root
path: path of the asset relative to repo rootBy default, the results are sorted by
path.
usage: onyo get [-h] [-d DEPTH] [-k KEY [KEY ...]] [-H] [-M MATCH [MATCH ...]]
[-i INCLUDE [INCLUDE ...]] [-x EXCLUDE [EXCLUDE ...]]
[-p PATH [PATH ...]] [-s SORT_KEY [SORT_KEY ...]]
[-S SORT_KEY [SORT_KEY ...]]
Named Arguments
- -d, --depth
Descend up to DEPTH levels into the directories specified. A depth of 0 descends recursively without limit.
Default:
0- -k, --keys
**KEY**s to print the values of. Pseudo-keys (information not stored in the asset file) are also available for queries. Dictionary subkeys can be addressed using a period (e.g.
model.name,model.year, etc.)- -H, --machine-readable
Useful for scripting. Do not print headers and separate values with a single tab instead of variable white space.
Default:
False- -M, --match
Criteria to match assets in the form
KEY=VALUE, where VALUE is a python regular expression. Pseudo-keys such aspathcan also be used. Dictionary subkeys can be addressed using a period (e.g.model.name,model.year, etc.) One can match keys that are not in the output. Special values supported are:<dict><list><unset>
- -i, --include
Assets or directories to query.
- -x, --exclude
Assets or directories to exclude from the query. Note, that DEPTH does not apply to excluded paths.
- -p, --path
Deprecated. Alias for
--include.- -s, --sort-ascending
Sort matches by SORT-KEY in ascending order. Can be given multiple times. Sorting by multiple SORT-KEY will be done in order (earlier given keys take precedence over subsequent keys). This can be intermixed with
-s/--sort-descending. Note, that if a SORT-KEY appears multiple times, the latest appearance will overrule what was specified before. One can sort by keys that are not in the output.- -S, --sort-descending
Sort matches by SORT-KEY in descending order. Can be given multiple times. Sorting by multiple SORT-KEY will be done in order (earlier given keys take precedence over subsequent keys). This can be intermixed with
-s/--sort-ascending. Note, that if a SORT-KEY appears multiple times, the latest appearance will overrule what was specified before. One can sort by keys that are not in the output.
Exit Status
The exit status is 0 if at least one result is found, 1 if there are no
results, and 2 if an error occurred.
These exit values match those of grep.
Examples
List all assets belonging to a user:
$ onyo get --path accounting/Bingo\ Bob
List all laptops in the warehouse:
$ onyo get --match type=laptop --path warehouse/
Get the path of all laptops of a specific make and model, and print in machine parsable format (suitable for piping):
$ onyo get --match type=laptop make=apple model=macbookpro --keys path --machine-readable