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

Merge multiple arguments? #266

Open
Slesa opened this issue Dec 20, 2024 · 0 comments
Open

Merge multiple arguments? #266

Slesa opened this issue Dec 20, 2024 · 0 comments

Comments

@Slesa
Copy link

Slesa commented Dec 20, 2024

Description

In case of modularization, is it possible somehow to merge different arguments without subcommands? Let's say you have a bunch of command line backends: a POS cash register, a kitchen order viewer, and a customer database. Each of them may have their service arguments like network address to listen on and a port. And each of them have their own settings, a fixed waiter for the POS or sth like that.

Repro steps

type ServiceArguments =
    | Rest_Service of RestHost: string * RestPort: uint16
    interface IArgParserTemplate with

type PosArguments =
    | [<AltCommandLine("-w")>] [<EqualsAssignmentOrSpaced>] Waiter of uint
    interface IArgParserTemplate with

type ClientArguments =
    | ServiceArguments of service: ServiceArguments 
    | PosArguments of pos: PosArguments
    interface IArgParserTemplate with

I assume there is some kind of interceptor function, or should I collect all known arguments for each interface and then provide it to the sub arguments? Or is the only way to use subcommands? Feels a bit strange, though.

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

No branches or pull requests

1 participant