Skip to content

Commit

Permalink
several similar, main commands should be more consistemnt
Browse files Browse the repository at this point in the history
  • Loading branch information
verdverm committed May 25, 2020
1 parent 93a3833 commit cd1e5db
Show file tree
Hide file tree
Showing 94 changed files with 2,944 additions and 139 deletions.
4 changes: 4 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ var CreateCmd = &cobra.Command{

Use: "create",

Aliases: []string{
"c",
},

Short: "create resources",

Long: createLong,
Expand Down
4 changes: 4 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ func init() {
DatamodelCmd.SetHelpFunc(thelp)
DatamodelCmd.SetUsageFunc(tusage)

DatamodelCmd.AddCommand(cmddatamodel.CreateCmd)
DatamodelCmd.AddCommand(cmddatamodel.GetCmd)
DatamodelCmd.AddCommand(cmddatamodel.SetCmd)
DatamodelCmd.AddCommand(cmddatamodel.EditCmd)
DatamodelCmd.AddCommand(cmddatamodel.DeleteCmd)
DatamodelCmd.AddCommand(cmddatamodel.StatusCmd)
DatamodelCmd.AddCommand(cmddatamodel.VisualizeCmd)
DatamodelCmd.AddCommand(cmddatamodel.DiffCmd)
Expand Down
4 changes: 4 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ var ApplyCmd = &cobra.Command{

Use: "apply",

Aliases: []string{
"a",
},

Short: "apply a migraion sequence against a data store",

Long: applyLong,
Expand Down
77 changes: 77 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package cmddatamodel

import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

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

var createLong = `create data models`

func CreateRun(args []string) (err error) {

// you can safely comment this print out
fmt.Println("not implemented")

return err
}

var CreateCmd = &cobra.Command{

Use: "create",

Aliases: []string{
"c",
},

Short: "create data models",

Long: createLong,

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

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

},

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

// Argument Parsing

err = CreateRun(args)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
},
}

func init() {

help := CreateCmd.HelpFunc()
usage := CreateCmd.UsageFunc()

thelp := func(cmd *cobra.Command, args []string) {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c+"/help", "<omit>", 0)
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c+"/usage", "<omit>", 0)
return usage(cmd)
}
CreateCmd.SetHelpFunc(thelp)
CreateCmd.SetUsageFunc(tusage)

}
77 changes: 77 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package cmddatamodel

import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

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

var deleteLong = `find and delete data models`

func DeleteRun(args []string) (err error) {

// you can safely comment this print out
fmt.Println("not implemented")

return err
}

var DeleteCmd = &cobra.Command{

Use: "delete",

Aliases: []string{
"del",
},

Short: "find and delete data models",

Long: deleteLong,

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

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

},

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

// Argument Parsing

err = DeleteRun(args)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
},
}

func init() {

help := DeleteCmd.HelpFunc()
usage := DeleteCmd.UsageFunc()

thelp := func(cmd *cobra.Command, args []string) {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c+"/help", "<omit>", 0)
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c+"/usage", "<omit>", 0)
return usage(cmd)
}
DeleteCmd.SetHelpFunc(thelp)
DeleteCmd.SetUsageFunc(tusage)

}
4 changes: 4 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ var DiffCmd = &cobra.Command{

Use: "diff",

Aliases: []string{
"d",
},

Short: "show the current diff for a data model",

Long: diffLong,
Expand Down
77 changes: 77 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/edit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package cmddatamodel

import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

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

var editLong = `find and edit data models`

func EditRun(args []string) (err error) {

// you can safely comment this print out
fmt.Println("not implemented")

return err
}

var EditCmd = &cobra.Command{

Use: "edit",

Aliases: []string{
"e",
},

Short: "find and edit data models",

Long: editLong,

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

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

},

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

// Argument Parsing

err = EditRun(args)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
},
}

func init() {

help := EditCmd.HelpFunc()
usage := EditCmd.UsageFunc()

thelp := func(cmd *cobra.Command, args []string) {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c+"/help", "<omit>", 0)
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c+"/usage", "<omit>", 0)
return usage(cmd)
}
EditCmd.SetHelpFunc(thelp)
EditCmd.SetUsageFunc(tusage)

}
4 changes: 4 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ var GetCmd = &cobra.Command{

Use: "get",

Aliases: []string{
"g",
},

Short: "find and display data models",

Long: getLong,
Expand Down
7 changes: 7 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ var HistoryCmd = &cobra.Command{

Use: "history",

Aliases: []string{
"hist",
"h",
"log",
"l",
},

Short: "show the history for a data model",

Long: historyLong,
Expand Down
6 changes: 6 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ var MigrateCmd = &cobra.Command{

Use: "migrate",

Aliases: []string{
"mig",
"migs",
"migrations",
},

Short: "calculate a changeset for a data model",

Long: migrateLong,
Expand Down
77 changes: 77 additions & 0 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/set.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package cmddatamodel

import (
"fmt"
"os"

"strings"

"github.com/spf13/cobra"

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

var setLong = `find and configure data models`

func SetRun(args []string) (err error) {

// you can safely comment this print out
fmt.Println("not implemented")

return err
}

var SetCmd = &cobra.Command{

Use: "set",

Aliases: []string{
"s",
},

Short: "find and configure data models",

Long: setLong,

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

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

},

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

// Argument Parsing

err = SetRun(args)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
},
}

func init() {

help := SetCmd.HelpFunc()
usage := SetCmd.UsageFunc()

thelp := func(cmd *cobra.Command, args []string) {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c+"/help", "<omit>", 0)
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
cs := strings.Fields(cmd.CommandPath())
c := strings.Join(cs[1:], "/")
ga.SendGaEvent(c+"/usage", "<omit>", 0)
return usage(cmd)
}
SetCmd.SetHelpFunc(thelp)
SetCmd.SetUsageFunc(tusage)

}
Loading

0 comments on commit cd1e5db

Please sign in to comment.