mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-07 22:35:37 +00:00
- Add ShellVariablesPreferences struct with KeySeparator field (default: '_') - Update shellVariablesEncoder to use configurable separator - Add --shell-key-separator CLI flag - Add comprehensive tests for custom separator functionality - Update documentation with example usage for custom separator This feature allows users to specify a custom separator (e.g. '__') when outputting shell variables, which helps disambiguate nested keys from keys that contain underscores in their names. Example: yq -o=shell --shell-key-separator='__' file.yaml Fixes ambiguity when original YAML keys contain underscores.
15 lines
293 B
Go
15 lines
293 B
Go
package yqlib
|
|
|
|
type ShellVariablesPreferences struct {
|
|
KeySeparator string
|
|
}
|
|
|
|
func NewDefaultShellVariablesPreferences() ShellVariablesPreferences {
|
|
return ShellVariablesPreferences{
|
|
KeySeparator: "_",
|
|
}
|
|
}
|
|
|
|
var ConfiguredShellVariablesPreferences = NewDefaultShellVariablesPreferences()
|
|
|