MCPcopy Create free account
hub / github.com/chhoumann/quickadd / executeCommands

Method executeCommands

src/engine/MacroChoiceEngine.ts:283–324  ·  view source on GitHub ↗
(commands: ICommand[])

Source from the content-addressed store, hash-verified

281 }
282
283 protected async executeCommands(commands: ICommand[]) {
284 try {
285 for (const command of commands) {
286 if (isObsidianCommand(command))
287 this.executeObsidianCommand(command);
288 if (isUserScriptCommand(command))
289 await this.executeUserScript(command);
290 if (isChoiceCommand(command))
291 await this.executeChoice(command);
292 if (isWaitCommand(command)) {
293 await waitFor(command.time);
294 }
295 if (isNestedChoiceCommand(command)) {
296 await this.executeNestedChoice(command);
297 }
298 if (isEditorCommand(command)) {
299 await this.executeEditorCommand(command);
300 }
301 if (isAIAssistantCommand(command)) {
302 await this.executeAIAssistant(command);
303 }
304 if (isOpenFileCommand(command)) {
305 await this.executeOpenFile(command);
306 }
307 if (isConditionalCommand(command)) {
308 await this.executeConditional(command);
309 }
310 }
311 } catch (error) {
312 if (
313 handleMacroAbort(error, {
314 logPrefix: "Macro execution aborted",
315 noticePrefix: "Macro execution aborted",
316 defaultReason: "Macro execution aborted",
317 })
318 ) {
319 this.choiceExecutor.signalAbort?.(error);
320 return;
321 }
322 throw error;
323 }
324 }
325
326 // Slightly modified from Templater's user script engine:
327 // https://github.com/SilentVoid13/Templater/blob/master/src/UserTemplates/UserTemplateParser.ts

Callers 3

runMethod · 0.95
executeConditionalMethod · 0.95
runSubsetMethod · 0.95

Calls 15

executeUserScriptMethod · 0.95
executeChoiceMethod · 0.95
executeNestedChoiceMethod · 0.95
executeEditorCommandMethod · 0.95
executeAIAssistantMethod · 0.95
executeOpenFileMethod · 0.95
executeConditionalMethod · 0.95
waitForFunction · 0.90
handleMacroAbortFunction · 0.90
isObsidianCommandFunction · 0.85
isUserScriptCommandFunction · 0.85

Tested by

no test coverage detected