spectreconsole / spectre.console

A .NET library that makes it easier to create beautiful console applications.
https://spectreconsole.net
MIT License
9.17k stars 472 forks source link

How to prevent specifying the same option twice #302

Closed babysnakes closed 3 years ago

babysnakes commented 3 years ago

Hi,

(Sorry about the free form issue, This is not a bug and not a feature request - it's a question 😄)

It seems that by default I can specify an option multiple times and the last one is the one that counts (this is from the Demo example:

PROMPT > .\bin\Debug\net5.0\Demo.exe run --verbosity n --verbosity m
┌───────────────────┬─────────┐
│ Name              │ Value   │
├───────────────────┼─────────┤
│ Configuration     │ Debug   │
│ Framework         │ null    │
│ RuntimeIdentifier │ null    │
│ ProjectPath       │ null    │
│ LaunchProfile     │ null    │
│ NoLaunchProfile   │ False   │
│ NoBuild           │ False   │
│ Interactive       │ null    │
│ NoRestore         │ False   │
│ Verbosity         │ Minimal │
│ NoDependencies    │ False   │
│ Force             │ False   │
└───────────────────┴─────────┘

Is there a way to disallow it?

(sorry if I miss something obvious but I'm completely new to windows, .Net and F#).

Thanks

Haim

phil-scott-78 commented 3 years ago

Right now there isn't a way to fail, but that behavior is pretty common for CLIs. E.g. here's GH

image

and just to verify here's git on ubuntu

image

babysnakes commented 3 years ago

Yeah, I can live with it. I just started playing with it and I'm not sure how it handles lists - many libraries handle lists by repeating the option so I wanted to differentiate ...

In any case, thanks for what seems to be a great library for displaying data in the console.

Haim