more complete readme
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by spf13 · committed by spf13 · parent fb2146e · Browse files · 1 file·+33 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+33 added−9 removed
- other:+33 added−9 removed
Provenance
- Commit
f0d16a4- Tree
53566df- Author
spf13 <steve.francia@gmail.com>- Committer
spf13 <steve.francia@gmail.com>- Parent
fb2146e
1 file changed+33 added−9 removed
modified:README.md+33 added-9 removed
77 unmodified lines7879808182828384858687888988909192919394959697989910010110210310410510610710810911011111211310011411511610311711811912012112210810911012311212412512612712812913013113213313413513613713813914014114214313 unmodified lines77 unmodified lines
var cmdPrint = &cobra.Command{ Use: "print [string to print]", Short: "Print anything to the screen", Long: `an utterly useless command for testing.`, Long: `print is for printing anything back to the screen. For many years people have printed back to the screen. `, Run: func(cmd *cobra.Command, args []string) { fmt.Println("Print: " + strings.Join(args, " ")) }, }
var cmdEcho = &cobra.Command{ var cmdEcho = &Command{ Use: "echo [string to echo]", Short: "Echo anything to the screen", Long: `an utterly useless command for testing.`, Long: `echo is for echoing anything back. Echo works a lot like print, except it has a child command. `, Run: func(cmd *cobra.Command, args []string) { fmt.Println("Print: " + strings.Join(args, " ")) }, }
var cmdTimes = &Command{ Use: "times [# times] [string to echo]", Short: "Echo anything to the screen more times", Long: `echo things multiple times back to the user by providing a count and a string.`, Run: func(cmd *cobra.Command, args []string) { for i:=0; i < echoTimes; i++ { fmt.Println("Echo: " + strings.Join(args, " ")) } }, }
cmdEcho.Flags().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input") cmdTimes().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input")
var commander = cobra.Commander() commander.SetName("Cobra") commander.SetName("CobraExample") commander.AddCommand(cmdPrint, cmdEcho) cmdEcho.AddCommand(cmdTimes) commander.Execute() }
## Release Notes
* **0.7.0** Sept 24, 2013 * Needs more eyes * Test suite * Support for automatic error messages * Support for help command * Support for printing to any io.Writer instead of os.Stderr * Support for persistent flags which cascade down tree * Ready for integration into Hugo* **0.1.0** Sept 3, 2013 * Implement first draft
## ToDo* More testing of non-runnable* More testing* Launch proper documentation site
## Contributing
1. Fork it2. Create your feature branch (`git checkout -b my-new-feature`)13 unmodified lines