# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['clinja']

package_data = \
{'': ['*']}

install_requires = \
['Jinja2>=3.0.1,<4.0.0', 'click>=8.0.1,<9.0.0', 'myopy>=1.0,<2.0']

entry_points = \
{'console_scripts': ['clinja = clinja.cli:cli']}

setup_kwargs = {
    'name': 'clinja',
    'version': '1.2.1',
    'description': 'A jinja command line interface',
    'long_description': '<p align="center">\n  <img src="https://i.imgur.com/9RtyTib.gif">\n</p>\n<h5 align="center">A jinja CLI.</h5>\n<p align="center">\n  <a href="https://github.com/loiccoyle/clinja/workflows/tests/"><img src="https://github.com/loiccoyle/clinja/workflows/tests/badge.svg"></a>\n  <a href="./LICENSE.md"><img src="https://img.shields.io/badge/license-MIT-blue.svg"></a>\n  <a href="https://pypi.org/project/clinja/"><img src="https://img.shields.io/pypi/v/clinja"></a>\n  <img src="https://img.shields.io/badge/platform-linux%20%7C%20macOS%7C%20windows-informational">\n</p>\n\nclinja is a versatile command line interface for [`jinja`](https://github.com/pallets/jinja).\n\n# Instalation\n\nclinja should run just fine on Windows, macOS and Linux, to install open up a terminal and run:\n```\npip install clinja\n```\n\nAs always, it\'s a good idea to use a virtual env, or maybe consider using [`pipx`](https://github.com/pipxproject/pipx).\n\n##### To generate \\<tab\\> completion for your shell run:\n```bash\n# Bash:\nclinja completions bash > /etc/bash_completion.d/clinja.bash-completion\n\n# Bash (Homebrew)\nclinja completions bash > $(brew --prefix)/etc/bash_completion.d/clinja.bash-completion\n\n# Fish:\nclinja completions fish > ~/.config/fish/completions/clinja.fish\n\n# Fish (Homebrew)\nclinja completions fish > $(brew --prefix)/share/fish/vendor_completions.d/clinja.fish\n\n# Zsh\nclinja completions zsh > /somewhere/in/your/fpath/_clinja\n\n# Zsh (Homebrew)\nclinja completions zsh > $(brew --prefix)/share/zsh/site-functions/_clinja\n```\n\n# Dependencies\nclinja relies on the following dependencies:\n* python3\n* [`jinja`](https://github.com/pallets/jinja): the templating engine.\n* [`click`](https://github.com/pallets/click): for the command line interface and completion.\n* [`myopy`](https://github.com/loiccoyle/myopy): to run the **dynamic** source python file.\n\n# How it works\nWhen you run clinja on a template containing some `jinja` variables to fill in, clinja will fetch values for these variables from 2 sources.\n\n#### The static source\nThe **static** source is simply a json file which contains unchanging, static, key value pairs, a la `cookiecutter`\'s `cookiecutter.json` file. This is where you would want to add your name, email, username etc. You have full control over these values and can easily manage the stored values using clinja.\n\n#### The dynamic source\nThis is where things get a bit more interesting, clinja can also get values from a so called **dynamic** source, check the [wiki](https://github.com/loiccoyle/clinja/wiki) for some examples. This source is a python file, with a few variables provided to it at run time. The provided variables are:\n```python\nTEMPLATE  # Pathlib Path to the template, is None when using stdin.\nDESTINATION  # Pathlib Path to the destination, is None when using stdout.\nRUN_CWD  # Pathlib Path, Directory were the clinja command was run.\nSTATIC_VARS  # Dictionary of static variables.\nDYNAMIC_VARS  # Dictionary of dynamic variables, initially empty, populated by the dynamic file.\n```\nWith this file you can do some nifty things, such as [automatically determining the name of the git repo in which the completed template will live in](https://github.com/loiccoyle/clinja/wiki/git-repository-name). Any values computed in this file should be added to the ```DYNAMIC_VARS``` dict.\n\n#### Missing variables\nWhen clinja runs into a variable it can\'t get from either the **static** or the **dynamic** source, it will prompt you for a value, and offer to store it in the **static** file for later use.\n\n# Usage\n```\n$ clinja --help\nUsage: clinja [OPTIONS] COMMAND [ARGS]...\n\n  A versatile jinja command line interface.\n\n  Clinja uses two sources to find values for jinja variables. A\n  static source, which is just a json file, and a dynamic\n  source, which is a python source file. Clinja populates the static\n  source with user entered values. Whereas the dynamic variables are\n  computed at run time by the python file.\n\n  In short:\n\n      Clinja stores all static variables in:\n      /home/lcoyle/.config/clinja/static.json\n\n      Clinja\'s dynamic variables are computed by the python file:\n      /home/lcoyle/.config/clinja/dynamic.py\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  add         Add a variable to static storage.\n  completion  Generate autocompletion for your shell.\n  list        List stored static variable(s).\n  remove      Remove stored static variable(s).\n  run         Run jinja on a template.\n  test        Test run your dynamic.py file.\n```\n#### Static variables:\nTo manage the **static** variables, use the subcommands: `clinja add`, `clinja remove` and `clinja list`. They should be self explanatory.\n\n#### Dynamic variables:\n```\n$ clinja test --help\nUsage: clinja test [OPTIONS]\n\n  Test run your dynamic.py file.\n\n  Run your dynamic.py file using mock values.\n\n  template, destination, run_cwd and static_vars are provided to the\n  dynamic.py file in their respective variable names.\n\nOptions:\n  --template PATH     mock template path.\n  --destination PATH  mock template path.\n  --run_cwd PATH      mock current working directory path.\n  --static_vars TEXT  mock json format static variables.\n  --help              Show this message and exit.\n\n```\nThe `clinja test` subcommand is provided to help setup and test your **dynamic** source. It allows you to provide any values to the [`dynamic` source\'s input variables](#The-dynamic-source), run the `dynamic.py` file and will print out the results.\n\n#### Run jinja\n```\n$ clinja run --help\nUsage: clinja run [OPTIONS] [TEMPLATE] [DESTINATION]\n\n  Run jinja on a template.\n\n  TEMPLATE (optional, default: stdin): template file on which to run jinja,\n  if using stdin, --prompt is set to "never".\n\n  DESTINATION (optional, default: stdout): output destination.\n\nOptions:\n  --prompt [always|missing|never]\n                                  When to prompt for variable values.\n  -d, --dry-run                   Dry run, won\'t write any files or change/add\n                                  any static values.\n\n  --help                          Show this message and exit.\n```\n###### --prompt\n* Using `--prompt always`, will use the values fetched from both sources as defaults and prompt you for each variable\'s value, giving you a chance to overwrite.\n* Using `--prompt missing`, will only prompt you for the variables it can\'t find a value for.\n* Using `--prompt never`, will never prompt and will fail if clinja encounters a variable for which it has no value.\n\n###### -d\nThe `-d` flag will do a dry run, no files will be written and your **static** source will not change.\n\n<sub>This is part 2 of my ongoing personal mission to improve template handling from the command line, see part 1: [tmpl](https://github.com/loiccoyle/tmpl.sh).</sub>\n',
    'author': 'Loic Coyle',
    'author_email': 'loic.coyle@hotmail.fr',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/loiccoyle/clinja',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
