Adding CommandOptions to branch requires options to be defined BEFORE subcommands
See original GitHub issueInformation
- OS: Windows
- Version: Commit: e4dda28
- Windows terminal
Describe the bug Adding CommandOptions to branch requires options to be defined BEFORE subcommands
To Reproduce
Use Demo project and extend AddSettings
with this:
[CommandOption("--quiet")]
[Description("Quite mode")]
public bool Quiet { get; set; }
> Demo.exe add wo package pkt --quiet
ββββββββββββββββββββ¬ββββββββ
β Name β Value β
ββββββββββββββββββββΌββββββββ€
β PackageName β pkt β
β Version β null β
β Framework β null β
β NoRestore β False β
β Source β null β
β PackageDirectory β null β
β Interactive β False β
β Project β wo β
β Quiet β False β
ββββββββββββββββββββ΄ββββββββ
Quit is here FALSE even though I clearly gave it as an option to the command.
Demo.exe add wo --quiet package pkt
ββββββββββββββββββββ¬ββββββββ
β Name β Value β
ββββββββββββββββββββΌββββββββ€
β PackageName β pkt β
β Version β null β
β Framework β null β
β NoRestore β False β
β Source β null β
β PackageDirectory β null β
β Interactive β False β
β Project β wo β
β Quiet β True β
ββββββββββββββββββββ΄ββββββββ
Gives Quite = true
Expected behavior I expected CommandOption:s can be assigned anywhere on the commandline. IΒ΄ve never seen CLI:s requiring this strict order.
With CommandArguments itβs might be more intuitive to assign arguments to each command in order: βX arg1 arg2 Y arg1 arg2β. But this cant be the case with options. Examples of usages would be great on the https://spectreconsole.net/cli/composing page
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Why design global options need to be before subcommands?
Global options need to appear before subcommands, not anywhere, why are they designed this way? This is not the same as spf13/cobra.
Read more >Advanced command creation
This allows you to branch a single command to require different options depending on the subcommand chosen.
Read more >Git - git-branch Documentation
Defines, together with branch.<name>.remote, the upstream branch for the given branch. It tells git fetch/git pull/git rebase which branch to merge and can...
Read more >Reference manual for CVS commands
Go to the previous, next section. Reference manual for CVS commands. This appendix describes how to invoke CVS, and describes in detail those...
Read more >Quick Guide
The easiest way is to add a @Command -annotated method to the command class. For each option and positional parameter of the subcommand,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Goffen Thanks for reporting this. Will take a look at it closer when I have some spare time.
@PsychoNineSix Id suggest that it is also valuable to want to place the settings on the branch, and expect the Argument to show as you had originally expected (per --help options) as the argument applies to all subcommands - so Iβd say un-scratch!
I assume it is βnot normalβ to have branch options separated from their sub command options as today all the options are moved to the end regardless of what part of the setting call hierarchy they are in - this implies that there are multiple sets of options, those as part of the branch and this and part of the selected sub command one is looking at --help for?