|
| 1 | +# Instabug Flutter CLI Tool |
| 2 | + |
| 3 | +A command-line tool for managing Instabug Flutter SDK integration and utilities. |
| 4 | + |
| 5 | +## Available Commands |
| 6 | + |
| 7 | +### `init` - Initialize Instabug Flutter SDK |
| 8 | + |
| 9 | +Automatically sets up the Instabug Flutter SDK in your project with basic instrumentation. |
| 10 | + |
| 11 | +#### Usage |
| 12 | + |
| 13 | +```bash |
| 14 | +dart run instabug_flutter:instabug init --token YOUR_APP_TOKEN [options] |
| 15 | +``` |
| 16 | + |
| 17 | +#### Options |
| 18 | + |
| 19 | +- `--token, -t` (required): Your Instabug app token |
| 20 | +- `--project-path, -p`: Path to your Flutter project (defaults to current directory) |
| 21 | +- `--invocation-events, -i`: Comma-separated list of invocation events (default: shake) |
| 22 | + - Available events: `shake`, `floating_button`, `screenshot`, `two_finger_swipe_left`, `none` |
| 23 | +- `--setup-permissions`: Setup required permissions for iOS and Android (default: true) |
| 24 | +- `--update-pubspec`: Add instabug_flutter dependency to pubspec.yaml (default: true) |
| 25 | +- `--help, -h`: Show help message |
| 26 | + |
| 27 | +#### What it does |
| 28 | + |
| 29 | +1. **Updates pubspec.yaml**: Automatically fetches and adds the latest `instabug_flutter` dependency from pub.dev |
| 30 | +2. **Updates main.dart**: Adds the Instabug import and initialization code in the `main()` function before `runApp()` |
| 31 | +3. **Sets up permissions**: |
| 32 | + - **iOS**: Adds required usage descriptions to Info.plist for microphone and photo library access |
| 33 | + - **Android**: Permissions are automatically handled by the plugin |
| 34 | +4. **Configures invocation events**: Sets up how users can invoke Instabug (shake, floating button, etc.) |
| 35 | +5. **Latest version detection**: Automatically fetches the most recent version from pub.dev with fallback support |
| 36 | + |
| 37 | +#### Examples |
| 38 | + |
| 39 | +**Basic initialization with shake gesture:** |
| 40 | +```bash |
| 41 | +dart run instabug_flutter:instabug init --token YOUR_APP_TOKEN |
| 42 | +``` |
| 43 | + |
| 44 | +**Initialize with multiple invocation events:** |
| 45 | +```bash |
| 46 | +dart run instabug_flutter:instabug init --token YOUR_APP_TOKEN --invocation-events shake,floating_button |
| 47 | +``` |
| 48 | + |
| 49 | +**Initialize without automatic permission setup:** |
| 50 | +```bash |
| 51 | +dart run instabug_flutter:instabug init --token YOUR_APP_TOKEN --no-setup-permissions |
| 52 | +``` |
| 53 | + |
| 54 | +**Initialize for a specific project path:** |
| 55 | +```bash |
| 56 | +dart run instabug_flutter:instabug init --token YOUR_APP_TOKEN --project-path /path/to/my/flutter/project |
| 57 | +``` |
| 58 | + |
| 59 | +#### After running the command |
| 60 | + |
| 61 | +1. Run `flutter packages get` to install the new dependency |
| 62 | +2. If using a placeholder token, replace `YOUR_APP_TOKEN` in your main.dart with your actual Instabug app token |
| 63 | +3. Test the integration by using your configured invocation event (e.g., shake the device) |
| 64 | + |
| 65 | +#### Finding your App Token |
| 66 | + |
| 67 | +You can find your app token by: |
| 68 | +1. Going to your [Instabug dashboard](https://dashboard.instabug.com) |
| 69 | +2. Selecting **SDK Integration** in the **Settings** menu |
| 70 | +3. Your app token will be displayed there |
| 71 | + |
| 72 | +### `upload-so-files` - Upload Symbol Files |
| 73 | + |
| 74 | +Uploads .so files for NDK crash reporting (existing command). |
| 75 | + |
| 76 | +## Getting Help |
| 77 | + |
| 78 | +For help on any command: |
| 79 | +```bash |
| 80 | +dart run instabug_flutter:instabug <command> --help |
| 81 | +``` |
| 82 | + |
| 83 | +For general help: |
| 84 | +```bash |
| 85 | +dart run instabug_flutter:instabug --help |
| 86 | +``` |
| 87 | + |
| 88 | +## Requirements |
| 89 | + |
| 90 | +- Flutter SDK |
| 91 | +- Dart SDK |
| 92 | +- Valid Instabug app token |
| 93 | + |
| 94 | +## Documentation |
| 95 | + |
| 96 | +For more detailed information about Instabug Flutter integration, visit the [official documentation](https://docs.instabug.com/docs/flutter-integration). |
0 commit comments