Skip to content

Commit

Permalink
Merge pull request #1099 from oom-ai/move-o
Browse files Browse the repository at this point in the history
refactor: move -o option from 'get' to 'get online'
  • Loading branch information
t0t07 authored Jan 27, 2022
2 parents 5c39dc1 + 1d4037c commit cb15799
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions oomcli/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ import (
"github.com/spf13/cobra"
)

var getOutput *string

var getCmd = &cobra.Command{
Use: "get",
Short: "Get resources",
}

func init() {
rootCmd.AddCommand(getCmd)

flags := getCmd.PersistentFlags()

getOutput = flags.StringP("output", "o", ASCIITable, "output format [csv,ascii_table]")
}
5 changes: 4 additions & 1 deletion oomcli/cmd/get_online.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

var multiGetOpt types.OnlineMultiGetOpt
var getOnlineOutput *string

var getOnlineCmd = &cobra.Command{
Use: "online",
Expand All @@ -29,7 +30,7 @@ var getOnlineCmd = &cobra.Command{
exitf("failed getting online features: %+v", err)
}

if err := printOnlineFeatures(featureValues, *getOutput); err != nil {
if err := printOnlineFeatures(featureValues, *getOnlineOutput); err != nil {
exitf("failed printing online feature values, error %+v\n", err)
}
},
Expand All @@ -45,6 +46,8 @@ func init() {

flags.StringSliceVar(&multiGetOpt.FeatureNames, "feature", nil, "feature full names")
_ = getOnlineCmd.MarkFlagRequired("feature")

getOnlineOutput = flags.StringP("output", "o", ASCIITable, "output format [csv,ascii_table]")
}

func printOnlineFeatures(featureValues map[string]*types.FeatureValues, output string) error {
Expand Down

0 comments on commit cb15799

Please sign in to comment.