elvish/pkg/getopt/string.go
Qi Xiao e01e5dd2f5 pkg/getopt: Revamp the API and implementation.
- Don't require creating a Getopt object in the API.

- Add a new Parse function, and rename the existing method to Complete.

- Add an Unknown field to Option to indicate unknown options.

- Rewrite the tests.

- Numerous stylistic changes.
2021-12-31 14:36:01 +00:00

77 lines
2.0 KiB
Go

// Code generated by "stringer -type=Config,Arity,ContextType -output=string.go"; DO NOT EDIT.
package getopt
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[StopAfterDoubleDash-1]
_ = x[StopBeforeFirstNonOption-2]
_ = x[LongOnly-4]
}
const (
_Config_name_0 = "StopAfterDoubleDashStopBeforeFirstNonOption"
_Config_name_1 = "LongOnly"
)
var (
_Config_index_0 = [...]uint8{0, 19, 43}
)
func (i Config) String() string {
switch {
case 1 <= i && i <= 2:
i -= 1
return _Config_name_0[_Config_index_0[i]:_Config_index_0[i+1]]
case i == 4:
return _Config_name_1
default:
return "Config(" + strconv.FormatInt(int64(i), 10) + ")"
}
}
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[NoArgument-0]
_ = x[RequiredArgument-1]
_ = x[OptionalArgument-2]
}
const _Arity_name = "NoArgumentRequiredArgumentOptionalArgument"
var _Arity_index = [...]uint8{0, 10, 26, 42}
func (i Arity) String() string {
if i >= Arity(len(_Arity_index)-1) {
return "Arity(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _Arity_name[_Arity_index[i]:_Arity_index[i+1]]
}
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[OptionOrArgument-0]
_ = x[AnyOption-1]
_ = x[LongOption-2]
_ = x[ChainShortOption-3]
_ = x[OptionArgument-4]
_ = x[Argument-5]
}
const _ContextType_name = "OptionOrArgumentAnyOptionLongOptionChainShortOptionOptionArgumentArgument"
var _ContextType_index = [...]uint8{0, 16, 25, 35, 51, 65, 73}
func (i ContextType) String() string {
if i >= ContextType(len(_ContextType_index)-1) {
return "ContextType(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _ContextType_name[_ContextType_index[i]:_ContextType_index[i+1]]
}