Skip to content

cmd/cue: fix should be able to process CUE from stdin #3417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jpluscplusm opened this issue Aug 31, 2024 · 2 comments
Closed

cmd/cue: fix should be able to process CUE from stdin #3417

jpluscplusm opened this issue Aug 31, 2024 · 2 comments
Labels
FeatureRequest New feature or request

Comments

@jpluscplusm
Copy link
Collaborator

jpluscplusm commented Aug 31, 2024

Is your feature request related to a problem? Please describe.

I have processes that need to operate inside an isolated container, consuming stdin and communicating via stdout.
One of the processes I'd like to run in this way is cue fix - but I can't, as it only consumes named packages (or files?) it can find via the filesytem.

Describe the solution you'd like

I'd like cue fix to accept CUE that needs fixing on stdin, and emit the fixed result to stdout.
I'd like this test to pass:

cp orig.cue unfixed.cue
exec cue fix unfixed.cue
cmp unfixed.cue fixed.cue

stdin orig.cue
exec cue fix -
cmp stdout fixed.cue
-- orig.cue --
x: 5 mod 3
-- fixed.cue --
x: __mod(5, 3)

Describe alternatives you've considered

n/a.

Additional context

n/a

@jpluscplusm jpluscplusm added FeatureRequest New feature or request Triage Requires triage/attention labels Aug 31, 2024
@mvdan
Copy link
Member

mvdan commented Sep 2, 2024

Here is a version of your testscript without needing a shell:

cp orig.cue unfixed.cue
exec cue fix unfixed.cue
cmp unfixed.cue fixed.cue

stdin orig.cue
exec cue fix -
cmp stdout fixed.cue
-- orig.cue --
x: 5 mod 3
-- fixed.cue --
x: __mod(5, 3)

cue fix - indeed seems to be a no-op:

> stdin orig.cue
> exec cue fix -
> cmp stdout fixed.cue
diff stdout fixed.cue
--- stdout
+++ fixed.cue
@@ -0,0 +1,1 @@
+x: __mod(5, 3)

This could be related to #3405.

@jpluscplusm
Copy link
Collaborator Author

Here is a version of your testscript without needing a shell:

Thanks - I didn't know stdin could work like that! I've edited my original comment to include your updated example.

@cueckoo cueckoo closed this as completed in c0fdf75 Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants