Hooks

What are Hooks?

A hook is simply a command that can run on the Terminal or Command Prompt.

Configuration

  • version: 2
    hooks:
      stub_load_contract: python load.py
    
  • {
      "version": 2,
      "hooks": {
        "stub_load_contract": "python load.py"
      }
    }
    

How Hooks Work

In the above snippet, stub_load_contract is the hook name. python load.py is executed, while the path of the original contract file is present in CONTRACT_FILE environment variable.

The command can parse the contract file and write it to standard out. Specmatic will read it as the new contract.

Supported Hook Names

  • stub_load_contract
  • test_load_contract

Table of contents