mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Export default parser
Signed-off-by: Derek Nola <derek.nola@suse.com>
(cherry picked from commit 9cc930e4a3
)
This commit is contained in:
parent
d0f7e23328
commit
ff49dcf71e
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultParser = &Parser{
|
var DefaultParser = &Parser{
|
||||||
After: []string{"server", "agent", "etcd-snapshot:1"},
|
After: []string{"server", "agent", "etcd-snapshot:1"},
|
||||||
FlagNames: []string{"--config", "-c"},
|
FlagNames: []string{"--config", "-c"},
|
||||||
EnvName: version.ProgramUpper + "_CONFIG_FILE",
|
EnvName: version.ProgramUpper + "_CONFIG_FILE",
|
||||||
@ -16,7 +16,7 @@ var defaultParser = &Parser{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func MustParse(args []string) []string {
|
func MustParse(args []string) []string {
|
||||||
result, err := defaultParser.Parse(args)
|
result, err := DefaultParser.Parse(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ func Test_UnitMustParse(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
defaultParser.DefaultConfig = tt.config
|
DefaultParser.DefaultConfig = tt.config
|
||||||
if got := MustParse(tt.args); !reflect.DeepEqual(got, tt.want) {
|
if got := MustParse(tt.args); !reflect.DeepEqual(got, tt.want) {
|
||||||
t.Errorf("MustParse() = %+v\nWant = %+v", got, tt.want)
|
t.Errorf("MustParse() = %+v\nWant = %+v", got, tt.want)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user