Skip to content

Create a file from the template with the variables.

License

Notifications You must be signed in to change notification settings

alice1017/load-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

load-template

forthebadge

Build Status Coverage Status Python 2.7 only

📄 Overview

The load-template create a file from the template with the variables, and edit the file in your editor.

You can create templates as freely if you save it 📂 ~/.templates/.

If you want to add new default template, please send pull request. 👍

🔧 Usage

basic

$ load-template [template] [file] [variables [variables ...]]

positional arguments

  • template - The template name. You can show all templates by --list.
  • file - The file name to create.
  • variables - The template variables formatted key=value.

optional arguments

  • -l, --list - Display the all template list.
  • -c, --contents - Display contents of the template.
  • -s, --sync - Sync the default template to local template. Before using this feature, you have to do git pull.
  • -n, --no-edit - Create a file from template without edit.
  • -D, --dev - Run development mode.

template variable

You can set some variables to the template as follows:

<h1>Hello, {name}</h1>

when use this variable:

$ load-template template hello.html name=Alice

rendered:

<h1>Hello, Alice</h1>

📥 Installation

$ git clone git@github.com:alice1017/load-template.git
$ cd load-template
$ python setup.py build install

You need to clone this repository for installation, Because the load-template copies the default templates to ~/.templates/ directory.

👀 Contribution

  1. Forks on Github
  2. Find a bug? Add new default template? Send a pull request to get it merged and published.

CHANGELOG

All notable changes to this project will be documented in this file. The format is based on Keep a Changelog

1.0.0 - 2018/4/16

Added new feature

  • Added --contents argument to display template contents. Fixed #2
  • Added edit feature. Fixed #3
  • Added --sync argument to sync default template and local template. Fixed #1

Added new template

  • Added templates/readme-py template.
  • Added templates/python-argparser template.

Changed

  • Changed a template name: mit_license to mit-license

Other

1.0.0b1 - 2018/3/28

A Beta Version Release.

About

Create a file from the template with the variables.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages