Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x | import { defineCommand } from '../../lib/define-command.js';
import { styleText } from '../../lib/style-text.js';
import * as AppConfig from '../../models/app_configuration.js';
import * as Application from '../../models/application.js';
import { openBrowser } from '../../models/utils.js';
import { aliasOption, appIdOrNameOption } from '../global.options.js';
export const consoleCommand = defineCommand({
description: 'Open an application in the Console',
since: '1.0.0',
options: {
alias: aliasOption,
app: appIdOrNameOption,
},
args: [],
async handler(options) {
const { alias, app: appIdOrName } = options;
const { apps } = await AppConfig.loadApplicationConf();
// If no app is linked or asked, open the Console without any context
if (apps.length === 0 && !appIdOrName) {
await openBrowser('/', 'Opening the Console in the browser…');
return;
}
const { ownerId, appId } = await Application.resolveId(appIdOrName, alias);
const prefixPath = ownerId.startsWith('user_') ? 'users/me' : `organisations/${ownerId}`;
const consolePath = `/${prefixPath}/applications/${appId}`;
await openBrowser(consolePath, `Opening ${styleText('blue', appId)} in the browser…`);
},
});
|