run method

  1. @override
void run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
void run() async {
  Loggy.initLoggy(
      logPrinter: const PrettyPrinter(
        showColors: false,
      ),
      logOptions: OnvifUtil.convertToLogOptions(globalResults!['log-level']));

  var server = await io.serve(
    DevicesController().handler,
    argResults!['bind-ip'],
    int.parse(argResults!['port']),
  );

  if (argResults!['bind-ip'] == _defaultIp) {
    for (var interface in await NetworkInterface.list()) {
      for (var addr in interface.addresses) {
        logInfo('Serving at http://${addr.address}:${server.port}');
      }
    }
  } else {
    logInfo('Serving at http://${server.address.host}:${server.port}');
  }
}