feat(completions): add filesystem path tab completion#1723
Merged
Conversation
Collect path-taking options and positional arguments from Click metadata and complete them with compgen -f, covering commands like restore, backup, and data-import without breaking existing site/app completion.
Complete filesystem paths for path options and positional arguments (e.g. bench restore), including tilde expansion and directory trailing slashes without inserting extra whitespace. Fix frappe subcommand context resolution, avoid zsh PATH shadowing, and scope emulate -L sh to the completion handler so sourcing does not break zsh modules.
Replace bashcompinit-based zsh completion with a native #compdef script that routes path args to _files, while keeping the bash runtime unchanged. Fix _bench_has_word failing when called with no haystack words during partial command completion.
barredterra
marked this pull request as ready for review
June 23, 2026 00:11
Confidence Score: 5/5Safe to merge; changes are self-contained to the completion subsystem with no effect on bench runtime behaviour. All changed code paths are purely in shell completion generation and script output. The logic is well-tested with new bash and zsh integration tests covering positional-index tracking, tilde expansion, and directory-slash appending. No data mutations or external-service calls are introduced. No files require special attention. Reviews (9): Last reviewed commit: "Merge branch 'develop' into path-complet..." | Re-trigger Greptile |
Collaborator
Author
|
Easy install test failure is tackled in #1724 |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Goal:
bench restore [TAB]and similar commands should offer file path completions.Collects path-taking options and positional arguments from Click metadata and completes them with
compgen -f, covering commands likerestore,backup, anddata-importwithout breaking existing site/app completion.Changes CI to actually run completion tests and install zsh to make them pass.
Contains some noise from formatting python files (
style:commit) and refactoring complex functions to satisfy Sonarqube's complexitiy score (refactor: ... Cognitive Complexity).