Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Janitor

A simple CLI tool to clean up strings.

  • Lowercase the entire string.
  • Replace accented Latin letters with their unaccented base letter.
  • Replace any sequence of non-alphanumeric characters with a single underscore.
  • Insert an underscore between adjacent numeric and alpha characters.
  • If the string starts with a digit, prepend an underscore.
  • Strip any trailing underscores.

Examples

First Name      ->  first_name
2026 World Cup  ->  _2026_world_cup
col#1           ->  col_1
Amount($)       ->  amount
Café Müller     ->  cafe_muller

Installation

make install   # Builds and installs janitor to ~/.local/bin

Make sure ~/.local/bin is on your PATH.

Usage

janitor -s "string"       # Using flag
janitor "string"          # Positional args
echo "string" | janitor   # Piped

Combining -s with a positional argument is an error, since it's ambiguous which one you meant.

Development

make help       # List all available targets
make build      # Build janitor into bin/
make run        # Run janitor
make test       # Run the test suite
make lint       # Run golangci-lint
make fmt        # Format all Go files
make modernize  # Report modernizable Go patterns
make tidy       # Tidy go.mod and go.sum
make clean      # Remove build artifacts

About

A CLI tool to clean up strings

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages