findkeys: New command, very similar to git-annex find but operating on keys
authorJoey Hess <joeyh@joeyh.name>
Tue, 17 Jan 2023 18:42:29 +0000 (14:42 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 17 Jan 2023 18:51:57 +0000 (14:51 -0400)
commitf8bc208e89e610be31b47d4cea6334005f10af22
tree6e80336f78e0e83e9f2b43f9b5a8c8ab05a4a045
parenta522a41a42c77446c4432ab4d10a6defcfdb6f20
findkeys: New command, very similar to git-annex find but operating on keys

I've long been asked for `git-annex find --all` or something like that,
but pushed back on it because I feel that the command is analagous to
find(1) and so it would be surprising for it to list keys rather than
files. So instead, add a new findkeys subcommand.

Note that the use of withKeyOptions is rather strange because usually
that is used to fall back to --all rather than listing files, but here
it's made to default to --all like behavior and never list files.

A performance thing that could be improved is that withKeyOptions
always reads and caches location logs. But findkeys with no options does
not need them, so it could be made faster. That caching does speed up
options like --in though. This is really just a subset of a more general
performance thing that --all reads location logs sometimes unncessarily.
Anyway, it needs to read the location log in order to checkDead,
and it seems good that findkeys does skip dead keys.

Also, cleaned up comments on git-annex-find man page asking for --all
option.

Sponsored-by: Dartmouth College's DANDI project
24 files changed:
CHANGELOG
CmdLine/GitAnnex.hs
CmdLine/GitAnnex/Options.hs
Command/Find.hs
Command/FindKeys.hs [new file with mode: 0644]
doc/git-annex-find.mdwn
doc/git-annex-find/comment_10_085277234c93261701b8c5bb9f1758d3._comment [deleted file]
doc/git-annex-find/comment_10_b1c3f781b573d56f1b9572a9bf9f269b._comment [deleted file]
doc/git-annex-find/comment_12_cb599679d6b5e19867253175e2174c31._comment [deleted file]
doc/git-annex-find/comment_13_19556ecddc220a9739d8b061744dc065._comment [deleted file]
doc/git-annex-find/comment_14_2acf9c8a2d261ee69f3649b05581be4d._comment [deleted file]
doc/git-annex-find/comment_15_7124135eced9d6516141bb9be8bb345e._comment [deleted file]
doc/git-annex-find/comment_16_8ae8dd431e62ac9b98fce9ab18a8b031._comment [deleted file]
doc/git-annex-find/comment_17_b24572ef407439b6976ee72b2bea888f._comment [deleted file]
doc/git-annex-find/comment_1_cc246e2341138dddf692d28a2918bd38._comment [deleted file]
doc/git-annex-find/comment_2_191421867cc01ab920071d13ebcb6293._comment [deleted file]
doc/git-annex-find/comment_3_29e8f9b05ec786308a83ab6bb2001e38._comment [deleted file]
doc/git-annex-find/comment_4_d12f5b9eddd889cdf8deb5024d83088d._comment [deleted file]
doc/git-annex-find/comment_5_dbbcaed69b06f45d64ee1dad24aacdda._comment [deleted file]
doc/git-annex-find/comment_9_d7ea718f3a898bf9f3e1514802b99fec._comment [deleted file]
doc/git-annex-findkeys.mdwn [new file with mode: 0644]
doc/git-annex.mdwn
doc/todo/findkeys.mdwn
git-annex.cabal