This is a creation in
Article, where the information may have evolved or changed.
Based on the Golang 1.6.2 flag source has made an extension
Make command-line help information more complete, clearer, and easier to use
Source Address: Http://github.com/vipally/cmdline
Ally (vipally@gmail.com) modify from Std.flag version 1.6.2
1. Add Logicname and Required field for every flag, and modify the flag define interface
2. Add Summary and Details for Commond line info
3. Add interface Getusage () string
4. Modify the Parse () logic
Func Main () {cmdline. Summary ("command copy is used-to-copy a file to another path.") CmdLine. Details (' Command copy is used toCopya file toAnother path. If theDestnationfileis exist, default ask for ifwould coverit. If Flag-y used,itwould cover theDestnationfile withoutAsk. If Flag-n used,itWould notCover theDestnationfile withoutAsk. ') 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 ".") //destnation 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 and default ask for If would cover it. //If flag-y used, it'll cover the destnation file without ask. //If flag-n used, it'll not cover the destnation file without ask.}