-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
cli.go
45 lines (38 loc) · 813 Bytes
/
cli.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package convert
import (
"github.com/urfave/cli/v2"
"github.com/mintoolkit/mint/pkg/app"
"github.com/mintoolkit/mint/pkg/app/master/command"
)
const (
Name = "convert"
Usage = "Convert container image"
Alias = "k"
)
var CLI = &cli.Command{
Name: Name,
Aliases: []string{Alias},
Usage: Usage,
Action: func(ctx *cli.Context) error {
gcvalues := command.GlobalFlagValues(ctx)
xc := app.NewExecutionContext(
Name,
gcvalues.QuietCLIMode,
gcvalues.OutputFormat)
targetRef := ctx.String(command.FlagTarget)
if targetRef == "" {
if ctx.Args().Len() < 1 {
xc.Out.Error("param.target", "missing target")
cli.ShowCommandHelp(ctx, Name)
return nil
} else {
targetRef = ctx.Args().First()
}
}
OnCommand(
xc,
gcvalues,
targetRef)
return nil
},
}