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

套件詳情v0.3.4+1

cli_launcher

CLI 開發實用程式,用於支援啟動本機安裝的版本。

AndroidiOSLinuxmacOSWindows
近 30 天下載
106萬
喜歡數
5
Pub 分數
160

安裝套件

flutter pub add cli_launcher

套件介紹

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

一個專為簡化開發過程中啟動本機安裝之命令列工具而設計的 Flutter/Dart 套件。它支援在 Flutter 應用程式內無縫執行 CLI 工具,並支援 Android、iOS、Linux、macOS 與 Windows 的跨平台工作流程。對於需要整合或呼叫外部命令列程式的開發者而言,此套件透過管理本機安裝與執行路徑,簡化了測試與除錯流程。在需要直接存取系統層級命令的開發環境中尤為實用。

適用情境

  • 在應用開發期間啟動本機 CLI 工具
  • 將外部命令列工具整合到Flutter應用中
  • 在受控環境中測試命令列互動
  • 在Flutter應用中自動化建構或部署腳本
  • 支援依賴本機執行檔的開發者工具鏈

主要特色

  • 跨平台 CLI 執行支援
  • 輕鬆整合本機安裝的工具
  • 可執行檔的自動路徑解析
  • 用於啟動命令的簡單 API
  • 命令失敗的內建錯誤處理

適合對象

  • 使用 CLI 工具的 Flutter 開發人員
  • 需要與系統命令整合的工具
  • 需要本地命令執行的開發環境
  • Flutter 專案中的建構與自動化指令碼
  • 使用自訂或第三方 CLI 工具的團隊

使用建議

  • 需要正確的權限才能執行系統命令
  • 可能需要平台特定的設定
  • 不適用於 CLI 工具的生產發行
  • 僅限本機安裝,不支援遠端執行
  • 依賴主機系統上目標 CLI 工具的正確設定

原始 README

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

CI Pub Version

CLI development utility to support launching locally installed versions.

When the globally installed version of a CLI is launched and it finds a locally installed version of itself that is a different version, it will launch the locally installed version.

Otherwise, the globally installed version will continue to run.

Installing means adding the package that contains the CLI executable to a pubspec.yaml file.

To find the locally installed version, the globally installed version will search for a pubspec.yaml file in the current directory or any parent directory. If it finds one, it will look for a dependency on the package that contains the CLI executable.

In addition, if the CLI is executed in the package that contains the CLI executable, the current version in that package will be launched. This is useful for development.

Launch flow

flowchart TD
    A["User invokes CLI"] --> B["launchExecutable()"]
    B --> C{"Launch context<br/>in args?"}

    C -- "Yes (relaunched by global)" --> D["Restore original working<br/>directory, call entrypoint"]
    C -- "No (initial invocation)" --> E["Detect global installation<br/>from Platform.script"]

    E --> F["Search for local installation<br/>(walk up from cwd, check pubspec.yaml<br/>for dependency or dev_dependency)"]

    F -- "Found" --> G{"pubspec.lock<br/>up to date?"}
    F -- "Not found" --> GLOBAL

    G -- "Yes" --> I
    G -- "Missing or<br/>older than<br/>pubspec.yaml" --> H["Run pub get from<br/>lock file root"]

    H -- "OK" --> I{"Source package,<br/>path dep, or<br/>version mismatch?"}
    H -- "Failed" --> EXIT["Exit with error"]

    I -- "No" --> GLOBAL["Run entrypoint<br/>with global installation"]
    I -- "Yes" --> J["Launch local via<br/>dart run package:executable<br/>(inject launch context in args)"]

    J --> K["New process starts,<br/>calls launchExecutable(),<br/>finds launch context in args"]
    K --> D

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。

所在榜單