protected function execute(InputInterface $input, OutputInterface $output)
{
$keys = $this->api()->getClient()->getSshKeys();
if (empty($keys)) {
$this->stdErr->writeln("You do not yet have any SSH public keys in your " . self::$config->get('service.name') . " account");
} else {
$table = new Table($input, $output);
$headers = ['ID', 'Title', 'Fingerprint'];
$rows = [];
foreach ($keys as $key) {
$rows[] = [$key['key_id'], $key['title'], $key['fingerprint']];
}
if ($table->formatIsMachineReadable()) {
$table->render($rows, $headers);
return 0;
}
$this->stdErr->writeln("Your SSH keys are:");
$table->render($rows, $headers);
}
$this->stdErr->writeln('');
$this->stdErr->writeln("Add a new SSH key with: <info>" . self::$config->get('application.executable') . " ssh-key:add</info>");
$this->stdErr->writeln("Delete an SSH key with: <info>" . self::$config->get('application.executable') . " ssh-key:delete [id]</info>");
return !empty($keys) ? 0 : 1;
}