Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

cue cmd: improve error message for non-existing commands #479

Closed
edwintorok opened this issue Aug 5, 2020 · 3 comments
Closed

cue cmd: improve error message for non-existing commands #479

edwintorok opened this issue Aug 5, 2020 · 3 comments
Labels
NeedsFix roadmap/errors Related to improving error messages.

Comments

@edwintorok
Copy link

edwintorok commented Aug 5, 2020

What version of CUE are you using (cue version)?

$ cue version
v0.2.2

(also reproduced on latest master version)

Does this issue reproduce with the latest release?

Yes, tested v0.2.2 and v0.3.0-alpha1.0.20200730155834-304b02e40842, different error message though.

What did you do?

cat >prompter_tool.cue <<EOF
package foo

import (
        "tool/cli"
        "tool/exec"
        "tool/file"
)

city: "Amsterdam"

// Say hello!
command: prompter: {
        // save transcript to this file
        var: file: *"out.txt" | string @tag(file)

        ask: cli.Ask & {
                prompt:   "What is your name?"
                response: string
        }

        // starts after ask
        echo: exec.Run & {
                cmd:    ["echo", "Hello", ask.response + "!"]
                stdout: string // capture stdout
        }

        // starts after echo
        file.Append & {
                filename: var.file
                contents: echo.stdout
        }

        // also starts after echo
        print: cli.Print & {
                text: echo.stdout
        }
}
EOF

What did you expect to see?

Example from go help cmd working (1st one does, 2nd one doesn't).
A prompt and then a message on stdout.

What did you see instead?

v0.2.2 no prompt, and:

go/bin/cue cmd -v prompter
command.prompter.contents: invalid bytes argument for field "contents": non-concrete value string:
    ./prompter_tool.cue:12:10

v0.3.0-alpha1.0.20200730155834-304b02e40842 no prompt, and:

go/bin/cue cmd -v prompter
command.prompter.contents: invalid bytes argument for field "contents": incomplete cause disjunction:
    ./prompter_tool.cue:12:10
@chai2010
Copy link
Contributor

chai2010 commented Aug 6, 2020

see #467 #468

@mpvl mpvl added roadmap/errors Related to improving error messages. and removed NeedsFix labels Sep 30, 2020
@mpvl
Copy link
Contributor

mpvl commented Sep 30, 2020

This should be fixed with Ask now being supported. Obviously, there is another problem here in that it should have reported that as an error, and not the obscure errors it returned instead. So keeping this open for now.

@mpvl mpvl changed the title cue cmd: 2nd example from documentation doesn't work cue cmd: improve error message for non-existing commands Sep 30, 2020
@mpvl mpvl added the NeedsFix label Nov 28, 2020
@mpvl mpvl closed this as completed in bbe493a Nov 29, 2020
@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#479.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
NeedsFix roadmap/errors Related to improving error messages.
Projects
None yet
Development

No branches or pull requests

4 participants