@cloudbase/cli 2.5.1-alpha.3 → 2.5.1-alpha.4
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/lib/commands/common.js
CHANGED
|
@@ -134,7 +134,7 @@ class Command extends events_1.EventEmitter {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
createProgram(instance, deprecate, newCmd) {
|
|
137
|
-
const { cmd, desc, options, requiredEnvId = true, withoutAuth = false } = this.options;
|
|
137
|
+
const { cmd, desc, options, requiredEnvId = true, withoutAuth = false, autoRunLogin = false } = this.options;
|
|
138
138
|
instance.storeOptionsAsProperties(false);
|
|
139
139
|
options.forEach((option) => {
|
|
140
140
|
const { hideHelp } = option;
|
|
@@ -161,7 +161,13 @@ class Command extends events_1.EventEmitter {
|
|
|
161
161
|
loginState = (yield utils_1.authSupevisor.getLoginState());
|
|
162
162
|
}
|
|
163
163
|
if (!withoutAuth && !loginState) {
|
|
164
|
-
|
|
164
|
+
if (autoRunLogin) {
|
|
165
|
+
console.log(chalk_1.default.bold.yellowBright('无有效身份信息,将自动为您打开授权页面。授权成功后请再重新执行命令'));
|
|
166
|
+
yield commander_1.program.parseAsync(['node', 'tcb', 'login']);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
throw new error_1.CloudBaseError('无有效身份信息,请使用 cloudbase login 登录');
|
|
170
|
+
}
|
|
165
171
|
}
|
|
166
172
|
if (!envId && requiredEnvId) {
|
|
167
173
|
throw new error_1.CloudBaseError('未识别到有效的环境 Id,请使用 cloudbaserc 配置文件进行操作或通过 -e 参数指定环境 Id');
|
package/package.json
CHANGED