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