2022-07-22 14:09:34 +00:00
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
type action struct {
|
|
|
|
flags struct {
|
|
|
|
depsFile string
|
2022-07-22 15:50:51 +00:00
|
|
|
depsURL string
|
2022-07-22 14:09:34 +00:00
|
|
|
verbose bool
|
|
|
|
dryRun bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *action) RunHelp(c *cli.Context) error {
|
|
|
|
return cli.ShowAppHelp(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *action) getFlags(c *cli.Context) {
|
|
|
|
a.flags.verbose = c.Bool(flagVerbose)
|
|
|
|
a.flags.depsFile = c.String(flagDepsFile)
|
2022-07-22 15:50:51 +00:00
|
|
|
a.flags.depsURL = c.String(flagDepsURL)
|
2022-07-22 14:09:34 +00:00
|
|
|
a.flags.dryRun = c.Bool(flagDryRun)
|
|
|
|
|
|
|
|
a.log("flags %+v", a.flags)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *action) log(format string, v ...interface{}) {
|
|
|
|
if a.flags.verbose {
|
|
|
|
log.Printf(format, v...)
|
|
|
|
}
|
|
|
|
}
|