This commit is contained in:
parent
b4cb97f6d0
commit
44a5b664a0
|
|
@ -265,22 +265,6 @@ var TextFilters = map[string]TextProcessor{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"ucl-evaluate": {
|
|
||||||
Label: "UCL: Evaluate",
|
|
||||||
Description: "Evaluates the input as a UCL expression and displays the result in the status bar.",
|
|
||||||
Analyze: func(ctx context.Context, input string) (result string, err error) {
|
|
||||||
res, err := uclInstFromContext(ctx).EvalString(ctx, input)
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, ucl.ErrNotConvertable) {
|
|
||||||
return "Evaluated successfully. No result.", err
|
|
||||||
}
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf("Result: %v", res), nil
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
"sort-lines-asc": {
|
"sort-lines-asc": {
|
||||||
Label: "Lines: Sort A-Z",
|
Label: "Lines: Sort A-Z",
|
||||||
Filter: func(ctx context.Context, input string) (resp TextFilterResponse, err error) {
|
Filter: func(ctx context.Context, input string) (resp TextFilterResponse, err error) {
|
||||||
|
|
@ -356,22 +340,6 @@ var TextFilters = map[string]TextProcessor{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"ucl-replace": {
|
|
||||||
Label: "UCL: Replace",
|
|
||||||
Description: "Evaluates the input as a UCL expression and replaces it with the result.",
|
|
||||||
Filter: func(ctx context.Context, input string) (resp TextFilterResponse, err error) {
|
|
||||||
res, err := uclInstFromContext(ctx).EvalString(ctx, input)
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, ucl.ErrNotConvertable) {
|
|
||||||
return TextFilterResponse{}, err
|
|
||||||
}
|
|
||||||
return TextFilterResponse{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return TextFilterResponse{Output: fmt.Sprint(res)}, nil
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type strPseudoVar struct {
|
type strPseudoVar struct {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue