mirror of
https://github.com/crazybber/awesome-patterns.git
synced 2024-11-26 23:06:03 +03:00
28 lines
428 B
Go
28 lines
428 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
|
||
|
"github.com/urfave/cli"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
app := cli.NewApp()
|
||
|
app.Name = "hello_cli"
|
||
|
app.Usage = "Print hello world"
|
||
|
app.Flags = []cli.Flag{
|
||
|
cli.StringFlag{
|
||
|
Name: "name, n",
|
||
|
Value: "World",
|
||
|
Usage: "Who to say hello to.",
|
||
|
},
|
||
|
}
|
||
|
app.Action = func(c *cli.Context) error {
|
||
|
name := c.GlobalString("name")
|
||
|
fmt.Printf("Hello %s!\n", name)
|
||
|
return nil
|
||
|
}
|
||
|
app.Run(os.Args)
|
||
|
}
|