🐛 Fix 'list-hosts' when empty #13
4 changed files with 28 additions and 21 deletions
|
|
@ -9,7 +9,10 @@ export default ({
|
|||
user
|
||||
}) => {
|
||||
screenStream.stdin.write(
|
||||
new AsciiTable()
|
||||
(
|
||||
user.getHosts().length === 0
|
||||
? getString('listHosts.noHosts')
|
||||
: new AsciiTable()
|
||||
.setHeading('Host', 'URI')
|
||||
.addRowMatrix(user.getHosts().map(host => [
|
||||
host.chain
|
||||
|
|
@ -27,6 +30,7 @@ export default ({
|
|||
]))
|
||||
.toString()
|
||||
.replaceAll('\n', '\r\n')
|
||||
)
|
||||
+
|
||||
'\r\n'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export default ({
|
|||
.alias('host')
|
||||
.description(getString('hostsCommand'))
|
||||
.argument('[name]', getString('setHost.name'))
|
||||
.option('-l, --list', getString('listHosts'))
|
||||
.option('-l, --list', getString('listHosts.title'))
|
||||
.option('-a, --add', getString('addHost'))
|
||||
.option('-e, --edit [name]', getString('editHost'))
|
||||
.option('-r, --remove [name]', getString('removeHost.title'))
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default ({
|
|||
}) => program
|
||||
.command('list-hosts')
|
||||
.alias('l')
|
||||
.description(getString('listHosts'))
|
||||
.description(getString('listHosts.title'))
|
||||
.action(() => listHosts({
|
||||
screenStream,
|
||||
user
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ i18next.init({
|
|||
'invalidTotpCode': 'Wrong TOTP code',
|
||||
'addHost': 'Add host',
|
||||
'totpCode': 'TOTP code',
|
||||
'listHosts': 'List hosts',
|
||||
'editHost': 'Edit host',
|
||||
'COMMAND_FAILED': 'Command failed : {{- message}}',
|
||||
'COMMAND_ABORTED': 'Command aborted.',
|
||||
|
|
@ -85,6 +84,10 @@ i18next.init({
|
|||
'enableTotp': 'Enable TOTP (next step)',
|
||||
'passwordMismatch': 'This password does not match the one you entered via SSH.'
|
||||
},
|
||||
'listHosts': {
|
||||
'title': 'List hosts',
|
||||
'noHosts': 'No host configured yet.'
|
||||
},
|
||||
'setHost': {
|
||||
'name': 'Name',
|
||||
'nameNew': 'New name',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue