Open pmarkowsky opened 7 months ago
I started work on this but it's going to be quite tricky and I don't believe it's possible to do without breaking invocations that currently work. The two primary issues are:
1) The flag library is intended for a single-function binary (really, a server) but santactl is a multi-command tool with different flags for different subcommands. This has a couple of side-effects: a) If two commands define the same flag it causes a linker error. This can be worked around by putting those flags in a separate file with a shared header but then those flags can't have different help text. b) Usage/help text doesn't work properly because absl assumes all flags apply to all commands.
2) Support for repeated flags is a little limited and works very differently to how it does currently. For example, you can use std::vector<std::string>
as the flag's type and it will break the passed string on ,
but we have commands (e.g. fileinfo) where you can pass a flag multiple times to add more values. It's not possible to do this with absl flag, even with custom types.
There's a lot of hard to test command line parsing in santactl. This should be refactored to use Abseil's Flag library.