Skip to main content

Flexible and extensible templating CLI

Project description

qtemplate

A command line tool for managing and generating files or scripts from templates

Overview

qtemplate is a linux command line tool that helps generate files from templates, settings/datafiles, and command line prompts. A common task is creating new scripts or files that follow a convention you want to adhere to. You want access to create these base scripts but don't want to have to copy files and manually replace tags.

qtempalte is meant to have the feel of shell aliases, where defining a new template is easy and instantiating a new template is easy. By creating a simple directory structure for storing templates, default data, and plugins, we can ensure templates are available at a your fingertips, without pausing.

Structure

qtemplate supports system level configurations under /etc/qtemplate that are overwritten by user level configurations under ~/.qtemplate/

.qtemplate/
├── conf.yaml
└── templates
    └── example_template
        ├── example.jinja
        ├── example.json
        └── example.yaml

Under the conf.yaml, you can configure your template stores. Default template stores are localhost directories.

template_stores

The template stores config is the ordering in which templates are looked up. This is a cascading list in the conf.yaml:

template_stores:
    - https://www.qsonlabs.com/qtemplate/registry/templates/
    - file://user@remote-host/etc/qtemplate/templates
    - file://localhost/~/.qtemplate/templates/
    - file://localhost/etc/qtemplate/templates

Each store should be a valid URI and qtemplate will handle pulling the data using the appropriate connector. If a given template is not found, it will check the next template store in the list. This enables remote template repositories

Templates

A template should have at most 3 files:

  • *.jinja - Mandatory file for a template. There should only be one .jinja file and that will be the template used
  • template.conf - a file used to specify any template level configurations. All of these configs can be overwritten with command line params
  • *.data - any default data that should be supplied to the jinja template. Default data can be provided directly in the jinja file but a separate .data file is more explicit. the *.data file can be json or yaml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qtemplate-0.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

qtemplate-0.0.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file qtemplate-0.0.1.tar.gz.

File metadata

  • Download URL: qtemplate-0.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.2

File hashes

Hashes for qtemplate-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c2363650eec980446619b0d42976ed6ebe4ee21074dac95777e298c4e8cd687d
MD5 25822a5fff4307093eb85f66f50f05a7
BLAKE2b-256 fd1fc0a087465abd34da17bda0335299a139254c4e813b6ae14aab3cafc4cd33

See more details on using hashes here.

File details

Details for the file qtemplate-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: qtemplate-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.2

File hashes

Hashes for qtemplate-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ac636f98427dbbabfbd32b277b5eb38ce5986eecee0346408d8752307c0997b
MD5 7bf835db05aa4040ae0cf7630f67f5f2
BLAKE2b-256 c936b7e8d5fd718a11743a69fb57d41ca7a76f6f6470a160e4c7eb3c57e2f358

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page