mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 09:04:58 +08:00
Added default value flag - for printing out a value when reading and there are no matches
This commit is contained in:
@@ -104,6 +104,9 @@ func updateStyleOfNode(node *yaml.Node, style yaml.Style) {
|
||||
func printResults(matchingNodes []*yqlib.NodeContext, cmd *cobra.Command) error {
|
||||
if len(matchingNodes) == 0 {
|
||||
log.Debug("no matching results, nothing to print")
|
||||
if defaultValue != "" {
|
||||
cmd.Print(defaultValue)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user