Tiny command line program that accepts a template and outputs fake data.
# publish email to nsq every 1ms.
echo '{"email":"{{email}}", "subject": "welcome!"}' \
| phony --tick 1ms \
| json-to-nsq --topic users
# add users to FoundationDB.
echo "'set {{username}} {{avatar}}'" \
| phony \
| xargs -L1 -n3 fdbcli --exec
# add users to MongoDB.
echo "'db.users.insert({ name: \"{{name}}\" })'" \
| phony \
| xargs -L1 -n1 mongo --eval
# add users to Redis.
echo "set {{username}} {{avatar}}" \
| phony \
| xargs -L1 -n3 redis-cli
# send a single request using curl.
echo 'country={{country}}' \
| phony --max 1 \
| curl -d @- httpbin.org/post
$ go get github.com/yields/phony
Usage: phony
[--tick d]
[--max n]
[--list]
phony -h | --help
phony -v | --version
Options:
--list list all available generators
--max n generate data up to n [default: -1]
--tick d generate data every d [default: 10ms]
-v, --version show version information
-h, --help show help information
Generate an uri to an avatar picture
$ echo "{{avatar}}" | phony --max 1
https://s3.amazonaws.com/uifaces/faces/twitter/areus/128.jpg
Select randomly one of the arguments
$ echo "{{choice:Viewed,Purchased,Watched,Clicked}}" | phony --max 1
Watched
Generate a textual name of a color
$ echo "{{color}}" | phony --max 1
red
Generate the name of a country
$ echo "{{country}}" | phony --max 1
Argentina
Generate the short alphabetic geographical code of a country
$ echo "{{country.code}}" | phony --max 1
AR
Generate a domain
$ echo "{{domain}}" | phony --max 1
example.com
Generate a domain name
$ echo "{{domain.name}}" | phony --max 1
example
Generate a domain TLD
$ echo "{{domain.name}}" | phony --max 1
org
Generate a double number
$ echo "{{double}}" | phony --max 1
12.23
Generate an email address
$ echo "{{email}}" | phony --max 1
[email protected]
Generate a geohash
Arguments:
- the precision of the geohash (optional; default to 12)
$ echo "{{geo.hash:10}}" | phony --max 1
zvtfye3v6b
Generate a HTTP method
$ echo "{{http.method}}" | phony --max 1
GET
Generate an identifier
$ echo "{{id}}" | phony --max 1
az23eGE23e
Generate an ipv4 address
$ echo "{{ipv4}}" | phony --max 1
10.23.45.67
Generate an ipv6 address
$ echo "{{ipv6}}" | phony --max 1
2001:cafe:85:b:cf:62:60:81
Generate a k-sortable unique id
$ echo "{{ksuid}}" | phony --max 1
1Zlye1QoDrANrPV9MP6c1tMU4yd
Generate a geographical latitude
$ echo "{{geo.latitude}}" | phony --max 1
-64.007899
Generate a geographical longitude
$ echo "{{geo.longitude}}" | phony --max 1
-176.537284
Generate a mac address
$ echo "{{mac.address}}" | phony --max 1
cd:da:8d:e7:c5:e3
Generate a person name
$ echo "{{name}}" | phony --max 1
Britta Mccarthy
Generate a firstname
$ echo "{{name.first}}" | phony --max 1
Filiberto
Generate a lastname
$ echo "{{name.last}}" | phony --max 1
Walton
Generate a product category
$ echo "{{product.category}}" | phony --max 1
Clothing
Generate a product name
$ echo "{{product.name}}" | phony --max 1
Namdax
Generate a random integer
Arguments:
- the minimum value of the random integer (optional)
- the maximum value of the random integer (mandatory)
$ echo "{{randint:100}}" | phony --max 1
71
$ echo "{{randint:20,50}}" | phony --max 1
34
Generate a USA state
$ echo "{{state}}" | phony --max 1
Idaho
Generate the short code of a USA state
$ echo "{{state.code}}" | phony --max 1
AZ
Generate a timezone
$ echo "{{timezone}}" | phony --max 1
America/Phoenix
Generate an Unix time
$ echo "{{unixtime}}" | phony --max 1
1585421720493623000
Generate a username
$ echo "{{username}}" | phony --max 1
kerem
Generate an uuid
$ echo "{{uuid}}" | phony --max 1
f8b3a519-2e83-427f-b3a6-53e617310690
(MIT), 2014 Amir Abu Shareb.