initializeObs method
Implementation
Future<void> initializeObs() async {
final config = <String, dynamic>{};
if (globalResults?['uri'] == null) {
final configFile = File('${ObsUtil.userHome}/.obs/credentials.json');
if (!configFile.existsSync()) {
throw UsageException('OBS connection information not provided.', usage);
}
config.addAll(json.decode(configFile.readAsStringSync()));
} else {
config['uri'] = globalResults!['uri'];
if (globalResults?['passwd'] != null) {
config['password'] = globalResults!['passwd'];
}
}
_obs = await ObsWebSocket.connect(
config['uri']!,
password: config['password'],
timeout: Duration(
seconds: globalResults?['timeout'] == null
? 5
: int.parse(globalResults!['timeout']),
),
logOptions: ObsUtil.convertToLogOptions(globalResults!['log-level']),
);
}