-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Feature Request
It would be useful if there was a way to distinguish between passing a string flag a blank string (command -f "") and the absence of the flag (command).
Currently both will return "" from c.String("f")
Our use case:
We have a command to update a resource via an API. Fields that can be updated are represented by different CLI flags. One of the fields on the resource is a string that can be blank. We would like users to be able to set the field to the blank string.
#Setting the field to non-blank string
command -f "string"
#Setting the field to blank string
command -f ""To do this currently we have to have another flag to reset the field.
command --clear-fieldThis is annoying because it means we have two flags for a single field and have to handle cases where both flags are passed.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels