A CLI of @faker-js/faker.
ℹ️ Note: This is currently a MVP.
npm install --save-dev @faker-js/clinpx faker <moduleName> <functionName>
ℹ️ Note: Read more about
npx
Faker-CLI expects a moduleName as well as a functionName argument.
This is equivalent to calling faker[moduleName][functionName].
Checkout Fakers's API for information on which modules and functions are available.
If you want a integer you can run:
npx faker number intUpcoming features might include:
Users will be able to specify a locale for localized data.
Currently, the CLI always uses the default en locale.
In the future, this feature could be implemented as follows:
npx faker --locale de person firstNameThis example would print a first name from the German locale.
This CLI is currently in its MVP stage, which means that it only performs the bare minimum. If you need an integer within a specific range, you'll have to do it yourself. In the future, this feature could be implemented as follows:
npx faker number int --min 10 --max 20This example will generate an integer between 10 and 20.
The min and max options are available in Faker's int options.
Developers often dislike changing work environments.
If you're already working in the terminal, you probably don't want to leave it to look up a small detail.
Instead, you expect the CLI to have a proper --help documentation that includes examples.
This will be the case in the future.