diff --git a/.eslintrc.json b/.eslintrc.json index 6a6815a..ff34fab 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,18 +2,25 @@ "env": { "node": true }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", - "plugin:@typescript-eslint/strict" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "./tsconfig.json" - }, - "plugins": [ - "@typescript-eslint" - ], - "root": true -} + "root": true, + "overrides": [ + { + "files": [ + "src/**/*.ts" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:@typescript-eslint/strict" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "./tsconfig.json" + }, + "plugins": [ + "@typescript-eslint" + ] + } + ] +} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e197eb7..e8f8c3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: run: npm install - name: Lint - run: npx eslint . + run: npm run lint format: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 7762951..cec4f34 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,39 @@ # Faker-CLI -A CLI of [@faker-js/faker](https://github.com/faker-js/faker). \ No newline at end of file +A CLI of [@faker-js/faker](https://github.com/faker-js/faker). + +> **Note**: This is currently a [MVP](https://en.wikipedia.org/wiki/Minimum_viable_product). + +## Install + +```bash +npm install --save-dev @faker-js/cli +``` + +## Usage + +``` +faker module_name method_name +``` + +Faker-CLI expects a `module_name` as well as a `method_name` depending on the module chosen. + +To list all possible modules run: + +```bash +faker --help +``` + +To list all possible methods of a module run: + +```bash +faker module_name --help +``` + +## Whats next + +Upcoming features might include: + +- localization +- support for all parameters `@faker-js/faker` natively +- make the CLI consumable for your own modules diff --git a/bin/faker.js b/bin/faker.js new file mode 100644 index 0000000..9ac1ba1 --- /dev/null +++ b/bin/faker.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +require('../dist/src/index.js').cli(process.argv); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9c100b2..1d72dc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,21 @@ "": { "name": "@faker-js/cli", "version": "0.0.0", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/fakerjs" + } + ], "license": "MIT", + "dependencies": { + "@faker-js/faker": "^8.0.2", + "commander": "^11.0.0" + }, + "bin": { + "cli": "bin/faker.js", + "faker": "bin/faker.js" + }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", @@ -81,6 +95,21 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@faker-js/faker": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.0.2.tgz", + "integrity": "sha512-Uo3pGspElQW91PCvKSIAXoEgAUlRnH29sX2/p89kg7sP1m2PzCufHINd0FhTXQf6DYGiUlVncdSPa2F9wxed2A==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/fakerjs" + } + ], + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0", + "npm": ">=6.14.13" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", @@ -497,6 +526,14 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/commander": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==", + "engines": { + "node": ">=16" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", diff --git a/package.json b/package.json index 742074e..9711f35 100644 --- a/package.json +++ b/package.json @@ -2,18 +2,29 @@ "name": "@faker-js/cli", "version": "0.0.0", "description": "A CLI of @faker-js/faker.", - "main": "dist/index.js", + "bin": { + "@faker-js/cli": "bin/faker.js", + "faker": "bin/faker.js" + }, "scripts": { "build": "tsc", "format": "prettier src --write", - "lint": "eslint .", - "lint:fix": "eslint . --fix" + "lint": "eslint src", + "lint:fix": "eslint src --fix" }, + "files": [ + "dist" + ], "keywords": [ "faker", "faker.js", "fakerjs", "faker-js", + "cli", + "faker-cli", + "faker.js-cli", + "fakerjs-cli", + "faker-js-cli", "fake data generator", "fake data", "fake-data", @@ -25,8 +36,15 @@ ], "repository": { "type": "git", - "url": "https://github.com/faker-js/faker.git" + "url": "https://github.com/faker-js/cli.git" }, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/fakerjs" + } + ], + "bugs": "https://github.com/faker-js/cli/issues", "license": "MIT", "devDependencies": { "@typescript-eslint/eslint-plugin": "^6.6.0", @@ -34,5 +52,9 @@ "eslint": "^8.48.0", "prettier": "^3.0.3", "typescript": "~5.2.2" + }, + "dependencies": { + "@faker-js/faker": "^8.0.2", + "commander": "^11.0.0" } } diff --git a/src/commands/airline/aircraftType.ts b/src/commands/airline/aircraftType.ts new file mode 100644 index 0000000..07ebf38 --- /dev/null +++ b/src/commands/airline/aircraftType.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('aircraftType') + .description(`Generates a random aircraft type.`) + .action(() => { + console.log(faker.airline.aircraftType()); + }); + +export default command; diff --git a/src/commands/airline/airline.ts b/src/commands/airline/airline.ts new file mode 100644 index 0000000..098e6a1 --- /dev/null +++ b/src/commands/airline/airline.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('airline') + .description(`Generates a random airline.`) + .action(() => { + console.log(faker.airline.airline()); + }); + +export default command; diff --git a/src/commands/airline/airplane.ts b/src/commands/airline/airplane.ts new file mode 100644 index 0000000..9cf6dd5 --- /dev/null +++ b/src/commands/airline/airplane.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('airplane') + .description(`Generates a random airplane.`) + .action(() => { + console.log(faker.airline.airplane()); + }); + +export default command; diff --git a/src/commands/airline/airport.ts b/src/commands/airline/airport.ts new file mode 100644 index 0000000..8d713d4 --- /dev/null +++ b/src/commands/airline/airport.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('airport') + .description(`Generates a random airport.`) + .action(() => { + console.log(faker.airline.airport()); + }); + +export default command; diff --git a/src/commands/airline/flightNumber.ts b/src/commands/airline/flightNumber.ts new file mode 100644 index 0000000..92ef3a1 --- /dev/null +++ b/src/commands/airline/flightNumber.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('flightNumber') + .description(`Generates a random flight number.`) + .action(() => { + console.log(faker.airline.flightNumber()); + }); + +export default command; diff --git a/src/commands/airline/index.ts b/src/commands/airline/index.ts new file mode 100644 index 0000000..57a76b9 --- /dev/null +++ b/src/commands/airline/index.ts @@ -0,0 +1,20 @@ +import { Command } from 'commander'; +import airportCommand from './airport'; +import airlineCommand from './airline'; +import airplaneCommand from './airplane'; +import recordLocatorCommand from './recordLocator'; +import seatCommand from './seat'; +import aircraftTypeCommand from './aircraftType'; +import flightNumberCommand from './flightNumber'; + +const command = new Command('airline') + .description(`Module to generate airline and airport related data.`) + .addCommand(airportCommand) + .addCommand(airlineCommand) + .addCommand(airplaneCommand) + .addCommand(recordLocatorCommand) + .addCommand(seatCommand) + .addCommand(aircraftTypeCommand) + .addCommand(flightNumberCommand); + +export default command; diff --git a/src/commands/airline/recordLocator.ts b/src/commands/airline/recordLocator.ts new file mode 100644 index 0000000..2d94756 --- /dev/null +++ b/src/commands/airline/recordLocator.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('recordLocator') + .description(`Generates a random record locator.`) + .action(() => { + console.log(faker.airline.recordLocator()); + }); + +export default command; diff --git a/src/commands/airline/seat.ts b/src/commands/airline/seat.ts new file mode 100644 index 0000000..3a72eef --- /dev/null +++ b/src/commands/airline/seat.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('seat') + .description(`Generates a random seat.`) + .action(() => { + console.log(faker.airline.seat()); + }); + +export default command; diff --git a/src/commands/animal/bear.ts b/src/commands/animal/bear.ts new file mode 100644 index 0000000..53af6c3 --- /dev/null +++ b/src/commands/animal/bear.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bear') + .description(`Generates a random bear species.`) + .action(() => { + console.log(faker.animal.bear()); + }); + +export default command; diff --git a/src/commands/animal/bird.ts b/src/commands/animal/bird.ts new file mode 100644 index 0000000..762899d --- /dev/null +++ b/src/commands/animal/bird.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bird') + .description(`Generates a random bird species.`) + .action(() => { + console.log(faker.animal.bird()); + }); + +export default command; diff --git a/src/commands/animal/cat.ts b/src/commands/animal/cat.ts new file mode 100644 index 0000000..fb82779 --- /dev/null +++ b/src/commands/animal/cat.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cat') + .description(`Generates a random cat breed.`) + .action(() => { + console.log(faker.animal.cat()); + }); + +export default command; diff --git a/src/commands/animal/cetacean.ts b/src/commands/animal/cetacean.ts new file mode 100644 index 0000000..e3aaca9 --- /dev/null +++ b/src/commands/animal/cetacean.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cetacean') + .description(`Generates a random cetacean species.`) + .action(() => { + console.log(faker.animal.cetacean()); + }); + +export default command; diff --git a/src/commands/animal/cow.ts b/src/commands/animal/cow.ts new file mode 100644 index 0000000..5755856 --- /dev/null +++ b/src/commands/animal/cow.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cow') + .description(`Generates a random cow species.`) + .action(() => { + console.log(faker.animal.cow()); + }); + +export default command; diff --git a/src/commands/animal/crocodilia.ts b/src/commands/animal/crocodilia.ts new file mode 100644 index 0000000..c58ffd8 --- /dev/null +++ b/src/commands/animal/crocodilia.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('crocodilia') + .description(`Generates a random crocodilian species.`) + .action(() => { + console.log(faker.animal.crocodilia()); + }); + +export default command; diff --git a/src/commands/animal/dog.ts b/src/commands/animal/dog.ts new file mode 100644 index 0000000..90698b7 --- /dev/null +++ b/src/commands/animal/dog.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('dog') + .description(`Generates a random dog breed.`) + .action(() => { + console.log(faker.animal.dog()); + }); + +export default command; diff --git a/src/commands/animal/fish.ts b/src/commands/animal/fish.ts new file mode 100644 index 0000000..168bf9d --- /dev/null +++ b/src/commands/animal/fish.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('fish') + .description(`Generates a random fish species.`) + .action(() => { + console.log(faker.animal.fish()); + }); + +export default command; diff --git a/src/commands/animal/horse.ts b/src/commands/animal/horse.ts new file mode 100644 index 0000000..072647d --- /dev/null +++ b/src/commands/animal/horse.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('horse') + .description(`Generates a random horse breed.`) + .action(() => { + console.log(faker.animal.horse()); + }); + +export default command; diff --git a/src/commands/animal/index.ts b/src/commands/animal/index.ts new file mode 100644 index 0000000..ce93aa3 --- /dev/null +++ b/src/commands/animal/index.ts @@ -0,0 +1,36 @@ +import { Command } from 'commander'; +import dogCommand from './dog'; +import catCommand from './cat'; +import snakeCommand from './snake'; +import bearCommand from './bear'; +import lionCommand from './lion'; +import cetaceanCommand from './cetacean'; +import horseCommand from './horse'; +import birdCommand from './bird'; +import cowCommand from './cow'; +import fishCommand from './fish'; +import crocodiliaCommand from './crocodilia'; +import insectCommand from './insect'; +import rabbitCommand from './rabbit'; +import rodentCommand from './rodent'; +import typeCommand from './type'; + +const command = new Command('animal') + .description(`Module to generate animal related entries.`) + .addCommand(dogCommand) + .addCommand(catCommand) + .addCommand(snakeCommand) + .addCommand(bearCommand) + .addCommand(lionCommand) + .addCommand(cetaceanCommand) + .addCommand(horseCommand) + .addCommand(birdCommand) + .addCommand(cowCommand) + .addCommand(fishCommand) + .addCommand(crocodiliaCommand) + .addCommand(insectCommand) + .addCommand(rabbitCommand) + .addCommand(rodentCommand) + .addCommand(typeCommand); + +export default command; diff --git a/src/commands/animal/insect.ts b/src/commands/animal/insect.ts new file mode 100644 index 0000000..e4d0ce1 --- /dev/null +++ b/src/commands/animal/insect.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('insect') + .description(`Generates a random insect species.`) + .action(() => { + console.log(faker.animal.insect()); + }); + +export default command; diff --git a/src/commands/animal/lion.ts b/src/commands/animal/lion.ts new file mode 100644 index 0000000..c96dd65 --- /dev/null +++ b/src/commands/animal/lion.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('lion') + .description(`Generates a random lion species.`) + .action(() => { + console.log(faker.animal.lion()); + }); + +export default command; diff --git a/src/commands/animal/rabbit.ts b/src/commands/animal/rabbit.ts new file mode 100644 index 0000000..949a022 --- /dev/null +++ b/src/commands/animal/rabbit.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('rabbit') + .description(`Generates a random rabbit species.`) + .action(() => { + console.log(faker.animal.rabbit()); + }); + +export default command; diff --git a/src/commands/animal/rodent.ts b/src/commands/animal/rodent.ts new file mode 100644 index 0000000..fc7eb62 --- /dev/null +++ b/src/commands/animal/rodent.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('rodent') + .description(`Generates a random rodent breed.`) + .action(() => { + console.log(faker.animal.rodent()); + }); + +export default command; diff --git a/src/commands/animal/snake.ts b/src/commands/animal/snake.ts new file mode 100644 index 0000000..30671ca --- /dev/null +++ b/src/commands/animal/snake.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('snake') + .description(`Generates a random snake species.`) + .action(() => { + console.log(faker.animal.snake()); + }); + +export default command; diff --git a/src/commands/animal/type.ts b/src/commands/animal/type.ts new file mode 100644 index 0000000..58bef27 --- /dev/null +++ b/src/commands/animal/type.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('type') + .description(`Generates a random animal type.`) + .action(() => { + console.log(faker.animal.type()); + }); + +export default command; diff --git a/src/commands/color/cmyk.ts b/src/commands/color/cmyk.ts new file mode 100644 index 0000000..5fa27d0 --- /dev/null +++ b/src/commands/color/cmyk.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cmyk') + .description(`Generates a CMYK color.`) + .action(() => { + console.log(faker.color.cmyk()); + }); + +export default command; diff --git a/src/commands/color/colorByCSSColorSpace.ts b/src/commands/color/colorByCSSColorSpace.ts new file mode 100644 index 0000000..ca1625b --- /dev/null +++ b/src/commands/color/colorByCSSColorSpace.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('colorByCSSColorSpace') + .description(`Generates a random color based on CSS color space specified.`) + .action(() => { + console.log(faker.color.colorByCSSColorSpace()); + }); + +export default command; diff --git a/src/commands/color/cssSupportedFunction.ts b/src/commands/color/cssSupportedFunction.ts new file mode 100644 index 0000000..1457267 --- /dev/null +++ b/src/commands/color/cssSupportedFunction.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cssSupportedFunction') + .description(`Generates a random css supported color function name.`) + .action(() => { + console.log(faker.color.cssSupportedFunction()); + }); + +export default command; diff --git a/src/commands/color/cssSupportedSpace.ts b/src/commands/color/cssSupportedSpace.ts new file mode 100644 index 0000000..009c89b --- /dev/null +++ b/src/commands/color/cssSupportedSpace.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cssSupportedSpace') + .description(`Generates a random css supported color space name.`) + .action(() => { + console.log(faker.color.cssSupportedSpace()); + }); + +export default command; diff --git a/src/commands/color/hsl.ts b/src/commands/color/hsl.ts new file mode 100644 index 0000000..058345e --- /dev/null +++ b/src/commands/color/hsl.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('hsl') + .description(`Generates an HSL color.`) + .action(() => { + console.log(faker.color.hsl()); + }); + +export default command; diff --git a/src/commands/color/human.ts b/src/commands/color/human.ts new file mode 100644 index 0000000..2f33f33 --- /dev/null +++ b/src/commands/color/human.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('human') + .description(`Generates a random human readable color name.`) + .action(() => { + console.log(faker.color.human()); + }); + +export default command; diff --git a/src/commands/color/hwb.ts b/src/commands/color/hwb.ts new file mode 100644 index 0000000..0754596 --- /dev/null +++ b/src/commands/color/hwb.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('hwb') + .description(`Generates an HWB color.`) + .action(() => { + console.log(faker.color.hwb()); + }); + +export default command; diff --git a/src/commands/color/index.ts b/src/commands/color/index.ts new file mode 100644 index 0000000..090ffbc --- /dev/null +++ b/src/commands/color/index.ts @@ -0,0 +1,28 @@ +import { Command } from 'commander'; +import humanCommand from './human'; +import spaceCommand from './space'; +import cssSupportedFunctionCommand from './cssSupportedFunction'; +import cssSupportedSpaceCommand from './cssSupportedSpace'; +import rgbCommand from './rgb'; +import cmykCommand from './cmyk'; +import hslCommand from './hsl'; +import hwbCommand from './hwb'; +import labCommand from './lab'; +import lchCommand from './lch'; +import colorByCSSColorSpaceCommand from './colorByCSSColorSpace'; + +const command = new Command('color') + .description(`Module to generate colors.`) + .addCommand(humanCommand) + .addCommand(spaceCommand) + .addCommand(cssSupportedFunctionCommand) + .addCommand(cssSupportedSpaceCommand) + .addCommand(rgbCommand) + .addCommand(cmykCommand) + .addCommand(hslCommand) + .addCommand(hwbCommand) + .addCommand(labCommand) + .addCommand(lchCommand) + .addCommand(colorByCSSColorSpaceCommand); + +export default command; diff --git a/src/commands/color/lab.ts b/src/commands/color/lab.ts new file mode 100644 index 0000000..f6838d4 --- /dev/null +++ b/src/commands/color/lab.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('lab') + .description(`Generates a LAB (CIELAB) color.`) + .action(() => { + console.log(faker.color.lab()); + }); + +export default command; diff --git a/src/commands/color/lch.ts b/src/commands/color/lch.ts new file mode 100644 index 0000000..6713b46 --- /dev/null +++ b/src/commands/color/lch.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('lch') + .description(`Generates an LCH color. Even though upper bound of`) + .action(() => { + console.log(faker.color.lch()); + }); + +export default command; diff --git a/src/commands/color/rgb.ts b/src/commands/color/rgb.ts new file mode 100644 index 0000000..a63ddac --- /dev/null +++ b/src/commands/color/rgb.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('rgb') + .description(`Generates an RGB color.`) + .action(() => { + console.log(faker.color.rgb()); + }); + +export default command; diff --git a/src/commands/color/space.ts b/src/commands/color/space.ts new file mode 100644 index 0000000..78813e5 --- /dev/null +++ b/src/commands/color/space.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('space') + .description( + `Generates a random color space name from the worldwide accepted color spaces.`, + ) + .action(() => { + console.log(faker.color.space()); + }); + +export default command; diff --git a/src/commands/commerce/department.ts b/src/commands/commerce/department.ts new file mode 100644 index 0000000..a19a16b --- /dev/null +++ b/src/commands/commerce/department.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('department') + .description(`Generates a department inside a shop.`) + .action(() => { + console.log(faker.commerce.department()); + }); + +export default command; diff --git a/src/commands/commerce/index.ts b/src/commands/commerce/index.ts new file mode 100644 index 0000000..2461aa0 --- /dev/null +++ b/src/commands/commerce/index.ts @@ -0,0 +1,20 @@ +import { Command } from 'commander'; +import departmentCommand from './department'; +import productNameCommand from './productName'; +import priceCommand from './price'; +import productAdjectiveCommand from './productAdjective'; +import productMaterialCommand from './productMaterial'; +import productCommand from './product'; +import productDescriptionCommand from './productDescription'; + +const command = new Command('commerce') + .description(`Module to generate commerce and product related entries.`) + .addCommand(departmentCommand) + .addCommand(productNameCommand) + .addCommand(priceCommand) + .addCommand(productAdjectiveCommand) + .addCommand(productMaterialCommand) + .addCommand(productCommand) + .addCommand(productDescriptionCommand); + +export default command; diff --git a/src/commands/commerce/price.ts b/src/commands/commerce/price.ts new file mode 100644 index 0000000..2f6fd03 --- /dev/null +++ b/src/commands/commerce/price.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('price') + .description(`Generates a price.`) + .action(() => { + console.log(faker.commerce.price()); + }); + +export default command; diff --git a/src/commands/commerce/product.ts b/src/commands/commerce/product.ts new file mode 100644 index 0000000..efb98ea --- /dev/null +++ b/src/commands/commerce/product.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('product') + .description(`Generates a short product name.`) + .action(() => { + console.log(faker.commerce.product()); + }); + +export default command; diff --git a/src/commands/commerce/productAdjective.ts b/src/commands/commerce/productAdjective.ts new file mode 100644 index 0000000..f63ca33 --- /dev/null +++ b/src/commands/commerce/productAdjective.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('productAdjective') + .description(`Generates an adjective describing a product.`) + .action(() => { + console.log(faker.commerce.productAdjective()); + }); + +export default command; diff --git a/src/commands/commerce/productDescription.ts b/src/commands/commerce/productDescription.ts new file mode 100644 index 0000000..92b3e85 --- /dev/null +++ b/src/commands/commerce/productDescription.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('productDescription') + .description(`Generates a product description.`) + .action(() => { + console.log(faker.commerce.productDescription()); + }); + +export default command; diff --git a/src/commands/commerce/productMaterial.ts b/src/commands/commerce/productMaterial.ts new file mode 100644 index 0000000..12d10af --- /dev/null +++ b/src/commands/commerce/productMaterial.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('productMaterial') + .description(`Generates a material of a product.`) + .action(() => { + console.log(faker.commerce.productMaterial()); + }); + +export default command; diff --git a/src/commands/commerce/productName.ts b/src/commands/commerce/productName.ts new file mode 100644 index 0000000..665dd94 --- /dev/null +++ b/src/commands/commerce/productName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('productName') + .description(`Generates a random descriptive product name.`) + .action(() => { + console.log(faker.commerce.productName()); + }); + +export default command; diff --git a/src/commands/company/bs.ts b/src/commands/company/bs.ts new file mode 100644 index 0000000..9f5b737 --- /dev/null +++ b/src/commands/company/bs.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bs') + .description(`Generates a random company bs phrase.`) + .action(() => { + console.log(faker.company.bs()); + }); + +export default command; diff --git a/src/commands/company/bsAdjective.ts b/src/commands/company/bsAdjective.ts new file mode 100644 index 0000000..778e195 --- /dev/null +++ b/src/commands/company/bsAdjective.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bsAdjective') + .description(`Generates a random company bs adjective.`) + .action(() => { + console.log(faker.company.bsAdjective()); + }); + +export default command; diff --git a/src/commands/company/bsBuzz.ts b/src/commands/company/bsBuzz.ts new file mode 100644 index 0000000..1f6072e --- /dev/null +++ b/src/commands/company/bsBuzz.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bsBuzz') + .description(`Generates a random company bs buzz word.`) + .action(() => { + console.log(faker.company.bsBuzz()); + }); + +export default command; diff --git a/src/commands/company/bsNoun.ts b/src/commands/company/bsNoun.ts new file mode 100644 index 0000000..a7e23d3 --- /dev/null +++ b/src/commands/company/bsNoun.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bsNoun') + .description(`Generates a random company bs noun.`) + .action(() => { + console.log(faker.company.bsNoun()); + }); + +export default command; diff --git a/src/commands/company/buzzAdjective.ts b/src/commands/company/buzzAdjective.ts new file mode 100644 index 0000000..0791aec --- /dev/null +++ b/src/commands/company/buzzAdjective.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('buzzAdjective') + .description( + `Generates a random buzz adjective that can be used to demonstrate data being viewed by a manager.`, + ) + .action(() => { + console.log(faker.company.buzzAdjective()); + }); + +export default command; diff --git a/src/commands/company/buzzNoun.ts b/src/commands/company/buzzNoun.ts new file mode 100644 index 0000000..8e2cdc8 --- /dev/null +++ b/src/commands/company/buzzNoun.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('buzzNoun') + .description( + `Generates a random buzz noun that can be used to demonstrate data being viewed by a manager.`, + ) + .action(() => { + console.log(faker.company.buzzNoun()); + }); + +export default command; diff --git a/src/commands/company/buzzPhrase.ts b/src/commands/company/buzzPhrase.ts new file mode 100644 index 0000000..5e48dbb --- /dev/null +++ b/src/commands/company/buzzPhrase.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('buzzPhrase') + .description( + `Generates a random buzz phrase that can be used to demonstrate data being viewed by a manager.`, + ) + .action(() => { + console.log(faker.company.buzzPhrase()); + }); + +export default command; diff --git a/src/commands/company/buzzVerb.ts b/src/commands/company/buzzVerb.ts new file mode 100644 index 0000000..2cc602d --- /dev/null +++ b/src/commands/company/buzzVerb.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('buzzVerb') + .description( + `Generates a random buzz verb that can be used to demonstrate data being viewed by a manager.`, + ) + .action(() => { + console.log(faker.company.buzzVerb()); + }); + +export default command; diff --git a/src/commands/company/catchPhrase.ts b/src/commands/company/catchPhrase.ts new file mode 100644 index 0000000..7fc4033 --- /dev/null +++ b/src/commands/company/catchPhrase.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('catchPhrase') + .description( + `Generates a random catch phrase that can be displayed to an end user.`, + ) + .action(() => { + console.log(faker.company.catchPhrase()); + }); + +export default command; diff --git a/src/commands/company/catchPhraseAdjective.ts b/src/commands/company/catchPhraseAdjective.ts new file mode 100644 index 0000000..8d86bb7 --- /dev/null +++ b/src/commands/company/catchPhraseAdjective.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('catchPhraseAdjective') + .description( + `Generates a random catch phrase adjective that can be displayed to an end user.`, + ) + .action(() => { + console.log(faker.company.catchPhraseAdjective()); + }); + +export default command; diff --git a/src/commands/company/catchPhraseDescriptor.ts b/src/commands/company/catchPhraseDescriptor.ts new file mode 100644 index 0000000..c4903b9 --- /dev/null +++ b/src/commands/company/catchPhraseDescriptor.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('catchPhraseDescriptor') + .description( + `Generates a random catch phrase descriptor that can be displayed to an end user.`, + ) + .action(() => { + console.log(faker.company.catchPhraseDescriptor()); + }); + +export default command; diff --git a/src/commands/company/catchPhraseNoun.ts b/src/commands/company/catchPhraseNoun.ts new file mode 100644 index 0000000..b2dd800 --- /dev/null +++ b/src/commands/company/catchPhraseNoun.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('catchPhraseNoun') + .description( + `Generates a random catch phrase noun that can be displayed to an end user.`, + ) + .action(() => { + console.log(faker.company.catchPhraseNoun()); + }); + +export default command; diff --git a/src/commands/company/companySuffix.ts b/src/commands/company/companySuffix.ts new file mode 100644 index 0000000..c0273b4 --- /dev/null +++ b/src/commands/company/companySuffix.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('companySuffix') + .description(`Generates a random company suffix.`) + .action(() => { + console.log(faker.company.companySuffix()); + }); + +export default command; diff --git a/src/commands/company/index.ts b/src/commands/company/index.ts new file mode 100644 index 0000000..936ab3b --- /dev/null +++ b/src/commands/company/index.ts @@ -0,0 +1,36 @@ +import { Command } from 'commander'; +import suffixesCommand from './suffixes'; +import nameCommand from './name'; +import companySuffixCommand from './companySuffix'; +import catchPhraseCommand from './catchPhrase'; +import bsCommand from './bs'; +import buzzPhraseCommand from './buzzPhrase'; +import catchPhraseAdjectiveCommand from './catchPhraseAdjective'; +import catchPhraseDescriptorCommand from './catchPhraseDescriptor'; +import catchPhraseNounCommand from './catchPhraseNoun'; +import bsAdjectiveCommand from './bsAdjective'; +import buzzAdjectiveCommand from './buzzAdjective'; +import bsBuzzCommand from './bsBuzz'; +import buzzVerbCommand from './buzzVerb'; +import bsNounCommand from './bsNoun'; +import buzzNounCommand from './buzzNoun'; + +const command = new Command('company') + .description(`Module to generate company related entries.`) + .addCommand(suffixesCommand) + .addCommand(nameCommand) + .addCommand(companySuffixCommand) + .addCommand(catchPhraseCommand) + .addCommand(bsCommand) + .addCommand(buzzPhraseCommand) + .addCommand(catchPhraseAdjectiveCommand) + .addCommand(catchPhraseDescriptorCommand) + .addCommand(catchPhraseNounCommand) + .addCommand(bsAdjectiveCommand) + .addCommand(buzzAdjectiveCommand) + .addCommand(bsBuzzCommand) + .addCommand(buzzVerbCommand) + .addCommand(bsNounCommand) + .addCommand(buzzNounCommand); + +export default command; diff --git a/src/commands/company/name.ts b/src/commands/company/name.ts new file mode 100644 index 0000000..503a2f4 --- /dev/null +++ b/src/commands/company/name.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('name') + .description(`Generates a random company name.`) + .action(() => { + console.log(faker.company.name()); + }); + +export default command; diff --git a/src/commands/company/suffixes.ts b/src/commands/company/suffixes.ts new file mode 100644 index 0000000..4754dd0 --- /dev/null +++ b/src/commands/company/suffixes.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('suffixes') + .description(`Generates an array with possible company name suffixes.`) + .action(() => { + console.log(faker.company.suffixes()); + }); + +export default command; diff --git a/src/commands/database/collation.ts b/src/commands/database/collation.ts new file mode 100644 index 0000000..835a601 --- /dev/null +++ b/src/commands/database/collation.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('collation') + .description(`Generates a random database collation.`) + .action(() => { + console.log(faker.database.collation()); + }); + +export default command; diff --git a/src/commands/database/column.ts b/src/commands/database/column.ts new file mode 100644 index 0000000..5bcbb8d --- /dev/null +++ b/src/commands/database/column.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('column') + .description(`Generates a random database column name.`) + .action(() => { + console.log(faker.database.column()); + }); + +export default command; diff --git a/src/commands/database/engine.ts b/src/commands/database/engine.ts new file mode 100644 index 0000000..e3450ed --- /dev/null +++ b/src/commands/database/engine.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('engine') + .description(`Generates a random database engine.`) + .action(() => { + console.log(faker.database.engine()); + }); + +export default command; diff --git a/src/commands/database/index.ts b/src/commands/database/index.ts new file mode 100644 index 0000000..764534b --- /dev/null +++ b/src/commands/database/index.ts @@ -0,0 +1,16 @@ +import { Command } from 'commander'; +import columnCommand from './column'; +import typeCommand from './type'; +import collationCommand from './collation'; +import engineCommand from './engine'; +import mongodbObjectIdCommand from './mongodbObjectId'; + +const command = new Command('database') + .description(`Module to generate database related entries.`) + .addCommand(columnCommand) + .addCommand(typeCommand) + .addCommand(collationCommand) + .addCommand(engineCommand) + .addCommand(mongodbObjectIdCommand); + +export default command; diff --git a/src/commands/database/mongodbObjectId.ts b/src/commands/database/mongodbObjectId.ts new file mode 100644 index 0000000..94b7ce3 --- /dev/null +++ b/src/commands/database/mongodbObjectId.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('mongodbObjectId') + .description(`Generates a MongoDB ObjectId string.`) + .action(() => { + console.log(faker.database.mongodbObjectId()); + }); + +export default command; diff --git a/src/commands/database/type.ts b/src/commands/database/type.ts new file mode 100644 index 0000000..ec61511 --- /dev/null +++ b/src/commands/database/type.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('type') + .description(`Generates a random database column type.`) + .action(() => { + console.log(faker.database.type()); + }); + +export default command; diff --git a/src/commands/datatype/array.ts b/src/commands/datatype/array.ts new file mode 100644 index 0000000..eb37576 --- /dev/null +++ b/src/commands/datatype/array.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('array') + .description(`Generates an array with random strings and numbers.`) + .action(() => { + console.log(faker.datatype.array()); + }); + +export default command; diff --git a/src/commands/datatype/bigInt.ts b/src/commands/datatype/bigInt.ts new file mode 100644 index 0000000..6a3e5c6 --- /dev/null +++ b/src/commands/datatype/bigInt.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bigInt') + .description(`Generates a BigInt number.`) + .action(() => { + console.log(faker.datatype.bigInt()); + }); + +export default command; diff --git a/src/commands/datatype/boolean.ts b/src/commands/datatype/boolean.ts new file mode 100644 index 0000000..2a17ac7 --- /dev/null +++ b/src/commands/datatype/boolean.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('boolean') + .description(`Generates the boolean value true or false.`) + .action(() => { + console.log(faker.datatype.boolean()); + }); + +export default command; diff --git a/src/commands/datatype/datetime.ts b/src/commands/datatype/datetime.ts new file mode 100644 index 0000000..f3ba187 --- /dev/null +++ b/src/commands/datatype/datetime.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('datetime') + .description( + `Generates a Date object using a random number of milliseconds since`, + ) + .action(() => { + console.log(faker.datatype.datetime()); + }); + +export default command; diff --git a/src/commands/datatype/float.ts b/src/commands/datatype/float.ts new file mode 100644 index 0000000..f557f5f --- /dev/null +++ b/src/commands/datatype/float.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('float') + .description( + `Generates a single random floating-point number between zero and 99999.`, + ) + .action(() => { + console.log(faker.datatype.float({})); + }); + +export default command; diff --git a/src/commands/datatype/hexadecimal.ts b/src/commands/datatype/hexadecimal.ts new file mode 100644 index 0000000..cd09da2 --- /dev/null +++ b/src/commands/datatype/hexadecimal.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('hexadecimal') + .description( + `Generates a [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) number.`, + ) + .action(() => { + console.log(faker.datatype.hexadecimal()); + }); + +export default command; diff --git a/src/commands/datatype/index.ts b/src/commands/datatype/index.ts new file mode 100644 index 0000000..5e8c975 --- /dev/null +++ b/src/commands/datatype/index.ts @@ -0,0 +1,26 @@ +import { Command } from 'commander'; +import numberCommand from './number'; +import floatCommand from './float'; +import datetimeCommand from './datetime'; +import stringCommand from './string'; +import uuidCommand from './uuid'; +import booleanCommand from './boolean'; +import hexadecimalCommand from './hexadecimal'; +import jsonCommand from './json'; +import arrayCommand from './array'; +import bigIntCommand from './bigInt'; + +const command = new Command('datatype') + .description(`Module to generate various primitive values and data types.`) + .addCommand(numberCommand) + .addCommand(floatCommand) + .addCommand(datetimeCommand) + .addCommand(stringCommand) + .addCommand(uuidCommand) + .addCommand(booleanCommand) + .addCommand(hexadecimalCommand) + .addCommand(jsonCommand) + .addCommand(arrayCommand) + .addCommand(bigIntCommand); + +export default command; diff --git a/src/commands/datatype/json.ts b/src/commands/datatype/json.ts new file mode 100644 index 0000000..5c939e5 --- /dev/null +++ b/src/commands/datatype/json.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('json') + .description( + `Generates a string representing JSON object with 7 pre-defined properties.`, + ) + .action(() => { + console.log(faker.datatype.json()); + }); + +export default command; diff --git a/src/commands/datatype/number.ts b/src/commands/datatype/number.ts new file mode 100644 index 0000000..5d59de6 --- /dev/null +++ b/src/commands/datatype/number.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('number') + .description(`Generates a single random number between zero and 99999.`) + .action(() => { + console.log(faker.datatype.number()); + }); + +export default command; diff --git a/src/commands/datatype/string.ts b/src/commands/datatype/string.ts new file mode 100644 index 0000000..892645e --- /dev/null +++ b/src/commands/datatype/string.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('string') + .description( + `Generates a string containing UTF-16 chars between 33 and 125 (\`!\` to \`}\`).`, + ) + .action(() => { + console.log(faker.datatype.string()); + }); + +export default command; diff --git a/src/commands/datatype/uuid.ts b/src/commands/datatype/uuid.ts new file mode 100644 index 0000000..5b3ec32 --- /dev/null +++ b/src/commands/datatype/uuid.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('uuid') + .description(`Generates a UUID v4 (Universally Unique Identifier).`) + .action(() => { + console.log(faker.datatype.uuid()); + }); + +export default command; diff --git a/src/commands/date/anytime.ts b/src/commands/date/anytime.ts new file mode 100644 index 0000000..5c96132 --- /dev/null +++ b/src/commands/date/anytime.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('anytime') + .description( + `Generates a random date that can be either in the past or in the future.`, + ) + .action(() => { + console.log(faker.date.anytime()); + }); + +export default command; diff --git a/src/commands/date/birthdate.ts b/src/commands/date/birthdate.ts new file mode 100644 index 0000000..2a74be3 --- /dev/null +++ b/src/commands/date/birthdate.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('birthdate') + .description(`Generates a random birthdate.`) + .action(() => { + console.log(faker.date.birthdate()); + }); + +export default command; diff --git a/src/commands/date/future.ts b/src/commands/date/future.ts new file mode 100644 index 0000000..37e6eeb --- /dev/null +++ b/src/commands/date/future.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('future') + .description(`Generates a random date in the future.`) + .action(() => { + console.log(faker.date.future()); + }); + +export default command; diff --git a/src/commands/date/index.ts b/src/commands/date/index.ts new file mode 100644 index 0000000..bb1261d --- /dev/null +++ b/src/commands/date/index.ts @@ -0,0 +1,22 @@ +import { Command } from 'commander'; +import anytimeCommand from './anytime'; +import pastCommand from './past'; +import futureCommand from './future'; +import recentCommand from './recent'; +import soonCommand from './soon'; +import monthCommand from './month'; +import weekdayCommand from './weekday'; +import birthdateCommand from './birthdate'; + +const command = new Command('date') + .description(`Module to generate dates.`) + .addCommand(anytimeCommand) + .addCommand(pastCommand) + .addCommand(futureCommand) + .addCommand(recentCommand) + .addCommand(soonCommand) + .addCommand(monthCommand) + .addCommand(weekdayCommand) + .addCommand(birthdateCommand); + +export default command; diff --git a/src/commands/date/month.ts b/src/commands/date/month.ts new file mode 100644 index 0000000..5dd62be --- /dev/null +++ b/src/commands/date/month.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('month') + .description(`Generates a random name of a month.`) + .action(() => { + console.log(faker.date.month()); + }); + +export default command; diff --git a/src/commands/date/past.ts b/src/commands/date/past.ts new file mode 100644 index 0000000..50676f9 --- /dev/null +++ b/src/commands/date/past.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('past') + .description(`Generates a random date in the past.`) + .action(() => { + console.log(faker.date.past()); + }); + +export default command; diff --git a/src/commands/date/recent.ts b/src/commands/date/recent.ts new file mode 100644 index 0000000..0afa1a8 --- /dev/null +++ b/src/commands/date/recent.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('recent') + .description(`Generates a random date in the recent past.`) + .action(() => { + console.log(faker.date.recent()); + }); + +export default command; diff --git a/src/commands/date/soon.ts b/src/commands/date/soon.ts new file mode 100644 index 0000000..a917c54 --- /dev/null +++ b/src/commands/date/soon.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('soon') + .description(`Generates a random date in the near future.`) + .action(() => { + console.log(faker.date.soon()); + }); + +export default command; diff --git a/src/commands/date/weekday.ts b/src/commands/date/weekday.ts new file mode 100644 index 0000000..9d9a164 --- /dev/null +++ b/src/commands/date/weekday.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('weekday') + .description(`Generates a random day of the week.`) + .action(() => { + console.log(faker.date.weekday()); + }); + +export default command; diff --git a/src/commands/finance/account.ts b/src/commands/finance/account.ts new file mode 100644 index 0000000..3ba008f --- /dev/null +++ b/src/commands/finance/account.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('account') + .description(`Generates a random account number.`) + .action(() => { + console.log(faker.finance.account()); + }); + +export default command; diff --git a/src/commands/finance/accountName.ts b/src/commands/finance/accountName.ts new file mode 100644 index 0000000..3b90b8e --- /dev/null +++ b/src/commands/finance/accountName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('accountName') + .description(`Generates a random account name.`) + .action(() => { + console.log(faker.finance.accountName()); + }); + +export default command; diff --git a/src/commands/finance/accountNumber.ts b/src/commands/finance/accountNumber.ts new file mode 100644 index 0000000..92f5105 --- /dev/null +++ b/src/commands/finance/accountNumber.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('accountNumber') + .description(`Generates a random account number.`) + .action(() => { + console.log(faker.finance.accountNumber()); + }); + +export default command; diff --git a/src/commands/finance/amount.ts b/src/commands/finance/amount.ts new file mode 100644 index 0000000..2b0e3d8 --- /dev/null +++ b/src/commands/finance/amount.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('amount') + .description( + `Generates a random amount between the given bounds (inclusive).`, + ) + .action(() => { + console.log(faker.finance.amount()); + }); + +export default command; diff --git a/src/commands/finance/bic.ts b/src/commands/finance/bic.ts new file mode 100644 index 0000000..1f5e2dc --- /dev/null +++ b/src/commands/finance/bic.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bic') + .description( + `Generates a random SWIFT/BIC code based on the ISO-9362 format.`, + ) + .action(() => { + console.log(faker.finance.bic()); + }); + +export default command; diff --git a/src/commands/finance/bitcoinAddress.ts b/src/commands/finance/bitcoinAddress.ts new file mode 100644 index 0000000..b369f43 --- /dev/null +++ b/src/commands/finance/bitcoinAddress.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bitcoinAddress') + .description(`Generates a random Bitcoin address.`) + .action(() => { + console.log(faker.finance.bitcoinAddress()); + }); + +export default command; diff --git a/src/commands/finance/creditCardCVV.ts b/src/commands/finance/creditCardCVV.ts new file mode 100644 index 0000000..bf816f6 --- /dev/null +++ b/src/commands/finance/creditCardCVV.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('creditCardCVV') + .description(`Generates a random credit card CVV.`) + .action(() => { + console.log(faker.finance.creditCardCVV()); + }); + +export default command; diff --git a/src/commands/finance/creditCardIssuer.ts b/src/commands/finance/creditCardIssuer.ts new file mode 100644 index 0000000..b3129ee --- /dev/null +++ b/src/commands/finance/creditCardIssuer.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('creditCardIssuer') + .description(`Generates a random credit card issuer.`) + .action(() => { + console.log(faker.finance.creditCardIssuer()); + }); + +export default command; diff --git a/src/commands/finance/creditCardNumber.ts b/src/commands/finance/creditCardNumber.ts new file mode 100644 index 0000000..a30884b --- /dev/null +++ b/src/commands/finance/creditCardNumber.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('creditCardNumber') + .description(`Generates a random credit card number.`) + .action(() => { + console.log(faker.finance.creditCardNumber()); + }); + +export default command; diff --git a/src/commands/finance/currency.ts b/src/commands/finance/currency.ts new file mode 100644 index 0000000..d4fa019 --- /dev/null +++ b/src/commands/finance/currency.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('currency') + .description( + `Generates a random currency object, containing \`code\`, \`name \`and \`symbol\` properties.`, + ) + .action(() => { + console.log(faker.finance.currency()); + }); + +export default command; diff --git a/src/commands/finance/currencyCode.ts b/src/commands/finance/currencyCode.ts new file mode 100644 index 0000000..dd5ef7a --- /dev/null +++ b/src/commands/finance/currencyCode.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('currencyCode') + .description(`Generates a random currency code.`) + .action(() => { + console.log(faker.finance.currencyCode()); + }); + +export default command; diff --git a/src/commands/finance/currencyName.ts b/src/commands/finance/currencyName.ts new file mode 100644 index 0000000..fc9d336 --- /dev/null +++ b/src/commands/finance/currencyName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('currencyName') + .description(`Generates a random currency name.`) + .action(() => { + console.log(faker.finance.currencyName()); + }); + +export default command; diff --git a/src/commands/finance/currencySymbol.ts b/src/commands/finance/currencySymbol.ts new file mode 100644 index 0000000..3c8a204 --- /dev/null +++ b/src/commands/finance/currencySymbol.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('currencySymbol') + .description(`Generates a random currency symbol.`) + .action(() => { + console.log(faker.finance.currencySymbol()); + }); + +export default command; diff --git a/src/commands/finance/ethereumAddress.ts b/src/commands/finance/ethereumAddress.ts new file mode 100644 index 0000000..0090f1a --- /dev/null +++ b/src/commands/finance/ethereumAddress.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('ethereumAddress') + .description(`Generates a random, non-checksum Ethereum address.`) + .action(() => { + console.log(faker.finance.ethereumAddress()); + }); + +export default command; diff --git a/src/commands/finance/iban.ts b/src/commands/finance/iban.ts new file mode 100644 index 0000000..f41b1d7 --- /dev/null +++ b/src/commands/finance/iban.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('iban') + .description(`Generates a random iban.`) + .action(() => { + console.log(faker.finance.iban()); + }); + +export default command; diff --git a/src/commands/finance/index.ts b/src/commands/finance/index.ts new file mode 100644 index 0000000..a4c593c --- /dev/null +++ b/src/commands/finance/index.ts @@ -0,0 +1,50 @@ +import { Command } from 'commander'; +import accountCommand from './account'; +import accountNumberCommand from './accountNumber'; +import accountNameCommand from './accountName'; +import routingNumberCommand from './routingNumber'; +import maskCommand from './mask'; +import maskedNumberCommand from './maskedNumber'; +import amountCommand from './amount'; +import transactionTypeCommand from './transactionType'; +import currencyCommand from './currency'; +import currencyCodeCommand from './currencyCode'; +import currencyNameCommand from './currencyName'; +import currencySymbolCommand from './currencySymbol'; +import bitcoinAddressCommand from './bitcoinAddress'; +import litecoinAddressCommand from './litecoinAddress'; +import creditCardNumberCommand from './creditCardNumber'; +import creditCardCVVCommand from './creditCardCVV'; +import creditCardIssuerCommand from './creditCardIssuer'; +import pinCommand from './pin'; +import ethereumAddressCommand from './ethereumAddress'; +import ibanCommand from './iban'; +import bicCommand from './bic'; +import transactionDescriptionCommand from './transactionDescription'; + +const command = new Command('finance') + .description(`Module to generate finance and money related entries.`) + .addCommand(accountCommand) + .addCommand(accountNumberCommand) + .addCommand(accountNameCommand) + .addCommand(routingNumberCommand) + .addCommand(maskCommand) + .addCommand(maskedNumberCommand) + .addCommand(amountCommand) + .addCommand(transactionTypeCommand) + .addCommand(currencyCommand) + .addCommand(currencyCodeCommand) + .addCommand(currencyNameCommand) + .addCommand(currencySymbolCommand) + .addCommand(bitcoinAddressCommand) + .addCommand(litecoinAddressCommand) + .addCommand(creditCardNumberCommand) + .addCommand(creditCardCVVCommand) + .addCommand(creditCardIssuerCommand) + .addCommand(pinCommand) + .addCommand(ethereumAddressCommand) + .addCommand(ibanCommand) + .addCommand(bicCommand) + .addCommand(transactionDescriptionCommand); + +export default command; diff --git a/src/commands/finance/litecoinAddress.ts b/src/commands/finance/litecoinAddress.ts new file mode 100644 index 0000000..7be59cb --- /dev/null +++ b/src/commands/finance/litecoinAddress.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('litecoinAddress') + .description(`Generates a random Litecoin address.`) + .action(() => { + console.log(faker.finance.litecoinAddress()); + }); + +export default command; diff --git a/src/commands/finance/mask.ts b/src/commands/finance/mask.ts new file mode 100644 index 0000000..b104225 --- /dev/null +++ b/src/commands/finance/mask.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('mask') + .description(`Generates a random masked number.`) + .action(() => { + console.log(faker.finance.mask()); + }); + +export default command; diff --git a/src/commands/finance/maskedNumber.ts b/src/commands/finance/maskedNumber.ts new file mode 100644 index 0000000..4ad8b58 --- /dev/null +++ b/src/commands/finance/maskedNumber.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('maskedNumber') + .description(`Generates a random masked number.`) + .action(() => { + console.log(faker.finance.maskedNumber()); + }); + +export default command; diff --git a/src/commands/finance/pin.ts b/src/commands/finance/pin.ts new file mode 100644 index 0000000..6b0f230 --- /dev/null +++ b/src/commands/finance/pin.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('pin') + .description(`Generates a random PIN number.`) + .action(() => { + console.log(faker.finance.pin()); + }); + +export default command; diff --git a/src/commands/finance/routingNumber.ts b/src/commands/finance/routingNumber.ts new file mode 100644 index 0000000..4f58f4c --- /dev/null +++ b/src/commands/finance/routingNumber.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('routingNumber') + .description(`Generates a random routing number.`) + .action(() => { + console.log(faker.finance.routingNumber()); + }); + +export default command; diff --git a/src/commands/finance/transactionDescription.ts b/src/commands/finance/transactionDescription.ts new file mode 100644 index 0000000..1397a1b --- /dev/null +++ b/src/commands/finance/transactionDescription.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('transactionDescription') + .description(`Generates a random transaction description.`) + .action(() => { + console.log(faker.finance.transactionDescription()); + }); + +export default command; diff --git a/src/commands/finance/transactionType.ts b/src/commands/finance/transactionType.ts new file mode 100644 index 0000000..a585c26 --- /dev/null +++ b/src/commands/finance/transactionType.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('transactionType') + .description(`Generates a random transaction type.`) + .action(() => { + console.log(faker.finance.transactionType()); + }); + +export default command; diff --git a/src/commands/git/branch.ts b/src/commands/git/branch.ts new file mode 100644 index 0000000..fff7d3a --- /dev/null +++ b/src/commands/git/branch.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('branch') + .description(`Generates a random branch name.`) + .action(() => { + console.log(faker.git.branch()); + }); + +export default command; diff --git a/src/commands/git/commitDate.ts b/src/commands/git/commitDate.ts new file mode 100644 index 0000000..af44de7 --- /dev/null +++ b/src/commands/git/commitDate.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('commitDate') + .description( + `Generates a date string for a git commit using the same format as \`git log\`.`, + ) + .action(() => { + console.log(faker.git.commitDate()); + }); + +export default command; diff --git a/src/commands/git/commitEntry.ts b/src/commands/git/commitEntry.ts new file mode 100644 index 0000000..a108f08 --- /dev/null +++ b/src/commands/git/commitEntry.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('commitEntry') + .description(`Generates a random commit entry as printed by \`git log\`.`) + .action(() => { + console.log(faker.git.commitEntry()); + }); + +export default command; diff --git a/src/commands/git/commitMessage.ts b/src/commands/git/commitMessage.ts new file mode 100644 index 0000000..4eee2fe --- /dev/null +++ b/src/commands/git/commitMessage.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('commitMessage') + .description(`Generates a random commit message.`) + .action(() => { + console.log(faker.git.commitMessage()); + }); + +export default command; diff --git a/src/commands/git/commitSha.ts b/src/commands/git/commitSha.ts new file mode 100644 index 0000000..712c460 --- /dev/null +++ b/src/commands/git/commitSha.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('commitSha') + .description(`Generates a random commit sha.`) + .action(() => { + console.log(faker.git.commitSha()); + }); + +export default command; diff --git a/src/commands/git/index.ts b/src/commands/git/index.ts new file mode 100644 index 0000000..2cb2659 --- /dev/null +++ b/src/commands/git/index.ts @@ -0,0 +1,18 @@ +import { Command } from 'commander'; +import branchCommand from './branch'; +import commitEntryCommand from './commitEntry'; +import commitMessageCommand from './commitMessage'; +import commitDateCommand from './commitDate'; +import commitShaCommand from './commitSha'; +import shortShaCommand from './shortSha'; + +const command = new Command('git') + .description(`Module to generate git related entries.`) + .addCommand(branchCommand) + .addCommand(commitEntryCommand) + .addCommand(commitMessageCommand) + .addCommand(commitDateCommand) + .addCommand(commitShaCommand) + .addCommand(shortShaCommand); + +export default command; diff --git a/src/commands/git/shortSha.ts b/src/commands/git/shortSha.ts new file mode 100644 index 0000000..f2b000f --- /dev/null +++ b/src/commands/git/shortSha.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('shortSha') + .description(`Generates a random commit sha (short).`) + .action(() => { + console.log(faker.git.shortSha()); + }); + +export default command; diff --git a/src/commands/hacker/abbreviation.ts b/src/commands/hacker/abbreviation.ts new file mode 100644 index 0000000..94f5610 --- /dev/null +++ b/src/commands/hacker/abbreviation.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('abbreviation') + .description(`Generates a random hacker/IT abbreviation.`) + .action(() => { + console.log(faker.hacker.abbreviation()); + }); + +export default command; diff --git a/src/commands/hacker/adjective.ts b/src/commands/hacker/adjective.ts new file mode 100644 index 0000000..7ed23b0 --- /dev/null +++ b/src/commands/hacker/adjective.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('adjective') + .description(`Generates a random hacker/IT adjective.`) + .action(() => { + console.log(faker.hacker.adjective()); + }); + +export default command; diff --git a/src/commands/hacker/index.ts b/src/commands/hacker/index.ts new file mode 100644 index 0000000..ecd0693 --- /dev/null +++ b/src/commands/hacker/index.ts @@ -0,0 +1,18 @@ +import { Command } from 'commander'; +import abbreviationCommand from './abbreviation'; +import adjectiveCommand from './adjective'; +import nounCommand from './noun'; +import verbCommand from './verb'; +import ingverbCommand from './ingverb'; +import phraseCommand from './phrase'; + +const command = new Command('hacker') + .description(`Module to generate hacker/IT words and phrases.`) + .addCommand(abbreviationCommand) + .addCommand(adjectiveCommand) + .addCommand(nounCommand) + .addCommand(verbCommand) + .addCommand(ingverbCommand) + .addCommand(phraseCommand); + +export default command; diff --git a/src/commands/hacker/ingverb.ts b/src/commands/hacker/ingverb.ts new file mode 100644 index 0000000..6f03fee --- /dev/null +++ b/src/commands/hacker/ingverb.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('ingverb') + .description( + `Generates a random hacker/IT verb for continuous actions (en: ing suffix; e.g. hacking).`, + ) + .action(() => { + console.log(faker.hacker.ingverb()); + }); + +export default command; diff --git a/src/commands/hacker/noun.ts b/src/commands/hacker/noun.ts new file mode 100644 index 0000000..46763c9 --- /dev/null +++ b/src/commands/hacker/noun.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('noun') + .description(`Generates a random hacker/IT noun.`) + .action(() => { + console.log(faker.hacker.noun()); + }); + +export default command; diff --git a/src/commands/hacker/phrase.ts b/src/commands/hacker/phrase.ts new file mode 100644 index 0000000..73c29fa --- /dev/null +++ b/src/commands/hacker/phrase.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('phrase') + .description(`Generates a random hacker/IT phrase.`) + .action(() => { + console.log(faker.hacker.phrase()); + }); + +export default command; diff --git a/src/commands/hacker/verb.ts b/src/commands/hacker/verb.ts new file mode 100644 index 0000000..bfe01ed --- /dev/null +++ b/src/commands/hacker/verb.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('verb') + .description(`Generates a random hacker/IT verb.`) + .action(() => { + console.log(faker.hacker.verb()); + }); + +export default command; diff --git a/src/commands/image/abstract.ts b/src/commands/image/abstract.ts new file mode 100644 index 0000000..7732074 --- /dev/null +++ b/src/commands/image/abstract.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('abstract') + .description(`Generates a random abstract image url.`) + .action(() => { + console.log(faker.image.abstract()); + }); + +export default command; diff --git a/src/commands/image/animals.ts b/src/commands/image/animals.ts new file mode 100644 index 0000000..9b825f1 --- /dev/null +++ b/src/commands/image/animals.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('animals') + .description(`Generates a random animal image url.`) + .action(() => { + console.log(faker.image.animals()); + }); + +export default command; diff --git a/src/commands/image/avatar.ts b/src/commands/image/avatar.ts new file mode 100644 index 0000000..a2062e9 --- /dev/null +++ b/src/commands/image/avatar.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('avatar') + .description(`Generates a random avatar image url.`) + .action(() => { + console.log(faker.image.avatar()); + }); + +export default command; diff --git a/src/commands/image/avatarGitHub.ts b/src/commands/image/avatarGitHub.ts new file mode 100644 index 0000000..90226e0 --- /dev/null +++ b/src/commands/image/avatarGitHub.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('avatarGitHub') + .description(`Generates a random avatar from GitHub.`) + .action(() => { + console.log(faker.image.avatarGitHub()); + }); + +export default command; diff --git a/src/commands/image/avatarLegacy.ts b/src/commands/image/avatarLegacy.ts new file mode 100644 index 0000000..78e8c4a --- /dev/null +++ b/src/commands/image/avatarLegacy.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('avatarLegacy') + .description( + `Generates a random avatar from \`https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar\`.`, + ) + .action(() => { + console.log(faker.image.avatarLegacy()); + }); + +export default command; diff --git a/src/commands/image/business.ts b/src/commands/image/business.ts new file mode 100644 index 0000000..405c920 --- /dev/null +++ b/src/commands/image/business.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('business') + .description(`Generates a random business image url.`) + .action(() => { + console.log(faker.image.business()); + }); + +export default command; diff --git a/src/commands/image/cats.ts b/src/commands/image/cats.ts new file mode 100644 index 0000000..2e25311 --- /dev/null +++ b/src/commands/image/cats.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cats') + .description(`Generates a random cat image url.`) + .action(() => { + console.log(faker.image.cats()); + }); + +export default command; diff --git a/src/commands/image/city.ts b/src/commands/image/city.ts new file mode 100644 index 0000000..f76d32d --- /dev/null +++ b/src/commands/image/city.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('city') + .description(`Generates a random city image url.`) + .action(() => { + console.log(faker.image.city()); + }); + +export default command; diff --git a/src/commands/image/dataUri.ts b/src/commands/image/dataUri.ts new file mode 100644 index 0000000..5442415 --- /dev/null +++ b/src/commands/image/dataUri.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('dataUri') + .description(`Generates a random data uri containing an svg image.`) + .action(() => { + console.log(faker.image.dataUri()); + }); + +export default command; diff --git a/src/commands/image/fashion.ts b/src/commands/image/fashion.ts new file mode 100644 index 0000000..d33b936 --- /dev/null +++ b/src/commands/image/fashion.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('fashion') + .description(`Generates a random fashion image url.`) + .action(() => { + console.log(faker.image.fashion()); + }); + +export default command; diff --git a/src/commands/image/food.ts b/src/commands/image/food.ts new file mode 100644 index 0000000..bde24c4 --- /dev/null +++ b/src/commands/image/food.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('food') + .description(`Generates a random food image url.`) + .action(() => { + console.log(faker.image.food()); + }); + +export default command; diff --git a/src/commands/image/image.ts b/src/commands/image/image.ts new file mode 100644 index 0000000..94033bd --- /dev/null +++ b/src/commands/image/image.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('image') + .description( + `Generates a random image url from one of the supported categories.`, + ) + .action(() => { + console.log(faker.image.image()); + }); + +export default command; diff --git a/src/commands/image/imageUrl.ts b/src/commands/image/imageUrl.ts new file mode 100644 index 0000000..043334b --- /dev/null +++ b/src/commands/image/imageUrl.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('imageUrl') + .description(`Generates a random image url.`) + .action(() => { + console.log(faker.image.imageUrl()); + }); + +export default command; diff --git a/src/commands/image/index.ts b/src/commands/image/index.ts new file mode 100644 index 0000000..800cef3 --- /dev/null +++ b/src/commands/image/index.ts @@ -0,0 +1,52 @@ +import { Command } from 'commander'; +import avatarCommand from './avatar'; +import avatarGitHubCommand from './avatarGitHub'; +import avatarLegacyCommand from './avatarLegacy'; +import urlCommand from './url'; +import urlLoremFlickrCommand from './urlLoremFlickr'; +import urlPicsumPhotosCommand from './urlPicsumPhotos'; +import urlPlaceholderCommand from './urlPlaceholder'; +import dataUriCommand from './dataUri'; +import imageCommand from './image'; +import imageUrlCommand from './imageUrl'; +import abstractCommand from './abstract'; +import animalsCommand from './animals'; +import businessCommand from './business'; +import catsCommand from './cats'; +import cityCommand from './city'; +import foodCommand from './food'; +import nightlifeCommand from './nightlife'; +import fashionCommand from './fashion'; +import peopleCommand from './people'; +import natureCommand from './nature'; +import sportsCommand from './sports'; +import technicsCommand from './technics'; +import transportCommand from './transport'; + +const command = new Command('image') + .description(`Module to generate images.`) + .addCommand(avatarCommand) + .addCommand(avatarGitHubCommand) + .addCommand(avatarLegacyCommand) + .addCommand(urlCommand) + .addCommand(urlLoremFlickrCommand) + .addCommand(urlPicsumPhotosCommand) + .addCommand(urlPlaceholderCommand) + .addCommand(dataUriCommand) + .addCommand(imageCommand) + .addCommand(imageUrlCommand) + .addCommand(abstractCommand) + .addCommand(animalsCommand) + .addCommand(businessCommand) + .addCommand(catsCommand) + .addCommand(cityCommand) + .addCommand(foodCommand) + .addCommand(nightlifeCommand) + .addCommand(fashionCommand) + .addCommand(peopleCommand) + .addCommand(natureCommand) + .addCommand(sportsCommand) + .addCommand(technicsCommand) + .addCommand(transportCommand); + +export default command; diff --git a/src/commands/image/nature.ts b/src/commands/image/nature.ts new file mode 100644 index 0000000..a0837a9 --- /dev/null +++ b/src/commands/image/nature.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('nature') + .description(`Generates a random nature image url.`) + .action(() => { + console.log(faker.image.nature()); + }); + +export default command; diff --git a/src/commands/image/nightlife.ts b/src/commands/image/nightlife.ts new file mode 100644 index 0000000..2485daa --- /dev/null +++ b/src/commands/image/nightlife.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('nightlife') + .description(`Generates a random nightlife image url.`) + .action(() => { + console.log(faker.image.nightlife()); + }); + +export default command; diff --git a/src/commands/image/people.ts b/src/commands/image/people.ts new file mode 100644 index 0000000..0f9c0c1 --- /dev/null +++ b/src/commands/image/people.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('people') + .description(`Generates a random people image url.`) + .action(() => { + console.log(faker.image.people()); + }); + +export default command; diff --git a/src/commands/image/sports.ts b/src/commands/image/sports.ts new file mode 100644 index 0000000..bf5c774 --- /dev/null +++ b/src/commands/image/sports.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('sports') + .description(`Generates a random sports image url.`) + .action(() => { + console.log(faker.image.sports()); + }); + +export default command; diff --git a/src/commands/image/technics.ts b/src/commands/image/technics.ts new file mode 100644 index 0000000..125b249 --- /dev/null +++ b/src/commands/image/technics.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('technics') + .description(`Generates a random technics image url.`) + .action(() => { + console.log(faker.image.technics()); + }); + +export default command; diff --git a/src/commands/image/transport.ts b/src/commands/image/transport.ts new file mode 100644 index 0000000..a3e70bc --- /dev/null +++ b/src/commands/image/transport.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('transport') + .description(`Generates a random transport image url.`) + .action(() => { + console.log(faker.image.transport()); + }); + +export default command; diff --git a/src/commands/image/url.ts b/src/commands/image/url.ts new file mode 100644 index 0000000..8d67d34 --- /dev/null +++ b/src/commands/image/url.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('url') + .description(`Generates a random image url.`) + .action(() => { + console.log(faker.image.url()); + }); + +export default command; diff --git a/src/commands/image/urlLoremFlickr.ts b/src/commands/image/urlLoremFlickr.ts new file mode 100644 index 0000000..a6374f9 --- /dev/null +++ b/src/commands/image/urlLoremFlickr.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('urlLoremFlickr') + .description( + `Generates a random image url provided via https://loremflickr.com.`, + ) + .action(() => { + console.log(faker.image.urlLoremFlickr()); + }); + +export default command; diff --git a/src/commands/image/urlPicsumPhotos.ts b/src/commands/image/urlPicsumPhotos.ts new file mode 100644 index 0000000..228534f --- /dev/null +++ b/src/commands/image/urlPicsumPhotos.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('urlPicsumPhotos') + .description( + `Generates a random image url provided via https://picsum.photos.`, + ) + .action(() => { + console.log(faker.image.urlPicsumPhotos()); + }); + +export default command; diff --git a/src/commands/image/urlPlaceholder.ts b/src/commands/image/urlPlaceholder.ts new file mode 100644 index 0000000..13b1d46 --- /dev/null +++ b/src/commands/image/urlPlaceholder.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('urlPlaceholder') + .description( + `Generates a random image url provided via https://via.placeholder.com/.`, + ) + .action(() => { + console.log(faker.image.urlPlaceholder()); + }); + +export default command; diff --git a/src/commands/index.ts b/src/commands/index.ts new file mode 100644 index 0000000..7072aa1 --- /dev/null +++ b/src/commands/index.ts @@ -0,0 +1,53 @@ +import airlineModule from './airline'; +import animalModule from './animal'; +import colorModule from './color'; +import commerceModule from './commerce'; +import companyModule from './company'; +import databaseModule from './database'; +import datatypeModule from './datatype'; +import dateModule from './date'; +import financeModule from './finance'; +import gitModule from './git'; +import hackerModule from './hacker'; +import imageModule from './image'; +import internetModule from './internet'; +import locationModule from './location'; +import loremModule from './lorem'; +import musicModule from './music'; +import numberModule from './number'; +import personModule from './person'; +import phoneModule from './phone'; +import scienceModule from './science'; +import stringModule from './string'; +import systemModule from './system'; +import vehicleModule from './vehicle'; +import wordModule from './word'; + +const commands = [ + airlineModule, + animalModule, + colorModule, + commerceModule, + companyModule, + databaseModule, + datatypeModule, + dateModule, + financeModule, + gitModule, + hackerModule, + imageModule, + internetModule, + locationModule, + loremModule, + musicModule, + numberModule, + personModule, + phoneModule, + scienceModule, + stringModule, + systemModule, + vehicleModule, + wordModule, +]; + +export default commands; diff --git a/src/commands/internet/avatar.ts b/src/commands/internet/avatar.ts new file mode 100644 index 0000000..0470d8b --- /dev/null +++ b/src/commands/internet/avatar.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('avatar') + .description(`Generates a random avatar url.`) + .action(() => { + console.log(faker.internet.avatar()); + }); + +export default command; diff --git a/src/commands/internet/color.ts b/src/commands/internet/color.ts new file mode 100644 index 0000000..4501fc4 --- /dev/null +++ b/src/commands/internet/color.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('color') + .description( + `Generates a random css hex color code in aesthetically pleasing color palette.`, + ) + .action(() => { + console.log(faker.internet.color()); + }); + +export default command; diff --git a/src/commands/internet/displayName.ts b/src/commands/internet/displayName.ts new file mode 100644 index 0000000..039d203 --- /dev/null +++ b/src/commands/internet/displayName.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('displayName') + .description( + `Generates a display name using the given person's name as base.`, + ) + .action(() => { + console.log(faker.internet.displayName()); + }); + +export default command; diff --git a/src/commands/internet/domainName.ts b/src/commands/internet/domainName.ts new file mode 100644 index 0000000..bafc477 --- /dev/null +++ b/src/commands/internet/domainName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('domainName') + .description(`Generates a random domain name.`) + .action(() => { + console.log(faker.internet.domainName()); + }); + +export default command; diff --git a/src/commands/internet/domainSuffix.ts b/src/commands/internet/domainSuffix.ts new file mode 100644 index 0000000..10bdc42 --- /dev/null +++ b/src/commands/internet/domainSuffix.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('domainSuffix') + .description(`Generates a random domain suffix.`) + .action(() => { + console.log(faker.internet.domainSuffix()); + }); + +export default command; diff --git a/src/commands/internet/domainWord.ts b/src/commands/internet/domainWord.ts new file mode 100644 index 0000000..8cb1985 --- /dev/null +++ b/src/commands/internet/domainWord.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('domainWord') + .description(`Generates a random domain word.`) + .action(() => { + console.log(faker.internet.domainWord()); + }); + +export default command; diff --git a/src/commands/internet/email.ts b/src/commands/internet/email.ts new file mode 100644 index 0000000..e932c04 --- /dev/null +++ b/src/commands/internet/email.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('email') + .description(`Generates an email address.`) + .action(() => { + console.log(faker.internet.email()); + }); + +export default command; diff --git a/src/commands/internet/emoji.ts b/src/commands/internet/emoji.ts new file mode 100644 index 0000000..d640b39 --- /dev/null +++ b/src/commands/internet/emoji.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('emoji') + .description(`Generates a random emoji.`) + .action(() => { + console.log(faker.internet.emoji()); + }); + +export default command; diff --git a/src/commands/internet/exampleEmail.ts b/src/commands/internet/exampleEmail.ts new file mode 100644 index 0000000..c74b4fd --- /dev/null +++ b/src/commands/internet/exampleEmail.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('exampleEmail') + .description(`Generates an email address using an example mail provider.`) + .action(() => { + console.log(faker.internet.exampleEmail()); + }); + +export default command; diff --git a/src/commands/internet/httpMethod.ts b/src/commands/internet/httpMethod.ts new file mode 100644 index 0000000..c854fb4 --- /dev/null +++ b/src/commands/internet/httpMethod.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('httpMethod') + .description(`Generates a random http method.`) + .action(() => { + console.log(faker.internet.httpMethod()); + }); + +export default command; diff --git a/src/commands/internet/httpStatusCode.ts b/src/commands/internet/httpStatusCode.ts new file mode 100644 index 0000000..9dd7b61 --- /dev/null +++ b/src/commands/internet/httpStatusCode.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('httpStatusCode') + .description(`Generates a random HTTP status code.`) + .action(() => { + console.log(faker.internet.httpStatusCode()); + }); + +export default command; diff --git a/src/commands/internet/index.ts b/src/commands/internet/index.ts new file mode 100644 index 0000000..9af9a30 --- /dev/null +++ b/src/commands/internet/index.ts @@ -0,0 +1,48 @@ +import { Command } from 'commander'; +import avatarCommand from './avatar'; +import emailCommand from './email'; +import exampleEmailCommand from './exampleEmail'; +import userNameCommand from './userName'; +import displayNameCommand from './displayName'; +import protocolCommand from './protocol'; +import httpMethodCommand from './httpMethod'; +import httpStatusCodeCommand from './httpStatusCode'; +import urlCommand from './url'; +import domainNameCommand from './domainName'; +import domainSuffixCommand from './domainSuffix'; +import domainWordCommand from './domainWord'; +import ipCommand from './ip'; +import ipv4Command from './ipv4'; +import ipv6Command from './ipv6'; +import portCommand from './port'; +import userAgentCommand from './userAgent'; +import colorCommand from './color'; +import macCommand from './mac'; +import passwordCommand from './password'; +import emojiCommand from './emoji'; + +const command = new Command('internet') + .description(`Module to generate internet related entries.`) + .addCommand(avatarCommand) + .addCommand(emailCommand) + .addCommand(exampleEmailCommand) + .addCommand(userNameCommand) + .addCommand(displayNameCommand) + .addCommand(protocolCommand) + .addCommand(httpMethodCommand) + .addCommand(httpStatusCodeCommand) + .addCommand(urlCommand) + .addCommand(domainNameCommand) + .addCommand(domainSuffixCommand) + .addCommand(domainWordCommand) + .addCommand(ipCommand) + .addCommand(ipv4Command) + .addCommand(ipv6Command) + .addCommand(portCommand) + .addCommand(userAgentCommand) + .addCommand(colorCommand) + .addCommand(macCommand) + .addCommand(passwordCommand) + .addCommand(emojiCommand); + +export default command; diff --git a/src/commands/internet/ip.ts b/src/commands/internet/ip.ts new file mode 100644 index 0000000..5213497 --- /dev/null +++ b/src/commands/internet/ip.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('ip') + .description(`Generates a random IPv4 or IPv6 address.`) + .action(() => { + console.log(faker.internet.ip()); + }); + +export default command; diff --git a/src/commands/internet/ipv4.ts b/src/commands/internet/ipv4.ts new file mode 100644 index 0000000..ee59865 --- /dev/null +++ b/src/commands/internet/ipv4.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('ipv4') + .description(`Generates a random IPv4 address.`) + .action(() => { + console.log(faker.internet.ipv4()); + }); + +export default command; diff --git a/src/commands/internet/ipv6.ts b/src/commands/internet/ipv6.ts new file mode 100644 index 0000000..b85dc5e --- /dev/null +++ b/src/commands/internet/ipv6.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('ipv6') + .description(`Generates a random IPv6 address.`) + .action(() => { + console.log(faker.internet.ipv6()); + }); + +export default command; diff --git a/src/commands/internet/mac.ts b/src/commands/internet/mac.ts new file mode 100644 index 0000000..ac4925f --- /dev/null +++ b/src/commands/internet/mac.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('mac') + .description(`Generates a random mac address.`) + .action(() => { + console.log(faker.internet.mac()); + }); + +export default command; diff --git a/src/commands/internet/password.ts b/src/commands/internet/password.ts new file mode 100644 index 0000000..9fd0cfb --- /dev/null +++ b/src/commands/internet/password.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('password') + .description( + `Generates a random password-like string. Do not use this method for generating actual passwords for users.`, + ) + .action(() => { + console.log(faker.internet.password()); + }); + +export default command; diff --git a/src/commands/internet/port.ts b/src/commands/internet/port.ts new file mode 100644 index 0000000..04f3eda --- /dev/null +++ b/src/commands/internet/port.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('port') + .description(`Generates a random port number.`) + .action(() => { + console.log(faker.internet.port()); + }); + +export default command; diff --git a/src/commands/internet/protocol.ts b/src/commands/internet/protocol.ts new file mode 100644 index 0000000..5a3c353 --- /dev/null +++ b/src/commands/internet/protocol.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('protocol') + .description(`Generates a random web protocol. Either \`http\` or \`https\`.`) + .action(() => { + console.log(faker.internet.protocol()); + }); + +export default command; diff --git a/src/commands/internet/url.ts b/src/commands/internet/url.ts new file mode 100644 index 0000000..7641c2f --- /dev/null +++ b/src/commands/internet/url.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('url') + .description(`Generates a random http(s) url.`) + .action(() => { + console.log(faker.internet.url()); + }); + +export default command; diff --git a/src/commands/internet/userAgent.ts b/src/commands/internet/userAgent.ts new file mode 100644 index 0000000..730b926 --- /dev/null +++ b/src/commands/internet/userAgent.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('userAgent') + .description(`Generates a random user agent string.`) + .action(() => { + console.log(faker.internet.userAgent()); + }); + +export default command; diff --git a/src/commands/internet/userName.ts b/src/commands/internet/userName.ts new file mode 100644 index 0000000..7ee0fe7 --- /dev/null +++ b/src/commands/internet/userName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('userName') + .description(`Generates a username.`) + .action(() => { + console.log(faker.internet.userName()); + }); + +export default command; diff --git a/src/commands/location/buildingNumber.ts b/src/commands/location/buildingNumber.ts new file mode 100644 index 0000000..5c9fb0b --- /dev/null +++ b/src/commands/location/buildingNumber.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('buildingNumber') + .description(`Generates a random building number.`) + .action(() => { + console.log(faker.location.buildingNumber()); + }); + +export default command; diff --git a/src/commands/location/cardinalDirection.ts b/src/commands/location/cardinalDirection.ts new file mode 100644 index 0000000..8dc4ecf --- /dev/null +++ b/src/commands/location/cardinalDirection.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cardinalDirection') + .description( + `Generates a random cardinal direction (north, east, south, west).`, + ) + .action(() => { + console.log(faker.location.cardinalDirection()); + }); + +export default command; diff --git a/src/commands/location/city.ts b/src/commands/location/city.ts new file mode 100644 index 0000000..4482a32 --- /dev/null +++ b/src/commands/location/city.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('city') + .description(`Generates a random localized city name.`) + .action(() => { + console.log(faker.location.city()); + }); + +export default command; diff --git a/src/commands/location/cityName.ts b/src/commands/location/cityName.ts new file mode 100644 index 0000000..1798f95 --- /dev/null +++ b/src/commands/location/cityName.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cityName') + .description( + `Generates a random city name from a list of real cities for the locale.`, + ) + .action(() => { + console.log(faker.location.cityName()); + }); + +export default command; diff --git a/src/commands/location/country.ts b/src/commands/location/country.ts new file mode 100644 index 0000000..11958f1 --- /dev/null +++ b/src/commands/location/country.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('country') + .description(`Generates a random country name.`) + .action(() => { + console.log(faker.location.country()); + }); + +export default command; diff --git a/src/commands/location/countryCode.ts b/src/commands/location/countryCode.ts new file mode 100644 index 0000000..db9b0ea --- /dev/null +++ b/src/commands/location/countryCode.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('countryCode') + .description(`Generates a random ISO_3166-1 country code.`) + .action(() => { + console.log(faker.location.countryCode()); + }); + +export default command; diff --git a/src/commands/location/county.ts b/src/commands/location/county.ts new file mode 100644 index 0000000..c73dbf3 --- /dev/null +++ b/src/commands/location/county.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('county') + .description( + `Generates a random localized county, or other equivalent second-level administrative entity for the locale's country such as a district or department.`, + ) + .action(() => { + console.log(faker.location.county()); + }); + +export default command; diff --git a/src/commands/location/direction.ts b/src/commands/location/direction.ts new file mode 100644 index 0000000..41bf03d --- /dev/null +++ b/src/commands/location/direction.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('direction') + .description( + `Generates a random direction (cardinal and ordinal; northwest, east, etc).`, + ) + .action(() => { + console.log(faker.location.direction()); + }); + +export default command; diff --git a/src/commands/location/index.ts b/src/commands/location/index.ts new file mode 100644 index 0000000..98b2514 --- /dev/null +++ b/src/commands/location/index.ts @@ -0,0 +1,50 @@ +import { Command } from 'commander'; +import zipCodeCommand from './zipCode'; +import zipCodeByStateCommand from './zipCodeByState'; +import cityCommand from './city'; +import cityNameCommand from './cityName'; +import buildingNumberCommand from './buildingNumber'; +import streetCommand from './street'; +import streetNameCommand from './streetName'; +import streetAddressCommand from './streetAddress'; +import secondaryAddressCommand from './secondaryAddress'; +import countyCommand from './county'; +import countryCommand from './country'; +import countryCodeCommand from './countryCode'; +import stateCommand from './state'; +import stateAbbrCommand from './stateAbbr'; +import latitudeCommand from './latitude'; +import longitudeCommand from './longitude'; +import directionCommand from './direction'; +import cardinalDirectionCommand from './cardinalDirection'; +import ordinalDirectionCommand from './ordinalDirection'; +import nearbyGPSCoordinateCommand from './nearbyGPSCoordinate'; +import timeZoneCommand from './timeZone'; + +const command = new Command('location') + .description( + `Module to generate addresses and locations. Prior to Faker 8.0.0, this module was known as \`faker.address\`.`, + ) + .addCommand(zipCodeCommand) + .addCommand(zipCodeByStateCommand) + .addCommand(cityCommand) + .addCommand(cityNameCommand) + .addCommand(buildingNumberCommand) + .addCommand(streetCommand) + .addCommand(streetNameCommand) + .addCommand(streetAddressCommand) + .addCommand(secondaryAddressCommand) + .addCommand(countyCommand) + .addCommand(countryCommand) + .addCommand(countryCodeCommand) + .addCommand(stateCommand) + .addCommand(stateAbbrCommand) + .addCommand(latitudeCommand) + .addCommand(longitudeCommand) + .addCommand(directionCommand) + .addCommand(cardinalDirectionCommand) + .addCommand(ordinalDirectionCommand) + .addCommand(nearbyGPSCoordinateCommand) + .addCommand(timeZoneCommand); + +export default command; diff --git a/src/commands/location/latitude.ts b/src/commands/location/latitude.ts new file mode 100644 index 0000000..d72feba --- /dev/null +++ b/src/commands/location/latitude.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('latitude') + .description(`Generates a random latitude.`) + .action(() => { + console.log(faker.location.latitude()); + }); + +export default command; diff --git a/src/commands/location/longitude.ts b/src/commands/location/longitude.ts new file mode 100644 index 0000000..a368515 --- /dev/null +++ b/src/commands/location/longitude.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('longitude') + .description(`Generates a random longitude.`) + .action(() => { + console.log(faker.location.longitude()); + }); + +export default command; diff --git a/src/commands/location/nearbyGPSCoordinate.ts b/src/commands/location/nearbyGPSCoordinate.ts new file mode 100644 index 0000000..71b9c69 --- /dev/null +++ b/src/commands/location/nearbyGPSCoordinate.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('nearbyGPSCoordinate') + .description( + `Generates a random GPS coordinate within the specified radius from the given coordinate.`, + ) + .action(() => { + console.log(faker.location.nearbyGPSCoordinate()); + }); + +export default command; diff --git a/src/commands/location/ordinalDirection.ts b/src/commands/location/ordinalDirection.ts new file mode 100644 index 0000000..a2d6152 --- /dev/null +++ b/src/commands/location/ordinalDirection.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('ordinalDirection') + .description( + `Generates a random ordinal direction (northwest, southeast, etc).`, + ) + .action(() => { + console.log(faker.location.ordinalDirection()); + }); + +export default command; diff --git a/src/commands/location/secondaryAddress.ts b/src/commands/location/secondaryAddress.ts new file mode 100644 index 0000000..c30c104 --- /dev/null +++ b/src/commands/location/secondaryAddress.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('secondaryAddress') + .description(`Generates a random localized secondary address.`) + .action(() => { + console.log(faker.location.secondaryAddress()); + }); + +export default command; diff --git a/src/commands/location/state.ts b/src/commands/location/state.ts new file mode 100644 index 0000000..b41044c --- /dev/null +++ b/src/commands/location/state.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('state') + .description( + `Generates a random localized state, or other equivalent first-level administrative entity for the locale's country such as a province or region.`, + ) + .action(() => { + console.log(faker.location.state()); + }); + +export default command; diff --git a/src/commands/location/stateAbbr.ts b/src/commands/location/stateAbbr.ts new file mode 100644 index 0000000..d862aeb --- /dev/null +++ b/src/commands/location/stateAbbr.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('stateAbbr') + .description( + `Generates a random localized state's abbreviated name from this country.`, + ) + .action(() => { + console.log(faker.location.stateAbbr()); + }); + +export default command; diff --git a/src/commands/location/street.ts b/src/commands/location/street.ts new file mode 100644 index 0000000..73cbd62 --- /dev/null +++ b/src/commands/location/street.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('street') + .description(`Generates a random localized street name.`) + .action(() => { + console.log(faker.location.street()); + }); + +export default command; diff --git a/src/commands/location/streetAddress.ts b/src/commands/location/streetAddress.ts new file mode 100644 index 0000000..0795779 --- /dev/null +++ b/src/commands/location/streetAddress.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('streetAddress') + .description(`Generates a random localized street address.`) + .action(() => { + console.log(faker.location.streetAddress()); + }); + +export default command; diff --git a/src/commands/location/streetName.ts b/src/commands/location/streetName.ts new file mode 100644 index 0000000..7fef3c4 --- /dev/null +++ b/src/commands/location/streetName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('streetName') + .description(`Generates a random localized street name.`) + .action(() => { + console.log(faker.location.streetName()); + }); + +export default command; diff --git a/src/commands/location/timeZone.ts b/src/commands/location/timeZone.ts new file mode 100644 index 0000000..f483f4a --- /dev/null +++ b/src/commands/location/timeZone.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('timeZone') + .description(`Generates a random time zone.`) + .action(() => { + console.log(faker.location.timeZone()); + }); + +export default command; diff --git a/src/commands/location/zipCode.ts b/src/commands/location/zipCode.ts new file mode 100644 index 0000000..55d005b --- /dev/null +++ b/src/commands/location/zipCode.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('zipCode') + .description(`Generates random zip code from specified format.`) + .action(() => { + console.log(faker.location.zipCode()); + }); + +export default command; diff --git a/src/commands/location/zipCodeByState.ts b/src/commands/location/zipCodeByState.ts new file mode 100644 index 0000000..8d47a03 --- /dev/null +++ b/src/commands/location/zipCodeByState.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('zipCodeByState') + .description(`Generates random zip code from state abbreviation.`) + .action(() => { + console.log(faker.location.zipCodeByState()); + }); + +export default command; diff --git a/src/commands/lorem/index.ts b/src/commands/lorem/index.ts new file mode 100644 index 0000000..6ee5581 --- /dev/null +++ b/src/commands/lorem/index.ts @@ -0,0 +1,24 @@ +import { Command } from 'commander'; +import wordCommand from './word'; +import wordsCommand from './words'; +import sentenceCommand from './sentence'; +import slugCommand from './slug'; +import sentencesCommand from './sentences'; +import paragraphCommand from './paragraph'; +import paragraphsCommand from './paragraphs'; +import textCommand from './text'; +import linesCommand from './lines'; + +const command = new Command('lorem') + .description(`Module to generate random texts and words.`) + .addCommand(wordCommand) + .addCommand(wordsCommand) + .addCommand(sentenceCommand) + .addCommand(slugCommand) + .addCommand(sentencesCommand) + .addCommand(paragraphCommand) + .addCommand(paragraphsCommand) + .addCommand(textCommand) + .addCommand(linesCommand); + +export default command; diff --git a/src/commands/lorem/lines.ts b/src/commands/lorem/lines.ts new file mode 100644 index 0000000..dd67ffe --- /dev/null +++ b/src/commands/lorem/lines.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('lines') + .description( + `Generates the given number lines of lorem separated by \`'\\n'\`.`, + ) + .action(() => { + console.log(faker.lorem.lines()); + }); + +export default command; diff --git a/src/commands/lorem/paragraph.ts b/src/commands/lorem/paragraph.ts new file mode 100644 index 0000000..eed2ae0 --- /dev/null +++ b/src/commands/lorem/paragraph.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('paragraph') + .description(`Generates a paragraph with the given number of sentences.`) + .action(() => { + console.log(faker.lorem.paragraph()); + }); + +export default command; diff --git a/src/commands/lorem/paragraphs.ts b/src/commands/lorem/paragraphs.ts new file mode 100644 index 0000000..00a2b05 --- /dev/null +++ b/src/commands/lorem/paragraphs.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('paragraphs') + .description(`Generates the given number of paragraphs.`) + .action(() => { + console.log(faker.lorem.paragraphs()); + }); + +export default command; diff --git a/src/commands/lorem/sentence.ts b/src/commands/lorem/sentence.ts new file mode 100644 index 0000000..81bed2c --- /dev/null +++ b/src/commands/lorem/sentence.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('sentence') + .description( + `Generates a space separated list of words beginning with a capital letter and ending with a period.`, + ) + .action(() => { + console.log(faker.lorem.sentence()); + }); + +export default command; diff --git a/src/commands/lorem/sentences.ts b/src/commands/lorem/sentences.ts new file mode 100644 index 0000000..5f9c115 --- /dev/null +++ b/src/commands/lorem/sentences.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('sentences') + .description(`Generates the given number of sentences.`) + .action(() => { + console.log(faker.lorem.sentences()); + }); + +export default command; diff --git a/src/commands/lorem/slug.ts b/src/commands/lorem/slug.ts new file mode 100644 index 0000000..d3d13c0 --- /dev/null +++ b/src/commands/lorem/slug.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('slug') + .description( + `Generates a slugified text consisting of the given number of hyphen separated words.`, + ) + .action(() => { + console.log(faker.lorem.slug()); + }); + +export default command; diff --git a/src/commands/lorem/text.ts b/src/commands/lorem/text.ts new file mode 100644 index 0000000..7395926 --- /dev/null +++ b/src/commands/lorem/text.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('text') + .description(`Generates a random text based on a random lorem method.`) + .action(() => { + console.log(faker.lorem.text()); + }); + +export default command; diff --git a/src/commands/lorem/word.ts b/src/commands/lorem/word.ts new file mode 100644 index 0000000..0943030 --- /dev/null +++ b/src/commands/lorem/word.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('word') + .description(`Generates a word of a specified length.`) + .action(() => { + console.log(faker.lorem.word()); + }); + +export default command; diff --git a/src/commands/lorem/words.ts b/src/commands/lorem/words.ts new file mode 100644 index 0000000..2abf02b --- /dev/null +++ b/src/commands/lorem/words.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('words') + .description(`Generates a space separated list of words.`) + .action(() => { + console.log(faker.lorem.words()); + }); + +export default command; diff --git a/src/commands/music/genre.ts b/src/commands/music/genre.ts new file mode 100644 index 0000000..756c677 --- /dev/null +++ b/src/commands/music/genre.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('genre') + .description(`Generates a random music genre.`) + .action(() => { + console.log(faker.music.genre()); + }); + +export default command; diff --git a/src/commands/music/index.ts b/src/commands/music/index.ts new file mode 100644 index 0000000..1c32154 --- /dev/null +++ b/src/commands/music/index.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import genreCommand from './genre'; +import songNameCommand from './songName'; + +const command = new Command('music') + .description(`Module to generate music related entries.`) + .addCommand(genreCommand) + .addCommand(songNameCommand); + +export default command; diff --git a/src/commands/music/songName.ts b/src/commands/music/songName.ts new file mode 100644 index 0000000..bad4d20 --- /dev/null +++ b/src/commands/music/songName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('songName') + .description(`Generates a random song name.`) + .action(() => { + console.log(faker.music.songName()); + }); + +export default command; diff --git a/src/commands/number/bigInt.ts b/src/commands/number/bigInt.ts new file mode 100644 index 0000000..9cefb03 --- /dev/null +++ b/src/commands/number/bigInt.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bigInt') + .description(`Generates a BigInt number.`) + .action(() => { + console.log(faker.number.bigInt()); + }); + +export default command; diff --git a/src/commands/number/binary.ts b/src/commands/number/binary.ts new file mode 100644 index 0000000..6634cd6 --- /dev/null +++ b/src/commands/number/binary.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('binary') + .description(`Generates a binary number.`) + .action(() => { + console.log(faker.number.binary()); + }); + +export default command; diff --git a/src/commands/number/float.ts b/src/commands/number/float.ts new file mode 100644 index 0000000..396ab72 --- /dev/null +++ b/src/commands/number/float.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('float') + .description( + `Generates a single random floating-point number between zero and one.`, + ) + .action(() => { + console.log(faker.number.float()); + }); + +export default command; diff --git a/src/commands/number/hex.ts b/src/commands/number/hex.ts new file mode 100644 index 0000000..af6d9bf --- /dev/null +++ b/src/commands/number/hex.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('hex') + .description(`Generates a lowercase hexadecimal number.`) + .action(() => { + console.log(faker.number.hex()); + }); + +export default command; diff --git a/src/commands/number/index.ts b/src/commands/number/index.ts new file mode 100644 index 0000000..6c47a22 --- /dev/null +++ b/src/commands/number/index.ts @@ -0,0 +1,18 @@ +import { Command } from 'commander'; +import intCommand from './int'; +import floatCommand from './float'; +import binaryCommand from './binary'; +import octalCommand from './octal'; +import hexCommand from './hex'; +import bigIntCommand from './bigInt'; + +const command = new Command('number') + .description(`Module to generate numbers of any kind.`) + .addCommand(intCommand) + .addCommand(floatCommand) + .addCommand(binaryCommand) + .addCommand(octalCommand) + .addCommand(hexCommand) + .addCommand(bigIntCommand); + +export default command; diff --git a/src/commands/number/int.ts b/src/commands/number/int.ts new file mode 100644 index 0000000..ae50162 --- /dev/null +++ b/src/commands/number/int.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('int') + .description( + `Generates a single random integer between zero and \`Number.MAX_SAFE_INTEGER\`.`, + ) + .action(() => { + console.log(faker.number.int()); + }); + +export default command; diff --git a/src/commands/number/octal.ts b/src/commands/number/octal.ts new file mode 100644 index 0000000..c063550 --- /dev/null +++ b/src/commands/number/octal.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('octal') + .description(`Generates an octal number.`) + .action(() => { + console.log(faker.number.octal()); + }); + +export default command; diff --git a/src/commands/person/bio.ts b/src/commands/person/bio.ts new file mode 100644 index 0000000..da4f3b0 --- /dev/null +++ b/src/commands/person/bio.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bio') + .description(`Generates a random short biography`) + .action(() => { + console.log(faker.person.bio()); + }); + +export default command; diff --git a/src/commands/person/firstName.ts b/src/commands/person/firstName.ts new file mode 100644 index 0000000..f3a23b5 --- /dev/null +++ b/src/commands/person/firstName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('firstName') + .description(`Generates a random first name.`) + .action(() => { + console.log(faker.person.firstName()); + }); + +export default command; diff --git a/src/commands/person/fullName.ts b/src/commands/person/fullName.ts new file mode 100644 index 0000000..cb9dbbd --- /dev/null +++ b/src/commands/person/fullName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('fullName') + .description(`Generates a random full name.`) + .action(() => { + console.log(faker.person.fullName()); + }); + +export default command; diff --git a/src/commands/person/gender.ts b/src/commands/person/gender.ts new file mode 100644 index 0000000..5919700 --- /dev/null +++ b/src/commands/person/gender.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('gender') + .description(`Generates a random gender.`) + .action(() => { + console.log(faker.person.gender()); + }); + +export default command; diff --git a/src/commands/person/index.ts b/src/commands/person/index.ts new file mode 100644 index 0000000..ef61aaa --- /dev/null +++ b/src/commands/person/index.ts @@ -0,0 +1,38 @@ +import { Command } from 'commander'; +import firstNameCommand from './firstName'; +import lastNameCommand from './lastName'; +import middleNameCommand from './middleName'; +import fullNameCommand from './fullName'; +import genderCommand from './gender'; +import sexCommand from './sex'; +import sexTypeCommand from './sexType'; +import bioCommand from './bio'; +import prefixCommand from './prefix'; +import suffixCommand from './suffix'; +import jobTitleCommand from './jobTitle'; +import jobDescriptorCommand from './jobDescriptor'; +import jobAreaCommand from './jobArea'; +import jobTypeCommand from './jobType'; +import zodiacSignCommand from './zodiacSign'; + +const command = new Command('person') + .description( + `Module to generate people's personal information such as names and job titles. Prior to Faker 8.0.0, this module was known as \`faker.name\`.`, + ) + .addCommand(firstNameCommand) + .addCommand(lastNameCommand) + .addCommand(middleNameCommand) + .addCommand(fullNameCommand) + .addCommand(genderCommand) + .addCommand(sexCommand) + .addCommand(sexTypeCommand) + .addCommand(bioCommand) + .addCommand(prefixCommand) + .addCommand(suffixCommand) + .addCommand(jobTitleCommand) + .addCommand(jobDescriptorCommand) + .addCommand(jobAreaCommand) + .addCommand(jobTypeCommand) + .addCommand(zodiacSignCommand); + +export default command; diff --git a/src/commands/person/jobArea.ts b/src/commands/person/jobArea.ts new file mode 100644 index 0000000..4e3f0f0 --- /dev/null +++ b/src/commands/person/jobArea.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('jobArea') + .description(`Generates a random job area.`) + .action(() => { + console.log(faker.person.jobArea()); + }); + +export default command; diff --git a/src/commands/person/jobDescriptor.ts b/src/commands/person/jobDescriptor.ts new file mode 100644 index 0000000..6c0ed7d --- /dev/null +++ b/src/commands/person/jobDescriptor.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('jobDescriptor') + .description(`Generates a random job descriptor.`) + .action(() => { + console.log(faker.person.jobDescriptor()); + }); + +export default command; diff --git a/src/commands/person/jobTitle.ts b/src/commands/person/jobTitle.ts new file mode 100644 index 0000000..7901a2b --- /dev/null +++ b/src/commands/person/jobTitle.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('jobTitle') + .description(`Generates a random job title.`) + .action(() => { + console.log(faker.person.jobTitle()); + }); + +export default command; diff --git a/src/commands/person/jobType.ts b/src/commands/person/jobType.ts new file mode 100644 index 0000000..5730c6c --- /dev/null +++ b/src/commands/person/jobType.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('jobType') + .description(`Generates a random job type.`) + .action(() => { + console.log(faker.person.jobType()); + }); + +export default command; diff --git a/src/commands/person/lastName.ts b/src/commands/person/lastName.ts new file mode 100644 index 0000000..60ad571 --- /dev/null +++ b/src/commands/person/lastName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('lastName') + .description(`Generates a random last name.`) + .action(() => { + console.log(faker.person.lastName()); + }); + +export default command; diff --git a/src/commands/person/middleName.ts b/src/commands/person/middleName.ts new file mode 100644 index 0000000..f55d0c3 --- /dev/null +++ b/src/commands/person/middleName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('middleName') + .description(`Generates a random middle name.`) + .action(() => { + console.log(faker.person.middleName()); + }); + +export default command; diff --git a/src/commands/person/prefix.ts b/src/commands/person/prefix.ts new file mode 100644 index 0000000..99ff6df --- /dev/null +++ b/src/commands/person/prefix.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('prefix') + .description(`Generates a random person prefix.`) + .action(() => { + console.log(faker.person.prefix()); + }); + +export default command; diff --git a/src/commands/person/sex.ts b/src/commands/person/sex.ts new file mode 100644 index 0000000..bf716e1 --- /dev/null +++ b/src/commands/person/sex.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('sex') + .description(`Generates a random sex.`) + .action(() => { + console.log(faker.person.sex()); + }); + +export default command; diff --git a/src/commands/person/sexType.ts b/src/commands/person/sexType.ts new file mode 100644 index 0000000..5550e44 --- /dev/null +++ b/src/commands/person/sexType.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('sexType') + .description(`Generates a random sex type.`) + .action(() => { + console.log(faker.person.sexType()); + }); + +export default command; diff --git a/src/commands/person/suffix.ts b/src/commands/person/suffix.ts new file mode 100644 index 0000000..57991eb --- /dev/null +++ b/src/commands/person/suffix.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('suffix') + .description(`Generates a random person suffix.`) + .action(() => { + console.log(faker.person.suffix()); + }); + +export default command; diff --git a/src/commands/person/zodiacSign.ts b/src/commands/person/zodiacSign.ts new file mode 100644 index 0000000..385fc0b --- /dev/null +++ b/src/commands/person/zodiacSign.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('zodiacSign') + .description(`Generates a random zodiac sign.`) + .action(() => { + console.log(faker.person.zodiacSign()); + }); + +export default command; diff --git a/src/commands/phone/imei.ts b/src/commands/phone/imei.ts new file mode 100644 index 0000000..3d8b78d --- /dev/null +++ b/src/commands/phone/imei.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('imei') + .description(`Generates IMEI number.`) + .action(() => { + console.log(faker.phone.imei()); + }); + +export default command; diff --git a/src/commands/phone/index.ts b/src/commands/phone/index.ts new file mode 100644 index 0000000..18466e3 --- /dev/null +++ b/src/commands/phone/index.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import numberCommand from './number'; +import imeiCommand from './imei'; + +const command = new Command('phone') + .description(`Module to generate phone-related data.`) + .addCommand(numberCommand) + .addCommand(imeiCommand); + +export default command; diff --git a/src/commands/phone/number.ts b/src/commands/phone/number.ts new file mode 100644 index 0000000..16a03a4 --- /dev/null +++ b/src/commands/phone/number.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('number') + .description(`Generates a random phone number.`) + .action(() => { + console.log(faker.phone.number()); + }); + +export default command; diff --git a/src/commands/science/chemicalElement.ts b/src/commands/science/chemicalElement.ts new file mode 100644 index 0000000..9ef3a59 --- /dev/null +++ b/src/commands/science/chemicalElement.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('chemicalElement') + .description(`Generates a random periodic table element.`) + .action(() => { + console.log(faker.science.chemicalElement()); + }); + +export default command; diff --git a/src/commands/science/index.ts b/src/commands/science/index.ts new file mode 100644 index 0000000..ddd1a05 --- /dev/null +++ b/src/commands/science/index.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import chemicalElementCommand from './chemicalElement'; +import unitCommand from './unit'; + +const command = new Command('science') + .description(`Module to generate science related entries.`) + .addCommand(chemicalElementCommand) + .addCommand(unitCommand); + +export default command; diff --git a/src/commands/science/unit.ts b/src/commands/science/unit.ts new file mode 100644 index 0000000..996d566 --- /dev/null +++ b/src/commands/science/unit.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('unit') + .description(`Generates a random scientific unit.`) + .action(() => { + console.log(faker.science.unit()); + }); + +export default command; diff --git a/src/commands/string/alpha.ts b/src/commands/string/alpha.ts new file mode 100644 index 0000000..be41b07 --- /dev/null +++ b/src/commands/string/alpha.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('alpha') + .description( + `Generating a string consisting of letters in the English alphabet.`, + ) + .action(() => { + console.log(faker.string.alpha()); + }); + +export default command; diff --git a/src/commands/string/alphanumeric.ts b/src/commands/string/alphanumeric.ts new file mode 100644 index 0000000..e19fefe --- /dev/null +++ b/src/commands/string/alphanumeric.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('alphanumeric') + .description(`Generating a string consisting of alpha characters and digits.`) + .action(() => { + console.log(faker.string.alphanumeric()); + }); + +export default command; diff --git a/src/commands/string/binary.ts b/src/commands/string/binary.ts new file mode 100644 index 0000000..488f9c1 --- /dev/null +++ b/src/commands/string/binary.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('binary') + .description(`Generates a binary string.`) + .action(() => { + console.log(faker.string.binary()); + }); + +export default command; diff --git a/src/commands/string/hexadecimal.ts b/src/commands/string/hexadecimal.ts new file mode 100644 index 0000000..17dce60 --- /dev/null +++ b/src/commands/string/hexadecimal.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('hexadecimal') + .description(`Generates a hexadecimal string.`) + .action(() => { + console.log(faker.string.hexadecimal()); + }); + +export default command; diff --git a/src/commands/string/index.ts b/src/commands/string/index.ts new file mode 100644 index 0000000..1bce66c --- /dev/null +++ b/src/commands/string/index.ts @@ -0,0 +1,26 @@ +import { Command } from 'commander'; +import alphaCommand from './alpha'; +import alphanumericCommand from './alphanumeric'; +import binaryCommand from './binary'; +import octalCommand from './octal'; +import hexadecimalCommand from './hexadecimal'; +import numericCommand from './numeric'; +import sampleCommand from './sample'; +import uuidCommand from './uuid'; +import nanoidCommand from './nanoid'; +import symbolCommand from './symbol'; + +const command = new Command('string') + .description(`Module to generate string related entries.`) + .addCommand(alphaCommand) + .addCommand(alphanumericCommand) + .addCommand(binaryCommand) + .addCommand(octalCommand) + .addCommand(hexadecimalCommand) + .addCommand(numericCommand) + .addCommand(sampleCommand) + .addCommand(uuidCommand) + .addCommand(nanoidCommand) + .addCommand(symbolCommand); + +export default command; diff --git a/src/commands/string/nanoid.ts b/src/commands/string/nanoid.ts new file mode 100644 index 0000000..00ce3cd --- /dev/null +++ b/src/commands/string/nanoid.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('nanoid') + .description(`Generates a Nano ID.`) + .action(() => { + console.log(faker.string.nanoid()); + }); + +export default command; diff --git a/src/commands/string/numeric.ts b/src/commands/string/numeric.ts new file mode 100644 index 0000000..c24e5c3 --- /dev/null +++ b/src/commands/string/numeric.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('numeric') + .description(`Generates a given length string of digits.`) + .action(() => { + console.log(faker.string.numeric()); + }); + +export default command; diff --git a/src/commands/string/octal.ts b/src/commands/string/octal.ts new file mode 100644 index 0000000..4567db4 --- /dev/null +++ b/src/commands/string/octal.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('octal') + .description(`Generates an octal string.`) + .action(() => { + console.log(faker.string.octal()); + }); + +export default command; diff --git a/src/commands/string/sample.ts b/src/commands/string/sample.ts new file mode 100644 index 0000000..099f72f --- /dev/null +++ b/src/commands/string/sample.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('sample') + .description( + `Generates a string containing UTF-16 chars between 33 and 125 (\`!\` to \`}\`).`, + ) + .action(() => { + console.log(faker.string.sample()); + }); + +export default command; diff --git a/src/commands/string/symbol.ts b/src/commands/string/symbol.ts new file mode 100644 index 0000000..d30e415 --- /dev/null +++ b/src/commands/string/symbol.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('symbol') + .description(`Generates a string containing only special characters.`) + .action(() => { + console.log(faker.string.symbol()); + }); + +export default command; diff --git a/src/commands/string/uuid.ts b/src/commands/string/uuid.ts new file mode 100644 index 0000000..a6d6e2d --- /dev/null +++ b/src/commands/string/uuid.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('uuid') + .description(`Generates a UUID v4 (Universally Unique Identifier).`) + .action(() => { + console.log(faker.string.uuid()); + }); + +export default command; diff --git a/src/commands/system/commonFileExt.ts b/src/commands/system/commonFileExt.ts new file mode 100644 index 0000000..332f3c7 --- /dev/null +++ b/src/commands/system/commonFileExt.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('commonFileExt') + .description(`Generates a commonly used file extension.`) + .action(() => { + console.log(faker.system.commonFileExt()); + }); + +export default command; diff --git a/src/commands/system/commonFileName.ts b/src/commands/system/commonFileName.ts new file mode 100644 index 0000000..db8de38 --- /dev/null +++ b/src/commands/system/commonFileName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('commonFileName') + .description(`Generates a random file name and a commonly used extension.`) + .action(() => { + console.log(faker.system.commonFileName()); + }); + +export default command; diff --git a/src/commands/system/commonFileType.ts b/src/commands/system/commonFileType.ts new file mode 100644 index 0000000..1ac23fd --- /dev/null +++ b/src/commands/system/commonFileType.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('commonFileType') + .description(`Generates a commonly used file type.`) + .action(() => { + console.log(faker.system.commonFileType()); + }); + +export default command; diff --git a/src/commands/system/cron.ts b/src/commands/system/cron.ts new file mode 100644 index 0000000..eaa86e8 --- /dev/null +++ b/src/commands/system/cron.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('cron') + .description(`Generates a random cron expression.`) + .action(() => { + console.log(faker.system.cron()); + }); + +export default command; diff --git a/src/commands/system/directoryPath.ts b/src/commands/system/directoryPath.ts new file mode 100644 index 0000000..87bc371 --- /dev/null +++ b/src/commands/system/directoryPath.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('directoryPath') + .description(`Generates a directory path.`) + .action(() => { + console.log(faker.system.directoryPath()); + }); + +export default command; diff --git a/src/commands/system/fileExt.ts b/src/commands/system/fileExt.ts new file mode 100644 index 0000000..9a68235 --- /dev/null +++ b/src/commands/system/fileExt.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('fileExt') + .description(`Generates a file extension.`) + .action(() => { + console.log(faker.system.fileExt()); + }); + +export default command; diff --git a/src/commands/system/fileName.ts b/src/commands/system/fileName.ts new file mode 100644 index 0000000..5118d13 --- /dev/null +++ b/src/commands/system/fileName.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('fileName') + .description(`Generates a random file name with extension.`) + .action(() => { + console.log(faker.system.fileName()); + }); + +export default command; diff --git a/src/commands/system/filePath.ts b/src/commands/system/filePath.ts new file mode 100644 index 0000000..d2a4f9c --- /dev/null +++ b/src/commands/system/filePath.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('filePath') + .description(`Generates a file path.`) + .action(() => { + console.log(faker.system.filePath()); + }); + +export default command; diff --git a/src/commands/system/fileType.ts b/src/commands/system/fileType.ts new file mode 100644 index 0000000..626b260 --- /dev/null +++ b/src/commands/system/fileType.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('fileType') + .description(`Generates a file type.`) + .action(() => { + console.log(faker.system.fileType()); + }); + +export default command; diff --git a/src/commands/system/index.ts b/src/commands/system/index.ts new file mode 100644 index 0000000..ac3d825 --- /dev/null +++ b/src/commands/system/index.ts @@ -0,0 +1,30 @@ +import { Command } from 'commander'; +import fileNameCommand from './fileName'; +import commonFileNameCommand from './commonFileName'; +import mimeTypeCommand from './mimeType'; +import commonFileTypeCommand from './commonFileType'; +import commonFileExtCommand from './commonFileExt'; +import fileTypeCommand from './fileType'; +import fileExtCommand from './fileExt'; +import directoryPathCommand from './directoryPath'; +import filePathCommand from './filePath'; +import semverCommand from './semver'; +import networkInterfaceCommand from './networkInterface'; +import cronCommand from './cron'; + +const command = new Command('system') + .description(`Generates fake data for many computer systems properties.`) + .addCommand(fileNameCommand) + .addCommand(commonFileNameCommand) + .addCommand(mimeTypeCommand) + .addCommand(commonFileTypeCommand) + .addCommand(commonFileExtCommand) + .addCommand(fileTypeCommand) + .addCommand(fileExtCommand) + .addCommand(directoryPathCommand) + .addCommand(filePathCommand) + .addCommand(semverCommand) + .addCommand(networkInterfaceCommand) + .addCommand(cronCommand); + +export default command; diff --git a/src/commands/system/mimeType.ts b/src/commands/system/mimeType.ts new file mode 100644 index 0000000..2ce21eb --- /dev/null +++ b/src/commands/system/mimeType.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('mimeType') + .description(`Generates a mime-type.`) + .action(() => { + console.log(faker.system.mimeType()); + }); + +export default command; diff --git a/src/commands/system/networkInterface.ts b/src/commands/system/networkInterface.ts new file mode 100644 index 0000000..8c7c9ae --- /dev/null +++ b/src/commands/system/networkInterface.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('networkInterface') + .description(`Generates a random network interface.`) + .action(() => { + console.log(faker.system.networkInterface()); + }); + +export default command; diff --git a/src/commands/system/semver.ts b/src/commands/system/semver.ts new file mode 100644 index 0000000..4647acf --- /dev/null +++ b/src/commands/system/semver.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('semver') + .description(`Generates a semantic version.`) + .action(() => { + console.log(faker.system.semver()); + }); + +export default command; diff --git a/src/commands/vehicle/bicycle.ts b/src/commands/vehicle/bicycle.ts new file mode 100644 index 0000000..97eb9da --- /dev/null +++ b/src/commands/vehicle/bicycle.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('bicycle') + .description(`Generates a type of bicycle.`) + .action(() => { + console.log(faker.vehicle.bicycle()); + }); + +export default command; diff --git a/src/commands/vehicle/color.ts b/src/commands/vehicle/color.ts new file mode 100644 index 0000000..e16efc5 --- /dev/null +++ b/src/commands/vehicle/color.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('color') + .description(`Generates a vehicle color.`) + .action(() => { + console.log(faker.vehicle.color()); + }); + +export default command; diff --git a/src/commands/vehicle/fuel.ts b/src/commands/vehicle/fuel.ts new file mode 100644 index 0000000..4c4247c --- /dev/null +++ b/src/commands/vehicle/fuel.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('fuel') + .description(`Generates a fuel type.`) + .action(() => { + console.log(faker.vehicle.fuel()); + }); + +export default command; diff --git a/src/commands/vehicle/index.ts b/src/commands/vehicle/index.ts new file mode 100644 index 0000000..9e702c7 --- /dev/null +++ b/src/commands/vehicle/index.ts @@ -0,0 +1,24 @@ +import { Command } from 'commander'; +import vehicleCommand from './vehicle'; +import manufacturerCommand from './manufacturer'; +import modelCommand from './model'; +import typeCommand from './type'; +import fuelCommand from './fuel'; +import vinCommand from './vin'; +import colorCommand from './color'; +import vrmCommand from './vrm'; +import bicycleCommand from './bicycle'; + +const command = new Command('vehicle') + .description(`Module to generate vehicle related entries.`) + .addCommand(vehicleCommand) + .addCommand(manufacturerCommand) + .addCommand(modelCommand) + .addCommand(typeCommand) + .addCommand(fuelCommand) + .addCommand(vinCommand) + .addCommand(colorCommand) + .addCommand(vrmCommand) + .addCommand(bicycleCommand); + +export default command; diff --git a/src/commands/vehicle/manufacturer.ts b/src/commands/vehicle/manufacturer.ts new file mode 100644 index 0000000..2041e6c --- /dev/null +++ b/src/commands/vehicle/manufacturer.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('manufacturer') + .description(`Generates a manufacturer name.`) + .action(() => { + console.log(faker.vehicle.manufacturer()); + }); + +export default command; diff --git a/src/commands/vehicle/model.ts b/src/commands/vehicle/model.ts new file mode 100644 index 0000000..2845e54 --- /dev/null +++ b/src/commands/vehicle/model.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('model') + .description(`Generates a vehicle model.`) + .action(() => { + console.log(faker.vehicle.model()); + }); + +export default command; diff --git a/src/commands/vehicle/type.ts b/src/commands/vehicle/type.ts new file mode 100644 index 0000000..ab247d4 --- /dev/null +++ b/src/commands/vehicle/type.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('type') + .description(`Generates a vehicle type.`) + .action(() => { + console.log(faker.vehicle.type()); + }); + +export default command; diff --git a/src/commands/vehicle/vehicle.ts b/src/commands/vehicle/vehicle.ts new file mode 100644 index 0000000..38b7b36 --- /dev/null +++ b/src/commands/vehicle/vehicle.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('vehicle') + .description(`Generates a random vehicle.`) + .action(() => { + console.log(faker.vehicle.vehicle()); + }); + +export default command; diff --git a/src/commands/vehicle/vin.ts b/src/commands/vehicle/vin.ts new file mode 100644 index 0000000..35f878c --- /dev/null +++ b/src/commands/vehicle/vin.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('vin') + .description(`Generates a vehicle identification number (VIN).`) + .action(() => { + console.log(faker.vehicle.vin()); + }); + +export default command; diff --git a/src/commands/vehicle/vrm.ts b/src/commands/vehicle/vrm.ts new file mode 100644 index 0000000..a48f033 --- /dev/null +++ b/src/commands/vehicle/vrm.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('vrm') + .description( + `Generates a vehicle registration number (Vehicle Registration Mark - VRM).`, + ) + .action(() => { + console.log(faker.vehicle.vrm()); + }); + +export default command; diff --git a/src/commands/word/adjective.ts b/src/commands/word/adjective.ts new file mode 100644 index 0000000..1044416 --- /dev/null +++ b/src/commands/word/adjective.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('adjective') + .description(`Generates an adjective of random length.`) + .action(() => { + console.log(faker.word.adjective()); + }); + +export default command; diff --git a/src/commands/word/adverb.ts b/src/commands/word/adverb.ts new file mode 100644 index 0000000..9306c97 --- /dev/null +++ b/src/commands/word/adverb.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('adverb') + .description(`Generates an adverb of random length.`) + .action(() => { + console.log(faker.word.adverb()); + }); + +export default command; diff --git a/src/commands/word/conjunction.ts b/src/commands/word/conjunction.ts new file mode 100644 index 0000000..974aa0d --- /dev/null +++ b/src/commands/word/conjunction.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('conjunction') + .description(`Generates a conjunction of random length.`) + .action(() => { + console.log(faker.word.conjunction()); + }); + +export default command; diff --git a/src/commands/word/index.ts b/src/commands/word/index.ts new file mode 100644 index 0000000..eb76609 --- /dev/null +++ b/src/commands/word/index.ts @@ -0,0 +1,24 @@ +import { Command } from 'commander'; +import adjectiveCommand from './adjective'; +import adverbCommand from './adverb'; +import conjunctionCommand from './conjunction'; +import interjectionCommand from './interjection'; +import nounCommand from './noun'; +import prepositionCommand from './preposition'; +import verbCommand from './verb'; +import sampleCommand from './sample'; +import wordsCommand from './words'; + +const command = new Command('word') + .description(`Module to return various types of words.`) + .addCommand(adjectiveCommand) + .addCommand(adverbCommand) + .addCommand(conjunctionCommand) + .addCommand(interjectionCommand) + .addCommand(nounCommand) + .addCommand(prepositionCommand) + .addCommand(verbCommand) + .addCommand(sampleCommand) + .addCommand(wordsCommand); + +export default command; diff --git a/src/commands/word/interjection.ts b/src/commands/word/interjection.ts new file mode 100644 index 0000000..4903661 --- /dev/null +++ b/src/commands/word/interjection.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('interjection') + .description(`Generates an interjection of random length.`) + .action(() => { + console.log(faker.word.interjection()); + }); + +export default command; diff --git a/src/commands/word/noun.ts b/src/commands/word/noun.ts new file mode 100644 index 0000000..ac88e45 --- /dev/null +++ b/src/commands/word/noun.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('noun') + .description(`Generates a noun of random length.`) + .action(() => { + console.log(faker.word.noun()); + }); + +export default command; diff --git a/src/commands/word/preposition.ts b/src/commands/word/preposition.ts new file mode 100644 index 0000000..0035274 --- /dev/null +++ b/src/commands/word/preposition.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('preposition') + .description(`Generates a preposition of random length.`) + .action(() => { + console.log(faker.word.preposition()); + }); + +export default command; diff --git a/src/commands/word/sample.ts b/src/commands/word/sample.ts new file mode 100644 index 0000000..04cbab2 --- /dev/null +++ b/src/commands/word/sample.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('sample') + .description(`Generates a random sample of random length.`) + .action(() => { + console.log(faker.word.sample()); + }); + +export default command; diff --git a/src/commands/word/verb.ts b/src/commands/word/verb.ts new file mode 100644 index 0000000..31e9689 --- /dev/null +++ b/src/commands/word/verb.ts @@ -0,0 +1,10 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('verb') + .description(`Generates a verb of random length.`) + .action(() => { + console.log(faker.word.verb()); + }); + +export default command; diff --git a/src/commands/word/words.ts b/src/commands/word/words.ts new file mode 100644 index 0000000..d2aa76e --- /dev/null +++ b/src/commands/word/words.ts @@ -0,0 +1,12 @@ +import { Command } from 'commander'; +import { faker } from '@faker-js/faker'; + +const command = new Command('words') + .description( + `Generates a string containing a number of space separated random words.`, + ) + .action(() => { + console.log(faker.word.words()); + }); + +export default command; diff --git a/src/index.ts b/src/index.ts index 3db3fd4..c2ffb14 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,22 @@ -// todo write the application +import { Command } from 'commander'; +import { description, version } from '../package.json'; +import commands from './commands'; + +export function cli(args: string[]) { + const program = new Command() + .name('faker') + .version(version) + .description(description) + .usage('faker [options] module_name entry_name'); + + for (const command of commands) { + program.addCommand(command); + } + + program.parse(args); + + const hasArgs = args.length > 2; + if (!hasArgs) { + program.help(); + } +} diff --git a/tsconfig.json b/tsconfig.json index 28977ea..6e38ae9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,10 +6,13 @@ "forceConsistentCasingInFileNames": true, "module": "commonjs", "outDir": "dist", + "resolveJsonModule": true, "skipLibCheck": true, "strict": true, "target": "ESNext", "useUnknownInCatchVariables": true }, - "include": ["src/**/*.ts"] -} + "include": [ + "src/**/*.ts" + ] +} \ No newline at end of file