Macros

Reference documentation for macros.

Macros allow users to define custom command line arguments for Etcha . This allows users to easily create command templates and automate repetitive tasks.

Definition

Macros are defined under Config > cli_macros. Within this config block, users can define the command name as well as provide usage, flags, and arguments for the command. Using the template field, users can then map these inputs into an existing command line syntax.

An example macro looks like this:

{
  "cli": {
    "macro": {
      "mymacro": {
        "argumentsRequired": [
          "argument1"
        ],
        "flags": {
          "d": {
            "usage": "D flag usage!"
          },
        },
        "template": "config",
        "usage": "Mymacro usage!",
      }
    }
  }
}

This will add the macro, mymacro to the CLI.

Usage

After a Macro has been defined, it can be used like any other CLI command:

etcha mymacro -d arg1