On Wednesday, January 24, 2018 at 11:00:37 AM UTC-7, erisa wrote: > > I have a CLI program that uses the flag package and has one flag and takes > a string as its only nonflag argument. The string can be a complex > expression, but it is possible that the first character of the string is a > minus sign. > This parses correctly: > > powerseries -nterms=10 "x ^ 10" > > But this does not: > > powerseries -nterms=10 "-x ^ 10" > > It yields the error "flag provided but not defined: -x ^ 10". > > Is there a workaround for this problem? >
Yes: powerseries -nterms=10 -- "-x ^ 10" The "--" means "end of flag arguments." — Scott -- 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. For more options, visit https://groups.google.com/d/optout.