Skip to content

A first draft of tab-completion for prompts - #181

Closed
untitaker wants to merge 1 commit into
pallets:masterfrom
untitaker:path_completion_prompt
Closed

A first draft of tab-completion for prompts#181
untitaker wants to merge 1 commit into
pallets:masterfrom
untitaker:path_completion_prompt

Conversation

@untitaker

Copy link
Copy Markdown
Contributor

See #173. This is not ready for merge yet.

  • Missing tests, changelog entry, and isn't yet used in click.Path/File.
  • Is a very myopic implementation. Users will ask for custom completion
    functions, which bash's read of course doesn't support.

@untitaker

Copy link
Copy Markdown
Contributor Author

And i just found out that readline from the stdlib might be helpful...

@untitaker

Copy link
Copy Markdown
Contributor Author

I suggest that types can define custom readline completers.

@untitaker

Copy link
Copy Markdown
Contributor Author

A problem i am currently running into is that the prompt text doesn't get reshown after showing all suggestions. This is because click outputs the prompt text manually instead of passing it to raw_input. I tried some of the hooks in the readline module without success.

@mitsuhiko

Copy link
Copy Markdown
Contributor

We cannot use readline because of licensing issues unfortunately. Readline is GPL licensed :-/

@untitaker

Copy link
Copy Markdown
Contributor Author

From the readline docs:

On MacOS X the readline module can be implemented using the libedit library
instead of GNU readline.

The configuration file for libedit is different from that of GNU readline.
If you programmatically load configuration strings you can check for the
text “libedit” in readline.__doc__ to differentiate between GNU readline
and libedit.

Since libedit is BSD, this seems to be a greyzone.

Shouldn't GPL be enforced on CPython itself if its stdlib is depending on readline?

@untitaker

Copy link
Copy Markdown
Contributor Author

@untitaker

Copy link
Copy Markdown
Contributor Author

Rebased and reverted accidental change to index.rst. Any updates on this?

@untitaker

Copy link
Copy Markdown
Contributor Author

I think https://github.com/jonathanslenders/python-prompt-toolkit could be used as optdepends for this.

@msabramo

Copy link
Copy Markdown

Doesn't merge cleanly anymore.

@untitaker

Copy link
Copy Markdown
Contributor Author

Yeah, this is a dead end.

@untitaker untitaker closed this Jan 29, 2015
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 13, 2020
@kdeldycke kdeldycke added the shell completion Shell tab completion label Aug 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

shell completion Shell tab completion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants