Check for authentication after config
When user changes configuration, the tool could check the authentication against the server for example by getting users issues and check if the connection works. If the connection does not work the tool could ask the authentication parameters again or just quit and remove the configuration file. Otherwise the tool just fails abnormally whatever command you run if your credentials don't work, for example the ls command:
/usr/local/lib/node_modules/jira-cli/lib/jira/ls.js:41
if (!res.ok) {
^
TypeError: Cannot read property 'ok' of undefined
at /usr/local/lib/node_modules/jira-cli/lib/jira/ls.js:41:20
at Request.callback (/usr/local/lib/node_modules/jira-cli/node_modules/superagent/lib/node/index.js:704:3)
at ClientRequest.<anonymous> (/usr/local/lib/node_modules/jira-cli/node_modules/superagent/lib/node/index.js:637:10)
at Object.onceWrapper (events.js:421:26)
at ClientRequest.emit (events.js:314:20)
at TLSSocket.socketErrorListener (_http_client.js:469:9)
at TLSSocket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Actually for me it seems the authentication is working but for some reason it cannot connect to the server. With CURL I can get the issues from the server though. Another issue would be to also check the error returned by superagent instead just checking the result for ok. Anyhow for some reason this does not work (TLS related?)