! exec cue cmd
! stdout .
cmp stderr cue-cmd.stderr

exec cue help cmd
cmp stdout cue-help-cmd.stdout

exec cue help cmd hello
cmp stdout cue-help-cmd-hello.stdout

exec cue help cmd hello .
cmp stdout cue-help-cmd-hello.stdout

mkdir subdir
cp task_tool.cue subdir
exec cue help cmd hello ./subdir
cmp stdout cue-help-cmd-hello.stdout

! exec cue help cmd missing
stderr -count=1 'Unknown cmd command: missing'
stderr -count=1 '^Available Commands:$'
stderr -count=1 'hello *say hello to someone'

-- cue.mod/module.cue --
module: "test.example"
language: version: "v0.9.0"
-- task_tool.cue --
package home

import "tool/cli"

// say hello to someone
//
//   Usage: hello
//
// Hello can be used to say hello to the world.
command: hello: {
    task: say: {
        cli.Print
        text: "Hello world!"
    }
}

// echo something back
command: echo: {
    task: echo: {
        cli.Print
        text: "ECHO Echo echo..."
    }
}

-- cue-cmd.stderr --
cmd must be run as one of its subcommands
Run 'cue help cmd' for known subcommands.
-- cue-help-cmd.stdout --
cmd executes the named workflow command for each of the named instances.

Workflow commands are defined in tool files, which are regular CUE
files within the same package with a filename ending in _tool.cue.

Run "cue help commands" for more details on authoring tasks and
workflow commands.

Usage:
  cue cmd [flags] <name> [inputs]
  cue cmd [command]

Available Commands:
  echo        echo something back
  hello       say hello to someone

Flags:
  -t, --inject stringArray   set the value of a tagged field
  -T, --inject-vars          inject system variables in tags (default true)

Global Flags:
  -E, --all-errors     print all available errors
  -C, --chdir string   change working directory before running command (must be the first flag)
  -i, --ignore         proceed in the presence of errors
  -s, --simplify       simplify output

Use "cue cmd [command] --help" for more information about a command.
-- cue-help-cmd-hello.stdout --
Hello can be used to say hello to the world.

Usage:
  cue cmd hello [flags]

Global Flags:
  -E, --all-errors     print all available errors
  -C, --chdir string   change working directory before running command (must be the first flag)
  -i, --ignore         proceed in the presence of errors
  -s, --simplify       simplify output
