Skip to content
f-lombardoPublic

About

A simple CLI command to generate sample data

Topics

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

test coverage govulnchecks

generate

generate is a command-line interface (CLI) tool written in Go for quickly generating sample and test data such as IBAN numbers, VAT numbers, UUIDs, and random passwords. It is designed to fit seamlessly into developer workflows by automatically copying generated output directly to the system clipboard.


🚀 Features

  • IBAN Generation: Generates valid IBAN numbers for various supported countries (e.g., Italy IT, Spain ES, Netherlands NL, etc.).
  • VAT Generation: Generates valid VAT numbers for various supported countries (e.g., Italy IT, Spain ES, Netherlands NL, etc.). Only IT is supported at this time.
  • UUID Generation: Supports generating both Version 4 (random) and Version 7 (time-ordered) UUIDs.
  • Password Generation: Generates random passwords with customizable length.
  • Fictional persona data with fiscal code: Generates random data for fictional persons with their (Italian) fiscal code.
  • Clipboard Integration: Automatically copies generated values to the system clipboard (can be disabled via flag).
  • Flexible Output Formats: Supports plain text (tab) and JSON (json) output.

📦 Installation & Build

Installing with Homebrew

# 1. Add repository (Tap)
brew tap f-lombardo/tools

# 2. Trust the generate formula (needed by Homebrew 6.0+)
brew trust --formula f-lombardo/tools/generate

# 3. Install the program
brew install generate

Building from Source

(Go 1.27 or higher is required.)

Clone the repository and build the binary using Makefile:

make build

Or directly using go:

go build -o generate .

You can move the compiled binary into a directory in your $PATH (e.g., /usr/local/bin or ~/bin) to run it from anywhere:

mv generate /usr/local/bin/

Installing with go install

go install github.com/f-lombardo/generate@latest

🛠 Usage

General syntax:

generate [global options] <command> [command options]

Global Options

Option Type Default Description
-clipboard bool true Automatically copies results to the system clipboard. Use -clipboard=false to disable.
-output string tab Output format. Supported values: tab (plain text) or json.
-version Prints current version and exits.

📋 Available Commands

1. iban

Generates a syntactically valid IBAN.

Command Options:

  • -country (string, default: IT): ISO 3166-1 alpha-2 country code (e.g., IT, ES, DE, FR, NL).

Examples:

# Generate an Italian IBAN and copy it to clipboard
generate iban

# Generate a Spanish IBAN
generate iban -country ES

# Format output as JSON
generate -output json iban -country IT

2. uuid

Generates a Universally Unique Identifier (UUID).

Command Options:

  • -version (string, default: 4): UUID version to generate (4 for random UUID, 7 for time-ordered UUID).

Examples:

# Generate a UUID v4 (default)
generate uuid

# Generate a UUID v7 (time-ordered)
generate uuid -version 7

# Generate a UUID v4 in JSON format
generate -output json uuid

3. password

Generates a random password.

Command Options:

  • -length (int, default: 14): Length of the password (minimum 4).

Examples:

# Generate a random password of default length (14)
generate password

# Generate a password with custom length of 20
generate password -length 20

# Generate a password in JSON format
generate -output json password

4. vat

Generates a syntactically valid VAT number.

Command Options:

  • -country (string, default: IT): ISO 3166-1 alpha-2 country code (e.g., IT, ES, DE, FR, NL). Only IT is supported at this time.

Examples:

# Generate an Italian VAT number and copy it to clipboard
generate vat

# Generate an Italian VAT number with country flag
generate vat -country IT

# Format output as JSON
generate -output json vat -country IT

5. person

Generates data for a fake person (first name, last name, gender, birth date, place of birth) and computes a valid Italian Fiscal Code (Codice Fiscale).

Command Options:

  • -country (string, default: IT): ISO 3166-1 alpha-2 country code. Only IT is supported at this time.

Examples:

# Generate fake Italian person data with valid Codice Fiscale
generate person

# Format output as JSON
generate -output json person

💡 Advanced Examples

  • Generate an IBAN without copying to clipboard:

    generate -clipboard=false iban -country DE
  • JSON output for use in scripts or pipelines:

    generate -output json uuid -version 7
  • Print application version:

    generate -version

🧪 Running Tests & Quality Checks

To run the unit test suite using Makefile:

make test

Or directly using go:

go test -v -p 1 ./...

Running Code Quality Checks

To run all quality checks (code formatting, golangci-lint, go vet, vulnerability scan with govulncheck, and unit tests):

make quality

📄 License

This project is licensed under the MIT License.

About

A simple CLI command to generate sample data

Topics

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages