CLI

CLI

$ haetae [<options>] [<command>]
$ ht [<options>] [<command>]

ht is a shorthand alias of haetae.

For example:

$ ht --help # Equal to `haetae --help`
$ ht --version # Equal to `haetae --version`

Commands

You define your commands in the config file.

For example,

haetae.config.js
import { $, configure } from 'haetae'
 
export default configure({
  // Other options are omitted for brevity.
  commands: {
    myAwesomeCommand: {
      run: async () => {
        const { stdout } = await $`echo hello, world!`
        console.log(stdout)
      },
      env: { /* ommitted for brevity. */ }
    },
    myAnotherCommand: {
      run: async () => {
        const { stdout } = await $`echo hi, there!`
        console.log(stdout)
      },
      env: { /* ommitted for brevity. */ }
    },
    // ... more commands
  },
})

Then the commands become available from the CLI.

$ haetae myAwesomeCommand
 
hello world!
 
✔  success   Command myAwesomeCommand is successfully executed.
 
⎡ 🕗 time: 2023 Jun 08 09:23:07 Asia/Seoul (timestamp: 1686183787453)
⎜ 🌱 env: {}
#️⃣ envHash: bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f
⎣ 💾 data: {}
$ haetae myAnotherCommand
 
hi, there!
 
✔  success   Command myAwesomeCommand is successfully executed.
 
⎡ 🕗 time: 2023 Jun 08 09:23:10 Asia/Seoul (timestamp: 1686183790481)
⎜ 🌱 env: {}
#️⃣ envHash: bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f
⎣ 💾 data: {}

Options

-h, --help


(Type : boolean, Default: false)

If specified, usage help is shown.

Usage

$ haetae --help

Conflicts

This option should not be used with other options.

-v, --version


(Type : boolean, Default: false)

If specified, the version of CLI is shown.

💡

It is version of @haetae/cli, not version of other @haetae/* (e.g. @haetae/core) or the package haetae. If you want to know comprehensive versions, use -i, --info.

Usage

$ haetae --version

Conflicts

This option should not be used with other options.

-c, --config


(Type : string)

A config file path.

Usage

$ haetae --config path/to/haetae.config.js [<other-options>] <command>
💡

Config File Priority

  1. The option -c, --config
  2. Environment variable $HAETAE_CONFIG_FILE
  3. Finding haetae.config.js by walking up parent directories recursively from process.cwd (opens in a new tab)

Conflicts

This option should not be used with these options.

-e, --env


(Type : boolean, Default: false)

Usage

env of the <command> in the config file is evaluated.
The evaluated value, which is the current env, is shown on the shell.

$ haetae --env <command>

Conflicts

This option should not be used with these options.

-r, --record


(Type : boolean, Default: false)

Usage

The <command>'s Record for the current env is shown.
This means, env in the config file is evaluated, and the command's Record matching with the evaluated env is searched from the Store.

$ haetae --record <command>

Conflicts

This option should not be used with these options.

-d, --record-data


(Type : boolean, Default: false)
$ haetae --record-data <command>

Usage

The <command>'s Record Data for current env is shown.
This means, env in the config file is evaluated, and the command's Record Data matching with the evaluated env is searched from the Store.

$ haetae --record-data <command>

Conflicts

This option should not be used with these options.

-s, --silent


(Type : boolean, Default: false)

If specified, result of execution is not printed. stderr will still be printed.

Usage

$ haetae --silent [<other-options>] [<command>]

Conflicts

This option should not be used with these options.

--dry-run


(Type : boolean, Default: false)

If specified, a new record is not stored, but the result is printed.

Usage

$ haetae --dry-run [<other-options>] <command>

Conflicts

This option should not be used with these options.

-j, --json


(Type : boolean, Default: false)

This option exists for programmatic use (e.g. Unix pipeline).
If specified, the result (stdout, stderr) would be expressed in JSON format without ANSI color code.

Usage

You can freely use this option to transform any result into JSON.

$ haetae --json [<other-options>] [<command>]

For examples,

$ haetae --record --json <command>
$ haetae --env --json <command>
$ haetae --record-data --json <command>
$ haetae --json <command>
$ haetae --json --dry-run <command>
$ haetae --info --json

Conflicts

This option should not be used with these options.

-i, --info


(Type : boolean, Default: false)

If specified, comprehensive information about the running environment is shown.
The information is also automatically copied to the clipboard, without ANSI color code.
You can attach the result when reporting an issue (opens in a new tab).

💡

Why auto-copied without ANSI color code?
ANSI color code is good for readability on the terminal. However, many sites (e.g. GitHub), chat apps (e.g. Slack), and note-taking apps (e.g. Notion) do not support ANSI color code. This hinders ease of sharing and reporting. That's why the plain text is copied to the clipboard.

Usage

$ haetae --info

Conflicts

This option should not be used with other options.