tarbell-project / tarbell

A Flask-based static site authoring tool.
https://tarbell.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
165 stars 32 forks source link

Tarbell shell #444

Open eyeseast opened 7 years ago

eyeseast commented 7 years ago

Here's a thing I do a lot:

>>> from tarbell.site import TarbellApp

# create a site
>>> site = TarbellApp('.')

# get a request context
>>> ctx = site.app.test_request_context()
>>> ctx.push()

# run through the pre-request hooks, so g.current_site works
>>> site.app.preprocess_request()

# now I can do things with site data
>>> context = site.get_context()
>>> print(context['title'])

It would be really nice to package all those steps into a little shell script, so I could run something like:

tarbell shell

And get:

>>> site
<tarbell.app.TarbellSite instance at 0x...>