Jump to: navigation, search

Satori/TemplatedFormatting

< Satori
Revision as of 00:59, 7 March 2014 by Ziad Sawalha (talk | contribs) (Created page with "== Spec for Templated Output Formatting == At the command-line, we currently select part of the discovery data and format it using a hard-coded output routine. Different user...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Spec for Templated Output Formatting

At the command-line, we currently select part of the discovery data and format it using a hard-coded output routine. Different users have expressed interest in different parts of the output. While we can provide access to the raw data, there may eventually be so much of it that it becomes less useful and harder for users to find the parts they are interested in.

We therefore propose:

  • support multiple output formats (ex. json, text, yaml).
  • allow the customization of the output using a templating language


Implementation Proposal

1. Support —format and -F as an argument.

2. Support json and text as built-in formats

3. Use Jinja2 for output formatting.

4. Have the text output be generated by a default template that ships with satori


For example, in satori:

 /satori
   /formats
     /text.jinja
     /custom.jinja
 
 $ satori example.com                         # default format (uses text.jinja)
 $ satori example.com -F json                 # built-in json formatter
 $ satori example.com —format custom          # custom, packaged formatter (custom.jinja)
 $ satori example.com —format /etc/my/format  # format using an external template


We may include some default templates such as:

  • Template focused on package information
  • Template focused on networking information