Skip to main content

Function: addExampleToCommand()

addExampleToCommand(directory): (id, example, version?) => Promise<void>

Defined in: commands.ts:336

Add an example file to a command.

Parameters​

ParameterType
directorystring

Returns​

Function

Parameters​

ParameterType
idstring
example{ content: string; fileName: string; }
example.contentstring
example.fileName?string
version?string

Returns​

Promise<void>

Example​

import utils from '@eventcatalog/utils';

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

await addExampleToCommand('UpdateInventory', { content: '{"id": "123"}', fileName: 'basic.json' });
await addExampleToCommand('UpdateInventory', { content: '{"id": "123"}', fileName: 'basic.json' }, '0.0.1');