run method
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand
.
Implementation
@override
FutureOr<int>? run() async {
logger.spaces();
logger.info(
'to create an SSH connection to the remote device, we need an IP address and a username',
);
final ip = interaction.readDeviceIp();
final username = interaction.readDeviceUsername();
final sshConnectionCreated =
await sshService.createPasswordLessSshConnection(
username,
ip,
);
if (sshConnectionCreated) {
logger.success('SSH connection to the remote device is created!');
return 0;
} else {
logger.fail('Could not create SSH connection to the remote device!');
return 1;
}
}