Skip to content

Conversation

muminoff
Copy link
Contributor

Summary

Adds comprehensive ULID (Universally Unique Lexicographically Sortable Identifier) generation and manipulation tool to ut.

Features

  • ✅ Generate single or multiple ULIDs with --count flag
  • ✅ Parse ULIDs to extract timestamp, datetime, and bytes
  • ✅ Validate ULID strings
  • ✅ Convert between ULID and UUID formats (bidirectional)

Technical Details

  • Uses ulid crate v1.2.1 with serde and uuid features
  • Includes 8 comprehensive unit tests (all passing)
  • Follows existing tool patterns (similar to UUID and URL tools)
  • Returns JSON output for easy integration
  • Zero compilation warnings

Usage Examples

ut ulid                    # Generate 1 ULID
ut ulid -c 5               # Generate 5 ULIDs
ut ulid parse <ulid>       # Show timestamp and details
ut ulid validate <ulid>    # Check if valid
ut ulid to-uuid <ulid>     # Convert to UUID
ut ulid from-uuid <uuid>   # Convert from UUID

Test Results

All 8 unit tests passing:

  • test_generate_single
  • test_generate_multiple
  • test_validate_valid
  • test_validate_invalid
  • test_parse
  • test_ulid_to_uuid_conversion
  • test_uuid_to_ulid_conversion
  • test_roundtrip_ulid_uuid_ulid

Add comprehensive ULID (Universally Unique Lexicographically Sortable
Identifier) tool with the following features:

- Generate single or multiple ULIDs with --count flag
- Parse ULIDs to extract timestamp, datetime, and bytes
- Validate ULID strings
- Convert between ULID and UUID formats (bidirectional)

Implementation details:
- Uses ulid crate v1.2.1 with serde and uuid features
- Includes 8 comprehensive unit tests (all passing)
- Follows existing tool patterns (similar to UUID and URL tools)
- Returns JSON output for easy integration
- Zero compilation warnings

Usage examples:
  ut ulid                    # Generate 1 ULID
  ut ulid -c 5               # Generate 5 ULIDs
  ut ulid parse <ulid>       # Show timestamp and details
  ut ulid validate <ulid>    # Check if valid
  ut ulid to-uuid <ulid>     # Convert to UUID
  ut ulid from-uuid <uuid>   # Convert from UUID
- Add ULID to Available Tools tree structure
- Document all ULID subcommands and features
- Include usage examples for generation, parsing, validation, and conversion
- Highlight key advantages (sortable, shorter, UUID-compatible)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant