alire-project / clic

Command Line Interface Components
MIT License
11 stars 3 forks source link

Impossible to distinguish arguments for the subcommand from switches after `--`? #18

Open mosteo opened 2 years ago

mosteo commented 2 years ago

I'm testing a command of the form:

$ cmd subcmd arg1 -- arg2 -switch

The subcommand is configured with Before_Double_Dash parsing. Then, the argument vector I receive in the subcommand is:

  1. arg1
  2. arg2
  3. -switch

So it seems it is impossible to know where the arguments for the subcommand end and the arguments after the -- begin.

Not sure if this is a current shortcoming or I'm missing the proper way to do this.

Fabien-Chouteau commented 2 years ago

This is not supported at the moment, but it should be doable I think.

What would the Execute procedure prototype look like?

   procedure Execute (Cmd  : in out Command;
                      Args :        AAA.Strings.Vector)
mosteo commented 2 years ago

I wonder if we could leverage the common Command base type to store there the list(s) of arguments and avoid changing the Execute profile.

Anyway, as this was for the install experiments and that's not immediate, this also isn't urgent.