Rite CLI¶
Command-line interface for the Rite utility library.
Installation¶
After installing the package:
The rite command will be available:
Usage¶
Version Information¶
Package Information¶
Hash Text¶
Hash text using SHA-256 (default) or MD5:
Generate UUIDs¶
# Generate single UUID
rite uuid
# Generate multiple UUIDs
rite uuid --count 5
# Generate UUID in hex format
rite uuid --hex
Generate URL Slugs¶
Convert Text Case¶
# Snake case
rite case "HelloWorld" --type snake
# Output: hello_world
# Camel case
rite case "hello_world" --type camel
# Output: helloWorld
# Pascal case
rite case "hello_world" --type pascal
# Output: HelloWorld
# Kebab case
rite case "helloWorld" --type kebab
# Output: hello-world
Hash File Contents¶
Command Reference¶
rite info¶
Display package information and available modules.
Options: - None
Example:
rite hash <text>¶
Hash text using cryptographic algorithms.
Arguments:
- text - Text to hash
Options:
- -a, --algorithm {sha256,md5} - Hash algorithm (default: sha256)
Example:
rite uuid¶
Generate UUIDs.
Options:
- -n, --count <number> - Number of UUIDs to generate (default: 1)
- --hex - Output in hex format
Examples:
rite slug <text>¶
Generate URL-friendly slugs.
Arguments:
- text - Text to slugify
Example:
rite case <text>¶
Convert text between different case formats.
Arguments:
- text - Text to convert
Options:
- -t, --type {snake,camel,pascal,kebab} - Target case type (required)
Examples:
rite case "myVariableName" --type snake
# Output: my_variable_name
rite case "my-css-class" --type camel
# Output: myCssClass
rite file-hash <file>¶
Hash file contents.
Arguments:
- file - File to hash
Options:
- -a, --algorithm {sha256,md5} - Hash algorithm (default: sha256)
Example:
Python API¶
You can also use the CLI functions programmatically:
from rite.cli import cli_main
import sys
# Programmatic usage
sys.argv = ["rite", "hash", "test"]
exit_code = cli_main()
Development¶
Run the CLI in development mode:
Error Handling¶
The CLI returns:
- 0 - Success
- 1 - Error (with message printed to stderr)
Example error:
Future Commands¶
Planned additions:
- rite encode/decode - Base64, URL encoding
- rite json - JSON validation and formatting
- rite yaml - YAML operations
- rite template - File templating
- rite convert - Unit conversions
Contributing¶
To add new CLI commands:
- Add command function in
src/rite/cli.py - Register parser in
create_parser() - Add documentation to this file
- Add tests in
tst/cases/test_cli.py