{"id":13582536,"url":"https://github.com/lucapette/fakedata","last_synced_at":"2025-07-22T18:33:38.906Z","repository":{"id":20284717,"uuid":"89288835","full_name":"lucapette/fakedata","owner":"lucapette","description":"CLI utility for fake data generation","archived":false,"fork":false,"pushed_at":"2024-02-09T08:16:07.000Z","size":950,"stargazers_count":209,"open_issues_count":4,"forks_count":7,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-10T03:52:44.287Z","etag":null,"topics":["cli-utilities","data-generator","fake-data","fakedata","test-data","test-data-generator","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucapette.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-04-24T21:28:48.000Z","updated_at":"2025-03-24T17:46:24.000Z","dependencies_parsed_at":"2024-02-09T09:35:06.981Z","dependency_job_id":"42c66e34-6378-478c-bccf-f01f8204af4f","html_url":"https://github.com/lucapette/fakedata","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/lucapette/fakedata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucapette%2Ffakedata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucapette%2Ffakedata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucapette%2Ffakedata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucapette%2Ffakedata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucapette","download_url":"https://codeload.github.com/lucapette/fakedata/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucapette%2Ffakedata/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266552617,"owners_count":23947179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli-utilities","data-generator","fake-data","fakedata","test-data","test-data-generator","testing-tools"],"created_at":"2024-08-01T15:02:48.580Z","updated_at":"2025-07-22T18:33:38.866Z","avatar_url":"https://github.com/lucapette.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# fakedata\n\n`fakedata` is a small program that generates test data on the command line.\n\n## How to install\n\nIf you use [Homebrew](https://brew.sh/):\n\n```sh\nbrew install lucapette/tap/fakedata\n```\n\nIf you have [Go](https://go.dev/) installed:\n\n```sh\ngo install github.com/lucapette/fakedata@latest\n```\n\nOr you can download the latest [compiled\nbinary](https://github.com/lucapette/fakedata/releases) and put it anywhere in\nyour executable path.\n\nIf you want to build it yourself, refer to our [contributing\nguidelines](/CONTRIBUTING.md).\n\n## Quick Start\n\n`fakedata` helps you generate random data in a number of ways.\n\nBy default, it uses a column formatter with space separator:\n\n```sh\n$ fakedata email country\ncemshid@example.com Afghanistan\nLucasPerdidao@example.me Turkey\narthurholcombe1@test.us Saint Helena\niamgarth@example.us Montenegro\njoelcipriano@test.name Croatia\nkeryilmaz@test.name Vietnam\nplbabin@test.org Lithuania\nbermonpainter@test.us Haiti\nopnsrce@example.name Malaysia\nankitind@test.info Virgin Islands, British\n```\n\nYou can choose a different separator:\n\n```sh\n$ fakedata --separator=, product.category product.name\nShoes,Rankfix\nAutomotive,Namis\nMovies,Matquadfax\nTools,Damlight\nComputers,Silverlux\nIndustrial,Matquadfax\nHome,Sil-Home\nHealth,Toughwarm\nShoes,Freetop\nTools,Domnix\n\n# tab is a little tricky to type, but works\n$ fakedata emoji industry -s=$'\\t'\n👦\tElectrical \u0026 Electronic Manufacturing\n🆘\tInvestment Banking/Venture\n📦\tComputer Hardware\n♐\tComputer \u0026 Network Security\n🔠\tReligious Institutions\n💷\tAutomotive\n🇱\tCapital Markets\n㊙\tPublic Relations\n☺\tAlternative Dispute Resoluti\n```\n\nYou can specify a SQL formatter:\n\n```sh\n$ fakedata --format=sql --limit 1 email domain\nINSERT INTO TABLE (email,domain) values ('yigitpinar@example.org','example.me');\n```\n\nOr a [ndjson](https://github.com/ndjson/ndjson-spec) one:\n\n```sh\n$ fakedata --format=ndjson --limit 1 noun country.code\n{\"country.code\":\"PY\",\"noun\":\"mainframe\"}\n```\n\nYou can change the name of the field column using a field with the syntax\n`column_name=generator`. It works with the SQL formatter as well the ndjson one:\n\n```sh\n$ fakedata --format=sql --limit 1 login=email referral=domain\nINSERT INTO TABLE (login,referral) values ('calebogden@example.com','test.me');\n\n$ fakedata --format=ndjson --limit 1 login=email referral=domain\n{\"login\":\"rmlewisuk@example.xn--80ao21a\",\"referral\":\"example.ventures\"}\n```\n\n`fakedata` can also _stream_ rows of test data for you:\n\n```sh\n$ fakedata --stream animal\nhorse\nkoala\nchameleon\n## and so on...\n```\n\nIf you need more control over the output, use [templates](#templates).\n\n## Generators\n\n`fakedata` provides a number of generators. You can see the full list running\nthe following command:\n\n```sh\n$ fakedata --generators # or -G\ncolor             one word color\ncountry           Full country name\ncountry.code      2-digit country code\ndate              date\ndomain            domain\ndomain.tld        example|test\n#...\n#...\n#It's a long list :)\n```\n\nYou can use the `-g` (or `--generator`) option to see an example:\n\n```sh\n$ fakedata -g sentence\nDescription: sentence\n\nExample:\n\nJerk the dart from the cork target.\nDrop the ashes on the worn old rug.\nThe sense of smell is better than that of touch.\nTin cans are absent from store shelves.\nShut the hatch before the waves push it in.\n```\n\n### Constraints\n\nSome generators allow you to pass in a range to constraint the output to a\nsubset of values. To find out which generators support constraints:\n\n```sh\nfakedata -c # or fakedata --generators-with-constraints\n```\n\n#### Int\n\nHere is how you can use constraints with the `int` generator:\n\n```sh\nfakedata int:1,100 # will generate only integers between 1 and 100\nfakedata int:50, # specifying only min number works too\nfakedata int:50 # also works\n```\n\n#### Enum\n\nThe `enum` generator allows you to specify a set of values. It comes handy when\nyou need random data from a small set of values:\n\n```sh\n$ fakedata --limit 5 enum\nfoo\nbaz\nfoo\nfoo\nbaz\n$ fakedata --limit 5 enum:bug,feature,question,duplicate\nquestion\nduplicate\nduplicate\nbug\nfeature\n```\n\nWhen passing a single value `enum` can be used to repeat a value in every line:\n\n```sh\n$ fakedata --limit 5 enum:one,two enum:repeat\ntwo repeat\none repeat\ntwo repeat\none repeat\none repeat\n```\n\n#### File\n\nThe `file` generator can be use to read custom values from a file:\n\n```sh\n$ printf \"one\\ntwo\\nthree\" \u003e values.txt\n$ fakedata -l5 file:values.txt\nthree\ntwo\ntwo\none\ntwo\n```\n\n## Templates\n\n`fakedata` supports parsing and executing template files for generating\ncustomized output formats.\n\nIt executes the provided template a number of times based on the limit flag\n(`-l`, `--limit`) and writes the output to `stdout`, exactly like using inline\ngenerators.\n\nYou pipe a template into `fakedata`:\n\n```sh\n$ echo \"#{{ Int 0 100}} {{ Name }} \u003c{{ Email }}\u003e\" | fakedata\n#56 Dannie Martin \u003cbassamology@test.th\u003e\n#89 Moshe Walsh \u003cbaires@example.autos\u003e\n#48 Buck Reid \u003csyropian@test.cg\u003e\n#55 Rico Powell \u003cfindingjenny@example.pohl\u003e\n#92 Luise Wood \u003c91bilal@example.link\u003e\n#30 Isreal Henderson \u003cthierrykoblentz@test.scb\u003e\n#96 Josphine Patton \u003cabelcabans@test.wtf\u003e\n#95 Jetta Blair \u003ctgerken@example.jewelry\u003e\n#10 Clorinda Parsons \u003croybarberuk@test.gives\u003e\n#0 Dionna Bates \u003cjefffis@test.flights\u003e\n```\n\nOr you ask `fakedata` to read templates from disk:\n\n```sh\n$ echo \"{{Email}}--{{Int}}\" \u003e /tmp/template.tmpl\n$ fakedata --template /tmp/template.tmpl\nademilter@test.school--214\nSilveredge9@example.anquan--379\nplbabin@example.here--902\nsilvanmuhlemann@test.aero--412\nivanfilipovbg@test.bmw--517\nrobbschiller@example.feedback--471\nrickdt@example.vista--963\nrmlewisuk@test.info--101\nlinux29@example.archi--453\ng3d@test.pl--921\n```\n\nThe generators listed under `fakedata -g` are available as functions into the\ntemplates.\n\nIf the generator name is a single word, then it's available as a function with\nthe same name capitalized (example: `int` becomes `Int`).\n\nIf the generator name is composed by multiple words joined by dots, then the\nfunction name is again capitalized by the first letter of the word and joined\ntogether (example: `product.name` becomes `ProductName`).\n\nEach generator with [constraints](#constraints) is available in templates as a\nfunction that takes arguments.\n\n### `Enum`\n\nEnum takes one or more strings and returns a random string on each run. Strings\nare passed to Enum like so:\n\n```sh\n$ echo '{{ Enum \"feature\" \"bug\" \"documentation\" }}' | fakedata -l5\nfeature\nbug\ndocumentation\nfeature\ndocumentation\n```\n\n### `File`\n\nFile reads a file from disk and returns a random line on each run. It takes one\nparameter which is the path to the file on disk.\n\n```sh\n$ echo \"uno\\ndue\\ntre\" \u003e example.txt\n$ echo '{{ File \"./example.txt\" }}' | fakedata -l5\ntre\nuno\ndue\ndue\ndue\nfoo\n```\n\n### `Int`\n\nInt takes one or two integer values and returns a number within this range. By\ndefault it returns a number between `0` and `1000`.\n\n```sh\n$ echo \"{{ Int 15 20 }}\" | fakedata -l5\n15\n20\n15\n15\n17\n```\n\n### `Date`\n\nDate takes one or two dates and returns a date within this range. By default, it\nreturns a date between one year ago and today.\n\n### Helpers\n\nBeside the generator functions, `fakedata` templates provide a number of helper\nfunctions:\n\n- `Loop`\n- `Odd`\n- `Even`\n\nIf you need to create your own loop for advanced templates you can use the `{{ Loop }}` function.\n\nThis function takes a single integer as parameter which is the number of\niterations. `Loop` must be used with `range` e.g.\n\n```html\n{{ range Loop 10 }} You're going to see this 10 times! {{ end }}\n```\n\n`Loop` can take a second argument, so that you can specify a range and\n`fakedata` will generate a random number of iterations in that range. For\nexample:\n\n```html\n{{ range Loop 1 5 }}42{{ end }}\n```\n\nIn combination with `Loop` and `range` you can use `Odd` and `Even` to determine\nif the current iteration is odd or even.\n\nFor example, this is helpful when creating HTML tables:\n\n```html\n{{ range $i := Loop 5 }}\n\u003ctr\u003e\n  {{ if Odd $i -}}\n  \u003ctd class=\"odd\"\u003e{{- else -}}\u003c/td\u003e\n\n  \u003ctd class=\"even\"\u003e{{- end -}} {{ Name }}\u003c/td\u003e\n\u003c/tr\u003e\n{{ end }}\n```\n\n`Odd` takes an integer as parameter which is why we need to assign the return\nvalues of `Loop 5` to the variables `$i` and `$j`.\n\nTemplates also support string manipulation via the `printf` function. Using\n`printf` we can create custom output.\n\nFor example, to display a full name in the format `Lastname Firstname` instead\nof `Firstname Lastname`.\n\n```html\n{{ printf \"%s %s\" NameLast NameFirst }}\n```\n\n## Completion\n\n`fakedata` supports basic shell tab completion for bash, zsh, and fish shells:\n\n```sh\neval \"$(fakedata --completion zsh)\"\neval \"$(fakedata --completion bash)\"\neval (fakedata --completion fish)\n```\n\n## How to contribute\n\nWe love every form of contribution! Good entry points to the project are:\n\n- Our [contributing guidelines](/CONTRIBUTING.md) document\n- Issues with the tag\n  [gardening](https://github.com/lucapette/fakedata/issues?q=is%3Aissue+is%3Aopen+label%3Agardening)\n- Issues with the tag [good first\n  patch](https://github.com/lucapette/fakedata/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+patch%22)\n\nIf you're not sure where to start, please open a [new\nissue](https://github.com/lucapette/fakedata/issues/new) and we'll gladly help\nyou get started.\n\n## Code of Conduct\n\nYou are expected to follow our [code of conduct](/CODE_OF_CONDUCT.md) when\ninteracting with the project via issues, pull requests, or in any other form.\nMany thanks to the awesome [contributor\ncovenant](http://contributor-covenant.org/) initiative!\n\n## License\n\n[MIT License](/LICENSE) Copyright (c) [2022] [Luca Pette](https://lucapette.me)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucapette%2Ffakedata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucapette%2Ffakedata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucapette%2Ffakedata/lists"}