From 0518fee98e577b7ee785171f6ffc0478e2818cb8 Mon Sep 17 00:00:00 2001 From: Evan Fiordeliso Date: Sun, 12 Nov 2023 14:28:44 -0500 Subject: [PATCH] Remove cmd directory and add comment to go.mod --- cmd/test.go | 53 ----------------------------------------------------- go.mod | 2 +- 2 files changed, 1 insertion(+), 54 deletions(-) delete mode 100644 cmd/test.go diff --git a/cmd/test.go b/cmd/test.go deleted file mode 100644 index ac667ef..0000000 --- a/cmd/test.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -import ( - "fmt" - "os" - - "go.fifitido.net/cmd" - "go.fifitido.net/cmd/opts" -) - -var stringOpt = opts.String("string", "s", "", "example string option") -var intOpt = opts.Int("int", "i", 0, "example int option") -var boolOpt = opts.Bool("bool", "b", false, "example bool option") -var floatOpt = opts.Float("float", "f", 0, "example float option") - -var root = cmd.NewRoot( - cmd.WithShortDescription("Example command"), - cmd.WithLongDescription(`An example command to show how to use go.fifitido.net/cmd - -this example is just a simple hello world program to show -the basics of the library.`), - cmd.WithSubcommand(subcmd), - cmd.WithArgument("name", false), - cmd.WithOptions(stringOpt, intOpt, boolOpt, floatOpt), - cmd.WithRunFunc(func(args []string) { - if len(args) == 0 { - fmt.Println("Hello World!") - } else { - fmt.Printf("Hello %s!\n", args[0]) - } - }), -) - -var subcmd = cmd.New( - "test", - cmd.WithShortDescription("Example command"), - cmd.WithLongDescription(`An example command to show how to use go.fifitido.net/cmd - -this example is just a simple hello world program to show -the basics of the library.`), - cmd.WithArgument("name", false), - cmd.WithRunFunc(func(args []string) { - if len(args) == 0 { - fmt.Println("Hello World!") - } else { - fmt.Printf("Hello %s!\n", args[0]) - } - }), -) - -func main() { - root.Execute(os.Args) -} diff --git a/go.mod b/go.mod index c4149d3..aeabfe9 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module go.fifitido.net/cmd go 1.21.3 -require github.com/spf13/pflag v1.0.5 +require github.com/spf13/pflag v1.0.5 // Used by opts/benchmarks_test.go