Skip to content
twe4ked edited this page Mar 18, 2013 · 12 revisions

Filters allow you to run specified files through arbitrary commands at build time.

Examples

ERB

Setting name and email with environment variables in gitconfig.erb.

# ~/.freshrc
fresh config/gitconfig.erb --file=~/.gitconfig --filter=erb
# ~/.dotfiles/config/gitconfig.erb
[user]
name=<%= ENV["NAME"] %>
email=<%= ENV["EMAIL"] %>

GnuPG

Decrypting files with GnuPG.

# ~/.freshrc
fresh encrypted_file.asc --filter=gpg

Using sed to source part of a file

You can use sed to grab parts of a file. Here is an example of getting rbenv initialization lines. We've also locked the file to a certain git ref in case the line numbers change.

# ~/.freshrc
fresh jasoncodes/dotfiles shell/profile --ref=452fb01 --filter='sed -n 224,227p'
Clone this wiki locally