mfer/internal/cli/gen.go

41 lines
849 B
Go

package cli
import (
"fmt"
"git.eeqj.de/sneak/mfer/mfer"
"github.com/davecgh/go-spew/spew"
"github.com/urfave/cli/v2"
)
func (mfa *CLIApp) generateManifestOperation(ctx *cli.Context) error {
fmt.Println("generateManifestOperation()")
myArgs := ctx.Args()
spew.Dump(myArgs)
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: ctx.Bool("IgnoreDotfiles"),
FollowSymLinks: ctx.Bool("FollowSymLinks"),
}
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)
return nil
}