개발 중에 로컬에 설치된 명령줄 도구를 간편하게 실행하기 위해 설계된 Flutter/Dart 패키지입니다. Flutter 애플리케이션 내에서 CLI 유틸리티를 원활하게 실행할 수 있으며, Android, iOS, Linux, macOS, Windows에서의 크로스플랫폼 워크플로우를 지원합니다. 외부 명령줄 프로그램과 통합하거나 호출하는 도구를 개발하는 개발자에게 적합하며, 로컬 설치 및 실행 경로를 관리함으로써 테스트와 디버깅을 간소화합니다. 시스템 레벨 명령어에 직접 접근이 필요한 개발 환경에서 특히 유용합니다.
사용 사례
앱 개발 중 로컬 CLI 도구 실행
Flutter 앱에 외부 명령줄 유틸리티 통합하기
제어된 환경에서 명령줄 상호작용 테스트
Flutter 앱 내에서 빌드 또는 배포 스크립트 자동화
로컬 실행 파일에 의존하는 개발자 도구 체인 지원
주요 기능
크로스 플랫폼 CLI 실행 지원
로컬에 설치된 도구와의 간편한 통합
실행 파일에 대한 자동 경로 해석
명령을 실행하기 위한 간단한 API
명령 실패에 대한 내장된 오류 처리
적합한 대상
CLI 도구를 사용하는 Flutter 개발자
시스템 명령어와의 통합이 필요한 도구
로컬 명령 실행이 필요한 개발 환경
Flutter 프로젝트에서의 빌드 및 자동화 스크립트
사용자 지정 또는 제3자 CLI 유틸리티를 사용하는 팀
고려 사항
시스템 명령을 실행하려면 적절한 권한이 필요합니다
플랫폼별 구성이 필요할 수 있습니다
CLI 도구의 생산 배포를 위한 것이 아님
로컬 설치에 한정되며 원격 실행은 지원하지 않음
호스트 시스템의 대상 CLI 도구가 올바르게 설정되어 있어야 함
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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