This commit is contained in:
sneak committed 2022-12-04 13:19:21 +04:00
1 parent 7a8a1b4a4a
commit bc5b2b039a
13 files changed
+202 -43

No files matched your search

+2 -3
View File
@@ -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
View 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)
}
+2 -3
View File
@@ -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
}
+13 -3
View File
@@ -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")
}
}