Skip to content

Commit

Permalink
[update] add login api key link
Browse files Browse the repository at this point in the history
  • Loading branch information
chhpt committed Feb 12, 2020
1 parent 3283de6 commit caaa90a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
6 changes: 2 additions & 4 deletions lib/commands/account/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ function askForCollectDataConfirm() {
yield utils_1.collectAgree(confirm);
});
}
function handleLoginSuccess() {
return __awaiter(this, void 0, void 0, function* () {
});
}
function accountLogin(ctx) {
return __awaiter(this, void 0, void 0, function* () {
const loading = utils_1.loadingFactory();
Expand All @@ -75,6 +71,8 @@ function accountLogin(ctx) {
loading.stop();
}
if (ctx.options.key) {
const clickableLink = utils_1.genClickableLink('https://console.cloud.tencent.com/cam/capi');
console.log(`您可以访问 ${clickableLink} 获取 API 秘钥`);
const { secretId } = yield inquirer_1.default.prompt({
type: 'input',
name: 'secretId',
Expand Down
15 changes: 10 additions & 5 deletions src/commands/account/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import { login } from '../../auth'
import { listEnvs } from '../../env'
import { CloudBaseError } from '../../error'
import { warnLog, errorLog } from '../../logger'
import { checkAndGetCredential, loadingFactory, usageStore, collectAgree } from '../../utils'
import {
checkAndGetCredential,
loadingFactory,
usageStore,
collectAgree,
genClickableLink
} from '../../utils'

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

async function handleLoginSuccess() {

}

// 登录
export async function accountLogin(ctx: ICommandContext) {
const loading = loadingFactory()
Expand All @@ -67,6 +69,9 @@ export async function accountLogin(ctx: ICommandContext) {

// 兼容临时密钥和永久密钥登录
if (ctx.options.key) {
const clickableLink = genClickableLink('https://console.cloud.tencent.com/cam/capi')
console.log(`您可以访问 ${clickableLink} 获取 API 秘钥`)

// 使用永久密钥登录
const { secretId } = await inquirer.prompt({
type: 'input',
Expand Down
2 changes: 1 addition & 1 deletion src/function/base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CloudBase from '@cloudbase/manager-node'
import { CloudApiService, loadingFactory, checkAndGetCredential, getProxy } from '../utils'
import { CloudApiService, checkAndGetCredential, getProxy } from '../utils'
import { successLog } from '../logger'
import {
IListFunctionOptions,
Expand Down

0 comments on commit caaa90a

Please sign in to comment.