avd_manager 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yml +3 -0
- package/.github/workflows/build-release.yml +103 -0
- package/.github/workflows/ci.yml +32 -0
- package/.versionrc.json +15 -0
- package/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +270 -0
- package/analysis_options.yaml +30 -0
- package/bin/avdm.dart +176 -0
- package/docs/.nojekyll +0 -0
- package/docs/404.html +28 -0
- package/docs/README.md +171 -0
- package/docs/_coverpage.md +8 -0
- package/docs/_sidebar.md +15 -0
- package/docs/assets/404.png +0 -0
- package/docs/assets/avdmbanner.png +0 -0
- package/docs/assets/badges.png +0 -0
- package/docs/assets/banner-light.png +0 -0
- package/docs/assets/cover.png +0 -0
- package/docs/assets/favicon.png +0 -0
- package/docs/assets/logo.png +0 -0
- package/docs/commands/create.md +24 -0
- package/docs/commands/delete.md +18 -0
- package/docs/commands/launch.md +17 -0
- package/docs/commands/list.md +32 -0
- package/docs/getting-started.md +135 -0
- package/docs/index.html +105 -0
- package/docs/theme.css +99 -0
- package/example/bin/example.dart +15 -0
- package/lib/avd_utils.dart +186 -0
- package/lib/commands/create.dart +86 -0
- package/lib/commands/delete.dart +31 -0
- package/lib/commands/launch.dart +68 -0
- package/lib/commands/list.dart +183 -0
- package/lib/src/version.dart +37 -0
- package/npm/LICENSE +21 -0
- package/npm/README.md +97 -0
- package/npm/bin/avdm-linux +0 -0
- package/npm/bin/avdm-macos +0 -0
- package/npm/bin/avdm-windows.exe +0 -0
- package/npm/index.js +16 -0
- package/npm/package.json +18 -0
- package/package.json +16 -0
- package/pubspec.yaml +28 -0
- package/scripts/debug_list_devices.dart +15 -0
- package/scripts/sync-versions.js +13 -0
- package/test/create_command_test.dart +38 -0
- package/test/list_avds_test.dart +76 -0
- package/test/utils_test.dart +52 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
name: Build and Create Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*" # Trigger on version tags (v1.0.0, v1.1.0, etc.)
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: Build ${{ matrix.os }}
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
15
|
+
include:
|
|
16
|
+
- os: ubuntu-latest
|
|
17
|
+
output-name: avdm-linux
|
|
18
|
+
asset-name: avdm-linux
|
|
19
|
+
- os: windows-latest
|
|
20
|
+
output-name: avdm-windows.exe
|
|
21
|
+
asset-name: avdm-windows.exe
|
|
22
|
+
- os: macos-latest
|
|
23
|
+
output-name: avdm-macos
|
|
24
|
+
asset-name: avdm-macos
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout code
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Setup Dart SDK
|
|
31
|
+
uses: dart-lang/setup-dart@v1
|
|
32
|
+
with:
|
|
33
|
+
sdk: stable
|
|
34
|
+
|
|
35
|
+
- name: Get dependencies
|
|
36
|
+
run: dart pub get
|
|
37
|
+
|
|
38
|
+
- name: Build executable
|
|
39
|
+
run: dart compile exe bin/avdm.dart -o ${{ matrix.output-name }}
|
|
40
|
+
|
|
41
|
+
- name: Upload artifact
|
|
42
|
+
uses: actions/upload-artifact@v3
|
|
43
|
+
with:
|
|
44
|
+
name: ${{ matrix.os }}-build
|
|
45
|
+
path: ${{ matrix.output-name }}
|
|
46
|
+
|
|
47
|
+
release:
|
|
48
|
+
name: Create GitHub Release
|
|
49
|
+
needs: build
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
|
|
52
|
+
steps:
|
|
53
|
+
- name: Checkout code
|
|
54
|
+
uses: actions/checkout@v4
|
|
55
|
+
|
|
56
|
+
- name: Download all artifacts
|
|
57
|
+
uses: actions/download-artifact@v3
|
|
58
|
+
with:
|
|
59
|
+
path: artifacts
|
|
60
|
+
|
|
61
|
+
- name: Create Release
|
|
62
|
+
uses: softprops/action-gh-release@v1
|
|
63
|
+
with:
|
|
64
|
+
files: |
|
|
65
|
+
artifacts/ubuntu-latest-build/avdm-linux
|
|
66
|
+
artifacts/windows-latest-build/avdm-windows.exe
|
|
67
|
+
artifacts/macos-latest-build/avdm-macos
|
|
68
|
+
draft: false
|
|
69
|
+
prerelease: false
|
|
70
|
+
env:
|
|
71
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
72
|
+
|
|
73
|
+
- name: Install Dependencies
|
|
74
|
+
run: npm install
|
|
75
|
+
|
|
76
|
+
- name: Generate Changelog & Bump Version
|
|
77
|
+
if ${{ github.event.inputs.dry_run != 'true' }}
|
|
78
|
+
id: version
|
|
79
|
+
|
|
80
|
+
run: |
|
|
81
|
+
npx standard-version --release-as ${{ github.event.inputs.bump }}
|
|
82
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
83
|
+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
|
84
|
+
|
|
85
|
+
update-homebrew:
|
|
86
|
+
name: Update Homebrew Formula
|
|
87
|
+
needs: release
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
|
|
90
|
+
steps:
|
|
91
|
+
- name: Trigger Homebrew update
|
|
92
|
+
uses: actions/github-script@v7
|
|
93
|
+
with:
|
|
94
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
95
|
+
script: |
|
|
96
|
+
// This creates an issue reminder to update the Homebrew formula with the new version and SHA256
|
|
97
|
+
const { data: issue } = await github.rest.issues.create({
|
|
98
|
+
owner: context.repo.owner,
|
|
99
|
+
repo: context.repo.repo,
|
|
100
|
+
title: `Update Homebrew formula for version ${process.env.GITHUB_REF.replace("refs/tags/v", "")}`,
|
|
101
|
+
body: `A new release has been created for version ${process.env.GITHUB_REF.replace("refs/tags/v", "")}. Please update the Homebrew formula with the new version and the correct SHA256 checksum for the new release.`
|
|
102
|
+
});
|
|
103
|
+
console.log("Remember to update the Homebrew formula with new SHA256");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Dart CLI CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
name: Run format, analyze, and test
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v3
|
|
17
|
+
|
|
18
|
+
- name: Set up Dart
|
|
19
|
+
uses: dart-lang/setup-dart@v1
|
|
20
|
+
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: dart pub get
|
|
23
|
+
|
|
24
|
+
- name: Check formatting
|
|
25
|
+
run: dart format . --set-exit-if-changed
|
|
26
|
+
|
|
27
|
+
- name: Analyze project source
|
|
28
|
+
run: dart analyze
|
|
29
|
+
|
|
30
|
+
# Optional: Add tests if you have any
|
|
31
|
+
- name: Run tests
|
|
32
|
+
run: dart test
|
package/.versionrc.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"types": [
|
|
3
|
+
{ "type": "feat", "section": "Features", "hidden": false },
|
|
4
|
+
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
|
|
5
|
+
{ "type": "docs", "section": "Documentation", "hidden": false },
|
|
6
|
+
{ "type": "perf", "section": "Performance", "hidden": false },
|
|
7
|
+
{ "type": "refactor", "section": "Refactoring", "hidden": false },
|
|
8
|
+
{ "type": "style", "section": "Styles", "hidden": false },
|
|
9
|
+
{ "type": "test", "section": "Tests", "hidden": false },
|
|
10
|
+
{ "type": "chore", "section": "Chores", "hidden": true }
|
|
11
|
+
],
|
|
12
|
+
"commitUrlFormat": "https://github.com/Tdebo21/avd_manager/commit/{{hash}}",
|
|
13
|
+
"compareUrlFormat": "https://github.com/Tdebo21/avd_manager/compare/{{previousTag}}...{{currentTag}}",
|
|
14
|
+
"releaseCommitMessageFormat": "chore(release): {{currentTag}}"
|
|
15
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [1.0.4](https://github.com/Tdebo21/avd_manager/compare/v1.0.3...v1.0.4) (2026-05-13)
|
|
6
|
+
|
|
7
|
+
## 1.0.0
|
|
8
|
+
|
|
9
|
+
- Initial version.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rabi Iya
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
[](https://www.npmjs.com/package/avd-manager-cli)
|
|
2
|
+
[](https://www.npmjs.com/package/avd-manager-cli)
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://github.com/Tdebo21/avd_manager/commits)
|
|
5
|
+
[](https://github.com/Tdebo21/avd_manager/actions)
|
|
6
|
+
[](https://pub.dev/packages/avd_manager)
|
|
7
|
+
[](https://buymeacoffee.com/guimbobabag)
|
|
8
|
+
[](https://github.com/sponsors/Tdebo21)
|
|
9
|
+
|
|
10
|
+
# 📱 avdm - AVD Manager CLI Tool
|
|
11
|
+
|
|
12
|
+
**avdm** is a simple and efficient command-line tool that helps you manage Android Virtual Devices (AVDs) right from your terminal.
|
|
13
|
+
|
|
14
|
+
Built for developers who want a faster, scriptable, and more minimal alternative to Android Studio’s GUI-based AVD Manager.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 🚀 Features
|
|
19
|
+
|
|
20
|
+
- ✨ Create and manage Android Virtual Devices with ease
|
|
21
|
+
- 🔍 List all available AVDs and their configurations
|
|
22
|
+
- 🔧 Launch AVDs with custom options
|
|
23
|
+
- 📋 Delete and clean up unused or outdated AVDs
|
|
24
|
+
- 📦 Show disk usage per AVD
|
|
25
|
+
- 📊 Sort AVDs by name or size
|
|
26
|
+
- 📏 Filter AVDs by minimum size (e.g. `--min-size 2GB`)
|
|
27
|
+
- ⚡ Lightweight & fast (written in Dart)
|
|
28
|
+
- No GUI required
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 📦 Installation
|
|
33
|
+
|
|
34
|
+
**Option 1: Via Pub.dev (requires Dart SDK)**
|
|
35
|
+
|
|
36
|
+
### Prerequisites
|
|
37
|
+
|
|
38
|
+
> Ensure you have the Dart SDK installed. If not, install it from https://dart.dev/get-dart
|
|
39
|
+
|
|
40
|
+
- **Dart SDK** 3.0 or higher ([Install Dart](https://dart.dev/get-dart))
|
|
41
|
+
- **Android SDK** with emulator tools ([Install Android Studio](https://developer.android.com/studio))
|
|
42
|
+
- **Java JDK** 11 or higher
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
dart pub global activate avd_manager
|
|
46
|
+
avdm --help
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 1. Clone the repo
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone https://github.com/Tdebo21/avd_manager.git
|
|
53
|
+
cd avd_manager
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 2. Activate the CLI
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
dart pub global activate --source path .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> This makes avdm available globally as a command.
|
|
63
|
+
>
|
|
64
|
+
> If you previously installed `avdm`, refresh the global install with:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
dart pub global deactivate avdm
|
|
68
|
+
dart pub global activate --source path .
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
**Option 2: Download Binary (no Dart Required)**
|
|
74
|
+
|
|
75
|
+
> Optionally, you can install **AVD Manager CLI Tool** by downloading the binary from the releases page.
|
|
76
|
+
|
|
77
|
+
**Option 3: Using npm**
|
|
78
|
+
You can install AVD Manager CLI globally using npm:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm install -g avd-manager-cli
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Option 4: Using Homebrew**
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Example installation using Homebrew (macOS)
|
|
88
|
+
|
|
89
|
+
brew tap Tdebo21/avd_manager
|
|
90
|
+
brew install avd_manager
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 🛠 Usage
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
avdm <command> [options]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 📋 Available Commands
|
|
100
|
+
|
|
101
|
+
| Command | Description |
|
|
102
|
+
| -------- | --------------------------------------- |
|
|
103
|
+
| `list` | List all AVDs with optional sort/filter |
|
|
104
|
+
| `create` | Create a new AVD from a system image |
|
|
105
|
+
| `patch` | Patch an existing AVD (config changes) |
|
|
106
|
+
| `launch` | Launch a specific AVD |
|
|
107
|
+
| `delete` | Delete a specific AVD |
|
|
108
|
+
| `help` | Show help |
|
|
109
|
+
|
|
110
|
+
### 🔧 Options for `list`
|
|
111
|
+
|
|
112
|
+
| Flag | Description | Example |
|
|
113
|
+
| ------------ | ------------------------------------- | ---------------- |
|
|
114
|
+
| `--sort` | Sort AVDs by `name` or `size` | `--sort size` |
|
|
115
|
+
| `--min-size` | Only show AVDs larger than given size | `--min-size 1GB` |
|
|
116
|
+
|
|
117
|
+
# Usage Examples
|
|
118
|
+
|
|
119
|
+
# List all AVDs
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
avdm list
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
> Note: `avdm list` reports the size of each AVD's local `.avd` directory. Newly created AVDs often
|
|
126
|
+
> start very small (around 1MB) and grow after the emulator is launched and the AVD image files are
|
|
127
|
+
> created.
|
|
128
|
+
|
|
129
|
+
# Sort AVDs by size
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
avdm list --sort size
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
# Filter AVDs larger than 2GB
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
avdm list --min-size 2GB
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
# Sort AVDs by name and filter by minimum size
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
avdm list --sort name --min-size 1GB
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
# Create a new AVD
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
avdm create <avd_name> --device "Pixel 2" --api 30
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
# Examples:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
avdm create Slim_API30 --api=30
|
|
157
|
+
avdm create TestDevice --device="Nexus 4" --api=29
|
|
158
|
+
avdm create miniTestPhone --device "pixel" --api 30 --abi arm64-v8a
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
> On Apple Silicon, the tool now defaults `--abi` to `arm64-v8a` when not provided. Use `--abi x86` or `--abi x86_64` only if you have Intel system images installed.
|
|
162
|
+
|
|
163
|
+
# Launch AVD with prompt-based selection:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
avdm launch
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
# Launch specific AVD with defaults:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
avdm launch TestDevice
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
# Launch with performance flags:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
avdm launch TestDevice --cold-boot --no-boot-anim --no-snapshot-load
|
|
179
|
+
avdm launch TestDevice --no-snapshot-save
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
> Use "avdm <command> --help" for more information about a command.
|
|
183
|
+
|
|
184
|
+
# Delete an AVD
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
avdm delete Slim_API30
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
# 🧩 How It Works
|
|
193
|
+
|
|
194
|
+
avdm looks for AVDs in your $ANDROID_AVD_HOME environment variable.
|
|
195
|
+
|
|
196
|
+
If not set, it defaults to ~/.android/avd/.
|
|
197
|
+
|
|
198
|
+
It reads each AVD’s directory and calculates its total disk usage.
|
|
199
|
+
|
|
200
|
+
Outputs the AVD name and its formatted size (e.g. 1.94 GB).
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Troubleshooting
|
|
205
|
+
|
|
206
|
+
### AVD Not Found
|
|
207
|
+
|
|
208
|
+
Ensure your `ANDROID_SDK_ROOT` environment variable is set:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# macOS/Linux
|
|
212
|
+
export ANDROID_SDK_ROOT=~/Library/Android/sdk # macOS
|
|
213
|
+
export ANDROID_SDK_ROOT=~/Android/sdk # Linux
|
|
214
|
+
|
|
215
|
+
# Windows (PowerShell)
|
|
216
|
+
$env:ANDROID_SDK_ROOT="C:\Users\YourName\AppData\Local\Android\sdk"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Permission Denied (Linux/macOS)
|
|
220
|
+
|
|
221
|
+
Ensure the tool has execute permissions:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
chmod +x ~/.pub-cache/bin/avdm
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Emulator Won't Launch
|
|
228
|
+
|
|
229
|
+
- Check that your system supports virtualization (KVM on Linux, Hypervisor Framework on macOS)
|
|
230
|
+
- Increase available RAM
|
|
231
|
+
- Disable VT-x/AMD-V in BIOS if conflicts exist
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
# 🤝 Contributing
|
|
236
|
+
|
|
237
|
+
Contributions, suggestions, and bug reports are welcome!
|
|
238
|
+
|
|
239
|
+
1. Fork the repository
|
|
240
|
+
2. Create a feature branch: `git checkout -b feature/your-feature`
|
|
241
|
+
3. Commit your changes: `git commit -am 'Add awesome feature'`
|
|
242
|
+
4. Push to the branch: `git push origin feature/your-feature`
|
|
243
|
+
5. Open a Pull Request
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
# 📝 License
|
|
248
|
+
|
|
249
|
+
This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Changelog
|
|
254
|
+
|
|
255
|
+
See [CHANGELOG.md](CHANGELOG.md) for version history and release notes.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
# ❤️ Support & Sponsorship
|
|
260
|
+
|
|
261
|
+
If you found this project useful, consider sponsoring it to support further development!
|
|
262
|
+
|
|
263
|
+
💖 Sponsor on GitHub: [](https://github.com/sponsors/Tdebo21)
|
|
264
|
+
|
|
265
|
+
Or buy me a coffee: [](https://buymeacoffee.com/guimbobabag)
|
|
266
|
+
|
|
267
|
+
# ✨ Author
|
|
268
|
+
|
|
269
|
+
Rabi Iya
|
|
270
|
+
GitHub @Tdebo21
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This file configures the static analysis results for your project (errors,
|
|
2
|
+
# warnings, and lints).
|
|
3
|
+
#
|
|
4
|
+
# This enables the 'recommended' set of lints from `package:lints`.
|
|
5
|
+
# This set helps identify many issues that may lead to problems when running
|
|
6
|
+
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
|
|
7
|
+
# style and format.
|
|
8
|
+
#
|
|
9
|
+
# If you want a smaller set of lints you can change this to specify
|
|
10
|
+
# 'package:lints/core.yaml'. These are just the most critical lints
|
|
11
|
+
# (the recommended set includes the core lints).
|
|
12
|
+
# The core lints are also what is used by pub.dev for scoring packages.
|
|
13
|
+
|
|
14
|
+
include: package:lints/recommended.yaml
|
|
15
|
+
|
|
16
|
+
# Uncomment the following section to specify additional rules.
|
|
17
|
+
|
|
18
|
+
# linter:
|
|
19
|
+
# rules:
|
|
20
|
+
# - camel_case_types
|
|
21
|
+
|
|
22
|
+
# analyzer:
|
|
23
|
+
# exclude:
|
|
24
|
+
# - path/to/excluded/files/**
|
|
25
|
+
|
|
26
|
+
# For more information about the core and recommended set of lints, see
|
|
27
|
+
# https://dart.dev/go/core-lints
|
|
28
|
+
|
|
29
|
+
# For additional information about configuring this file, see
|
|
30
|
+
# https://dart.dev/guides/language/analysis-options
|
package/bin/avdm.dart
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import 'dart:io';
|
|
2
|
+
import 'package:args/args.dart';
|
|
3
|
+
import 'package:avd_manager/commands/create.dart';
|
|
4
|
+
import 'package:avd_manager/commands/delete.dart';
|
|
5
|
+
import 'package:avd_manager/commands/launch.dart' as launch_cmd;
|
|
6
|
+
import 'package:avd_manager/commands/list.dart';
|
|
7
|
+
import 'package:avd_manager/src/version.dart';
|
|
8
|
+
|
|
9
|
+
void main(List<String> args) async {
|
|
10
|
+
final createParser = ArgParser()
|
|
11
|
+
..addFlag('help', abbr: 'h', negatable: false, help: 'Show create usage')
|
|
12
|
+
..addOption('device', help: 'Device name (e.g. "pixel")')
|
|
13
|
+
..addOption('api', help: 'API level (e.g. 28)')
|
|
14
|
+
..addOption('name', help: 'AVD name')
|
|
15
|
+
..addOption('abi',
|
|
16
|
+
help: 'ABI for the system image (e.g. x86, x86_64, arm64-v8a)');
|
|
17
|
+
|
|
18
|
+
final launchParser = ArgParser()
|
|
19
|
+
..addFlag('help', abbr: 'h', negatable: false, help: 'Show launch usage')
|
|
20
|
+
..addFlag('wipe-data', negatable: false, help: 'Wipe user data')
|
|
21
|
+
..addFlag('cold-boot', negatable: false, help: 'Cold boot the AVD')
|
|
22
|
+
..addFlag('no-snapshot-load',
|
|
23
|
+
negatable: false, help: 'Do not load from snapshot')
|
|
24
|
+
..addFlag('no-snapshot-save',
|
|
25
|
+
negatable: false, help: 'Do not save to snapshot on exit')
|
|
26
|
+
..addFlag('no-boot-anim', negatable: false, help: 'Disable boot animation');
|
|
27
|
+
|
|
28
|
+
final deleteParser = ArgParser()
|
|
29
|
+
..addFlag('help', abbr: 'h', negatable: false, help: 'Show delete usage');
|
|
30
|
+
|
|
31
|
+
final listParser = ArgParser()
|
|
32
|
+
..addFlag('help', abbr: 'h', negatable: false, help: 'Show list usage')
|
|
33
|
+
..addOption('sort',
|
|
34
|
+
allowed: ['size', 'name'], help: 'Sort AVDs by "size" or "name"')
|
|
35
|
+
..addOption('min-size',
|
|
36
|
+
help: 'Only show AVDs larger than this size (e.g. 500MB, 1GB)');
|
|
37
|
+
|
|
38
|
+
// ADD VERSION FLAG TO MAIN PARSER
|
|
39
|
+
final parser = ArgParser()
|
|
40
|
+
..addFlag('help', abbr: 'h', negatable: false, help: 'Show usage')
|
|
41
|
+
..addFlag('version', negatable: false, help: 'Show version information')
|
|
42
|
+
..addCommand('create', createParser)
|
|
43
|
+
..addCommand('launch', launchParser)
|
|
44
|
+
..addCommand('delete', deleteParser)
|
|
45
|
+
..addCommand('list', listParser);
|
|
46
|
+
|
|
47
|
+
late ArgResults results;
|
|
48
|
+
try {
|
|
49
|
+
results = parser.parse(args);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
print('❌ Error: ${e.toString()}');
|
|
52
|
+
_printUsage(parser);
|
|
53
|
+
exit(64);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Handle --version flag FIRST (before checking other flags)
|
|
57
|
+
if (results['version'] as bool) {
|
|
58
|
+
final version = getVersion();
|
|
59
|
+
print('avd_manager version $version');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (results['help'] as bool) {
|
|
64
|
+
_printUsage(parser);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
final command = results.command;
|
|
69
|
+
if (command == null) {
|
|
70
|
+
print('No command provided. Use --help for usage information.');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
// Handle commands
|
|
74
|
+
switch (results.command!.name) {
|
|
75
|
+
case 'launch':
|
|
76
|
+
final cmd = results.command!;
|
|
77
|
+
if (cmd['help'] as bool) {
|
|
78
|
+
print('Usage: avdm launch <avd_name> [options]\n${launchParser.usage}');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
final name = cmd.rest.isNotEmpty ? cmd.rest[0] : null;
|
|
82
|
+
final extraArgs = <String>[];
|
|
83
|
+
List<String> emulatorArgs = [];
|
|
84
|
+
|
|
85
|
+
if (cmd.wasParsed('wipe-data')) {
|
|
86
|
+
emulatorArgs.add('-wipe-data');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (cmd['cold-boot']) extraArgs.add('-no-snapshot-load');
|
|
90
|
+
if (cmd['no-snapshot-load']) extraArgs.add('-no-snapshot-load');
|
|
91
|
+
if (cmd['no-snapshot-save']) extraArgs.add('-no-snapshot-save');
|
|
92
|
+
if (cmd['no-boot-anim']) extraArgs.add('-no-boot-anim');
|
|
93
|
+
|
|
94
|
+
await launch_cmd.launchAvd(name, extraArgs: extraArgs);
|
|
95
|
+
break;
|
|
96
|
+
case 'create':
|
|
97
|
+
final cmd = results.command!;
|
|
98
|
+
if (cmd['help'] as bool) {
|
|
99
|
+
print('Usage: avdm create <name> [options]\n${createParser.usage}');
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
final name = cmd.rest.isNotEmpty ? cmd.rest[0] : null;
|
|
103
|
+
final device = cmd['device'] as String?;
|
|
104
|
+
final api = cmd['api'] as String?;
|
|
105
|
+
final abi = cmd['abi'] as String?;
|
|
106
|
+
if (name == null || api == null) {
|
|
107
|
+
print(
|
|
108
|
+
'❌ AVD name and --api are required.\nUsage: avdm create <name> --device "Nexus 9" --api 30');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
await createAvd(name, device: device, apiLevel: api, abi: abi);
|
|
112
|
+
break;
|
|
113
|
+
case 'delete':
|
|
114
|
+
final cmd = results.command!;
|
|
115
|
+
if (cmd['help'] as bool) {
|
|
116
|
+
print('Usage: avdm delete <avd_name>');
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
final name = cmd.rest.isNotEmpty ? cmd.rest[0] : null;
|
|
120
|
+
if (name == null) {
|
|
121
|
+
print('❌ Please specify the AVD name to delete.');
|
|
122
|
+
print('Usage: avdm delete <avd_name>');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
// confirm deletion
|
|
126
|
+
stdout.write('Are you sure you want to delete AVD "$name"? (y/N) ');
|
|
127
|
+
final confirm = stdin.readLineSync();
|
|
128
|
+
if (confirm == null || confirm.toLowerCase() != 'y') {
|
|
129
|
+
print('Deletion cancelled.');
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
await deleteAvd(name);
|
|
133
|
+
break;
|
|
134
|
+
case 'list':
|
|
135
|
+
final cmd = results.command!;
|
|
136
|
+
if (cmd['help'] as bool) {
|
|
137
|
+
print('Usage: avdm list [options]\n${listParser.usage}');
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
final sortBy = cmd['sort'] ?? 'name';
|
|
141
|
+
final minSizeStr = cmd['min-size'] ?? '0';
|
|
142
|
+
|
|
143
|
+
await listAvds({
|
|
144
|
+
'sort': sortBy,
|
|
145
|
+
'min-size': minSizeStr,
|
|
146
|
+
});
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
print('❓ Unknown command: ${results.command!.name}');
|
|
150
|
+
print('\n${usage(parser)}');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
void _printUsage(ArgParser parser) {
|
|
155
|
+
print('''AVDM - Lightweight Android AVD Manager CLI
|
|
156
|
+
${usage(parser)}
|
|
157
|
+
Commands:
|
|
158
|
+
avdm create <avd_name> [--device="Pixel 2"] [--api=30] Create and patch an AVD
|
|
159
|
+
avdm list List all AVDs
|
|
160
|
+
avdm delete <avd_name> Delete an AVD
|
|
161
|
+
avdm launch <avd_name> [options] Launch an AVD with optional flags
|
|
162
|
+
|
|
163
|
+
Examples:
|
|
164
|
+
avdm create Slim_API30 --api=30
|
|
165
|
+
avdm create TestDevice --device="Nexus 4" --api=29
|
|
166
|
+
avdm delete Slim_API30
|
|
167
|
+
avdm launch TestDevice --wipe-data --no-boot-anim
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
Use "avdm <command> --help" for command-specific usage.
|
|
171
|
+
''');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Function to generate usage string
|
|
175
|
+
String usage(ArgParser parser) =>
|
|
176
|
+
'Usage: avdm <command> [options]\n\n${parser.usage}';
|
package/docs/.nojekyll
ADDED
|
File without changes
|
package/docs/404.html
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>404 - Command Not Found!</title>
|
|
6
|
+
<link rel="stylesheet" href="./theme.css" />
|
|
7
|
+
<link rel="icon" href="./assets/404.png" type="image/png" />
|
|
8
|
+
</head>
|
|
9
|
+
<body style="text-align: center; padding: 50px">
|
|
10
|
+
<img src="./assets/404.png" alt="AVD Manager CLI Logo" width="120" />
|
|
11
|
+
<h1 style="color: var(--accent); font-size: 48px">
|
|
12
|
+
404 — Command Not Found!
|
|
13
|
+
</h1>
|
|
14
|
+
<p>The page you're looking for doesn't exist or has been moved.</p>
|
|
15
|
+
<p>Check the URL and try again, or return to the homepage.</p>
|
|
16
|
+
<a
|
|
17
|
+
href="https://Tdebo21.github.io/avd_manager"
|
|
18
|
+
id="go-home"
|
|
19
|
+
style="
|
|
20
|
+
background: var(--accent);
|
|
21
|
+
color: #000;
|
|
22
|
+
padding: 10px 20px;
|
|
23
|
+
border-radius: 6px;
|
|
24
|
+
"
|
|
25
|
+
>Go Home</a
|
|
26
|
+
>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|