From a29aaf2879e6d236eae13cb8f118c2c3137ac9d1 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 23 Jul 2013 17:16:08 +0800 Subject: [PATCH 1/2] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 63911fb..3c7fb3b 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,10 @@ app.Flags = []cli.Flag { cli.StringFlag{"lang", "english", "language for the greeting"}, } app.Action = func(c *cli.Context) { + name := "someone" + if len(c.Args()) > 0 { + name = c.Args()[0] + } if c.String("lang") == "spanish" { println("Hola", c.Args()[0]) } else { From cd365a2e946588aaca1512f7feae1a3ca3fb60d6 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 23 Jul 2013 17:17:26 +0800 Subject: [PATCH 2/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3c7fb3b..ebe5f3f 100644 --- a/README.md +++ b/README.md @@ -136,9 +136,9 @@ app.Action = func(c *cli.Context) { name = c.Args()[0] } if c.String("lang") == "spanish" { - println("Hola", c.Args()[0]) + println("Hola", name) } else { - println("Hello", c.Args()[0]) + println("Hello", name) } } ...