Search packages, repositories and app categories

Package detailsv0.3.4+1

cli_launcher

CLI development utility to support launching locally installed versions.

AndroidiOSLinuxmacOSWindows
30-day downloads
1.1M
Likes
5
Pub points
160

Install package

flutter pub add cli_launcher

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter/Dart package designed to simplify the launching of locally installed command-line tools during development. It enables seamless execution of CLI utilities from within a Flutter application, supporting cross-platform workflows on Android, iOS, Linux, macOS, and Windows. Ideal for developers building tools that integrate with or invoke external command-line programs, it streamlines testing and debugging by managing local installations and execution paths. The package is particularly useful in development environments where direct access to system-level commands is required.

Use cases

  • Launching local CLI tools during app development
  • Integrating external command-line utilities into Flutter apps
  • Testing command-line interactions in a controlled environment
  • Automating build or deployment scripts within Flutter apps
  • Supporting developer toolchains that rely on local executables

Key features

  • Cross-platform CLI execution support
  • Easy integration with locally installed tools
  • Automatic path resolution for executables
  • Simple API for launching commands
  • Built-in error handling for command failures

Suitable for

  • Flutter developers working with CLI tools
  • Tools requiring integration with system commands
  • Development environments needing local command execution
  • Build and automation scripts in Flutter projects
  • Teams using custom or third-party CLI utilities

Considerations

  • Requires proper permissions for executing system commands
  • May need platform-specific configuration
  • Not intended for production distribution of CLI tools
  • Limited to local installations, not remote execution
  • Depends on correct setup of target CLI tools on host system

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package

No data available yet.

Rankings