All files / src/commands/config-provider config-provider.open.command.js

88.23% Statements 15/17
100% Branches 1/1
0% Functions 0/1
88.23% Lines 15/17

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 18193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x     193x 193x  
import { config } from '../../config/config.js';
import { defineCommand } from '../../lib/define-command.js';
import { styleText } from '../../lib/style-text.js';
import { resolveConfigProviderId } from '../../models/config-provider.js';
import { openBrowser } from '../../models/utils.js';
import { configProviderIdOrNameArg } from './config-provider.args.js';
 
export const configProviderOpenCommand = defineCommand({
  description: 'Open the configuration provider in Clever Cloud Console',
  since: '4.6.0',
  options: {},
  args: [configProviderIdOrNameArg],
  async handler(_options, addonIdOrRealIdOrName) {
    const { addonId } = await resolveConfigProviderId(addonIdOrRealIdOrName);
    await openBrowser(`${config.GOTO_URL}/${addonId}`, `Opening ${styleText('blue', addonId)} in the browser…`);
  },
});