kcl-lang / kcl

KCL Programming Language (CNCF Sandbox Project). https://kcl-lang.io
https://kcl-lang.io
Apache License 2.0
1.42k stars 110 forks source link

kcl run split stderr and stdout ? #1406

Closed atelsier closed 3 weeks ago

atelsier commented 3 weeks ago

General Question

Hello, i have to do this to make yq work after a kcl run invocation:

kcl run oci://ghcr.io/kcl-lang/podinfo -D replicas=2 | tail +3 | yq

Would it be possible to send information logs to stderr and yaml data to stdout ?

kcl run oci://ghcr.io/kcl-lang/podinfo -D replicas=2 | head -2
the lastest version '0.1.1' will be pulled
pulling '/kcl-lang/podinfo:0.1.1' from 'ghcr.io/kcl-lang/podinfo'
Peefy commented 3 weeks ago

Hello @atelsier

With the latest version of KCL v0.9.0-rc.1 There are two ways to achieve this

  1. Use the -q flag to disable the package downloading log kcl run oci://ghcr.io/kcl-lang/podinfo -D replicas=2 -q
  2. Use the -o flag to output the YAML content to a temp file kcl run oci://ghcr.io/kcl-lang/podinfo -D replicas=2 -o temp.yaml && cat temp.yaml
atelsier commented 3 weeks ago

i was hoping for 2>/dev/null > temp.yaml instead of -q and -o file.yaml

thanks @Peefy