Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const listCommand = (accountToken: string, args: ServerListArguments): void => {
const { count, offset, name, showTokens, requestHost } = args
const command: CommandResponse = new CommandResponse()
command.initResponse('Fetching servers...')
const client = new AccountClient(accountToken)
if (requestHost !== undefined && requestHost !== '') {
client.clientOptions.requestHost = requestHost
}
getServers(client, count, offset, name)
.then(response => {
if (args.json) {
return command.response(serverJson(response, showTokens))
}
return command.response(serverTable(response, showTokens))
})
.catch(error => {
return command.errorResponse(error)
})
}