Debian Codegraph @

docs/v2/examples/arguments.md

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