Skip to content
プロジェクト

概要

↔️ Python製CLIアプリケーション向けのシェル補完を自動生成

開発ツール

この数値の測り方

できること

  • bash, zsh, fish, tcsh, powershell
  • docopt (via argopt)
  • <arguments>, --options and sub commands
  • Choices (--say={hello,goodbye})

計測したスター増加

24時間
0
7日間
+3
15日間
+4
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

Logo

Tests Coverage Quality PyPI conda-forge Downloads LICENCE

  • What: Automatically generate shell tab completion scripts for Python CLI apps
  • Why: Speed & correctness. Alternatives like argcomplete and pyzshcomplete are slow and have side-effects
  • How: shtab processes an argparse.ArgumentParser object to generate a tab completion script for your shell
  • Outputs tab completion scripts for multiple shells
    • bash, zsh, fish, tcsh, powershell
  • Supports
  • <arguments>, --options and sub commands
  • Choices (--say={hello,goodbye})
  • Paths (--file={*.y*ml,*.toml}, --dir=*/)
  • Dynamic shell commands (--branch=$(git branch))

Choose one of:

  • pip install shtab, or
  • conda install -c conda-forge shtab

See operating system-specific instructions in the docs.

There are two ways of using shtab:

  • CLI Usage: shtab's own CLI interface for external applications
    • may not require any code modifications whatsoever
    • end-users execute shtab your_cli_app.your_parser_object
  • Library Usage: as a library integrated into your CLI application
    • adds a couple of lines to your application
    • argument mode: end-users execute your_cli_app --print-completion {bash,zsh,tcsh,fish,powershell}
    • subparser mode: end-users execute your_cli_app completion {bash,zsh,tcsh,fish,powershell}

See the docs for usage examples.

Not working? Check out frequently asked questions.

All these execute the underlying script every time <TAB> is pressed (slow and have side-effects):

Please do open issues & pull requests! Some ideas:

  • support python -m prefix (#55)

See CONTRIBUTING.md for more guidance.

git-fame

Hits

関連プロジェクトを探す

読み込み中…