Skip to main content

No project description provided

Project description

PyPI Package Documentation Status Git tag Test status Code coverage

Fyoo is a simple jinja2-based command-argument-templatizer CLI utility. Templatizing can be done at runtime for consistent argument tweaks.

Basic Usage

Fyoo runs a command with templatized arguments succeeding . Context can be provided by flags or there are a few baked-in functions.

Example inline query:

# Create a sqlite3 db for this example
sqlite3 example.db 'create table if not exists user (username string, created date default current_date);insert into user(username) values ("cooluser")'

# run a templatized/dynamic query to csv output
fyoo --fyoo-set table=user --fyoo-set db=example.db -- \
  sqlite3 '{{ db }}' \
   'select * from {{ table }} where date(created) = "{{ dt() }}"' \
   -csv -header
# username,created
# cooluser,2020-06-21

If SQL queries are to be re-used, perhaps the query itself comes from a template file.

echo 'select count(*)
from {{ table }}' > count.sql

fyoo '--fyoo-context={"db": "example.db", "table": "user"}' -- \
  sqlite3 '{{ db }}' "$(cat count.sql)"
# 1 (assuming same example from before)

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

fyoo-0.1.0a2.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

fyoo-0.1.0a2-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

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