Skip to content

Recognize forward slashes in Windows shell command completion - #1830

Merged
tleonhardt merged 1 commit into
python-cmd2:mainfrom
timothyanderson096-ocdealcheck:fix/windows-shell-path-completion
Nov 18, 2026
Merged

tleonhardt merged 1 commit into
python-cmd2:mainfrom
timothyanderson096-ocdealcheck:fix/windows-shell-path-completion

Conversation

@timothyanderson096-ocdealcheck

Copy link
Copy Markdown
Contributor

On Windows, a forward slash is a valid path separator. Shell completion treated ./my as a bare command name, so an executable in PATH could win over the one in the current directory. Absolute paths could also lose their directory. The path check now recognizes both separators and routes these inputs to the existing path completer.

The regression tests use real directories and executables with Windows separator settings. Both cases failed on main and passed with the fix. On Linux with CPython 3.15.2, all 155 completion tests passed. make test passed 3,082 tests with three skips, and make check and make docs-test passed. The native Windows result remains for hosted CI.

Prepared and tested with OpenAI Codex.

Timothy Anderson · Spotted Ridge Engineering / OC Labs · GDN (Global Decision Network)
timothyanderson096@gmail.com · Engineering evidence

Closes #1820.

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.75%. Comparing base (56a9e56) to head (dba3ac8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1830   +/-   ##
=======================================
  Coverage   99.75%   99.75%           
=======================================
  Files          23       23           
  Lines        6665     6665           
=======================================
  Hits         6649     6649           
  Misses         16       16           
Flag Coverage Δ
unittests 99.75% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@tleonhardt tleonhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @timothyanderson096-ocdealcheck!

Your change appears to fix both case in #1820.

@tleonhardt
tleonhardt merged commit 2c34f12 into python-cmd2:main Nov 18, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shell_cmd_complete() ignores forward slashes on Windows when deciding whether text is a bare command name

2 participants