Add profile to twenty-cli authentication (#15778)
As title Eg: <img width="641" height="45" alt="image" src="https://github.com/user-attachments/assets/0ac159db-ebcf-4c21-af1b-b089ee3b39f8" /> Not breaking
This commit is contained in:
@@ -6,7 +6,7 @@ import { readFileSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { AppCommand } from './commands/app.command';
|
||||
import { AuthCommand } from './commands/auth.command';
|
||||
import { ConfigCommand } from './commands/config.command';
|
||||
import { ConfigService } from './services/config.service';
|
||||
|
||||
const packageJson = JSON.parse(
|
||||
readFileSync(join(__dirname, '../package.json'), 'utf-8'),
|
||||
@@ -20,14 +20,24 @@ program
|
||||
.version(packageJson.version);
|
||||
|
||||
program.option(
|
||||
'--api-url <url>',
|
||||
'Twenty API URL',
|
||||
process.env.TWENTY_API_URL || 'http://localhost:3000',
|
||||
'--workspace <name>',
|
||||
'Use a specific workspace configuration',
|
||||
'default',
|
||||
);
|
||||
|
||||
program.hook('preAction', (thisCommand) => {
|
||||
const opts = (thisCommand as any).optsWithGlobals
|
||||
? (thisCommand as any).optsWithGlobals()
|
||||
: thisCommand.opts();
|
||||
const workspace = opts.workspace;
|
||||
ConfigService.setActiveWorkspace(workspace);
|
||||
console.log(
|
||||
chalk.gray(`👩💻 Workspace - ${ConfigService.getActiveWorkspace()}`),
|
||||
);
|
||||
});
|
||||
|
||||
program.addCommand(new AuthCommand().getCommand());
|
||||
program.addCommand(new AppCommand().getCommand());
|
||||
program.addCommand(new ConfigCommand().getCommand());
|
||||
|
||||
program.exitOverride();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user