Skip to content

Latest commit

 

History

History
74 lines (56 loc) · 2.42 KB

readme.md

File metadata and controls

74 lines (56 loc) · 2.42 KB

Input and output of task

Official documentation:

Commands

cue cmd test_cli
cue test_cli

cue cmd test_exec
cue test_exec 

Explanations

Some commands provide input and output, for example cli.Ask has en output response:

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

  display: cli.Print &{
	text: "hello "+ask.response
  }
}

The command exec.Run has an input stdin, an input stdout and stderr:

command: test_exec: {

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

  echo: exec.Run & {
	cmd: ["echo", "Hello", ask.response + "!"]
	stdout: string // capture stdout, don't print to the terminal
  }

  display: cli.Print &{
	text: "sdout of task echo: " + echo.stdout
  }
}

More info in the documentation of tasks: