Built-in Utils

Mustard provides several tools that are frequently used in command-line application development, including JSON file reading and writing, output coloring and more in the future. These built-in utils do not cause severe frame size expansion but helps to reduce some installation costs during development.

You can use these utils with @Utils decorator, and it will be injected into the command class as a property.

import { Command, Utils } from "mustard-cli/decorator";
import type { MustardUtils } from "mustard-cli";


@Command('run')
class RunCommandHandle implements CommandStruct {
  @Utils()
  public utils!: MustardUtils;

  public run() {
    this.utils.json.readSync('package.json');
  }
}