Skip to content
Open
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
26 changes: 26 additions & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
// This script checks if the command-line argument provided is one of the available commands.
// If the command is not recognized, it prints an error message and exits the process.
import { printError } from '../util/io';

(async () => {
const availableCommands = [
'--help',
'make-publish',
'make',
'migrate-latest',
'migrate-list',
'migrate-rollback',
'prune',
'synchronize',
'--version'
];

// Check if there are at least 3 arguments (node, script, command)
// and if the command is not in the list of available commands
if (process.argv.length >= 3 && !availableCommands.includes(process.argv[2])) {
Comment thread
mesaugat marked this conversation as resolved.
await printError(`Invalid command. Please use one of the following commands: ${availableCommands.join(', ')}`);
// Exit the process with a status code of 1 (indicating an error)
process.exit(1);
}
})();

export { run } from '@oclif/command';