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

套件詳情v1.0.2

completion

一個為您的 Dart 應用程式添加 shell 命令補全功能的套件

AndroidiOSmacOSWindowsLinux
近 30 天下載
941萬
喜歡數
52
Pub 分數
160

安裝套件

flutter pub add completion

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

完成套件讓 Dart 應用程式中的 shell 命令列補完成為可能,讓使用者在與 CLI 工具互動時能受益於自動建議與 tab 補全。它與 Dart 命令列介面無縫整合,提升開發者建立互動式命令列工具的易用性。該套件支援多個平台,包括 Android、iOS、macOS、Windows 和 Linux,非常適合跨平台 CLI 開發。它透過註冊回應 shell 請求的補完處理常式來運作,藉由直覺的輸入協助改善使用者體驗。

適用情境

  • 建構互動式 CLI 工具
  • 為命令列應用程式添加標籤完成
  • 提升開發者工具的可用性
  • 使用自動建議創建命令列介面
  • 支援多平台 CLI 應用程式

主要特色

  • Shell 命令補全整合
  • 跨平台支援
  • 用於註冊補全的簡單 API
  • 與 Dart 的命令列工具搭配使用
  • 自動處理完成請求

適合對象

  • 開發 CLI 應用程式的開發者
  • 需要互動式輸入的工具
  • 跨平台命令列實用工具
  • 命令列開發者尋求更好的使用者體驗

使用建議

  • 需要 shell 級別設定才能實現完整功能
  • 僅限命令列上下文
  • 可能需要平台特定的設定
  • 不適用於GUI或Web應用程式
  • 依賴於 shell 環境的相容性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Add shell command completion to your Dart console applications.

Dart CI pub package package publisher

To use this package, instead of this:

import 'package:args/args.dart';

void main(List<String> args) {
  final argParser = ArgParser()..addFlag('option', help: 'flag help');
  // ... add more options ...
  final argResults = argParser.parse(args);
  // ...
}

do this:

import 'package:args/args.dart';
import 'package:completion/completion.dart' as completion;

void main(List<String> args) {
  final argParser = ArgParser()..addFlag('option', help: 'flag help');
  // ... add more options ...
  final argResults = completion.tryArgsCompletion(args, argParser);
  if (argResults == null) return;
  // ...
}

(The main difference is calling completion.tryArgsCompletion in place of argParser.parse and returning early when it returns null.)

This will add a "completion" command to your app, which the shell will use to complete arguments.

To generate the setup script automatically, call generateCompletionScript with the names of the executables that your Dart script runs as (typically just one, but it could be more), along with the target Shell.

Also, see the example.

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案