I assume you're aware it's valid to have two initializers for the same variable.? I often use -v and -verbose to both modify flagVerbose.
var flagVerbose bool func init() { boolVar(&flagVerbose,"v" .... boolVar(&flagVerbose "verbose" .... } Other than that I don't see what your package is actually enhancing over the current flag package. Could you please explain what advantage(s) you believe you are providing. You might also want to re-visit the "usage" function convention since that's pretty easy to use to accomplish the "enough information" part. On Thursday, August 18, 2016 at 6:11:35 AM UTC-4, Ally Dale wrote: > > Hi, everyone, > I have create a package named cmdline to extend std.flag based on Go > src v1.7 > Then, we can make a command usage page more easily and with enough > information. > > So, I wonder if the Go authors can merge this change into std.flag, to > help gophers make a command line page more conveniently? > > You can find the project here: http://github.com/vipally/cmdline > > This is the main change: > > 1. Add LogicName and Required field for every flag, and modify the flag > define interface > > 2. Add Summary and Details for command line info > > 3. Add interface GetUsage() string > > 4. Modify the Parse() logic > > > //usage of cmdline as follow > > import ( > > "github.com/vipally/cmdline" > > ) > > func main() { > > cmdline.Summary("command copy is used to copy a file to another path.") > > cmdline.Details(`Command copy is used to copy a file to another path. > > If the destnation file is exist, default ask for if will cover it. > > If flag -y used, it will cover the destnation file without ask. > > If flag -n used, it will not cover the destnation file without ask. > > `) > > cmdline.String("s", "src", ".", true, "source file path") > > cmdline.String("d", "dst", ".", true, "destnation file path") > > cmdline.Bool("c", "cover", false, false, "if cover the destnation file") > > cmdline.Bool("y", "yes", false, false, "if auto select yes when ask for > cover") > > cmdline.Bool("n", "no", false, false, "if auto select no when ask for > cover") > > cmdline.Parse() > > > //[error] require but lack of flag -s=<src> > > //Usage of [copy.exe]: > > // Summary: > > // command copy is used to copy a file to another path > > // > > // Usage: > > // copy.exe [-c=<cover>] -d=<dst> [-n=<no>] -s=<src> [-y=<yes>] > > // -c=<cover> > > // if cover the destnation file > > // -d=<dst> required string (default ".") > > // destination file path > > // -n=<no> if auto select no when ask for cover > > // -s=<src> required string (default ".") > > // source file path > > // -y=<yes> > > // if auto select yes when ask for cover > > // > > // Details: > > // Command copy is used to copy a file to another path. > > // If the destnation file is exist, default ask for if will cover it. > > // If flag -y used, it will cover the destnation file without ask. > > // If flag -n used, it will not cover the destnation file without ask. > > } > > -- 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.