kart icon indicating copy to clipboard operation
kart copied to clipboard

Improve `kart log --help`

Open craigds opened this issue 4 years ago • 1 comments
trafficstars

kart log seems a pretty important command but the docs are lacking:

$ kart log --help
Usage: kart log [OPTIONS] [ARGS]...

  Show commit logs

Options:
  -o, --output-format [text|json|json-lines]
  --json-style [extracompact|compact|pretty]
                                  How to format the output. Only used with
                                  --output-format=json

  --with-feature-count [veryfast|fast|medium|good|exact]
                                  Adds a 'feature_count' (the number of
                                  features modified in this diff) to JSON
                                  output.If the value is 'exact', the feature
                                  count is exact (this may be slow.)
                                  Otherwise, the feature count will be
                                  approximated with varying levels of
                                  accuracy.

  --help                          Show this message and exit.

This is because it's a thin wrapper of git log, so we didn't implement any args really, we just pass whatever we're given on to git log.

We should probably either:

  • parse the args/options using click, just so they show up properly in the help text.
  • override the help text function so it displays meaningful args even though we're not parsing them

craigds avatar Oct 25 '21 19:10 craigds

Seems like the best option is to stop forwarding unknown arguments to git log, and instead parse the whole command line (with a subset of the options git supports), and throw usage errors for unknown options.

Many of the git log options make no sense in a kart context, and supporting them just means we can't stop forwarding to git later (which we'll almost certainly want to do.)

craigds avatar Nov 18 '21 22:11 craigds