diff --git a/src/bpm-package/go.mod b/src/bpm-package/go.mod index 1ea9f14..dac4e62 100644 --- a/src/bpm-package/go.mod +++ b/src/bpm-package/go.mod @@ -2,8 +2,10 @@ module git.enumerated.dev/bubble-package-manager/bpm-utils/src/bpm-package go 1.23 -require gopkg.in/yaml.v3 v3.0.1 - -require bpm-utils-shared v1.0.0 +require ( + bpm-utils-shared v1.0.0 + github.com/spf13/pflag v1.0.10 + gopkg.in/yaml.v3 v3.0.1 +) replace bpm-utils-shared => ../bpm-utils-shared diff --git a/src/bpm-package/go.sum b/src/bpm-package/go.sum index a62c313..bea0ee8 100644 --- a/src/bpm-package/go.sum +++ b/src/bpm-package/go.sum @@ -1,3 +1,5 @@ +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/src/bpm-package/main.go b/src/bpm-package/main.go index d12a9b9..3a4c23a 100644 --- a/src/bpm-package/main.go +++ b/src/bpm-package/main.go @@ -2,7 +2,6 @@ package main import ( bpmutilsshared "bpm-utils-shared" - "flag" "fmt" "io" "log" @@ -11,14 +10,15 @@ import ( "path/filepath" "strings" + flag "github.com/spf13/pflag" "gopkg.in/yaml.v3" ) -var compile = flag.Bool("c", false, "Compile BPM source package") -var skipCheck = flag.Bool("s", false, "Skip 'check' function while compiling") -var installDepends = flag.Bool("d", false, "Install package dependencies for compilation") -var installPackage = flag.Bool("i", false, "Install compiled BPM package after compilation finishes") -var yesAll = flag.Bool("y", false, "Accept all confirmation prompts") +var compile = flag.BoolP("compile", "c", false, "Compile BPM source package") +var skipCheck = flag.BoolP("skip-checks", "s", false, "Skip 'check' function while compiling") +var installDepends = flag.BoolP("depends", "d", false, "Install package dependencies for compilation") +var installPackage = flag.BoolP("install", "i", false, "Install compiled BPM package after compilation finishes") +var yesAll = flag.BoolP("yes", "y", false, "Accept all confirmation prompts") func main() { // Setup flags and help diff --git a/src/bpm-setup/go.mod b/src/bpm-setup/go.mod index e630f53..fde1bcf 100644 --- a/src/bpm-setup/go.mod +++ b/src/bpm-setup/go.mod @@ -2,7 +2,11 @@ module git.enumerated.dev/bubble-package-manager/bpm-utils/src/bpm-setup go 1.23 -require bpm-utils-shared v1.0.0 +require ( + bpm-utils-shared v1.0.0 + github.com/spf13/pflag v1.0.10 +) + require gopkg.in/yaml.v3 v3.0.1 // indirect replace bpm-utils-shared => ../bpm-utils-shared diff --git a/src/bpm-setup/go.sum b/src/bpm-setup/go.sum index 4bc0337..bea0ee8 100644 --- a/src/bpm-setup/go.sum +++ b/src/bpm-setup/go.sum @@ -1,3 +1,6 @@ +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/src/bpm-setup/main.go b/src/bpm-setup/main.go index defc74a..195630f 100644 --- a/src/bpm-setup/main.go +++ b/src/bpm-setup/main.go @@ -3,7 +3,6 @@ package main import ( bpmutilsshared "bpm-utils-shared" "bufio" - "flag" "fmt" "log" "os" @@ -11,16 +10,18 @@ import ( "path" "path/filepath" "strings" + + flag "github.com/spf13/pflag" ) -var directory = flag.String("D", "", "Path to package directory (required)") -var name = flag.String("n", "", "Set the package name") -var description = flag.String("d", "Default Package Description", "Set the description") -var version = flag.String("v", "1.0", "Set the package version") -var url = flag.String("u", "", "Set the package URL") -var license = flag.String("l", "", "Set the package licenses") -var template = flag.String("t", "gnu-configure", "Set the package template") -var git = flag.Bool("g", true, "Create git repository") +var directory = flag.StringP("directory", "D", "", "Path to package directory") +var name = flag.StringP("name", "n", "", "Set the package name") +var description = flag.StringP("description", "d", "Default Package Description", "Set the description") +var version = flag.StringP("version", "v", "1.0", "Set the package version") +var url = flag.StringP("url", "u", "", "Set the package URL") +var license = flag.StringP("license", "l", "", "Set the package licenses") +var template = flag.StringP("template", "t", "gnu-configure", "Set the package template") +var git = flag.BoolP("git", "g", true, "Create git repository") func main() { // Setup flags and help @@ -29,6 +30,7 @@ func main() { // Show command help if no directory name is given if *directory == "" { + log.Println("Directory flag is required") bpmutilsshared.ShowHelp() os.Exit(1) } diff --git a/src/bpm-utils-shared/go.mod b/src/bpm-utils-shared/go.mod index 4287d93..e9bd07e 100644 --- a/src/bpm-utils-shared/go.mod +++ b/src/bpm-utils-shared/go.mod @@ -2,4 +2,7 @@ module bpm-utils-shared go 1.23 -require gopkg.in/yaml.v3 v3.0.1 // indirect +require ( + github.com/spf13/pflag v1.0.10 + gopkg.in/yaml.v3 v3.0.1 +) diff --git a/src/bpm-utils-shared/go.sum b/src/bpm-utils-shared/go.sum index 4bc0337..bea0ee8 100644 --- a/src/bpm-utils-shared/go.sum +++ b/src/bpm-utils-shared/go.sum @@ -1,3 +1,6 @@ +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/src/bpm-utils-shared/main.go b/src/bpm-utils-shared/main.go index e358925..3682b3b 100644 --- a/src/bpm-utils-shared/main.go +++ b/src/bpm-utils-shared/main.go @@ -1,10 +1,11 @@ package bpm_utils_shared import ( - "flag" "fmt" - "gopkg.in/yaml.v3" "os" + + flag "github.com/spf13/pflag" + "gopkg.in/yaml.v3" ) var usageMsg string