pallets / pallets/click

Should prompts work when the input file is stdin?

Open
#304 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

prompt
Dominant language
Python
Stars
17.7k
Forks
2.3k
Avg merge
1d 30m
Merged PRs (30d)
18

Description

I'm trying to use the confirmation_option decorator. When I add an argument of type click.File('r') and give it '-' on the command line - the confirmation prompt is reading stdin instead of /dev/tty

I expect the confirmation prompt to be read from /dev/tty when the input file is stdin.

Is there a way to do this?

Apologies if I missed it in the documentation.

I understand there's getchar to read characters from the terminal.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how confirmation_option handles input when click.File('r') receives '-' and review the interaction between stdin and /dev/tty; the issue also points to getchar as related terminal input behavior. Done means confirming through /dev/tty still works while the command's input file remains stdin, with the behavior documented or covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.