Macros (BEFORE / AFTER)
Macros are command hooks that run before or after specific CLI commands. They allow you to enforce rules, automate side effects, or chain scripts.
Where Macros Live
- Configured in
User/Settings/Macros.yml(case-insensitive). - Each macro points to a
.chsscript or inline commands.
Macro Types
- BEFORE - run before a command executes (can block or rewrite input).
- AFTER - run after a command executes (great for logging or automation).
Example
# User/Settings/Macros.yml
before:
- command: delete
script: Scripts/confirm_delete.chs
after:
- command: complete
script: Scripts/reward_on_complete.chs
Notes
- Macros are evaluated in order.
- Use CHS conditionals to guard behavior.
- Keep scripts small and focused.
