
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A command-line tool for mustache template, generating outputs from various data sources
A command-line tool for mustache template, generating outputs from various data sources
Mustang is a command-line tool to generate desired outputs from various data sources (e.g. CSV/JSON file, URL, MySQL, MongoDB), by applying mustache template.
$ npm install -g mustang
or
$ git clone git://github.com/stomita/mustang.git $ cd mustang $ npm link
Following is a very simple command to generate output to stdout from specified mustache template by using the input file as its templating context.
$ mustang -t <template_file> -i <input_file>
Following is an example to output html from a CSV file input.
$ cat input.csv
NO,TITLE
1,"Hello, World"
2,"Apple, Orange, and Banana"
3,"Thank you!"
$ cat template.mustache
{{#.}}
<div>{{NO}}: {{TITLE}}</div>
{{/.}}
$ mustang -t template.mustache -i input.csv
<div>1: Hello, World</div>
<div>2: Apple, Orange, and Banana</div>
<div>3: Thank you!</div>
Currently input file must be formatted in CSV or JSON. By default mustang checks its file extension and detect its format. You can add '-f' option to specify input file format explicitly.
$ cat input.txt
[
{ "NO": 1, "TITLE": "Hello, World" },
{ "NO": 2, "TITLE": "Apple, Orange, and Banana" },
{ "NO": 3, "TITLE": "Thank you!" }
]
$ mustang -t template.mustache -i input.txt -f json
<div>1: Hello, World</div>
<div>2: Apple, Orange, and Banana</div>
<div>3: Thank you!</div>
You can also use stdin for piping.
$ cat input.txt | mustang -t template.mustache -f json <div>1: Hello, World</div> <div>2: Apple, Orange, and Banana</div> <div>3: Thank you!</div>
Adding '-o' option, mustang output is saved to specified file.
$ mustang -t template.mustache -i input.csv -o output.html $ cat output.html <div>1: Hello, World</div> <div>2: Apple, Orange, and Banana</div> <div>3: Thank you!</div>
If you want to output multiple files from each input records, add '-m' option and set output directory path in '-o' option.
$ cat template.mustache
<div>{{NO}}: {{TITLE}}</div>
$ mkdir output
$ mustang -t template.mustache -i input.csv -o output -m
$ ls output
output-1.html output-2.html output-3.html
$ cat output/output-1.html
<div>1: Hello, World</div>
By using "-u" option, mustang downloads the content directly from specified URL and use it as input source.
$ mustang -t template.mustache -u "https://webservice.example.org/search?q=London" -f json
Also mustang can connnect to database and query records from database table/collection. Currently MySQL and MongoDB is supported for database.
Following example shows how to fetch all records in "emp" table in MySQL database.
$ mustang -t template.mustache -d mysql://user:pass@hostname/database -c emp
You can directly pass a SQL to fetch records by "-q" option.
$ mustang -t template.mustache -d mysql://user:pass@hostname/database -q 'SELECT * FROM emp WHERE deptno = 1234'
Following example shows how to fetch all records in "users" collection in MongoDB.
$ mustang -t template.mustache -d mongodb://user:pass@hostname/database -c users
You can also set URL-style query string in "-q" option to specify both querying collection and filter.
$ mustang -t template.mustache -d mongodb://user:pass@hostname/database -q 'users?type=internal&owner.name=john'
v0.1.1 (May 19, 2013):
v0.1.0 (May 19, 2013):
FAQs
A command-line tool for mustache template, generating outputs from various data sources
The npm package mustang receives a total of 3 weekly downloads. As such, mustang popularity was classified as not popular.
We found that mustang demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.