René's URL Explorer Experiment


Title: Update cmd2.Cmd.select to use prompt-toolkit choice by tleonhardt · Pull Request #1600 · python-cmd2/cmd2 · GitHub

Open Graph Title: Update cmd2.Cmd.select to use prompt-toolkit choice by tleonhardt · Pull Request #1600 · python-cmd2/cmd2

X Title: Update cmd2.Cmd.select to use prompt-toolkit choice by tleonhardt · Pull Request #1600 · python-cmd2/cmd2

Description: The choice function from prompt-toolkit is now used for cmd2.Cmd.select method when both stdin and stdout are TTYs. Key Changes: prompt_toolkit.shortcuts.choice integration: The select method now utilizes the modern, interactive choice shortcut when both stdin and stdout are TTYs. This provides a more user-friendly selection menu (usually supports arrow keys and searching). Backward Compatibility: Maintained the original numbered-list implementation as a fallback for non-TTY environments. This ensures that existing scripts, pipes, and tests (which mock read_input) continue to function correctly. Robust Argument Handling: Standardized the conversion of various input formats (strings, lists of strings, lists of tuples) to the (value, label) format required by choice. Error Handling: Wrapped the choice call in a loop and a try-except block to correctly handle KeyboardInterrupt (Ctrl-C) by printing ^C and re-raising, and to handle cancellations by reprompting, maintaining consistency with original select behavior.

Open Graph Description: The choice function from prompt-toolkit is now used for cmd2.Cmd.select method when both stdin and stdout are TTYs. Key Changes: prompt_toolkit.shortcuts.choice integration: The select method now ...

X Description: The choice function from prompt-toolkit is now used for cmd2.Cmd.select method when both stdin and stdout are TTYs. Key Changes: prompt_toolkit.shortcuts.choice integration: The select method now ...

