搜尋套件、儲存庫與 APP 分類

GitHub 儲存庫VeryGoodOpenSource/cli_completion

cli_completion

適用於使用 CommandRunner 構建的 Dart 命令列介面的補完功能。由 Very Good Ventures 開發。🦄

cli_completion 專案封面
星標
54
分支
6
最近推送(UTC)
2026年9月7日
專案狀態
未封存

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

CLI Completion

Very Good Ventures Very Good Ventures

ci coverage pub package style: very good analysis License: MIT


screen

Completion functionality for Dart Command-Line Interfaces built using CommandRunner.

Developed with 💙 by Very Good Ventures 🦄

Installation 💻

❗ In order to start using CLI Completion you must have the Dart SDK installed on your machine.

flutter pub add cli_completion

Usage ✨

On your CommandRunner class, extend CompletionCommandRunner :

import 'package:cli_completion/cli_completion.dart';

class ExampleCommandRunner extends CompletionCommandRunner<int> {
...

This will make the first command run to install the completion files automatically. To disable that behavior, set enableAutoInstall to false:

class ExampleCommandRunner extends CompletionCommandRunner<int> {
  
  @override
  bool get enableAutoInstall => false;
...

When enableAutoInstall is set to false, users will have to call install-completion-files to install these files manually.

$ example_cli install-completion-files

Additionally, when enableAutoInstall is disabled a completion-script command is exposed. It prints the completion script for the current shell to stdout, so users can install it wherever they prefer:

$ example_cli completion-script >> ~/.zshrc

Documentation 📝

For an overview of how this package works, check out the documentation.


Troubleshooting 🧠🔨

Tab completion is taking too long

Handling completion requests should be straightforward.

If there are any checks (like analytics, telemetry, or anything that you may have on run or runCommand overrides) before running subcommands, make sure you fast track the completion command to skip all of the unnecessary computations.

Example:

@override
Future<int?> runCommand(ArgResults topLevelResults) async {
  if (topLevelResults.command?.name == 'completion') {
    super.runCommand(topLevelResults);
      return;
  }
  // ... analytics and other unrelated stuff 
Tab completion is not working on my zsh terminal

If you are not using any zsh framework such as Oh My Zsh, you have to start the completion system manually.

Add the following lines to your ~/.zshrc file:

# Add this to the start of your zsh starter file (~/.zshrc)
autoload -Uz compinit
compinit
Very Good Open Source GitHub avatar
GitHub 作者

Very Good Open Source ↗

Open source code from Very Good Ventures (@VGVentures)

New York, NY官方網站 ↗
語言DartShell

分類

此儲存庫發佈的套件

使用的依賴

依賴清單 8 項

如何選擇適合專案的儲存庫?

先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。

  1. 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
  2. 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
  3. 使用前在 GitHub 確認 README、授權條款與 Issues。

來源與維護

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