mirror of
https://github.com/containers/skopeo.git
synced 2025-07-07 03:39:10 +00:00
Use globalOptions for the debug flag
This works just like the command-specific options. Handles only the single flag for now, others will be added as the infrastructure is built. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
33b474b224
commit
f30756a9bb
@ -16,6 +16,7 @@ import (
|
|||||||
var gitCommit = ""
|
var gitCommit = ""
|
||||||
|
|
||||||
type globalOptions struct {
|
type globalOptions struct {
|
||||||
|
debug bool // Enable debug output
|
||||||
}
|
}
|
||||||
|
|
||||||
// createApp returns a cli.App to be run or tested.
|
// createApp returns a cli.App to be run or tested.
|
||||||
@ -33,8 +34,9 @@ func createApp() *cli.App {
|
|||||||
app.Usage = "Various operations with container images and container image registries"
|
app.Usage = "Various operations with container images and container image registries"
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
Usage: "enable debug output",
|
Usage: "enable debug output",
|
||||||
|
Destination: &opts.debug,
|
||||||
},
|
},
|
||||||
cli.BoolTFlag{
|
cli.BoolTFlag{
|
||||||
Name: "tls-verify",
|
Name: "tls-verify",
|
||||||
@ -86,7 +88,7 @@ func createApp() *cli.App {
|
|||||||
|
|
||||||
// before is run by the cli package for any command, before running the command-specific handler.
|
// before is run by the cli package for any command, before running the command-specific handler.
|
||||||
func (opts *globalOptions) before(c *cli.Context) error {
|
func (opts *globalOptions) before(c *cli.Context) error {
|
||||||
if c.GlobalBool("debug") {
|
if opts.debug {
|
||||||
logrus.SetLevel(logrus.DebugLevel)
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
}
|
}
|
||||||
if c.GlobalIsSet("tls-verify") {
|
if c.GlobalIsSet("tls-verify") {
|
||||||
|
Loading…
Reference in New Issue
Block a user