latest
This commit is contained in:
@@ -3,12 +3,11 @@ package cli
|
||||
import (
|
||||
"errors"
|
||||
|
||||
log "github.com/visionmedia/go-cli-log"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func (mfa *CLIApp) checkManifestOperation(c *cli.Context) error {
|
||||
log.Error(errors.New("unimplemented"))
|
||||
log.WithError(errors.New("unimplemented"))
|
||||
return nil
|
||||
}
|
||||
|
||||
12
internal/cli/entry_test.go
Normal file
12
internal/cli/entry_test.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestBuild(t *testing.T) {
|
||||
m := &CLIApp{}
|
||||
assert.NotNil(t, m)
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func (mfa *CLIApp) fetchManifestOperation(c *cli.Context) error {
|
||||
fmt.Println("fetchManifestOperation()")
|
||||
log.Debugf("fetchManifestOperation()")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
log "github.com/visionmedia/go-cli-log"
|
||||
|
||||
"github.com/pterm/pterm"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/apex/log"
|
||||
acli "github.com/apex/log/handlers/cli"
|
||||
)
|
||||
|
||||
type CLIApp struct {
|
||||
@@ -48,6 +49,9 @@ func (mfa *CLIApp) run() {
|
||||
mfa.disableStyling()
|
||||
}
|
||||
|
||||
log.SetHandler(acli.Default)
|
||||
log.SetLevel(log.InfoLevel)
|
||||
|
||||
mfa.app = &cli.App{
|
||||
Name: mfa.appname,
|
||||
Usage: "Manifest generator",
|
||||
@@ -65,6 +69,12 @@ func (mfa *CLIApp) run() {
|
||||
Aliases: []string{"q"},
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
if c.Bool("verbose") {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
Commands: []*cli.Command{
|
||||
{
|
||||
Name: "generate",
|
||||
@@ -137,6 +147,6 @@ func (mfa *CLIApp) run() {
|
||||
err := mfa.app.Run(os.Args)
|
||||
if err != nil {
|
||||
mfa.exitCode = 1
|
||||
log.Error(err)
|
||||
log.WithError(err).Debugf("exiting")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user