1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Fixed linting

This commit is contained in:
Mike Farah
2020-11-13 14:07:11 +11:00
parent f8a700e400
commit af39fc737d
18 changed files with 135 additions and 101 deletions

View File

@@ -1,13 +1,11 @@
package cmd
import (
logging "gopkg.in/op/go-logging.v1"
)
var unwrapScalar = true
var writeInplace = false
// var writeInplace = false
var outputToJSON = false
var exitStatus = false
// var exitStatus = false
var forceColor = false
var forceNoColor = false
var colorsEnabled = false
@@ -17,4 +15,5 @@ var nullInput = false
var verbose = false
var version = false
var shellCompletion = ""
var log = logging.MustGetLogger("yq")
// var log = logging.MustGetLogger("yq")

View File

@@ -11,13 +11,13 @@ func createEvaluateAllCommand() *cobra.Command {
var cmdEvalAll = &cobra.Command{
Use: "eval-all [expression] [yaml_file1]...",
Aliases: []string{"ea"},
Short: "Loads all yaml documents of all yaml files and runs expression once",
Short: "Loads _all_ yaml documents of _all_ yaml files and runs expression once",
Example: `
yq es '.a.b | length' file1.yml file2.yml
yq es < sample.yaml
yq es -n '{"a": "b"}'
`,
Long: "Evaluate All:\nUseful when you need to run an expression across several yaml documents or files. Consumes more memory than eval-seq",
Long: "Evaluate All:\nUseful when you need to run an expression across several yaml documents or files. Consumes more memory than eval",
RunE: evaluateAll,
}
return cmdEvalAll
@@ -56,7 +56,7 @@ func evaluateAll(cmd *cobra.Command, args []string) error {
err = yqlib.EvaluateAllFileStreams("", []string{args[0]}, printer)
}
default:
err = yqlib.EvaluateAllFileStreams(args[0], args[1:len(args)], printer)
err = yqlib.EvaluateAllFileStreams(args[0], args[1:], printer)
}
cmd.SilenceUsage = true

View File

@@ -9,8 +9,8 @@ import (
func createEvaluateSequenceCommand() *cobra.Command {
var cmdEvalSequence = &cobra.Command{
Use: "eval-seq [expression] [yaml_file1]...",
Aliases: []string{"es"},
Use: "eval [expression] [yaml_file1]...",
Aliases: []string{"e"},
Short: "Apply expression to each document in each yaml file given in sequence",
Example: `
yq es '.a.b | length' file1.yml file2.yml
@@ -56,7 +56,7 @@ func evaluateSequence(cmd *cobra.Command, args []string) error {
err = yqlib.EvaluateFileStreamsSequence("", []string{args[0]}, printer)
}
default:
err = yqlib.EvaluateFileStreamsSequence(args[0], args[1:len(args)], printer)
err = yqlib.EvaluateFileStreamsSequence(args[0], args[1:], printer)
}
cmd.SilenceUsage = true