Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pystache command always treats template argument as string #183

Open
RealSalmon opened this issue Feb 12, 2016 · 3 comments
Open

pystache command always treats template argument as string #183

RealSalmon opened this issue Feb 12, 2016 · 3 comments

Comments

@RealSalmon
Copy link

The command line version of pystache always treats the template argument as a string. Based on the documentation, it should recognize a file if one exists, which is how the context argument currently works.

echo "Hello {{world}}" > template
echo '{"world": "everybody"}' > context

# expecting "Hello everybody" but the actual result is "template"
pystache template context

def main(sys_argv=sys.argv):

@dhylbert
Copy link

dhylbert commented Oct 1, 2016

It seems like unless the template input ends in .mustache it won't try to consider it as a filename.

@RealSalmon
Copy link
Author

RealSalmon commented Oct 1, 2016

Actually it seems like it work as advertised for me now (pystache==0.5.4). . . even with my own test case posted above. I'm not sure why I was seeing this before . . .

Edit . . . nevermind. You are correct. I had a .mustache template hanging around which is why I thought my original test case was working.

pystache template context will automatically look for 'template.mustache' and use that if found.

@daveloyall
Copy link

daveloyall commented May 1, 2019

Three years after this was originally reported, I had to dig through source code and issues to find out that it expects filenames ending with the magic string .mustache.

I recommend adding --context-file, --context-string, --template-file, and --template-string.

This leaves alone the behavior of the overloaded positional arguments, in case some users depend on that behavior.

Update: now that I've got pystache3 working, I just want you to know that I find it quite useful. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants