2020-01-13 09:11:56 +00:00
|
|
|
package cmd
|
|
|
|
|
2022-11-10 08:21:18 +00:00
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"github.com/spf13/pflag"
|
|
|
|
)
|
|
|
|
|
|
|
|
type boolFlag interface {
|
|
|
|
pflag.Value
|
|
|
|
IsExplicitySet() bool
|
|
|
|
IsSet() bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type unwrapScalarFlagStrc struct {
|
|
|
|
explicitySet bool
|
|
|
|
value bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func newFlag() boolFlag {
|
|
|
|
return &unwrapScalarFlagStrc{value: true}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *unwrapScalarFlagStrc) IsExplicitySet() bool {
|
|
|
|
return f.explicitySet
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *unwrapScalarFlagStrc) IsSet() bool {
|
|
|
|
return f.value
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *unwrapScalarFlagStrc) String() string {
|
|
|
|
return strconv.FormatBool(f.value)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *unwrapScalarFlagStrc) Set(value string) error {
|
|
|
|
|
|
|
|
v, err := strconv.ParseBool(value)
|
|
|
|
f.value = v
|
|
|
|
f.explicitySet = true
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*unwrapScalarFlagStrc) Type() string {
|
|
|
|
return "bool"
|
|
|
|
}
|
|
|
|
|
|
|
|
var unwrapScalarFlag = newFlag()
|
|
|
|
|
|
|
|
var unwrapScalar = false
|
2020-11-13 03:07:11 +00:00
|
|
|
|
2020-11-29 09:25:47 +00:00
|
|
|
var writeInplace = false
|
2020-01-13 09:11:56 +00:00
|
|
|
var outputToJSON = false
|
2021-07-25 08:08:33 +00:00
|
|
|
var outputFormat = "yaml"
|
2021-12-21 04:02:07 +00:00
|
|
|
var inputFormat = "yaml"
|
|
|
|
|
2020-11-30 05:35:21 +00:00
|
|
|
var exitStatus = false
|
2020-10-27 05:45:16 +00:00
|
|
|
var forceColor = false
|
|
|
|
var forceNoColor = false
|
2020-02-27 13:29:13 +00:00
|
|
|
var colorsEnabled = false
|
2020-02-03 05:52:12 +00:00
|
|
|
var indent = 2
|
2020-11-13 02:35:59 +00:00
|
|
|
var noDocSeparators = false
|
2020-11-06 03:37:01 +00:00
|
|
|
var nullInput = false
|
2020-01-13 09:11:56 +00:00
|
|
|
var verbose = false
|
|
|
|
var version = false
|
2020-12-28 00:40:41 +00:00
|
|
|
var prettyPrint = false
|
2020-11-30 05:05:07 +00:00
|
|
|
|
2021-07-18 02:28:46 +00:00
|
|
|
// can be either "" (off), "extract" or "process"
|
|
|
|
var frontMatter = ""
|
|
|
|
|
2021-10-29 03:14:39 +00:00
|
|
|
var splitFileExp = ""
|
2022-04-29 01:08:41 +00:00
|
|
|
var splitFileExpFile = ""
|
2021-10-29 03:14:39 +00:00
|
|
|
|
2020-11-30 05:05:07 +00:00
|
|
|
var completedSuccessfully = false
|
2022-02-06 22:27:52 +00:00
|
|
|
|
|
|
|
var forceExpression = ""
|
2022-03-01 00:50:09 +00:00
|
|
|
|
|
|
|
var expressionFile = ""
|