c4spar / deno-cliffy

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
https://cliffy.io
MIT License
910 stars 64 forks source link

Add a way to make options conflicting with arguments #228

Open lowlighter opened 3 years ago

lowlighter commented 3 years ago

As discussed in #225, it could be nice to make it possible to create conflicting depending on passed arguments

One use case could be when you want the default argument be a file, but alternative sources could be passed as option

mycli read-stuff my_file_with_content.json
mycli read-stuff --from-port 443
.command("read-stuff [file]")
.option("--form-port <port>", {conflicts:"[file]"})
c4spar commented 1 year ago

Currently thinking about this. Maybe it's better to add a .argument(name, options) method so you can define conflicting options on the argument instead of defining conflicting arguments on the option.