This commit is contained in:
熊潇 2025-04-03 01:30:39 +08:00
parent 43ce37b1ce
commit 7471e91fe6
4 changed files with 20 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@kevisual/envision-cli", "name": "@kevisual/envision-cli",
"version": "0.0.37", "version": "0.0.38",
"description": "envision command tools", "description": "envision command tools",
"main": "dist/app.mjs", "main": "dist/app.mjs",
"type": "module", "type": "module",

View File

@ -73,7 +73,13 @@ const loginCommand = new Command('login')
program.addCommand(loginCommand); program.addCommand(loginCommand);
const showMe = async (show = true) => { const showMe = async (show = true) => {
let me = await queryLogin.getMe(); const token = process.env.KEVISUAL_TOKEN;
const localToken = storage.getItem('token');
if (!token && !localToken) {
console.log('请先登录');
return;
}
let me = await queryLogin.getMe(token);
if (me.code === 401) { if (me.code === 401) {
me = await queryLogin.getMe(); me = await queryLogin.getMe();
} }

View File

@ -4,10 +4,17 @@ import { queryLogin, storage } from '@/module/query.ts';
import inquirer from 'inquirer'; import inquirer from 'inquirer';
import util from 'util'; import util from 'util';
const token = new Command('token').description('show token').action(async () => { const token = new Command('token')
const token = storage.getItem('token'); .option('-e, --env', 'show token in env')
console.log('token', token); .description('show token')
}); .action(async (opts) => {
const token = storage.getItem('token');
if (opts.env) {
console.log('token', process.env.KEVISUAL_TOKEN);
} else {
console.log('token', token);
}
});
const tokenList = new Command('list') const tokenList = new Command('list')
.description('show token list') .description('show token list')
// .option('-r --remove <number>', 'remove token by number') // .option('-r --remove <number>', 'remove token by number')

@ -1 +1 @@
Subproject commit f1024941eda4162b0ef5f9a4cd3b13c6645c7974 Subproject commit f8af24506bdfdbd895be293c8fd8ce061c94e7af