initCli method
Implementation
Future<void> initCli() async {
Map<String, dynamic>? cliArgs = cliArguments?.parse();
Map<String, dynamic>? newCliArgs = await cliTool.initArgs(cliArgs);
if (newCliArgs == null) newCliArgs = cliArgs;
String? toolTag = newCliArgs?[CLI_ARGUMENT_TAG] as String?;
String? toolHost = newCliArgs?[CLI_ARGUMENT_HOST] as String?;
int? toolPort = newCliArgs?[CLI_ARGUMENT_PORT] == null
? null
: int.parse(newCliArgs![CLI_ARGUMENT_PORT]);
List<String>? toolApiKeys =
newCliArgs?[CLI_ARGUMENT_APIKEYS] as List<String>?;
this.version = toolTag ?? DEFAULT_TOOL_TAG;
if (toolHost != null && toolHost.isNotEmpty) {
this.host = toolHost;
} else {
this.host = DEFAULT_TOOL_HOST;
}
if (toolPort != null && toolPort > 0) {
this.port = toolPort;
} else {
this.port = DEFAULT_TOOL_PORT;
}
if (toolApiKeys != null && toolApiKeys.isNotEmpty) {
this.apiKeys = toolApiKeys;
} else {
this.apiKeys = [];
}
}