latest
This commit is contained in:
@@ -7,5 +7,6 @@ import (
|
||||
|
||||
func (mfa *CLIApp) fetchManifestOperation(c *cli.Context) error {
|
||||
log.Debugf("fetchManifestOperation()")
|
||||
return nil
|
||||
panic("not implemented")
|
||||
return nil //nolint
|
||||
}
|
||||
|
||||
@@ -8,27 +8,31 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func (mfa *CLIApp) generateManifestOperation(c *cli.Context) error {
|
||||
func (mfa *CLIApp) generateManifestOperation(ctx *cli.Context) error {
|
||||
fmt.Println("generateManifestOperation()")
|
||||
myArgs := c.Args()
|
||||
myArgs := ctx.Args()
|
||||
spew.Dump(myArgs)
|
||||
|
||||
fmt.Printf("%#v\n", c.Args().First())
|
||||
if c.Args().Len() > 0 {
|
||||
fmt.Printf("%#v\n", c.Args().Get(1))
|
||||
fmt.Printf("%#v\n", ctx.Args().First())
|
||||
if ctx.Args().Len() > 0 {
|
||||
fmt.Printf("%#v\n", ctx.Args().Get(1))
|
||||
}
|
||||
|
||||
// fmt.Printf("called with arg: %s\n", c.String("input"))
|
||||
|
||||
opts := &mfer.ManifestScanOptions{
|
||||
IgnoreDotfiles: c.Bool("IgnoreDotfiles"),
|
||||
FollowSymLinks: c.Bool("FollowSymLinks"),
|
||||
IgnoreDotfiles: ctx.Bool("IgnoreDotfiles"),
|
||||
FollowSymLinks: ctx.Bool("FollowSymLinks"),
|
||||
}
|
||||
// FIXME add command flags for ignoring dotfiles and following symlinks
|
||||
mf, err := mfer.NewFromPath(c.String("input"), opts)
|
||||
paths := make([]string, ctx.Args().Len())
|
||||
for i := 0; i < ctx.Args().Len(); i++ {
|
||||
paths = append(paths, ctx.Args().Get(i))
|
||||
}
|
||||
mf, err := mfer.NewFromPaths(opts, paths...)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
mf.WithContext(ctx)
|
||||
|
||||
spew.Dump(mf)
|
||||
|
||||
|
||||
@@ -5,11 +5,9 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"git.eeqj.de/sneak/mfer/internal/log"
|
||||
"github.com/pterm/pterm"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/apex/log"
|
||||
acli "github.com/apex/log/handlers/cli"
|
||||
)
|
||||
|
||||
type CLIApp struct {
|
||||
@@ -26,17 +24,6 @@ func (mfa *CLIApp) printBanner() {
|
||||
pterm.DefaultCenter.Println(s) // Print BigLetters with the default CenterPrinter
|
||||
}
|
||||
|
||||
func (mfa *CLIApp) disableStyling() {
|
||||
pterm.DisableColor()
|
||||
pterm.DisableStyling()
|
||||
pterm.Debug.Prefix.Text = ""
|
||||
pterm.Info.Prefix.Text = ""
|
||||
pterm.Success.Prefix.Text = ""
|
||||
pterm.Warning.Prefix.Text = ""
|
||||
pterm.Error.Prefix.Text = ""
|
||||
pterm.Fatal.Prefix.Text = ""
|
||||
}
|
||||
|
||||
func (mfa *CLIApp) VersionString() string {
|
||||
return fmt.Sprintf("%s (%s)", mfa.version, mfa.gitrev)
|
||||
}
|
||||
@@ -46,11 +33,10 @@ func (mfa *CLIApp) run() {
|
||||
|
||||
if NO_COLOR {
|
||||
// shoutout to rob pike who thinks it's juvenile
|
||||
mfa.disableStyling()
|
||||
log.DisableStyling()
|
||||
}
|
||||
|
||||
log.SetHandler(acli.Default)
|
||||
log.SetLevel(log.InfoLevel)
|
||||
log.Init()
|
||||
|
||||
mfa.app = &cli.App{
|
||||
Name: mfa.appname,
|
||||
@@ -71,7 +57,7 @@ func (mfa *CLIApp) run() {
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
if c.Bool("verbose") {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
log.IncreaseLevel()
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user