runDeeplinkCli function

Future<int> runDeeplinkCli(
  1. List<String> args
)

CLI adapter for fdb deeplink <url> [--device <id>].

Output contract: DEEPLINK_OPENED=<url> (success) ERROR: No URL provided (no positional arg) ERROR: No active fdb session found. Run fdb launch first. (no session and no --device) ERROR: Deep links are only supported on Android devices and iOS simulators (unsupported platform) ERROR: Failed to open deep link: <details> (open failed) ERROR: <message> (--device unknown, or simulator not booted) WARNING: Universal Links (https://) may open Safari instead of the app on iOS simulator (written to stderr before DEEPLINK_OPENED for https:// on iOS)

Implementation

Future<int> runDeeplinkCli(List<String> args) {
  final parser = ArgParser()
    ..addOption(
      'device',
      valueHelp: 'id',
      help: "Target iOS simulator UDID or Android serial (default: the fdb session's device)",
    );
  if (args.contains('--help') || args.contains('-h')) {
    stdout.writeln('Usage: fdb deeplink <url> [--device <id>]\n\nOptions:\n${parser.usage}');
    return Future.value(0);
  }
  return runCliAdapter(parser, args, _execute);
}