2022-12-04 07:59:36 +00:00
|
|
|
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 {
|
2022-12-04 07:59:36 +00:00
|
|
|
fmt.Println("generateManifestOperation()")
|
2022-12-05 22:59:08 +00:00
|
|
|
myArgs := ctx.Args()
|
2022-12-04 07:59:36 +00:00
|
|
|
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))
|
2022-12-04 07:59:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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-04 07:59:36 +00:00
|
|
|
}
|
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...)
|
2022-12-04 07:59:36 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2022-12-05 22:59:08 +00:00
|
|
|
mf.WithContext(ctx)
|
2022-12-04 07:59:36 +00:00
|
|
|
|
|
|
|
spew.Dump(mf)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|