/
transform.go
47 lines (39 loc) · 973 Bytes
/
transform.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"github.com/urfave/cli/v2"
)
var transformCommand = &cli.Command{
Name: "transform",
Aliases: []string{"x"},
Usage: "transform a stream of input data with an expression",
Action: transform,
}
func transform(c *cli.Context) error {
panic("transform|x not implemented (https://github.com/arr-ai/arrai/issues/310)")
// source := c.Args().Get(0)
// expr, err := syntax.Parse(parser.NewScanner(source))
// if err != nil {
// return err
// }
// stream := parser.NewScanner(os.Stdin)
// for {
// if stream.Peek() == syntax.EOF {
// break
// }
// value, err := syntax.Parse(stream)
// if err != nil {
// return err
// }
// global := rel.EmptyScope.With(".", value)
// xvalue, err := expr.Eval(ctx, global, global)
// if err != nil {
// return err
// }
// s := xvalue.String()
// os.Stdout.WriteString(s)
// if s[len(s)-1] != '\n' {
// os.Stdout.Write([]byte{'\n'})
// }
// }
// return nil
}