Skip to content

Can't set context #611

@benkeil

Description

@benkeil
class HelloWorld : CliktCommand() {
  init {
    context { readArgumentFile = null }
  }

  val foo by option("--foo", "-f").required()

  override fun run() {
    println("Hello, $foo")
  }
}

HelloWorld().context { readArgumentFile = null }.main(args)

None of the context overrides works.

./github.main.kts --foo @types/node
warning: argfile not found: /Users/foobar/development/github.com/project/types/node
Usage: hello-world [<options>]

Error: option --foo requires a value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions