NewFromCLI builds and compiles a filter by joining all the command line arguments into the filter expression.
(args []string, config *config.Config)
| 109 | |
| 110 | // NewFromCLI builds and compiles a filter by joining all the command line arguments into the filter expression. |
| 111 | func NewFromCLI(args []string, config *config.Config) (Filter, error) { |
| 112 | expr := strings.Join(args, " ") |
| 113 | if expr == "" { |
| 114 | return nil, nil |
| 115 | } |
| 116 | filter := New(expr, config) |
| 117 | if err := filter.Compile(); err != nil { |
| 118 | return nil, fmt.Errorf("bad filter:\n%v", err) |
| 119 | } |
| 120 | return filter, nil |
| 121 | } |
| 122 | |
| 123 | // NewFromCLIWithAllAccessors builds and compiles a filter with all field accessors enabled. |
| 124 | func NewFromCLIWithAllAccessors(args []string) (Filter, error) { |
no test coverage detected