Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit caaa90a

Browse files
committed
[update] add login api key link
1 parent 3283de6 commit caaa90a

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

lib/commands/account/login.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ function askForCollectDataConfirm() {
5858
yield utils_1.collectAgree(confirm);
5959
});
6060
}
61-
function handleLoginSuccess() {
62-
return __awaiter(this, void 0, void 0, function* () {
63-
});
64-
}
6561
function accountLogin(ctx) {
6662
return __awaiter(this, void 0, void 0, function* () {
6763
const loading = utils_1.loadingFactory();
@@ -75,6 +71,8 @@ function accountLogin(ctx) {
7571
loading.stop();
7672
}
7773
if (ctx.options.key) {
74+
const clickableLink = utils_1.genClickableLink('https://console.cloud.tencent.com/cam/capi');
75+
console.log(`您可以访问 ${clickableLink} 获取 API 秘钥`);
7876
const { secretId } = yield inquirer_1.default.prompt({
7977
type: 'input',
8078
name: 'secretId',

src/commands/account/login.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ import { login } from '../../auth'
77
import { listEnvs } from '../../env'
88
import { CloudBaseError } from '../../error'
99
import { warnLog, errorLog } from '../../logger'
10-
import { checkAndGetCredential, loadingFactory, usageStore, collectAgree } from '../../utils'
10+
import {
11+
checkAndGetCredential,
12+
loadingFactory,
13+
usageStore,
14+
collectAgree,
15+
genClickableLink
16+
} from '../../utils'
1117

1218
function printSuggestion() {
1319
const tips = `可使用下面命令继续操作:
@@ -49,10 +55,6 @@ async function askForCollectDataConfirm() {
4955
await collectAgree(confirm)
5056
}
5157

52-
async function handleLoginSuccess() {
53-
54-
}
55-
5658
// 登录
5759
export async function accountLogin(ctx: ICommandContext) {
5860
const loading = loadingFactory()
@@ -67,6 +69,9 @@ export async function accountLogin(ctx: ICommandContext) {
6769

6870
// 兼容临时密钥和永久密钥登录
6971
if (ctx.options.key) {
72+
const clickableLink = genClickableLink('https://console.cloud.tencent.com/cam/capi')
73+
console.log(`您可以访问 ${clickableLink} 获取 API 秘钥`)
74+
7075
// 使用永久密钥登录
7176
const { secretId } = await inquirer.prompt({
7277
type: 'input',

src/function/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import CloudBase from '@cloudbase/manager-node'
2-
import { CloudApiService, loadingFactory, checkAndGetCredential, getProxy } from '../utils'
2+
import { CloudApiService, checkAndGetCredential, getProxy } from '../utils'
33
import { successLog } from '../logger'
44
import {
55
IListFunctionOptions,

0 commit comments

Comments
 (0)