🐛 Fix 'list-hosts' when empty (#13)
Co-authored-by: KaKi87 <KaKi87@pm.me> Reviewed-on: #13 Co-authored-by: Androz2091 <androz2091@gmail.com> Co-committed-by: Androz2091 <androz2091@gmail.com>dev
parent
993579be60
commit
f869631637
|
@ -9,24 +9,28 @@ export default ({
|
|||
user
|
||||
}) => {
|
||||
screenStream.stdin.write(
|
||||
new AsciiTable()
|
||||
.setHeading('Host', 'URI')
|
||||
.addRowMatrix(user.getHosts().map(host => [
|
||||
host.chain
|
||||
? getString(
|
||||
'home.chain',
|
||||
{
|
||||
host,
|
||||
via: host.chain
|
||||
.split(',')
|
||||
.join(getString('home.chainSeparator'))
|
||||
}
|
||||
)
|
||||
: host.name,
|
||||
getString('home.hostUri', { host })
|
||||
]))
|
||||
.toString()
|
||||
.replaceAll('\n', '\r\n')
|
||||
(
|
||||
user.getHosts().length === 0
|
||||
? getString('listHosts.noHosts')
|
||||
: new AsciiTable()
|
||||
.setHeading('Host', 'URI')
|
||||
.addRowMatrix(user.getHosts().map(host => [
|
||||
host.chain
|
||||
? getString(
|
||||
'home.chain',
|
||||
{
|
||||
host,
|
||||
via: host.chain
|
||||
.split(',')
|
||||
.join(getString('home.chainSeparator'))
|
||||
}
|
||||
)
|
||||
: host.name,
|
||||
getString('home.hostUri', { host })
|
||||
]))
|
||||
.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…
Reference in New Issue