prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Question: How to return key value from NestedCompleter?

Open
#1,399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

Hi, thanks for maintaining this package!

I want to read from a DB a nested structure of folders (name, ID, parentID), then create a NestedCompleter with this data showing the folder names as candidates, when the input process finishes I'd like to return the folder's ID like this:

Select the destination folder: folderA SubFolder DeepSubFolder

When the user press Enter after DeepSubFolder I wish to get DeepSubFolder's ID. I'm not interested in the name, I need the ID so I can refer to that folder in the database. I pretend to use the NestedCompleter as a way to help the user when navigating through the folder structure.

Currently I'm adding the ID after the folder names but probably there is a better way to do it.

Thanks!

Contributor guide

No contributing guide indexed for this repository

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 reading the NestedCompleter API and its usage examples, focusing on how completed candidate values are returned. Compare that behavior with the requested database-folder ID workflow and determine whether an existing documented approach or a scoped API/documentation change is needed; done means the question has a clear supported answer.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.