Skip to content

CliTaskResult

Abstract class representing the result of a task. Includes methods for handling success, exit codes, and chaining tasks.

Import:

import { CliTaskResult } from 'obsidian-dev-utils/script-utils/cli-utils';

Signature:

export class CliTaskResult

Methods

MethodReturnsDescription
exit()voidExits the process based on the task result.
isSuccessful()booleanDetermines if the task was successful.
throwOnFailure()voidThrows an error if the task was not successful.
static chain(tasks)Promise<CliTaskResult>Chains multiple tasks together, executing them sequentially until one fails.
static DoNotExit()CliTaskResultCreates a CliTaskResult that does not exit the process.
static Failure()CliTaskResultA failure result of a CLI task.
static FromExitCode(exitCode)CliTaskResultCreates a CliTaskResult based on an exit code.
static Success(isSuccess?)CliTaskResultCreates a CliTaskResult representing a successful task result.

Links to this page: