grim/reap
Clone
Summary
Browse
Changes
Graph
Initial revision
draft
2021-03-17, Gary Kramlich
3865cc22cdf3
Parents
Children
3bdf65de94ef
Initial revision
5 files changed, 59 insertions(+), 0 deletions(-)
+7
-0
consts/consts.go
+5
-0
go.mod
+7
-0
go.sum
+25
-0
main.go
+15
-0
version/cmd.go
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/consts/consts.go Wed Mar 17 17:46:12 2021 -0500
@@ -0,0 +1,7 @@
+package consts
+
+const (
+ Name = "reap"
+ Description = "A distro generator"
+ Version = "0.1"
+)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/go.mod Wed Mar 17 17:46:12 2021 -0500
@@ -0,0 +1,5 @@
+module keep.imfreedom.org/grim/reap
+
+go 1.15
+
+require github.com/alecthomas/kong v0.2.16
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/go.sum Wed Mar 17 17:46:12 2021 -0500
@@ -0,0 +1,7 @@
+github.com/alecthomas/kong v0.2.16 h1:F232CiYSn54Tnl1sJGTeHmx4vJDNLVP2b9yCVMOQwHQ=
+github.com/alecthomas/kong v0.2.16/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.go Wed Mar 17 17:46:12 2021 -0500
@@ -0,0 +1,25 @@
+package main
+
+import (
+ "github.com/alecthomas/kong"
+
+ "keep.imfreedom.org/grim/reap/const"
+ "keep.imfreedom.org/grim/reap/version"
+)
+
+type cli struct {
+ Version version.Cmd `kong:"cmd,help='Display the version number and exit'"`
+}
+
+func main() {
+ cli := cli{}
+ ctx := kong.Parse(
+ &cli,
+ kong.Name(consts.Name),
+ kong.Description(consts.Description),
+ kong.UsageOnError(),
+ )
+
+ err := ctx.Run()
+ ctx.FatalIfErrorf(err)
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/version/cmd.go Wed Mar 17 17:46:12 2021 -0500
@@ -0,0 +1,15 @@
+package version
+
+import (
+ "fmt"
+
+ "keep.imfreedom.org/grim/reap/consts"
+)
+
+type Cmd struct{}
+
+func (c *Cmd) Run() error {
+ fmt.Printf("%s version %s\n", consts.Name, consts.Version)
+
+ return nil
+}