Argu icon indicating copy to clipboard operation
Argu copied to clipboard

Merge multiple arguments?

Open Slesa opened this issue 11 months ago • 1 comments

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.

Slesa avatar Dec 20 '24 09:12 Slesa

Sorry, have been 🙈 re issues for a bit... In general I'd suggest to look at the test suite to see examples of typical usage to get an idea of the lie of the land,; the surface API can definitely be confusing in terms of being able to intuitively convey how to have it cover your use case.

If you could some some examples of a desired invocation syntax you're aiming to support, I or others may be able to suggest ways of achieving similar based on currently supported mechanism.

bartelink avatar May 14 '25 13:05 bartelink