Skip to content

NeilMacMullen/Textrude

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Textude

NuGet Coverage Status Join the chat at https://gitter.im/Textrude/community

Downloads

GitHub release NuGet Chocolatey

Give a Star! ⭐

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!

What is it?

Textrude is a tool to feed CSV,YAML, JSON or plain-text files into Scriban templates. That makes it useful for:

  • Code-generation. Generate serializers, smart-enums, lookup tables etc from structured data
  • Quick and dirty data-processing. Pull a json file from a URL and extract the fields you're interested in or use the convenience commands to process data files from the command line.
  • Text processing. Use line mode to filter the contents of large log files to get to the relevant sections

Textrude comes in 3 flavours:

  • textrude.exe is a Windows CLI tool for use from the console and within build-systems
  • textrude_linux as above but for Linux
  • TextrudeInteractive is a Windows UI tool for rapid prototyping and development of models and templates.

Screenshot of TextrudeInteractive

Why use it?

For code-generation, 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 and avoids unneccesary rebuilds
  • Support for template re-use/libraries
  • Real-time prototyping tool (TextrudeInteractive)

For text-processing or data-processing

  • Scriban is an easy to understand but relatively powerful scripting language
  • TextrudeInteractive provides immediate feedback so you can see how the input is being processed by your script
  • You can pipe text into Textrude from another command and reuse the templates you developed in TextrudeInteractive to shape the output
  • Textrude can even pull JSON directly from a URL and feed it through a template.

Download/build

Textrude requires .Net 7.0. If it's not already on your machine you will be prompted to install it.

To run TextrudeInteractive v1.3 and up the [WebView2 runtime] is required. If this is not already installed on your PC you can obtain it from (https://developer.microsoft.com/en-us/microsoft-edge/webview2/) (This is not required if you just want to run the CLI tool.)

  • If you just want the binaries, go here.
  • Or download using Chocolatey choco install textrude Important - TextrudeInteractive is not currently correctly installed in Chocolatey release
  • Alternatively, building from source is pretty easy and gives you access to the bleeding-edge!
  • Or you can create a Docker image
  • Textrude is also available on nuget

What's new

vNext (source)

  • Retarget to Net8

1.8.0 (source/binary)

  • Retarget to Net7
  • Fix bug where a StackOverflowException could be thrown if textrude.to_csv/to_json/to_yaml was called on recursive object
  • Add snippet support for script editor (thanks to Olof Wistrand)

v1.7.0 (source/binary)

  • Chocolatey install is available.
  • A number of cli convenience commands have been added to make it easier to process data files.
  • Textrude can now emit serialised representations of object trees
  • Textrude can now guess the format of models based on the first few hundred bytes of content.
  • Textrude now supports a set of flexible time recognition and comparison functions.
  • More examples added
  • TextrudeInteractive is now much better at cancelling in-flight renders
  • TextrudeInteractive now configures Webview to use APPDATALOCAL for cached data

Full change history

Documentation

Credits and contributors

Textrude makes heavy use of the following components:

Huge thanks to the contributors:

  • Martin Hochstrasser - Docker support, general build enhancements, integration of the Monaco editor and the fancy logo!
  • Neil MacMullen - original application concept and implementation

Help wanted

If you fancy making Textrude better, I'd be happy to have help! Grab something from the issues list or suggest an idea. Alternatively you can contribute script snippets, improve the documentation or spread the word by writing an article!

What's with the name

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