Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Command line client? #258

Open
tebeka opened this Issue · 8 comments

3 participants

@tebeka

I wrote a little utility to expand Jinja templates from the command line - https://bitbucket.org/tebeka/pythonwise/src/tip/jj2.py?at=default.

Maybe we can incorporate it to Jinja? Either as a tool or as __main__.py module?

@mitsuhiko
Owner

I am torn on that. If it should come, then as a command line tool that installs through setuptools. But I am not sure on what features it should have and how to load the context etc.

@tebeka

IMO we can go with the minimal features that make it usable (which are the ones I currently have of course :).

What do you mean by "load the context"?

@untitaker
Collaborator

@tebeka How to load variables (the "context") into the template. In your CLI tool that would be from a JSON or YAML file.

@untitaker
Collaborator

But obviously there are more object types than the ones that can be decoded from such files. Flask has several options to load data into a config file (from_envvar, from_object, ...). I think it's a good idea to move these functions to a new package and use them in a CLI tool to load template variables.

Although the name of such a package would be a bit tricky. configutils sounds good for Flask's usecase, but it sounds absolutely ridiculous for Jinja's. OTOH dictloader would be nondescriptive, but it makes sense.

@untitaker
Collaborator

Of course creating a new package could be avoided by moving that functionality into Jinja (on which Flask depends anyway) but that seems very unelegant to me.

@untitaker
Collaborator

...or just copy the code.

@tebeka

@untitaker Thanks for the explanation. But please - no cut&paste :) I think your changes are orthogonal to this utility and can be done in a later stage. We can add from_envvar and friends later.

@tebeka

@mitsuhiko Should I submit and pull request and we'll go from there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.