From 99e89d60d4e7ff56427b1d05601b0edc4fdcf769 Mon Sep 17 00:00:00 2001 From: sneak Date: Sun, 4 Dec 2022 04:48:23 +0400 Subject: [PATCH] latest --- internal/cli/fetch.go | 12 ++++++++++++ internal/cli/gen.go | 10 +++++++++- internal/cli/mfer.go | 11 +++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 internal/cli/fetch.go diff --git a/internal/cli/fetch.go b/internal/cli/fetch.go new file mode 100644 index 0000000..d23f7bb --- /dev/null +++ b/internal/cli/fetch.go @@ -0,0 +1,12 @@ +package cli + +import ( + "fmt" + + "github.com/urfave/cli/v2" +) + +func (mfa *CLIApp) fetchManifestOperation(c *cli.Context) error { + fmt.Println("fetchManifestOperation()") + return nil +} diff --git a/internal/cli/gen.go b/internal/cli/gen.go index 4d3dc69..2d503a3 100644 --- a/internal/cli/gen.go +++ b/internal/cli/gen.go @@ -10,7 +10,15 @@ import ( func (mfa *CLIApp) generateManifestOperation(c *cli.Context) error { fmt.Println("generateManifestOperation()") - fmt.Printf("called with arg: %s\n", c.String("input")) + myArgs := c.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("called with arg: %s\n", c.String("input")) opts := &mfer.ManifestScanOptions{ IgnoreDotfiles: c.Bool("IgnoreDotfiles"), diff --git a/internal/cli/mfer.go b/internal/cli/mfer.go index 00865bd..af7ed40 100644 --- a/internal/cli/mfer.go +++ b/internal/cli/mfer.go @@ -87,6 +87,7 @@ func (mfa *CLIApp) run() { Aliases: []string{"ignore-dotfiles"}, Usage: "Ignore any dot (hidden) files encountered", }, + // FIXME this should be a positional arg &cli.StringFlag{ Name: "input", Value: ".", @@ -119,6 +120,16 @@ func (mfa *CLIApp) run() { return nil }, }, + { + Name: "fetch", + Usage: "fetch manifest and referenced files", + Action: func(c *cli.Context) error { + if !c.Bool("quiet") { + mfa.printBanner() + } + return mfa.fetchManifestOperation(c) + }, + }, }, }