From f0d16a49847a65a18876960c12202f1cdd98fb8e Mon Sep 17 00:00:00 2001 From: spf13 Date: Tue, 24 Sep 2013 16:45:20 -0400 Subject: [PATCH] more complete readme --- README.md | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 374b9fa5..23d9457d 100644 --- a/README.md +++ b/README.md @@ -79,16 +79,30 @@ execute the commander. 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, " ")) @@ -97,22 +111,32 @@ execute the commander. } - 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 it