You can do rootCmd.SetArgs(os.Args[2:]), and process the first
parameter yourself.

On Sun, Feb 25, 2024 at 11:43 AM David Karr <davidmichaelk...@gmail.com> wrote:
>
> I am not a new programmer, but I am pretty new to golang, having only written 
> a couple of small applications, and that was several months ago. I'm trying 
> to construct an application using Cobra, using some nonstandard conventions. 
> Is it better to ask a question like this in an issue in the Cobra github site?
>
> The application I am trying to write will be used extremely often, and I want 
> to minimize the required syntax.
>
> I want to set up a command line like the following:
>
>     <applicationname> <parameter> <subcommand> <parameters>
>
> The parameter right after the application name will always be present. I 
> don't want it to be a flag. After that parameter value will be a subcommand, 
> followed by additional parameters, also not flags. There are some situations 
> where I want to allow for flags, but that will be uncommon.
>
> It's not clear to me how to cleanly set up this organization.  Is it simply 
> not practical to do with Cobra?  Should I just do ad hoc parameter processing?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/14b9efb1-7fbb-45a6-8e0e-56f25be310a3n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMV2RqrshNcSUdBiMrCTP8GkEc3mHre3eBXN2W%2BK%3DDiwoiWvCQ%40mail.gmail.com.

Reply via email to