jawher / mow.cli

A versatile library for building CLI applications in Go
MIT License
872 stars 55 forks source link

Associate option values with specific arguments #94

Open nim-nim opened 5 years ago

nim-nim commented 5 years ago

I have a (complex) set of options used to define the properties of an argument (some properties are optional, others mandatory, it's not a simple set).

I now need to write a subcommand that manipulates sets of this argument. Unfortunately, all the arguments in the set do not necessarily share the same properties.

The natural user-friendly way to do it would be to rely on

Order between options and arguments is significant

and basically do something like

[  [-a|--along=<avalue>]  |  [-b|--blong=<bvalue>] ] ARG...]... ]

Which basically means that:

mow.cli would then generate lists of structs for ARGS, with the ARG value as main field, and all the usual option lists as other fields

Short term I will pretend all the arguments share the same properties, but I'm pretty sure that a user will remind me this design is broken in the next months