Template files using the jinja2 templating engine.
This plugin requires dotbot to be installed.
- Run
git submodule add https://github.com/ssbanerje/dotbot-template.git - Run
git submodule update --init --recursive - Pass in the CLI argument
--plugin-dir dotbot-templatewhen executing thedotbotexecutable.
Add the template directive to the dotbot YAML file:
- template:
- ~/.gitconfig:
source_file: gitconfig
params:
NAME: John Doe
EMAIL: [email protected]
GITHUB_USERNAME: jd
SIGNING_KEY: ????
SMTP_SERVER: smtp.gmail.com
SMTP_PORT: 587
SMTP_ENCRYPTION: tls
__UNAME__:
CREDENTIAL_HELPER:
Darwin: osxkeychain
Linux: cache --timeout 36000The corresponding template file looks like:
[core]
excludesfile = {{HOME_DIR}}/.global_gitignore
[user]
name = {{NAME}}
email = {{EMAIL}}
signingkey = {{SIGNING_KEY}}
[sendmail]
smtpserver = {{SMTP_SERVER}}
smtpserverport = {{SMTP_PORT}}
smtpencryption = {{SMTP_ENCRYPTION}}
smtpuser = {{EMAIL}}
from = {{EMAIL}}
[github]
user = {{GITHUB_USERNAME}}
[credential]
helper = {{CREDENTIAL_HELPER}}The template directive takes a Jinja compatible
template file using the source_file field. Details about the template syntax and semantics can be
found here.
Configuration parameters to the templating engine are placed in the params field in the template
directive.
Platform specific parameters to the templating engine is can be placed in the __UNAME__ field as
shown in the example above (see CREDENTIAL_HELPER). The current system platform is queried using
Python's platform.system() command. Potential system names are Linux, Darwin, Java,
Windows.
In addition to the user defined parameters the directive has the HOME_DIR configuration parameter
set to the HOME environment variable in the calling shell.