Skip to content

Commit

Permalink
sweet updates from hofmod-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
verdverm committed May 8, 2020
1 parent b657639 commit 7b77b4f
Show file tree
Hide file tree
Showing 93 changed files with 1,202 additions and 108 deletions.
14 changes: 7 additions & 7 deletions cmd/hof/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ builds:

ldflags:
- -s -w
- -X github.com/hofstadter-io/hof/cmd/hof/cmd.Version={{.Version}}
- -X github.com/hofstadter-io/hof/cmd/hof/cmd.Commit={{.FullCommit}}
- -X github.com/hofstadter-io/hof/cmd/hof/cmd.BuildDate={{.Date}}
- -X github.com/hofstadter-io/hof/cmd/hof/cmd.GoVersion=go1.14
- -X github.com/hofstadter-io/hof/cmd/hof/cmd.BuildOS={{.Os}}
- -X github.com/hofstadter-io/hof/cmd/hof/cmd.BuildArch={{.Arch}}
- -X github.com/hofstadter-io/hof/cmd/hof/cmd.BuildArm={{.Arm}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.Version={{.Version}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.Commit={{.FullCommit}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildDate={{.Date}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.GoVersion=go1.14
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildOS={{.Os}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildArch={{.Arch}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildArm={{.Arm}}

env:
- CGO_ENABLED=0
Expand Down
21 changes: 21 additions & 0 deletions cmd/hof/cmd/auth.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package cmd

import (
"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/cmd/auth"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var authLong = `authentication subcommands`
Expand All @@ -15,8 +19,25 @@ var AuthCmd = &cobra.Command{
Short: "authentication subcommands",

Long: authLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},
}

func init() {
hf := AuthCmd.HelpFunc()
f := func(cmd *cobra.Command, args []string) {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
as := strings.Join(args, "/")
ga.SendGaEvent(c+"/help", as, 0)
hf(cmd, args)
}
AuthCmd.SetHelpFunc(f)
AuthCmd.AddCommand(cmdauth.LoginCmd)
}
12 changes: 12 additions & 0 deletions cmd/hof/cmd/auth/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var loginLong = `login to an account`
Expand All @@ -22,6 +26,14 @@ var LoginCmd = &cobra.Command{

Long: loginLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
21 changes: 21 additions & 0 deletions cmd/hof/cmd/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package cmd

import (
"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/cmd/config"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var configLong = `configuration subcommands`
Expand All @@ -15,9 +19,26 @@ var ConfigCmd = &cobra.Command{
Short: "configuration subcommands",

Long: configLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},
}

func init() {
hf := ConfigCmd.HelpFunc()
f := func(cmd *cobra.Command, args []string) {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
as := strings.Join(args, "/")
ga.SendGaEvent(c+"/help", as, 0)
hf(cmd, args)
}
ConfigCmd.SetHelpFunc(f)
ConfigCmd.AddCommand(cmdconfig.TestCmd)
ConfigCmd.AddCommand(cmdconfig.ListCmd)
ConfigCmd.AddCommand(cmdconfig.GetCmd)
Expand Down
12 changes: 12 additions & 0 deletions cmd/hof/cmd/config/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var getLong = `print a configuration`
Expand All @@ -22,6 +26,14 @@ var GetCmd = &cobra.Command{

Long: getLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
12 changes: 12 additions & 0 deletions cmd/hof/cmd/config/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var listLong = `list configurations`
Expand All @@ -22,6 +26,14 @@ var ListCmd = &cobra.Command{

Long: listLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
12 changes: 12 additions & 0 deletions cmd/hof/cmd/config/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var setLong = `set configuration values`
Expand All @@ -22,6 +26,14 @@ var SetCmd = &cobra.Command{

Long: setLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
12 changes: 12 additions & 0 deletions cmd/hof/cmd/config/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var testLong = `test your auth configuration, defaults to current`
Expand All @@ -22,6 +26,14 @@ var TestCmd = &cobra.Command{

Long: testLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
12 changes: 12 additions & 0 deletions cmd/hof/cmd/config/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var useLong = `set the default configuration`
Expand All @@ -22,6 +26,14 @@ var UseCmd = &cobra.Command{

Long: useLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
12 changes: 12 additions & 0 deletions cmd/hof/cmd/cue.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var cueLong = `Hof has cuelang embedded, so you can use hof anywhere you use cue`
Expand All @@ -26,6 +30,14 @@ var CueCmd = &cobra.Command{

Long: cueLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
14 changes: 13 additions & 1 deletion cmd/hof/cmd/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/lib"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var genLong = ` generate all the things, from code to data to config...`
Expand Down Expand Up @@ -45,6 +49,14 @@ var GenCmd = &cobra.Command{

Long: genLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand All @@ -56,4 +68,4 @@ var GenCmd = &cobra.Command{
os.Exit(1)
}
},
}
}
21 changes: 21 additions & 0 deletions cmd/hof/cmd/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/cmd/mod"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var modLong = `Hof has mvs embedded, so you can do all the same things from this subcommand`
Expand All @@ -28,6 +32,14 @@ var ModCmd = &cobra.Command{

Long: modLong,

PreRun: func(cmd *cobra.Command, args []string) {

cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c, strings.Join(args, "/"), 0)

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand All @@ -42,6 +54,15 @@ var ModCmd = &cobra.Command{
}

func init() {
hf := ModCmd.HelpFunc()
f := func(cmd *cobra.Command, args []string) {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
as := strings.Join(args, "/")
ga.SendGaEvent(c+"/help", as, 0)
hf(cmd, args)
}
ModCmd.SetHelpFunc(f)
ModCmd.AddCommand(cmdmod.InfoCmd)
ModCmd.AddCommand(cmdmod.ConvertCmd)
ModCmd.AddCommand(cmdmod.GraphCmd)
Expand Down
Loading

0 comments on commit 7b77b4f

Please sign in to comment.