Self-contained template system with Handlebars and inline shell scripts

Overview

Handlematters

Self-contained template system with Handlebars and inline shell scripts

Introduction

Handlematters is a template system that combines Handlebars and shell scripts. It is intended to replace simple substitution tasks such as those done by envsubst.

Here is an example of a Handlematters template:

hello.hms

Any text before the context or template block is just a comment.
It will not be output.

--- context ---
greeting: echo 'hello, world'
count: |
  echo -n 'hello, world' | wc --chars

--- template ---
{{greeting}} (length: {{count}})

Passing this file to handlematters will result in the following output:

$ handlematters hello.hms
hello, world (length: 12)

Let's take a closer look.

--- context ---
greeting: echo 'hello, world'
count: |
  echo -n 'hello, world' | wc --chars

The context block is a YAML document. Each value of the property will be executed as a shell script and the output will be the resulting value.

--- template ---
{{greeting}} (length: {{count}})

The template block is a Handlebars template. {{...}} to output the context value. If you are not familiar with Handlebars syntax, have a look at https://handlebarsjs.com/.

Let's look at a more practical example:

Note: The expression in triplet braces {{{...}}} will be output without HTML escaping.

--- context ---
name: cargo metadata --format-version=1 --no-deps | jq -r .packages[0].name
author: cargo metadata --format-version=1 --no-deps | jq -r .packages[0].authors[0]

--- template ---
{{{name}}} by {{{author}}}

Will result in:

handlematters by Keita Urashima 
   

   

Of course, this README is also generated by Handlematters. See: https://github.com/ursm/handlematters/blob/main/README.md.hms

Usage

handlematters 0.1.0

Keita Urashima 
   
    

Self-contained template system with Handlebars and inline shell scripts

USAGE:
    handlematters [FILE]

ARGS:
    
    
         Input file [default: stdin]

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

    
   
You might also like...
🚀 Supercharge your development with easy to setup package scripts

Mist 🚀 Supercharge your development with easy to setup package scripts. Works with every codebase regardless of the language or framework used! Note:

solve scripts for all 3 of @0xhana's paradigm ctf challs!

hana solana ctf ok like all the best software engineers i got the technicals done on time and under budget but left documentation for future me. its n

Standalone analytics provider and realtime dashboard designed for self-hosting.
Standalone analytics provider and realtime dashboard designed for self-hosting.

Stats Stats is a high-performance, standalone analytics provider designed for self-hosting, enabling the collection and viewing of event data from web

Scriptable tool to read and write UEFI variables from EFI shell. View, save, edit and restore hidden UEFI (BIOS) Setup settings faster than with the OEM menu forms.
Scriptable tool to read and write UEFI variables from EFI shell. View, save, edit and restore hidden UEFI (BIOS) Setup settings faster than with the OEM menu forms.

UEFI Variable Tool (UVT) UEFI Variable Tool (UVT) is a command-line application that runs from the UEFI shell. It can be launched in seconds from any

Guardian Self Assessment CLI tool
Guardian Self Assessment CLI tool

Guardian Self Assessment CLI tool What? self-assessment is a tool that generates a list of PRs authored and reviewed by you. Why? Assessing oneself is

CLI for self-bootstrapped Python applications

PyApp PyApp is a CLI wrapper for Python applications that bootstrap themselves at runtime. Each application is configured with environment variables a

Temporary elevated access management as a self-hosted service
Temporary elevated access management as a self-hosted service

💻🔐☁️ S A T O U N K I Temporary elevated access management as a self-hosted service Overview Satounki is a self-hosted service which brings visibilit

a simple, non-self-describing data-interchange format.

rust-fr 'rust-fr' (aka rust for real) is a simple, non-self-describing data-interchange format. installation You can use either of these methods. Add

🐢 Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands
🐢 Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands

Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands. Additionally, it provides optional and fully encrypted synchronisation of your history between machines, via an Atuin server.

Comments
  • Bump regex from 1.5.4 to 1.5.6

    Bump regex from 1.5.4 to 1.5.6

    Bumps regex from 1.5.4 to 1.5.6.

    Changelog

    Sourced from regex's changelog.

    1.5.6 (2022-05-20)

    This release includes a few bug fixes, including a bug that produced incorrect matches when a non-greedy ? operator was used.

    1.5.5 (2022-03-08)

    This releases fixes a security bug in the regex compiler. This bug permits a vector for a denial-of-service attack in cases where the regex being compiled is untrusted. There are no known problems where the regex is itself trusted, including in cases of untrusted haystacks.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
Owner
Keita Urashima
Keita Urashima
Work-in-progress Rust application that converts C++ header-only libraries to single self-contained headers.

unosolo Work-in-progress Rust application that converts C++ header-only libraries to single self-contained headers. Disclaimer This is my first Rust p

Vittorio Romeo 26 Jul 9, 2021
Non-interactive nREPL client for shell scripts and command-line

nreplops-tool (nr) nreplops-tool (nr) is a non-interactive nREPL client designed to be used in shell scripts and on the command-line. Early α warning:

Matti Hänninen 3 Jul 1, 2022
Quickly save and retrieve values for shell scripts.

Quickly save and retrieve values for shell scripts.

Alex Andrade 2 Dec 15, 2022
Shellcheck - a static analysis tool for shell scripts

ShellCheck - A shell script static analysis tool ShellCheck is a GPLv3 tool that gives warnings and suggestions for bash/sh shell scripts: The goals o

Vidar Holen 31.1k Jan 9, 2023
A command-line tool for patching shell scripts inspired by resholve

patsh A command-line tool for patching shell scripts inspired by resholve nix run github:nix-community/patsh -- -f script.sh Usage Usage: patsh [OPTIO

Nix community projects 23 Jan 7, 2023
Write simple proc-macros inline with other source code.

script-macro An experimental way to write simple proc-macros inline with other source code. Did you ever end up getting frustrated at the boilerplate

Markus Unterwaditzer 17 Jun 10, 2023
A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.)

FS Dir Cache A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.) When working on build s

Dawid Ciężarkiewicz 5 Aug 29, 2023
Raw C Shell: interact with your operating system using raw C code, because why not?

rcsh Raw C Shell is a minimalist shell with no built in commands. You write entirely in C code and use return; to execute your code. Unlike that silly

null 4 Feb 7, 2023
Shell Escape for Typst typesetting system. Linux Only.

Shell Escape for Typst This is a simple shell escape for Typst. It allows you to run shell commands directly from Typst compiler. That said, it does n

Nikolay Stepanov 4 Jun 7, 2023
Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

Andreas Nordal 4.3k Dec 28, 2022