sudoblockio / tackle

Tackle is a programmable configuration language for building modular utilities, code generators, and CLIs with schema validation baked in.
Apache License 2.0
51 stars 2 forks source link

Base Methods as Hooks #233

Open robcxyz opened 8 months ago

robcxyz commented 8 months ago

Base Methods as Hooks

Allow base methods to be called directly as hooks

Overview

This proposal would allow setting literal values if the first arg is a default method - either if, else, when, or for. All other kwargs fail.

Lists


this: that

foo:

  - bar

  - ->: --if this=='that' baz

check: assert {{foo[1]}} baz

foo:

  - bar

  - ->: --for [1,2,5] {{item}}

check: assert {{foo[1][1]}} 2

foo:

  - bar

  - ->: --for [1,2,5] {{item}} --merge

check: assert {{foo[1]}} 1

See #141

Maps


this: that

foo:

  bar: baz  

  bing->: --if this=='that' bang  

check: assert {{foo[bing]}} bang