On Thu, Oct 15, 2020 at 4:27 PM Roland Müller <[email protected]> wrote:
>
> Actually, it's explicitly documented, so I don't have to guess:
> https://golang.org/pkg/flag/#hdr-Command_line_flag_syntax

Thank you. I read it and it makes sense why the behavior is like that.

>
>
> Am Do., 15. Okt. 2020 um 08:22 Uhr schrieb Roland Müller <[email protected]>:
>>
>> I guess it's usage of flag is meant in to behave like parsing flags in 
>> Unix/LInux, or Python' argparse:
>>
>> after the command you have the flags denoted by '-'
>> after flags follow rest of command line args where elements can be every 
>> character string
>>
>> BR,
>> Roland
>>
>> Am Fr., 9. Okt. 2020 um 07:10 Uhr schrieb Amit Saha <[email protected]>:
>>>
>>> Hi all, I realize that the flag package stops parsing os.Args[] once it 
>>> finds a non "-" character. This means, if I invoke my program as:
>>>
>>> $ ./myprog arg1 -d value
>>>
>>> flag.Parse() will stop parsing the moment it sees arg1 and result in NArg() 
>>> returning 2 instead of 1.
>>>
>>> Is there a recommended workaround to handle both $./myprog -d value arg1 
>>> and $./myprog arg1 -d value correctly?
>>>
>>> Thanks for any suggestions.
>>>
>>> Thanks,
>>> Amit.
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/golang-nuts/d1399079-4589-454f-91d3-820a60aa239dn%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CANODV3nDeOQK%3DOkPMXtMuSQpkKkvLLG7NjO%3D9AJ60_QMvjc%3DfQ%40mail.gmail.com.

Reply via email to