All Projects → kesslern → dot-templater

kesslern / dot-templater

Licence: MIT License
A small, portable Rust program intended for templating dotfiles across multiple systems.

Programming Languages

rust
11053 projects
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to dot-templater

Windows10Tools
Tools for Windows 10
Stars: ✭ 45 (+9.76%)
Mutual labels:  portable
xtd
Free open-source modern C++17 / C++20 framework to create console, forms (GUI like WinForms) and unit test applications on Microsoft Windows, Apple macOS and Linux.
Stars: ✭ 321 (+682.93%)
Mutual labels:  portable
tge
Game Runtime in GO, aims to provide a light, portable and unopiniated runtime to integrate GO libraries to portable applications (dektop, web & mobile).
Stars: ✭ 30 (-26.83%)
Mutual labels:  portable
DebugVision
Portable set of log collection and visualization tools
Stars: ✭ 45 (+9.76%)
Mutual labels:  portable
Port-Able-Suite
🌐 Manager for portable applications
Stars: ✭ 35 (-14.63%)
Mutual labels:  portable
dotfiles.sh
Dotfiles made easy
Stars: ✭ 66 (+60.98%)
Mutual labels:  dotfiles-manager
vlc-portable
🚀 VLC Media Player portable for Windows
Stars: ✭ 17 (-58.54%)
Mutual labels:  portable
FullProxy
Bind and reverse connection based, SOCKS5, HTTP and PortForward based portable proxy
Stars: ✭ 22 (-46.34%)
Mutual labels:  portable
EverythingPortable
EverythingPortable
Stars: ✭ 59 (+43.9%)
Mutual labels:  portable
LibPortablePlus
-----
Stars: ✭ 17 (-58.54%)
Mutual labels:  portable
dotfiles
🌍 Look again at that dot. That's here. That's home. That's us.
Stars: ✭ 28 (-31.71%)
Mutual labels:  dotfiles-manager
Asuite
ASuite is a simple open source portable launcher for Microsoft Windows.
Stars: ✭ 58 (+41.46%)
Mutual labels:  portable
relative-path
Portable relative UTF-8 paths for Rust.
Stars: ✭ 54 (+31.71%)
Mutual labels:  portable
intellij-idea-community-portable
🚀 IntelliJ IDEA Community portable for Windows
Stars: ✭ 41 (+0%)
Mutual labels:  portable
cadru
A Microsoft .NET Framework toolkit
Stars: ✭ 58 (+41.46%)
Mutual labels:  portable
wasm-joey
Serverless Wasm - A lightweight Node.js application for deploying and executing WebAssembly(Wasm) binary-code via HTTP
Stars: ✭ 48 (+17.07%)
Mutual labels:  portable
PCLExt.FileStorage
Portable Storage APIs
Stars: ✭ 35 (-14.63%)
Mutual labels:  portable
teamspeak-client-portable
🚀 TeamSpeak Client portable for Windows
Stars: ✭ 21 (-48.78%)
Mutual labels:  portable
openvpn-portable
🚀 OpenVPN portable for Windows
Stars: ✭ 59 (+43.9%)
Mutual labels:  portable
dotman
dotman is a simple, elegant & easy to use dotfiles manager 🖖🏽
Stars: ✭ 85 (+107.32%)
Mutual labels:  dotfiles-manager

dot-templater

A small, portable Rust program intended for templating dotfiles across multiple systems.

Purpose

Storing dotfiles in git repositories allows them to be shared across multiple computers, but this becomes problematic once systems require slightly different configurations. Laptops require battery indicators and WiFi utilities, HiDPI displays use larger fonts... dot-templater intends to solve these problems by making it simple to change values or enable/disable chunks of configuration in any file, or content from stdin.

Features

  • Make string substitutions in files/content according to configured key/value pairs.
  • Use output from arbitrary shell commands in templated dotfiles (e.g. for passwords with GNU Pass).
  • Toggle chunks of files/content per feature flags.
  • Copy binary files without templating.
  • Preserve file permissions.
  • Perform a dry-run to compare expected output against existing files.
  • Ignore specific files/folders.

Planned Features

Feature requests are welcome!

Building

Build dependencies

  • cargo

Build the project with cargo build. Run with cargo run.

Usage

dot-templater CONFIG SRC_DIR DEST_DIR

Copies files from SRC_DIR to DEST_DIR according to rules in CONFIG.

dot-templater CONFIG

Templates content from stdin to stdout according to rules in CONFIG.

dot-templater --diff CONFIG SRC_DIR DEST_DIR

Compares files from SRC_DIR modified according to rules in CONFIG against the contents of DEST_DIR.

Parameters

  • -i <file> [...files] or --ignore <file> [...files]
    Excludes a file or directory (and all children) from templating, ie. they will not be copied to the destination directory. For example, use -i .git for git controlled dotfile repositories.

Config Format

Any line beginning with # is ignored. Config file can contain key/value substitutions and feature flags.

Key/Value Substitutions

String subsitutions are defined by a key and value separated by the first occurance of =. The following configuration file:

{SUBSTITION ONE}=123
[font size]=19
asdf=aoeu

will replace all occurances of {SUBSTITION ONE} with 123, [font size] with 19, and asdf with aoeu.

Arbitrary Shell Commands

If the = separating key/value pairs is immediately proceeded by SHELL, dot-templater will run the provided command and use the stdout when templating dotfiles. Providing following line in a config file will substitute any occurrance of SHELL_COMMAND with 1234.

SHELL_COMMAND=SHELL echo 1234

Feature Flags

Any line in the rules configuration file that does not include a = character and is not a comment will enable the feature name that matches the line. Dotfiles can designate togglable features with three octothorpes followed by the feature name. Features can be nested.

FEATURE1

Will enable FEATURE1 in any dotfiles:

This line will always be included
### FEATURE1
This line will only be included when FEATURE1 is enabled.
### FEATURE1
This line will always be included.

Releases

Pre-built Linux binaries are available, as well as AUR packages for releases and building from latest source.

Release Builds

Dependencies

  • make
  • cargo

Compiling

make release compiles a release build, producing target/release/dot-templater.

Testing

make test copies the files in test/dotfiles to test/dest according to test/rules and compares with test/expected.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].