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 { $, core } from 'haetae'
 
export default core.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!
$ haetae myAnotherCommand
 
hi, there!

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.

-s, --store


(Type : string, Default: Read "Store File Priority" section below)

A store file path.

Usage

$ haetae --store path/to/.haetae/store.json [<other-options>] <command>
$ haetae --store path/to/dir [<other-options>] <command>

If the value does not end with .json, store.json would be appended.
For instance, --store path/to/dir is identical to --store path/to/dir/store.json.

💡

Store File Priority

  1. The option -s, --store
  2. storeFile in config file.
  3. <directory-of-config-file>/.haetae/store.json

Conflicts

This option should not be used with these options.

-e, --env


(Type : boolean, Default: false)

When used with <command>

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>

When used with -r, --record and <command>

The <command>'s record for 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 file.

$ haetae --record --env <command>

When used with -d, --record-data and <command>

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 file.

$ haetae --record-data --env <command>

Conflicts

This option should not be used with these options.

-r, --record


(Type : boolean, Default: false)

When used alone

Content of store file is shown.

$ haetae --record

When used with command

A list of every records of the command is shown.

$ haetae --record <command>

When used with -e, --env and <command>

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

$ haetae --record --env <command>

Conflicts

This option should not be used with these options.

-d, --record-data


(Type : boolean, Default: false)

When used with command

A list of every Record Data of the command is shown.

$ haetae --record-data <command>

When used with -e, --env and <command>

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

$ haetae --record-data --env <command>

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 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 plain text is copied to the clipboard.

Usage

$ haetae --info

Conflicts

This option should not be used with other options, except -j, --json.

-j, --json


(Type : boolean, Default: false)

This option exists for programatic 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
$ haetae --record --json <command>
$ haetae --record --env --json <command>
$ haetae --record-data --json <command>
$ haetae --record-data --env --json <command>
$ haetae --env --json <command>
$ haetae --info --json

Conflicts

This option should not be used with these options.