@nectarcrm/ccx 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ccx.js +10 -2
- package/package.json +1 -1
package/bin/ccx.js
CHANGED
|
@@ -787,8 +787,16 @@ if (cmd === 'doctor') await doctor()
|
|
|
787
787
|
|
|
788
788
|
if (cmd === 'login') await login(rest[0] ?? readJson(APP, null)?.url ?? DEFAULT_URL)
|
|
789
789
|
|
|
790
|
-
|
|
791
|
-
|
|
790
|
+
let app = readJson(APP, null)
|
|
791
|
+
let key = app && secretGet()
|
|
792
|
+
// `ccx` sozinho num terminal sem login: faz o login e segue pra escolha da conta.
|
|
793
|
+
// Os outros comandos (e scripts, sem terminal) só avisam: nunca abrem o navegador sem a pessoa pedir.
|
|
794
|
+
if ((!app || !key) && !cmd && process.stdin.isTTY) {
|
|
795
|
+
console.error('Este computador ainda não está conectado. Vamos fazer o login.\n')
|
|
796
|
+
await login(app?.url ?? DEFAULT_URL)
|
|
797
|
+
app = readJson(APP, null)
|
|
798
|
+
key = app && secretGet()
|
|
799
|
+
}
|
|
792
800
|
if (!app || !key) die('Este computador ainda não está conectado. Rode: ccx login')
|
|
793
801
|
|
|
794
802
|
if (cmd === 'logout') {
|