Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@

global.quit = process.exit;

import { Command } from 'commander';
import { Command } from "commander"
import registerCommands from './utils/register-commands.mjs';
import { Printer } from './utils/printer.mjs';

const printer = new Printer('opti-cli');
const program = new Command();

(async () => {
program
.name('opti')
.description('Team Optimizely CLI tools.')
.version('1.0.0');
program
.name('opti')
.description('Team Optimizely CLI tools.')
.version('1.0.0');

// register all commands in /commands directory
await registerCommands();
// register all commands in /commands directory
await registerCommands();

program.parse(process.argv);
program.parse(process.argv);
})();

process.on('uncaughtException', (error) => {
if (error instanceof Error && error.name === 'ExitPromptError') {
printer.info('bye! 👋');
} else {
// Rethrow unknown errors
throw error;
}
if (error instanceof Error && error.name === 'ExitPromptError') {
printer.info('bye! 👋');
} else {
// Rethrow unknown errors
throw error;
}
});

export default program;