Opengraph URL: https://github.com/python-cmd2/cmd2/pull/1600

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e364dd71-f81b-f155-c53f-a770791c5eff
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC602:9C16A:54F59A:7C2059:6A4E0C14
html-safe-nonce8af8e6b4f73dcc8382e0b3d4509404fad3b7e748bcc786200f666c6558a4004a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjAyOjlDMTZBOjU0RjU5QTo3QzIwNTk6NkE0RTBDMTQiLCJ2aXNpdG9yX2lkIjoiNTkzOTIwMTc1NTAzNjEyNjIyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac684cb04f5b468327b32335a65fd7b7a0864dc4278de0db723cb71b557df3349a
hovercard-subject-tagpull_request:3366326446
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python-cmd2/cmd2/pull/1600/files
twitter:imagehttps://avatars.githubusercontent.com/u/2812720?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/2812720?s=400&v=4
og:image:altThe choice function from prompt-toolkit is now used for cmd2.Cmd.select method when both stdin and stdout are TTYs. Key Changes: prompt_toolkit.shortcuts.choice integration: The select method now ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonedf0492960db29b4938cb72070351d6b1d0c6c0767b27ceb8394bbf4fcc0223c6
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python-cmd2/cmd2 git https://github.com/python-cmd2/cmd2.git
octolytics-dimension-user_id17161025
octolytics-dimension-user_loginpython-cmd2
octolytics-dimension-repository_id51442999
octolytics-dimension-repository_nwopython-cmd2/cmd2
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id51442999
octolytics-dimension-repository_network_root_nwopython-cmd2/cmd2
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release51470c353b8a1f52a88d3e3cc2014b17ab8cc1ce
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-cmd2/cmd2/pull/1600/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-cmd2%2Fcmd2%2Fpull%2F1600%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-cmd2%2Fcmd2%2Fpull%2F1600%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python-cmd2%2Fcmd2
Reloadhttps://github.com/python-cmd2/cmd2/pull/1600/files
Reloadhttps://github.com/python-cmd2/cmd2/pull/1600/files
Reloadhttps://github.com/python-cmd2/cmd2/pull/1600/files
Please reload this pagehttps://github.com/python-cmd2/cmd2/pull/1600/files
python-cmd2 https://github.com/python-cmd2
cmd2https://github.com/python-cmd2/cmd2
Notifications https://github.com/login?return_to=%2Fpython-cmd2%2Fcmd2
Fork 132 https://github.com/login?return_to=%2Fpython-cmd2%2Fcmd2
Star 689 https://github.com/login?return_to=%2Fpython-cmd2%2Fcmd2
Code https://github.com/python-cmd2/cmd2
Issues 0 https://github.com/python-cmd2/cmd2/issues
Pull requests 0 https://github.com/python-cmd2/cmd2/pulls
Discussions https://github.com/python-cmd2/cmd2/discussions
Actions https://github.com/python-cmd2/cmd2/actions
Projects https://github.com/python-cmd2/cmd2/projects
Security and quality 0 https://github.com/python-cmd2/cmd2/security
Insights https://github.com/python-cmd2/cmd2/pulse
Code https://github.com/python-cmd2/cmd2
Issues https://github.com/python-cmd2/cmd2/issues
Pull requests https://github.com/python-cmd2/cmd2/pulls
Discussions https://github.com/python-cmd2/cmd2/discussions
Actions https://github.com/python-cmd2/cmd2/actions
Projects https://github.com/python-cmd2/cmd2/projects
Security and quality https://github.com/python-cmd2/cmd2/security
Insights https://github.com/python-cmd2/cmd2/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython-cmd2%2Fcmd2%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython-cmd2%2Fcmd2%2Fissues%2Fnew%2Fchoose
tleonhardthttps://github.com/tleonhardt
mainhttps://github.com/python-cmd2/cmd2/tree/main
pt-choicehttps://github.com/python-cmd2/cmd2/tree/pt-choice
Conversation 9 https://github.com/python-cmd2/cmd2/pull/1600
Commits 6 https://github.com/python-cmd2/cmd2/pull/1600/commits
Checks 41 https://github.com/python-cmd2/cmd2/pull/1600/checks
Files changed https://github.com/python-cmd2/cmd2/pull/1600/files
Please reload this pagehttps://github.com/python-cmd2/cmd2/pull/1600/files
Update cmd2.Cmd.select to use prompt-toolkit choice https://github.com/python-cmd2/cmd2/pull/1600/files#top
Show all changes 6 commits https://github.com/python-cmd2/cmd2/pull/1600/files
149bcca Update cmd2.Cmd.select to use prompt-toolkit choice tleonhardt Mar 7, 2026 https://github.com/python-cmd2/cmd2/pull/1600/commits/149bcca1f2c524b636653c72719b8309fbef30a1
de5f9a8 Add unit tests tleonhardt Mar 7, 2026 https://github.com/python-cmd2/cmd2/pull/1600/commits/de5f9a849136c89390855f6057427acf6cb8baf3
c061b95 Add unit test for uncovered code tleonhardt Mar 7, 2026 https://github.com/python-cmd2/cmd2/pull/1600/commits/c061b9580f115ce1643e9d451c74081502a2c4e4
589914e Updated CHANGELOG tleonhardt Mar 7, 2026 https://github.com/python-cmd2/cmd2/pull/1600/commits/589914edbaa7df301e55b17f2ba0966cea5240ee
9c50259 Merge branch 'main' into pt-choice kmvanbrunt Mar 7, 2026 https://github.com/python-cmd2/cmd2/pull/1600/commits/9c50259fe4738b0f130407b62a12e576717bf359
0551fa8 Addressed PR comments tleonhardt Mar 7, 2026 https://github.com/python-cmd2/cmd2/pull/1600/commits/0551fa8434335e86126eb30ec142c24e4a2c3fa7
Clear filters https://github.com/python-cmd2/cmd2/pull/1600/files
Please reload this pagehttps://github.com/python-cmd2/cmd2/pull/1600/files
Please reload this pagehttps://github.com/python-cmd2/cmd2/pull/1600/files
CHANGELOG.md https://github.com/python-cmd2/cmd2/pull/1600/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
cmd2.py https://github.com/python-cmd2/cmd2/pull/1600/files#diff-325e1c8c92627fe81d6ef9f286b107ede43813bfdb4160425ca4f69c9e7ce08b
misc.md https://github.com/python-cmd2/cmd2/pull/1600/files#diff-662699f5ec60018658685a51079c08bdc2c647b18d85da96c7ee5706ca581efb
read_input.py https://github.com/python-cmd2/cmd2/pull/1600/files#diff-4a9616eb62421ab44222e45497a8feb3049c076ebc1f1c9c941b700372b915ad
test_cmd2.py https://github.com/python-cmd2/cmd2/pull/1600/files#diff-619ddd8c328e715fff231ef137a18683cb81c372215cdd1085cdd3976f9b533c
https://github.com/python-cmd2/cmd2/blob/main/.github/CODEOWNERS#L67
CHANGELOG.mdhttps://github.com/python-cmd2/cmd2/pull/1600/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
View file https://github.com/python-cmd2/cmd2/blob/0551fa8434335e86126eb30ec142c24e4a2c3fa7/CHANGELOG.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python-cmd2/cmd2/pull/1600/{{ revealButtonHref }}
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
https://github.com/python-cmd2/cmd2/blob/main/.github/CODEOWNERS#L32
cmd2/cmd2.pyhttps://github.com/python-cmd2/cmd2/pull/1600/files#diff-325e1c8c92627fe81d6ef9f286b107ede43813bfdb4160425ca4f69c9e7ce08b
View file https://github.com/python-cmd2/cmd2/blob/0551fa8434335e86126eb30ec142c24e4a2c3fa7/cmd2/cmd2.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python-cmd2/cmd2/pull/1600/{{ revealButtonHref }}
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-325e1c8c92627fe81d6ef9f286b107ede43813bfdb4160425ca4f69c9e7ce08b
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-325e1c8c92627fe81d6ef9f286b107ede43813bfdb4160425ca4f69c9e7ce08b
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-325e1c8c92627fe81d6ef9f286b107ede43813bfdb4160425ca4f69c9e7ce08b
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-325e1c8c92627fe81d6ef9f286b107ede43813bfdb4160425ca4f69c9e7ce08b
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-325e1c8c92627fe81d6ef9f286b107ede43813bfdb4160425ca4f69c9e7ce08b
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-325e1c8c92627fe81d6ef9f286b107ede43813bfdb4160425ca4f69c9e7ce08b
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-325e1c8c92627fe81d6ef9f286b107ede43813bfdb4160425ca4f69c9e7ce08b
https://github.com/python-cmd2/cmd2/blob/main/.github/CODEOWNERS#L15
docs/features/misc.mdhttps://github.com/python-cmd2/cmd2/pull/1600/files#diff-662699f5ec60018658685a51079c08bdc2c647b18d85da96c7ee5706ca581efb
View file https://github.com/python-cmd2/cmd2/blob/0551fa8434335e86126eb30ec142c24e4a2c3fa7/docs/features/misc.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python-cmd2/cmd2/pull/1600/{{ revealButtonHref }}
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-662699f5ec60018658685a51079c08bdc2c647b18d85da96c7ee5706ca581efb
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-662699f5ec60018658685a51079c08bdc2c647b18d85da96c7ee5706ca581efb
https://github.com/python-cmd2/cmd2/blob/main/.github/CODEOWNERS#L55
examples/read_input.pyhttps://github.com/python-cmd2/cmd2/pull/1600/files#diff-4a9616eb62421ab44222e45497a8feb3049c076ebc1f1c9c941b700372b915ad
View file https://github.com/python-cmd2/cmd2/blob/0551fa8434335e86126eb30ec142c24e4a2c3fa7/examples/read_input.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python-cmd2/cmd2/pull/1600/{{ revealButtonHref }}
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-4a9616eb62421ab44222e45497a8feb3049c076ebc1f1c9c941b700372b915ad
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-4a9616eb62421ab44222e45497a8feb3049c076ebc1f1c9c941b700372b915ad
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-4a9616eb62421ab44222e45497a8feb3049c076ebc1f1c9c941b700372b915ad
https://github.com/python-cmd2/cmd2/blob/main/.github/CODEOWNERS#L58
tests/test_cmd2.pyhttps://github.com/python-cmd2/cmd2/pull/1600/files#diff-619ddd8c328e715fff231ef137a18683cb81c372215cdd1085cdd3976f9b533c
View file https://github.com/python-cmd2/cmd2/blob/0551fa8434335e86126eb30ec142c24e4a2c3fa7/tests/test_cmd2.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python-cmd2/cmd2/pull/1600/{{ revealButtonHref }}
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-619ddd8c328e715fff231ef137a18683cb81c372215cdd1085cdd3976f9b533c
https://github.com/python-cmd2/cmd2/pull/1600/files#diff-619ddd8c328e715fff231ef137a18683cb81c372215cdd1085cdd3976f9b533c
Please reload this pagehttps://github.com/python-cmd2/cmd2/pull/1600/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.