-
-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting value to empty string #11
Comments
After reading through the code: func parseValue(argument string) interface{} {
var value, err interface{}
var inQuotes = argument[0] == '"'
if !inQuotes {
value, err = strconv.ParseFloat(argument, 64)
if err == nil {
return value
}
value, err = strconv.ParseBool(argument)
if err == nil {
return value
}
return argument
}
return argument[1 : len(argument)-1]
} The unquoted empty string was passed in, as a result that is not understood. By explicitly passing in the quoted empty string, the result seems to work. The workaround seems to be doing the following: yaml write -i project.yml metadata.pretag '""' The result then look like this: metadata:
name: example
version: 0.4.0
pretag: "" The desired state would result in the following: metadata:
name: example
version: 0.4.0
pretag: |
Ah ok cool :) I've got a fix I should have out soon, need to check the len of arguments in the 'inQuotes' declaration |
Version: 1.10
File: (project.yml)
Command:
yaml write -i project.yml metadata.pretag ''
Response:
Seems like setting a value to empty should be valid, but instead it will panic.
The text was updated successfully, but these errors were encountered: