diff options
author | Teddy Wing | 2017-06-03 20:33:17 +0200 |
---|---|---|
committer | Teddy Wing | 2017-06-03 20:53:14 +0200 |
commit | bcb86d1e025c6928018f94c5634eed88e50c0a58 (patch) | |
tree | 134032a50a34250587f0a8a21d6e40806c935240 /README.md | |
parent | 57f64ce855309b27ea483af81cfdb1d38d1db7f3 (diff) | |
download | timetasker-bcb86d1e025c6928018f94c5634eed88e50c0a58.tar.bz2 |
main.go: Custom `Required()` for `--project` argument
As far as I've been able to figure out, Kingpin doesn't have a mechanism
for dependent arguments or conditional requireds. Thus there's no way to
say "--position is only required if --write-config isn't passed".
In that case, write our own "required" check, to enforce the presence of
"--project" only if "--write-config" isn't passed. We duplicate the
message that Kingpin provides from `Required()` and leverage its error
formatting (we should probably use this for our other error messages
too).
The only difference is that `--position=POSITION` won't appear on the
first line of the Help text, which would have emphasised the fact that
it's required. It's possible to configure Kingpin's help text via
templates, but I don't think that's worth the trouble at this point.
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions