Skip to main content

Function: getCommands()

getCommands(directory): (options?) => Promise<Command[]>

Defined in: commands.ts:64

Returns all commands from EventCatalog.

You can optionally specify if you want to get the latest version of the events.

Parameters

ParameterType
directorystring

Returns

Function

Parameters

ParameterType
options?{ attachSchema: boolean; latestOnly: boolean; }
options.attachSchema?boolean
options.latestOnly?boolean

Returns

Promise<Command[]>

Example

import utils from '@eventcatalog/utils';

const { getCommands } = utils('/path/to/eventcatalog');

// Gets all commands (and versions) from the catalog
const commands = await getCommands();

// Gets all commands (only latest version) from the catalog
const commands = await getCommands({ latestOnly: true });

// Gets all commands with the schema attached
const commands = await getCommands({ attachSchema: true });