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

Default Hook #232

Open robcxyz opened 8 months ago

robcxyz commented 8 months ago

Default Hook

Allow files to have a default hook to be called when no arguments are supplied

Overview

Currently, there is no way to call a tackle file without an argument and have any kind of exposed schema which would lend itself to building a defined schema that could be rendered into a help screen. This proposal aims at defining that default interface so that

Questions

Examples


<-:

  str_input: str

  list_input:

    type: list

    default: []

init<-:

  str_input: str

  list_input:

    type: list

    default: []

Public vs Private -> Before / After


<-:

  str_input: str

  list_input:

    type: list

    default: []

do->: tackle {{str_input}}

do->: tackle {{str_input}}

<-:

  ...

<_:

  str_input: str

  exec: ...

do->: import foo

---

# WRONG

<_:

  str_input: str

#   No exec / no action

do->: tackle {{str_input}}

---

# WRONG  

<_:

  str_input: str

#   No exec / no action

do->: print foo

Empty File Actions

Implementation