Skip to main content

Treadles

Overview​

A treadle is a global command shortcut with constant arguments baked in. glog -n 3 below invokes git log --oneline -n 3.

In a draft​

Invoke-Loom {
Thread Reed
Treadle glog { git log --oneline }
Sley git {
Command log {
Option '--oneline'
Option '--max-count' -Alias '-n' { Argument count }
}
}
}

From the command line​

New-Treadle glog { git log --oneline } -PassThru
Get-Treadle 'g*'
Remove-Treadle glog

Rules​

The body is parsed once as a single command with constant arguments. It is not executed at declaration and captures no variables. Pipelines, computed arguments and multi-statement bodies are rejected. Names accept letters, digits, hyphen, underscore and dot, without spaces or wildcards.

Functions, aliases and cmdlets are checked for collisions without command discovery. New-Treadle -Force can replace a collision; the draft verb has no force parameter. Removal leaves an unrelated same-named command alone.

Reed observes the treadle catalog and prepends baked tokens before resolving completion. glog therefore completes from the git log --oneline context without a separate completer. The underlying command still needs a registered Reed completer.

Reference​

Treadle, New-Treadle, Get-Treadle, Remove-Treadle.