node package manager

conjuror

The Magical Conjuror

NPM

Conjuror

Conjuror is magical wizard who knows how to do cool things with CSV data and dons an epic beard- kind of like Santa Claus, sans the whole naughty or nice bit. Conjuror is based on Data Packages, which are a nifty way to wrap simple CSV data in JSON, and was created by the OKFN.

Getting Started

  1. First install Conjuror npm install -g conjuror
  2. Then set it up by running setup script conjuror setup
  3. To use Conjuror to you will need to make copies of the following two data files:
  • data/_template.csv
  • data/_template.json

Rename these files something like clients.csv or receipts.csv or whatever suits your needs add modify the values of the JSON schema & CSV columns as you see it. Once the schema & CSV matches, you can start adding data items to the CSV such as:

date, time, description, client, location, rate
2015-02-07, 2, improved importing of files, conjuror, cafe, 0.00
2015-02-08, 2, updated commands & documentation, mailpile, home, 0.00

You can manually add items to the CSV, or you can use the rough implemenation of the time tracker tool by running a separate script called ctrack read more about this below.

Conjuror Commands

  • conjuror - shows a help screen with following commands
  • conjuror setup - setups up Conjuror on a new machine
  • conjuror view - renders filtered data to CLI for quick checks
  • conjuror track - add a new entry to an existing project
  • conjuror output - output a filtered report as PDF, HTML, and CSV

Flags (BROKEN AT THE MOMENT)

Normally the conjuror command should accept flags to be run as a normal shell command, but I broke that recently!

Flag Short Flag Behavior
--help -h shows list of commands
--input -i selects data.json schema file to open up
--formats -f allows you to choose different output formats (cli, csv, html, pdf)
--output -o specify Name of File to be output
--date -d filters by numerous date styles 'February, Feb, 02 read below
--search -s searches for a string like magic contained within a longer string I love doing magic tricks
--trim -t filters by an item like 'client' (currently hardcoded value)
--price -p Override the calculated price with a fixed price
--currency -c what currency the thing is in
--extra -e Text that appears in extra field of template (overrides field in config).
--details -l Affects visibility of the data_details field in a template (show, hide)
--message -m Shows up as a data_message in a template
--generated -g Allows specifying custom invoice date

Run either of the follow two examples from terminal command line

Example (trim)

node conjuror.js --input data/clients.json --trim client-name

This command should have printed data to your command line that matches your trim parameter.

Example (output & date)

node conjuror.js -i data/clients.json -o "Feb Invoice" -t client-name --date=Feb

The following examples are formats of dates values you can pass using the --date flag

  • Month - February or Feb or 02 which picks month of current year
  • Exact - 2015-09-04 gets all values since date
  • Range - 2015-09-04:to:2015-11-15 selects between two exact values

The above example should have outputted an HTML rendering of your the entries parsed from your data. The output will be located in output/Feb Invoice.html

Note: regarding PDF export

To generate PDF outputs, you need to install wkhtmltopdf for your operating system on Debian that is done with sudo apt-get install wkhtmltopdf

Why The Magical Name & Terminology?

Well, there is that quote by Asimov about technology... there is also the Cyber Wizard Institute which you should check out... and I really wanted to use this icon of a magical bearded wizard which came from my friend Max who is obsessed with JS

Made in Berlin