Skip to content

Disable prompt options on non-interactive terminals #618

@RafeArnold

Description

@RafeArnold

Clikt's prompt option capabilities are great, but prompting the user for input is not possible in non-interactive terminals. When this is the case, it seems logical to have prompt options fallback to being simple required options. I understand this can be done manually with something like

.run {
  if (interactive) {
    prompt(text = "username")
  } else {
    required()
  }
}

but seems like an obvious default to me that is within Clikt's remit, so could alleviate a pitfall for the library user with relative ease, and I believe would align with clig's guidelines.

Of course, there may be a totally valid reason for this not already being implemented that I'm missing and there may also be backwards compatibility concerns, so happy to take this to a discussion thread if that's more appropriate.

I'm happy to submit a PR for this myself if its deemed a good change.

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