mfer/internal/cli/gen.go

41 lines
849 B
Go
Raw Normal View History

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