8bc8469c38
metadata --json output format has changed, adding a inner json object named "fields" which contains only the fields and their values. This should be easier to parse than the old format, which mixed up metadata fields with other keys in the json object. Any consumers of the old format will need to be updated. This adds a dependency on unordered-containers for parsing MetaData from JSON, but it's a free dependency; aeson pulls in that library.
118 lines
2.7 KiB
Markdown
118 lines
2.7 KiB
Markdown
# NAME
|
|
|
|
git-annex metadata - sets or gets metadata of a file
|
|
|
|
# SYNOPSIS
|
|
|
|
git annex metadata `[path ...]`
|
|
|
|
# DESCRIPTION
|
|
|
|
The content of an annexed file can have any number of metadata fields
|
|
attached to it to describe it. Each metadata field can in turn
|
|
have any number of values.
|
|
|
|
This command can be used to set metadata, or show the currently set
|
|
metadata.
|
|
|
|
When run without any -s or -t parameters, displays the current metadata.
|
|
|
|
# OPTIONS
|
|
|
|
* `-g field` / `--get field`
|
|
|
|
Get the value(s) of a single field.
|
|
|
|
The values will be output one per line, with no other output, so
|
|
this is suitable for use in a script.
|
|
|
|
* `-s field=value` / `--set field=value`
|
|
|
|
Set a field's value, removing any old values.
|
|
|
|
* `-s field+=value` / `--set field+=value`
|
|
|
|
Add an additional value, preserving any old values.
|
|
|
|
* `-s field?=value` / `--set field?=value`
|
|
|
|
Set a value, but only if the field does not already have a value set.
|
|
|
|
* `-s field-=value` / `--set field-=value`
|
|
|
|
Remove a value from a field, leaving any other values that the field has
|
|
set.
|
|
|
|
* `-r field` / `--remove field`
|
|
|
|
Remove all current values of the field.
|
|
|
|
* `-t tag` / `--tag tag`
|
|
|
|
Set a tag. Note that a tag is just a value of the "tag" field.
|
|
|
|
* `-u tag` / `--unset tag`
|
|
|
|
Unset a tag.
|
|
|
|
* `--force`
|
|
|
|
By default, `git annex metadata` refuses to recursively set metadata
|
|
throughout the files in a directory. This option enables such recursive
|
|
setting.
|
|
|
|
* file matching options
|
|
|
|
The [[git-annex-matching-options]](1)
|
|
can be used to specify files to act on.
|
|
|
|
* `--json`
|
|
|
|
Enable JSON output. This is intended to be parsed by programs that use
|
|
git-annex. Each line of output is a JSON object.
|
|
|
|
The format of the JSON objects changed in git-annex version 6.20160726.
|
|
|
|
Example of the new format:
|
|
|
|
{"command":"metadata","file":"foo","key":"...","fields":{"author":["bar"],...},"note":"...","success":true}
|
|
|
|
Example of the old format, which lacks the inner fields object:
|
|
|
|
{"command":"metadata","file":"foo","key":"...","author":["bar"],...,"note":"...","success":true}
|
|
|
|
* `--all`
|
|
|
|
Specify instead of a file to get/set metadata on all known keys.
|
|
|
|
* `--branch=ref`
|
|
|
|
Specify instead of a file to get/set metadata on all files in the
|
|
specified branch or treeish.
|
|
|
|
* `--unused`
|
|
|
|
Specify instead of a file to get/set metadata on
|
|
files found by last run of git-annex unused.
|
|
|
|
* `--key=keyname`
|
|
|
|
Specify instead of a file to get/set metadata of the specified key.
|
|
|
|
# EXAMPLES
|
|
|
|
To set some tags on a file and also its author:
|
|
|
|
git annex metadata annexscreencast.ogv -t video -t screencast -s author+=Alice
|
|
|
|
# SEE ALSO
|
|
|
|
[[git-annex]](1)
|
|
|
|
[[git-annex-view]](1)
|
|
|
|
# AUTHOR
|
|
|
|
Joey Hess <id@joeyh.name>
|
|
|
|
Warning: Automatically converted into a man page by mdwn2man. Edit with care.
|