Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/captainsafia/fony
A simple command line tool for generating fake data from a template string
https://github.com/captainsafia/fony
Last synced: 6 days ago
JSON representation
A simple command line tool for generating fake data from a template string
- Host: GitHub
- URL: https://github.com/captainsafia/fony
- Owner: captainsafia
- License: mit
- Created: 2017-04-05T08:04:05.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-07T15:53:54.000Z (about 3 years ago)
- Last Synced: 2024-04-14T11:52:48.468Z (10 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 513
- Watchers: 7
- Forks: 24
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-nodejs - fony - A simple command line tool for generating fake data from a template string. ![](https://img.shields.io/github/stars/captainsafia/fony.svg?style=social&label=Star) (Repository / Testing)
README
# fony
fony is a **simple** command line tool that generates dummy JSON data from
a provided template.The application utilizes [Chance.js](http://chancejs.com/) under the hood
so any data type supported by Chance.js is supported by fony.fony is intended to provide a simple solution to the most common data
generation needs. You can use the command line to pipe output from
fony to other tools and integrate it into your workflow.## Installation
```
npm install --global fony
```## Usage
```
Usage: fony [options]Options:
-h, --help output usage information
-V, --version output the version number
-t, --template JSON template for data to be generated
-c, --count [count] The number of elements to create, defaults to 1```
## Example
Mac and Linux folks can use single quotes around a double-quoted string of JSON like this:
```
fony -t '{"name": "name", "age": "age", "address": "address"}' -c 2
```But Windows handles quotes on the command line differently, so be sure to escape your strings and only use double quotes:
```
fony -t "{\"name\": \"name\", \"age\": \"age\", \"address\": \"address\"}" -c 2
```## Niceties
fony supports nested fixtures:
```js
$ fony -t '{"foo": {"bar": "name"}}'
{
"foo": {
"bar": "Virgie Davidson"
}
}
```As well as arrays:
```js
$ fony -t '{"tags": ["word", 3]}'
{
"tags": [
"oklu",
"odikabi",
"coan"
]
}
```![fony](https://cloud.githubusercontent.com/assets/1857993/24695518/c4ab67e8-19ab-11e7-98e3-330fa48a14d3.gif)