From fbbda7a90219b8d5abe086fcbec51ea58ad4d1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20R=C3=B8dseth?= Date: Fri, 15 Nov 2013 12:51:53 +0100 Subject: [PATCH] Minor changes --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3fb272c..0917bb9 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,10 @@ One of the philosophies behind cli.go is that an API should be playful and full ``` go package main -import "os" -import "github.com/codegangsta/cli" +import ( + "os" + "github.com/codegangsta/cli" +) func main() { cli.NewApp().Run(os.Args) @@ -43,8 +45,10 @@ This app will run and show help text, but is not very useful. Let's give an acti ``` go package main -import "os" -import "github.com/codegangsta/cli" +import ( + "os" + "github.com/codegangsta/cli" +) func main() { app := cli.NewApp() @@ -68,8 +72,10 @@ Being a programmer can be a lonely job. Thankfully by the power of automation th /* greet.go */ package main -import "os" -import "github.com/codegangsta/cli" +import ( + "os" + "github.com/codegangsta/cli" +) func main() { app := cli.NewApp() @@ -158,7 +164,7 @@ app.Commands = []cli.Command{ ShortName: "a", Usage: "add a task to the list", Action: func(c *cli.Context) { - println("added task: ", c.Args()[0]) + println("added task: ", c.FirstArg()) }, }, { @@ -166,7 +172,7 @@ app.Commands = []cli.Command{ ShortName: "c", Usage: "complete a task on the list", Action: func(c *cli.Context) { - println("completed task: ", c.Args()[0]) + println("completed task: ", c.FirstArg()) }, }, }