| 1 | --- |
| 2 | tags: |
| 3 | - v1 |
| 4 | --- |
| 5 | |
| 6 | You can lookup arguments by calling the `Args` function on `cli.Context`, e.g.: |
| 7 | |
| 8 | <!-- { |
| 9 | "output": "Hello \"" |
| 10 | } --> |
| 11 | ``` go |
| 12 | package main |
| 13 | |
| 14 | import ( |
| 15 | "fmt" |
| 16 | "log" |
| 17 | "os" |
| 18 | |
| 19 | "github.com/urfave/cli" |
| 20 | ) |
| 21 | |
| 22 | func main() { |
| 23 | app := cli.NewApp() |
| 24 | |
| 25 | app.Action = func(c *cli.Context) error { |
| 26 | fmt.Printf("Hello %q", c.Args().Get(0)) |
| 27 | return nil |
| 28 | } |
| 29 | |
| 30 | err := app.Run(os.Args) |
| 31 | if err != nil { |
| 32 | log.Fatal(err) |
| 33 | } |
| 34 | } |
| 35 | ``` |