aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/metadata_--batch/comment_4_c72eb16b630b200265e125ebaf7d0d36._comment
blob: 4cd0f2d34dd57097804a43292650136f8d189f0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[[!comment format=mdwn
 username="joey"
 subject="""comment 4"""
 date="2016-07-25T17:39:37Z"
 content="""
--batch mode should be usable to get current metadata, set new
metadata, and remove existing metadata. The non-batch metadata command has
different syntaxes for all of these, but it would be good to have a single
interface that handles all three in batch mode.

It could read a line containing the file or key, with any metadata
fields that should be changed:

	{"file":"foo"}
	{"file":"foo","author":["bar"]}
	{"key":"SHA...","author":[]}

And reply with *all* the metadata, in nearly the same format:

	{"file":"foo","key":"SHA...","author":["bar"],lastchanged:["date"],"success":true}

And that reply could in turn be edited and fed back in to change the
metadata.

----

There's a DRY problem here because there's the current JSON generator code,
and I'd have to add an Aeson parser to parse the JSON input. But, Aeson
parsers also automatically have a matching generator, which is guaranteed
to generate code that the parser can parse.

So, it would be nice to use the Aeson JSON generator, instead of the
current one, but that can only be done if the JSON is formatted the same,
or close enough that nothing currently consuming `metadata --json` will
break.
"""]]