Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite Santactl Command Line Parsing to use Abseil #1305

Open
pmarkowsky opened this issue Mar 10, 2024 · 1 comment
Open

Rewrite Santactl Command Line Parsing to use Abseil #1305

pmarkowsky opened this issue Mar 10, 2024 · 1 comment

Comments

@pmarkowsky
Copy link
Contributor

There's a lot of hard to test command line parsing in santactl. This should be refactored to use Abseil's Flag library.

@russellhancox
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants