Skip to content

feat: Add pyrefly completion command - #4884

Open
pavelzw wants to merge 1 commit into
facebook:mainfrom
pavelzw:completion
Open

feat: Add pyrefly completion command#4884
pavelzw wants to merge 1 commit into
facebook:mainfrom
pavelzw:completion

Conversation

@pavelzw

@pavelzw pavelzw commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #4882

Test Plan

$ cargo run -- completion --shell fish > pyrefly.fish
$ cargo run -- completion --shell bash > pyrefly.bash
$ cargo run -- completion --shell zsh > pyrefly.zsh

# fish
$ source pyrefly.fish
$ pyrefly <TAB>
bazel-check                                                 (Entry point for Bazel integration)
buck-check                                                   (Entry point for Buck integration)
check                                               (Full type checking on a file or a project)
completion                                       (Generate a shell completion script on stdout)
coverage                                                               (Type coverage commands)
dump-config  (Dump info about pyrefly's configuration. Use by replacing `check` with `dump-co…)
help                                (Print this message or the help of the given subcommand(s))
infer                               (Automatically add type annotations to a file or directory)
init  (Initialize a new pyrefly config in the given directory, or migrate an existing mypy or…)
lsp                                                                       (Start an LSP server)
report  (Deprecated alias for `pyrefly coverage report`. Use `pyrefly coverage report` instead)
snippet                                                           (Check a Python code snippet)
stubgen                                     (Generate .pyi stub files from Python source files)
suppress             (Suppress type errors by adding ignore comments, or remove unused ignores)
tsp                                                                        (Start a TSP server)

# bash
$ source pyrefly.bash
$ pyrefly <TAB>
-j           --threads    --version    dump-config  lsp          report
-v           --color      check        buck-check   tsp          suppress
-h           --verbose    completion   bazel-check  infer        stubgen
-V           --help       snippet      init         coverage     help

# zsh
$ source pyrefly.zsh
$ pyrefly <TAB>
bazel-check  -- Entry point for Bazel integration
buck-check   -- Entry point for Buck integration
check        -- Full type checking on a file or a project
completion   -- Generate a shell completion script on stdout
coverage     -- Type coverage commands
dump-config  -- Dump info about pyrefly's configuration. Use by replacing `check` with `dum
help         -- Print this message or the help of the given subcommand(s)
infer        -- Automatically add type annotations to a file or directory
init         -- Initialize a new pyrefly config in the given directory, or migrate an exist
lsp          -- Start an LSP server
report       -- Deprecated alias for `pyrefly coverage report`. Use `pyrefly coverage repor
snippet      -- Check a Python code snippet
stubgen      -- Generate .pyi stub files from Python source files
suppress     -- Suppress type errors by adding ignore comments, or remove unused ignores
tsp          -- Start a TSP server

this can then get added to the homebrew formula like in https://github.com/Homebrew/homebrew-core/blob/fbd5caa399af11f0e4bb74c014204bbefc9318a6/Formula/p/pixi.rb#L45 or to the conda recipe like in https://github.com/conda-forge/ty-feedstock/blob/14216677727cdb373eb51ff871a225cec2f10cea/recipe/recipe.yaml#L51 to enable shell completions for all brew / pixi users automatically

@meta-codesync

meta-codesync Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D119480372. (Because this pull request was imported automatically, there will not be any future comments.)

@github-actions

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add bash/zsh/fish shell completions

1 participant