diff options
| -rw-r--r-- | flags/flags.go | 17 | ||||
| -rw-r--r-- | main.go | 10 | ||||
| -rw-r--r-- | version.txt | 1 |
3 files changed, 20 insertions, 8 deletions
diff --git a/flags/flags.go b/flags/flags.go index 19cc84b..a513019 100644 --- a/flags/flags.go +++ b/flags/flags.go @@ -3,12 +3,13 @@ package flags import "github.com/spf13/pflag" var ( - Here = pflag.BoolP("here", "h", false, "run target in current directory instead of source location") - At = pflag.StringP("at", "@", "", "override run location") - Single = pflag.BoolP("singgle", "s", false, "do not run any triggers") - All = pflag.BoolP("all", "a", false, "get sources from cache instead of crawling") - Dry = pflag.BoolP("dry", "d", false, "print cmdlines instead of running them") - Root = pflag.BoolP("root", "r", false, "run targets (including triggers) with sudo") - Yes = pflag.BoolP("yes", "y", false, "auto-confirm y/n confirmations") - Env = pflag.StringArray("env", nil, "environment files or pre- or suffix") + Here = pflag.BoolP("here", "h", false, "run target in current directory instead of source location") + At = pflag.StringP("at", "@", "", "override run location") + Single = pflag.BoolP("singgle", "s", false, "do not run any triggers") + All = pflag.BoolP("all", "a", false, "get sources from cache instead of crawling") + Dry = pflag.BoolP("dry", "d", false, "print cmdlines instead of running them") + Root = pflag.BoolP("root", "r", false, "run targets (including triggers) with sudo") + Yes = pflag.BoolP("yes", "y", false, "auto-confirm y/n confirmations") + Env = pflag.StringArray("env", nil, "environment files or pre- or suffix") + Version = pflag.BoolP("version", "v", false, "print version and exit") ) @@ -1,6 +1,7 @@ package main import ( + _ "embed" "github.com/spf13/pflag" "os" "pik/cache" @@ -37,8 +38,17 @@ var hydrators = []model.Hydrator{ var ForceConfirm = false +// go:embed version.txt +var version string + func main() { pflag.Parse() + + if *flags.Version { + _, _ = spool.Print("%s\n", version) + os.Exit(0) + } + for _, i := range initializers { err := i.Init() if err != nil { diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..8a9ecc2 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.0.1
\ No newline at end of file |
