If you like or are using this project please give it a star or leave some feedback in the discussions section. A little feedback goes a long way - thanks!
Textrude is a cross-platform general-purpose code-generation tool. It can easily import data from CSV,YAML, JSON or plain-text files and apply Scriban templates to quickly scaffold output files.
Templates and models can quickly be developed using the bundled TextrudeInteractive tool. A command-line executable is provided for easy integration with automated build-systems.
Let's face it, there are any number of code-generation technologies you might consider. Textrude's strengths are:
- Easy model (data) creation - use CSV for simple lists or YAML/JSON if you need structured data
- Low-ceremony syntax while retaining a fully functional programming language
- Supports multiple input models and multiple output files for a single template
- Easy to inject additional model context via environment variables or user-supplied definitions
- Built-in dependency checking integrates well with your build system
- Allows template re-use via include mechanism
- Real-time prototyping tool (TextrudeInteractive)
The current release is v1.2.0.
-
Get binaries from Releases. These are provided as single-file executables bundled with example projects and library scripts.
-
Build from source by cloning this repo and opening Textrude.sln in Visual Studio
-
Create a Docker image
You may need to install .Net 5.0 if it is not already on your machine.
- Turn StrictVariables back on
- AvalonEdit used for edit boxes in TextrudeInteractive allowing:
- line numberss
- text size can be changed
- CTRL-Z etc
- basic auto-complete when '.' is typed
- Docker image support - thanks to Martin Hochstrasser
- first public release
- YAML and CSV deserialisers will always attempt to force strings that look like numbers or booleans into that format rather than leaving them as strings. Most of the time this does not matter but please raise an issue if this causes particular problems
- TextrudeInteractive does not warn when closing if project is dirty.
- Textrude.exe is untested on Linux - please raise an issue if you run into problems
- Getting started with template generation
- Built in functions and helpers
- Environment variables and user-definitions
- Multiple models and/or output files
- Creating and using library functions
- Using Textrude in a build system
- Docker image
Textrude makes heavy use of the following components:
- Scriban as the template language engine
- CsvHelper for command-line parsing
- YamlDotNet for YAML deserialisation
- Json.Net for Json deserialisation
- Humanizr for useful text-processing
- MaterialDesignToolkit, MaterialDesignExtensions and Ookii Dialogsto make the UI a bit less clunky
- AvalonEdit for text-editing goodness
If you fancy making Textrude better, I'd be happy to have help! Some ideas for improvement...
- UI
- Change the current scratch code to a more formal MVVM architecture
- Improve code-completion
- Documentation and example projects
- Library methods and helpers
- More library functions for common tasks
- Suggestions for 3rd party helper packages such as Humanizr
- Distribution
- Chocolately package?
- General usage
- Bug-reporting, real-world usability, Linux testing
It's short for Text-extrude but if you can't stop seeing it as Text-Rude you are not alone.
It is unrelated to both the rather cool (but apparently abandoned project) Textruder and the plastics company Tex-Trude
