Skip to content

Commit

Permalink
cli/list: move dm list to shared implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Worm committed May 18, 2024
1 parent a485910 commit 9b8a219
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 62 deletions.
3 changes: 2 additions & 1 deletion lib/datamodel/cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (
"github.com/hofstadter-io/hof/cmd/hof/flags"
"github.com/hofstadter-io/hof/lib/datamodel"
"github.com/hofstadter-io/hof/lib/runtime"
"github.com/hofstadter-io/hof/lib/yagu"
)

func list(R *runtime.Runtime, dflags flags.DatamodelPflagpole) error {
return printAsTable(
return yagu.PrintAsTable(
[]string{"Name", "Type", "Version", "Status", "ID"},
func(table *tablewriter.Table) ([][]string, error) {
var rows = make([][]string, 0, len(R.Datamodels))
Expand Down
42 changes: 0 additions & 42 deletions lib/datamodel/cmd/table.go

This file was deleted.

4 changes: 1 addition & 3 deletions lib/datamodel/cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ func findMaxLabelLen(R *runtime.Runtime, dflags flags.DatamodelPflagpole) int {
}
}
return max
}


}
16 changes: 0 additions & 16 deletions lib/gen/cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,4 @@ func List(args []string, rflags flags.RootPflagpole, gflags flags.GenFlagpole) e
return rows, nil
},
)

// // TODO...
// // 1. use table printer
// // 2. move this command up, large blocks of this ought
// gens := make([]string, 0, len(R.Generators))
// for _, G := range R.Generators {
// gens = append(gens, G.Hof.Metadata.Name)
// }
// if len(gens) == 0 {
// return fmt.Errorf("no generators found")
// }
// fmt.Printf("Available Generators\n ")
// fmt.Println(strings.Join(gens, "\n "))

// // print gens
// return nil
}

0 comments on commit 9b8a219

Please sign in to comment.