No description
Find a file
2025-04-22 21:03:01 +02:00
src fix: add missing tests 2025-04-22 21:03:01 +02:00
.gitignore boilerplate code 2025-04-02 22:45:24 +02:00
Cargo.lock feat: slugify code 2025-04-02 23:19:31 +02:00
Cargo.toml feat: slugify code 2025-04-02 23:19:31 +02:00
README.md generated a README.md 2025-04-02 23:45:36 +02:00

Slugify

A simple command-line tool written in Rust that converts text into URL-friendly slugs.

What is a slug?

A slug is a URL-friendly version of a string, typically used in web applications for creating clean, readable URLs. Slugs are lowercase, contain only alphanumeric characters, underscores, or hyphens, and have no leading or trailing whitespace or special characters.

Features

  • Converts text to lowercase
  • Replaces spaces with hyphens
  • Removes non-alphanumeric characters (except underscores and hyphens)
  • Collapses multiple hyphens into a single hyphen
  • Trims leading and trailing whitespace, hyphens, and underscores

Installation

Prerequisites

Building from source

# Clone the repository
git clone https://github.com/yourusername/slugify.git
cd slugify

# Build the project
cargo build --release

# The binary will be available at target/release/slugify

Usage

slugify [STRINGS]...

Where [STRINGS]... are one or more strings to be slugified. Multiple strings will be joined with spaces before slugification.

Examples

# Basic usage
$ slugify Hello World
hello-world

# Multiple arguments
$ slugify The Quick Brown Fox
the-quick-brown-fox

# Special characters
$ slugify "Hello, World! How are you?"
hello-world-how-are-you

# Multiple hyphens get collapsed
$ slugify "Hello -- World"
hello-world

Help

slugify --help