Skip to content

feat(completions): add filesystem path tab completion#1723

Merged
barredterra merged 16 commits into
frappe:developfrom
barredterra:path-completion
Jul 16, 2026
Merged

feat(completions): add filesystem path tab completion#1723
barredterra merged 16 commits into
frappe:developfrom
barredterra:path-completion

Conversation

@barredterra

@barredterra barredterra commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

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 like restore, backup, and data-import without 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).

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
barredterra marked this pull request as ready for review June 23, 2026 00:11
@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Safe 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

Comment thread bench/commands/completions.py Outdated
@barredterra

Copy link
Copy Markdown
Collaborator Author

Easy install test failure is tackled in #1724

@sonarqubecloud

Copy link
Copy Markdown

@barredterra
barredterra merged commit 6dbfd02 into frappe:develop Jul 16, 2026
9 of 10 checks passed
@barredterra
barredterra deleted the path-completion branch July 16, 2026 16:26
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.

1 participant