run method
Run ulink verify --domain <domain>. Returns the exit code + structured
result; does not call exit() itself so it stays unit-testable.
0 = all checks passed, 1 = a check failed, 2 = bad usage.
Implementation
Future<DomainVerifyRunResult> run(DomainVerifyOptions opts) async {
try {
if (opts.help) {
_Log.out(domainVerifyUsage);
return DomainVerifyRunResult(0, null);
}
final domain = normalizeDomain(opts.domain ?? '');
if (domain.isEmpty) {
_Log.err(
'Missing --domain (the ULink domain to verify). See `ulink verify --help`.');
return DomainVerifyRunResult(2, null);
}
_Log.step('Verifying app-link setup for ${ConsoleStyle.bold(domain)}');
final checks = <Map<String, dynamic>>[];
await _checkIos(domain, opts.ios, checks);
await _checkAndroid(domain, opts.android, checks);
final ok = checks.every((c) => c['ok'] == true);
final result = <String, dynamic>{'domain': domain, 'ok': ok, 'checks': checks};
if (opts.json) {
_Log.out(const JsonEncoder.withIndent(' ').convert(result));
}
_Log.info('');
if (ok) {
_Log.ok('${ConsoleStyle.bold(domain)} is serving valid app-link '
'association files. Deep links can verify on-device.');
return DomainVerifyRunResult(0, result);
}
_Log.err('${ConsoleStyle.bold(domain)} is not fully wired for app links '
'yet — see the failures above.');
return DomainVerifyRunResult(1, result);
} finally {
if (_ownsClient) client.close();
}
}