在标志上从“-”更改为“ no”时获得不同的输出

Ok, I have having trouble with flags. I think I currently am on the right track but my println in my PrintRepeater program will output a true if I type "go run *.go printrepeater 3 --slow", but if I type "go run *.go printrepeater 3 slow" I get flase.

testCli.go

package main

import ( "github.com/codegangsta/cli" "os" )

func main() {
app := cli.NewApp()
app.Name = "Learn CLI"
app.Usage = "basic things in cli"
/*  app.Flags = []gangstaCli.Flag{
    gangstaCli.StringFlag{
        Name: "s",
        //Value:  "y",
        Usage: "slowing down",
    },
    }*/

  //    app.Flags = []cli.Flag{
  //cli.StringFlag{"slow", "yes", "for when you have too much time", ""},
 // }

 app.Commands = []cli.Command{
    {
        Name:   "countup",
        Usage:  "counting up",
        Action: PrintRepeater,
    },

    {
        Name:   "countdown",
        Usage:  "counting down",
        Action: GoDown,
    },

    {
        Name:  "printrepeater",
        Usage: "prints hello x number of times",
        Flags: []cli.Flag{
            cli.BoolFlag{
                Name:  "slow",
                Usage: "to slow things down by a certian amount",
            },
        },
        Action: PrintRepeater,
    },
}

app.Run(os.Args)
}

PrintRepeater.go

package main

import "github.com/codegangsta/cli"
import "strconv"

func PrintRepeater(c *cli.Context) {
    println(c.Bool("slow"))

    i1 := c.Args()[0]
    i2, err := strconv.Atoi(i1)
    if err != nil {
        println(err)
    }
    for i := i2; i >= 1; i-- {
        println("hello")
    }
}

Flags start with a -, that's just how they are defined.

When you use printrepeater 3 slow, "slow" is now an extra argument, and doesn't affect the state of the slow flag.