Conversation
|
This pull request has been linked to Shortcut Story #235703: create command to create a new flag. |
| "ld-cli/internal/flags" | ||
| ) | ||
|
|
||
| func NewCreateCmd() *cobra.Command { |
There was a problem hiding this comment.
This is the same as the projects version only it calls the flags API.
| panic(err) | ||
| } | ||
|
|
||
| cmd.Flags().String("projKey", "", "Input data in JSON") |
There was a problem hiding this comment.
This is a new flag since we need it to create a feature flag.
|
|
||
| var data inputData | ||
| err := json.Unmarshal([]byte(cmd.Flags().Lookup("data").Value.String()), &data) | ||
| // err := json.Unmarshal([]byte(viper.GetString("data")), &data) |
There was a problem hiding this comment.
I don't know why this isn't populating. I'll come back to it later.
| "", | ||
| "Input data in JSON", | ||
| ) | ||
| cmd.Flags().StringP("data", "d", "", "Input data in JSON") |
There was a problem hiding this comment.
We don't need the local var, so I changed the function.
|
|
||
| var data inputData | ||
| err := json.Unmarshal([]byte(dataStr), &data) | ||
| err := json.Unmarshal([]byte(viper.GetString("data")), &data) |
| "ld-cli/internal/errors" | ||
| ) | ||
|
|
||
| type Client interface { |
There was a problem hiding this comment.
We may not need a client per resource, but it does keep the interfaces smaller than one big one.
| } | ||
|
|
||
| func (m flagToggleModel) toggleFlag() error { | ||
| func (m flagToggleModel) toggleFlag() error { //nolint:unused |
There was a problem hiding this comment.
Added these for the pre-commit linter.
| panic(err) | ||
| } | ||
|
|
||
| cmd.Flags().String("projKey", "", "Input data in JSON") |
There was a problem hiding this comment.
| cmd.Flags().String("projKey", "", "Input data in JSON") | |
| cmd.Flags().String("projKey", "", "Project key string") |
| fmt.Println(">>> err") | ||
| spew.Dump(err) |
There was a problem hiding this comment.
left in some debugging statements
| } | ||
|
|
||
| func (m flagToggleModel) toggleFlag() error { | ||
| func (m flagToggleModel) toggleFlag() error { //nolint:unused |
Adds a
flags createcommand similar toprojects create. We'll use this in the setup wizard.