kubectl explain: ignore trailing period
kubectl explain ingress.spec.rules.http.paths. is valid and defaults to kubectl explain ingress.spec.rules.http.paths Rational: We use kubectl explain by adding fields (e.g. service, then service.spec, then service.spec.ports ...) so it's very easy to forget a trailing . at the end. We should ignore the trailing period and display the result without it.
This commit is contained in:
@@ -30,6 +30,10 @@ type fieldsPrinter interface {
|
||||
|
||||
func splitDotNotation(model string) (string, []string) {
|
||||
var fieldsPath []string
|
||||
|
||||
// ignore trailing period
|
||||
model = strings.TrimSuffix(model, ".")
|
||||
|
||||
dotModel := strings.Split(model, ".")
|
||||
if len(dotModel) >= 1 {
|
||||
fieldsPath = dotModel[1:]
|
||||
|
Reference in New Issue
Block a user