diff --git a/pkg/command/parsing.go b/pkg/command/parsing.go index 1eb6593..264a92c 100644 --- a/pkg/command/parsing.go +++ b/pkg/command/parsing.go @@ -1,47 +1,10 @@ package command -import ( - "errors" - - "gopkg.in/yaml.v3" -) - -type Parsing int +type Parsing string const ( - DEFAULT Parsing = iota // INTERSPERSED but allows implicit changes - INTERSPERSED // mixed flags and positional arguments - NON_INTERSPERSED // flag parsing stopped after first positional argument - DISABLED // flag parsing disabled + DEFAULT Parsing = "" // INTERSPERSED but allows implicit changes + INTERSPERSED Parsing = "interspersed" // mixed flags and positional arguments + NON_INTERSPERSED Parsing = "non-interspersed" // flag parsing stopped after first positional argument + DISABLED Parsing = "disabled" // flag parsing disabled ) - -func (p Parsing) MarshalYAML() (interface{}, error) { - switch p { - case DEFAULT: - return "", nil - case INTERSPERSED: - return "interspersed", nil - case NON_INTERSPERSED: - return "non-interspersed", nil - case DISABLED: - return "disabled", nil - default: - return "", errors.New("unknown parsing mode") - } -} - -func (p *Parsing) UnmarshalYAML(value *yaml.Node) error { - switch value.Value { - case "": - *p = DEFAULT - case "interspersed": - *p = INTERSPERSED - case "non-interspersed": - *p = NON_INTERSPERSED - case "disabled": - *p = DISABLED - default: - return errors.New("unknown parsing mode") - } - return nil -}