Skip to content

Add expected type guidance to shtab zsh completions - #1024

Merged
mauvilsa merged 1 commit into
mainfrom
shtab-zsh-guidance
Oct 23, 2026
Merged

mauvilsa merged 1 commit into
mainfrom
shtab-zsh-guidance

Conversation

@mauvilsa

Copy link
Copy Markdown
Owner

What does this PR do?

Brings the expected type guidance of shtab bash completions to zsh. When completing a value, zsh now shows a message like Expected type: bool | None above the choices, formatted with the user's descriptions style if one is configured. This covers options, positionals, subclass selection and subclass init_args, the last of these saying which subclasses accept them. For types that also accept values other than the choices, e.g. null for int | None, the choices are listed but not inserted until a prefix is typed, same as in bash.

It also fixes zsh completion script generation, which failed with TypeError: vars() argument must have __dict__ attribute for parsers that have subcommands added without help.

Before submitting

  • Did you read the contributing guideline?
  • If you used a coding agent, did you fully understand and validate all generated code and ensure it follows the contributing guidelines?
  • Did you update the documentation? (readme and public docstrings)
  • Did you write unit tests such that there is 100% coverage on related code? (required for bug fixes and new features)
  • Did you verify that new and existing tests pass locally?
  • If this is a bug fix, did you verify that the tests fail without the code fix?
  • Did you make sure that all changes preserve backward compatibility?
  • Did you update the CHANGELOG including a pull request link? (not for typos, docs, test updates, or minor internal changes/refactors)

@mauvilsa mauvilsa added bug Something isn't working enhancement New feature or request labels Oct 23, 2026
@mauvilsa
mauvilsa deployed to sonarcloud October 23, 2026 15:12 — with GitHub Actions Active
@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds expected-type messages to zsh completions for typed arguments and subclass parameters.

  • Zsh completions explain expected value types beside their choices.
  • Zsh completion scripts generate for subcommands with no help text.

Reviews (1) · Last reviewed commit: "Add expected type guidance to shtab zsh ..." · Reviewed by Greptile

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7ef2bab) to head (9519cc7).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1024   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         9950      9962   +12     
=========================================
+ Hits          9950      9962   +12     

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

@mauvilsa
mauvilsa merged commit 9ea957a into main Oct 23, 2026
36 checks passed
@mauvilsa
mauvilsa deleted the shtab-zsh-guidance branch October 23, 2026 15:19

This branch was successfully deployed

1 active deployment
sonarcloud — 9519cc73 Deployed Oct 23, 2026 by mauvilsa via sonarcloud #1002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant