Skip to content

Commit

Permalink
feat(cmd): add --jsonnet-implemenation flag to tk eval (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
Duologic committed Feb 15, 2024
1 parent 072ec44 commit 1975c28
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/tk/jsonnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ func evalCmd() *cli.Command {
}

evalPattern := cmd.Flags().StringP("eval", "e", "", "Evaluate expression on output of jsonnet")
jsonnetImplementation := cmd.Flags().String("jsonnet-implementation", "go", "Use `go` to use native go-jsonnet implementation and `binary:<path>` to delegate evaluation to a binary (with the same API as the regular `jsonnet` binary, see the BinaryImplementation docstrings for more details)")

getJsonnetOpts := jsonnetFlags(cmd.Flags())

cmd.Run = func(cmd *cli.Command, args []string) error {
jsonnetOpts := tanka.Opts{
JsonnetOpts: getJsonnetOpts(),
JsonnetImplementation: *jsonnetImplementation,
JsonnetOpts: getJsonnetOpts(),
}
if *evalPattern != "" {
jsonnetOpts.EvalScript = tanka.PatternEvalScript(*evalPattern)
Expand Down

0 comments on commit 1975c28

Please sign in to comment.