パッケージ、リポジトリ、アプリカテゴリを検索

cli_completion のカバー
パッケージ詳細v0.6.0

cli_completion

CommandRunner を使用して構築された Dart コマンドラインインターフェース用の補完機能。Very Good Ventures によって開発されました。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
97万
いいね数
71
Pub ポイント
150

パッケージをインストール

flutter pub add cli_completion

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

CommandRunner を使用して構築されたコマンドラインインターフェースに自動補完機能を追加する Flutter/Dart パッケージです。Very Good Ventures によって設計され、コマンド、フラグ、引数に対するインテリジェントな提案を提供することで、CLI の使いやすさを向上させます。既存の CommandRunner ベースのツールとシームレスに統合され、Android、iOS、macOS、Windows、Linux などの主要プラットフォームをサポートしています。最小限のセットアップで、インタラクティブでユーザーに優しいコマンドラインアプリケーションの開発を簡素化します。

用途

  • CLIツールの使いやすさの向上
  • コマンドラインアプリにタブ補完を追加する
  • ターミナルワークフローにおける開発者体験の向上
  • インタラクティブなDart CLIツールの構築
  • 提案を伴う複雑な引数解析のサポート

主な機能

  • CommandRunner とのシームレスな統合
  • プラットフォームに依存しない補完サポート
  • 最小限の構成が必要
  • リアルタイムタブ補完
  • カスタム補完用に拡張可能

適している対象

  • Dart CLI 開発者
  • インタラクティブなターミナル入力を必要とするツール
  • オープンソースCLIプロジェクト
  • CommandRunner をベースとしたアプリケーション
  • CLI設計におけるUXを重視するチーム

注意事項

  • CommandRunner を依存関係として必要とする
  • DartベースのCLIツールに限定
  • 完全な機能を活用するには、プラットフォーム固有の設定が必要になる場合があります
  • 非CLIの使用ケースには適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

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

カテゴリー

依存関係

依存関係一覧 5 件

ソースリポジトリ

このパッケージを使用しているプロジェクト