Skip to content

Commit

Permalink
rework hof/dm cmds a bit
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Worm <tony@hofstadter.io>
  • Loading branch information
verdverm committed Dec 28, 2021
1 parent 2606792 commit 3e5c27a
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 210 deletions.
3 changes: 1 addition & 2 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ func init() {
DatamodelCmd.SetHelpFunc(help)
DatamodelCmd.SetUsageFunc(usage)

DatamodelCmd.AddCommand(cmddatamodel.GetCmd)
DatamodelCmd.AddCommand(cmddatamodel.ListCmd)
DatamodelCmd.AddCommand(cmddatamodel.StatusCmd)
DatamodelCmd.AddCommand(cmddatamodel.DiffCmd)
DatamodelCmd.AddCommand(cmddatamodel.HistoryCmd)
DatamodelCmd.AddCommand(cmddatamodel.CheckpointCmd)
DatamodelCmd.AddCommand(cmddatamodel.ApplyCmd)

}
73 changes: 0 additions & 73 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/apply.go

This file was deleted.

2 changes: 0 additions & 2 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ var HistoryCmd = &cobra.Command{
Aliases: []string{
"hist",
"h",
"log",
"l",
},

Short: "show the history for a data model",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ import (
"github.com/spf13/cobra"
)

var getLong = `find and display data models`
var listLong = `find and display data models`

func GetRun(args []string) (err error) {
func ListRun(args []string) (err error) {

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

return err
}

var GetCmd = &cobra.Command{
var ListCmd = &cobra.Command{

Use: "get",
Use: "list",

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

Short: "find and display data models",

Long: getLong,
Long: listLong,

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

Expand All @@ -38,7 +38,7 @@ var GetCmd = &cobra.Command{

// Argument Parsing

err = GetRun(args)
err = ListRun(args)
if err != nil {
fmt.Println(err)
os.Exit(1)
Expand All @@ -52,8 +52,8 @@ func init() {
return false
}

ohelp := GetCmd.HelpFunc()
ousage := GetCmd.UsageFunc()
ohelp := ListCmd.HelpFunc()
ousage := ListCmd.UsageFunc()
help := func(cmd *cobra.Command, args []string) {
if extra(cmd) {
return
Expand All @@ -67,7 +67,7 @@ func init() {
return ousage(cmd)
}

GetCmd.SetHelpFunc(help)
GetCmd.SetUsageFunc(usage)
ListCmd.SetHelpFunc(help)
ListCmd.SetUsageFunc(usage)

}
2 changes: 1 addition & 1 deletion .hof/shadow/Cli/cmd/hof/cmd/datamodel/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var StatusCmd = &cobra.Command{
Use: "status",

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

Short: "print the data model status",
Expand Down
3 changes: 1 addition & 2 deletions cmd/hof/cmd/datamodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ func init() {
DatamodelCmd.SetHelpFunc(help)
DatamodelCmd.SetUsageFunc(usage)

DatamodelCmd.AddCommand(cmddatamodel.GetCmd)
DatamodelCmd.AddCommand(cmddatamodel.ListCmd)
DatamodelCmd.AddCommand(cmddatamodel.StatusCmd)
DatamodelCmd.AddCommand(cmddatamodel.DiffCmd)
DatamodelCmd.AddCommand(cmddatamodel.HistoryCmd)
DatamodelCmd.AddCommand(cmddatamodel.CheckpointCmd)
DatamodelCmd.AddCommand(cmddatamodel.ApplyCmd)

}
77 changes: 0 additions & 77 deletions cmd/hof/cmd/datamodel/apply.go

This file was deleted.

4 changes: 1 addition & 3 deletions cmd/hof/cmd/datamodel/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ var HistoryCmd = &cobra.Command{
Aliases: []string{
"hist",
"h",
"log",
"l",
},

Short: "show the history for a data model",
Expand Down Expand Up @@ -77,4 +75,4 @@ func init() {
HistoryCmd.SetHelpFunc(help)
HistoryCmd.SetUsageFunc(usage)

}
}
25 changes: 12 additions & 13 deletions cmd/hof/cmd/datamodel/get.go → cmd/hof/cmd/datamodel/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,32 @@ import (
"github.com/spf13/cobra"

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

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

var getLong = `find and display data models`
var listLong = `find and display data models`

func GetRun(args []string) (err error) {
func ListRun(args []string) (err error) {

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

err = datamodel.RunGetFromArgs(args, flags.DatamodelPflags)
err = datamodel.RunListFromArgs(args, flags.DatamodelPflags)

return err
}

var GetCmd = &cobra.Command{
var ListCmd = &cobra.Command{

Use: "get",
Use: "list",

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

Short: "find and display data models",

Long: getLong,
Long: listLong,

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

Expand All @@ -44,7 +43,7 @@ var GetCmd = &cobra.Command{

// Argument Parsing

err = GetRun(args)
err = ListRun(args)
if err != nil {
fmt.Println(err)
os.Exit(1)
Expand All @@ -58,8 +57,8 @@ func init() {
return false
}

ohelp := GetCmd.HelpFunc()
ousage := GetCmd.UsageFunc()
ohelp := ListCmd.HelpFunc()
ousage := ListCmd.UsageFunc()
help := func(cmd *cobra.Command, args []string) {
if extra(cmd) {
return
Expand All @@ -73,7 +72,7 @@ func init() {
return ousage(cmd)
}

GetCmd.SetHelpFunc(help)
GetCmd.SetUsageFunc(usage)
ListCmd.SetHelpFunc(help)
ListCmd.SetUsageFunc(usage)

}
4 changes: 2 additions & 2 deletions cmd/hof/cmd/datamodel/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var StatusCmd = &cobra.Command{
Use: "status",

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

Short: "print the data model status",
Expand Down Expand Up @@ -74,4 +74,4 @@ func init() {
StatusCmd.SetHelpFunc(help)
StatusCmd.SetUsageFunc(usage)

}
}
Loading

0 comments on commit 3e5c27a

Please sign in to comment.