33 lines
433 B
Markdown
33 lines
433 B
Markdown
### Arguments
|
|
|
|
You can lookup arguments by calling the `Args` function on `cli.Context`, e.g.:
|
|
|
|
<!-- {
|
|
"output": "Hello \""
|
|
} -->
|
|
``` go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
func main() {
|
|
app := cli.NewApp()
|
|
|
|
app.Action = func(c *cli.Context) error {
|
|
fmt.Printf("Hello %q", c.Args().Get(0))
|
|
return nil
|
|
}
|
|
|
|
err := app.Run(os.Args)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
```
|