Command Line Scripting with Templates
summary
Go templates get extended into a lightweight command-line scripting DSL with a new package published as t4tools that injects functions like table/select/sort/filter and helpers describe/generateUsage so tools can document types and run richer queries. The package composes functions, adds tojson/promote/head/tail/rows/cols, and powers an ELF/Mach-O “dump” utility implemented in about 15 lines that successfully extracts headers, symbols and imports. It claims to reduce boilerplate and avoid fragile hardcoded type help.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 5:06Example
- 8:50Pipeline
- 11:05Fun Facts
- 12:34Template directives
- 13:24Functions
- 18:47Problems with templates
- 21:01Template for Tools
- 23:27Output to Template
- 28:49Elf Dump Tool
- 35:42Guidelines
- 40:26Comments
related talks
04mAbusing text/template for data transformation
30mCLI Tools for All the Things
36mCLI applications & TDD: Never write scripts again
07mGo Templates
31mGo tricks from the trenches
22mScript Kit: The Ultimate Open Source Dev Kit
31mCome to the Dark Side! We have a whole bunch of Cookiecutters!
35mLightning Talks
