alecthomas / alecthomas/kingpin

Features for v3

Aperta
#90 21 commenti 12 reazioni 1 assegnatario Rivendicata da @alecthomas Vedi su GitHub
enhancement
Lingua principale
Go
Stelle
3.6k
Fork
279
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

This issue is to track feature implementation for v3. I'm mostly happy with the core functionality in v2, but there are a few rough edges. To that end, v3 will be mostly cleanup and streamlining.
- [x] Make hooks less ugly: `Action(*Context)` should be something like `Action(value Value)` perhaps, and called something other than Action. Not sure. See #125.
- [x] Clean up how boolean flags work (see #54).
- [x] Convert more values to use the generator.
- [x] Some way to manipulate flags after configuration but before parsing. This is useful when a package has defaults that you'd like to override in the main binary. This is currently impossible. (implemented in 292d4f20095c70c7599634c58870b0567d6a6820)
- [ ] Help "sections". This would be used to add sections to man pages, and to the plain text output.
- [ ] Rethink the way `@` and `-` work. See #65.
- [x] Make usage functions more consistently follow a pattern. Similar to how the `regexp` package works.
- [ ] Support a single environment variable that is parsed for flags. eg. `APP="-a -bfoo --something"`
- [x] Configurable help. Some people want enums displayed, default values, envars, etc. Maybe help strings should have their own var expansion.
- [ ] Allow recursive value expansion: eg. given flag `foo=${BAR}` and flag `bar=asdf`, `foo` will evaluate to `asdf`.
- [x] Cleaner usage/help API. eg. `Usage(text)` and `WriteUsage*`.
- [x] Usage templates should allow custom template functions/context.
- [ ] Support [mutually exclusive groups](https://docs.python.org/3/library/argparse.html#mutual-exclusion).
- [ ] Support for mixed mode boolean+value flags. eg. `--purge`, `--purge=24h`? Could use a nil value to indicate not provided? Not sure this is a good idea, plus it's hard to parse.
- [x] Use comma (or semi-colon) separated environment variables, with support for escaping (fixed by resolvers added in b62665b4ea4ea556c9a1ed1525ee77e8e289a9ef).
- [ ] "Fix" default values (see #115).
- [x] Values that open files result in leaked FDs if they have default values (removed feature).
- [x] Ability to customise `--help` flag (see #119)
- [x] `--version` and `--help` should go to stdout, errors to stderr (eg. #120) (implemented in 9f68dc0167caf0e2b2765183636f38d4780e9d44)
- [x] Make TCP types et al return strings rather than `net.*` types.
- [ ] Allow values to be configurable somehow (1)
- [x] Make `Default()` apply before parsing (implemented in 3f9c38e642472881fff9512eae289b40ac4148e1)
- [x] Support flag definitions from tagged structs (implemented in 319ba9076ccd5d047ba10d27a84922a393fbe76d).
- [x] Internationalisation support (started in 20700aa670b125872f58acd318986e777a103ab7)
- [x] Provide a list of environment variables to use as fallback (see #92) (achievable with custom resolvers).
- [x] Some values, such as repeating ones, would benefit from being more configurable. eg. Making sequences optionally support being comma-separated lists. I'm not sure how this would work in practice, but perhaps use the `XXXOption` configuration closure convention? eg. `Strings(options...ValueOption)` where `type ValueOption func(conf map[string]string) error`? (b88248d8da3f8a9eb99fc83b47a53b295e9fc8ee)
- [x] Support for interspersing arguments and commands (eg. `cmd0 cmd1 `) (801d8e545ccdde3fcaaec3ddafc4827969635aa5).
- [x] Distinct boolean and negatable-boolean flags (bf710ba16f982acf6eca0084acd9cb933151aa45).

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.