| Crates.io | octofhir-ucum-cli |
| lib.rs | octofhir-ucum-cli |
| version | 0.4.0 |
| created_at | 2025-07-20 21:42:15.626048+00 |
| updated_at | 2025-07-28 13:34:07.643934+00 |
| description | UCUM (Unified Code for Units of Measure) command-line interface |
| homepage | https://github.com/octofhir/ucum-rs |
| repository | https://github.com/octofhir/ucum-rs |
| max_upload_size | |
| id | 1761445 |
| size | 46,776 |
Command-line interface for UCUM (Unified Code for Units of Measure) operations.
cargo install octofhir-ucum-cli
octofhir-ucum validate "mg/dL"
# ✅ Valid UCUM expression: mg/dL
octofhir-ucum analyze "mg/dL"
# 📊 Unit Analysis: mg/dL
# Factor: 0.000010
# Dimension: [1, -3, 0, 0, 0, 0, 0]
# Offset: 0.000000
# Dimensionless: false
# Has offset: false
octofhir-ucum canonical "mg/dL"
# 📐 Canonical form of 'mg/dL':
# Unit: kg.m-3
# Factor: 0.000010
# Dimension: [1, -3, 0, 0, 0, 0, 0]
octofhir-ucum convert 100 "mg" "g"
# 100 mg = 0.1 g
octofhir-ucum comparable "mg" "g"
# ✅ 'mg' and 'g' are comparable (can be converted)
octofhir-ucum comparable "mg" "s"
# ❌ 'mg' and 's' are NOT comparable (different dimensions)
octofhir-ucum search "gram" --limit 5
# 🔍 Search results for 'gram':
# ================================
# 1. g - gram [mass]
# 2. kg - kilogram [mass]
# 3. mg - milligram [mass]
# 4. ug - microgram [mass]
# 5. ng - nanogram [mass]
| Command | Description |
|---|---|
validate <expression> |
Validate a UCUM expression |
analyze <expression> |
Analyze unit properties (factor, dimension, etc.) |
canonical <expression> |
Get canonical (base SI) form |
convert <value> <from> <to> |
Convert value between units |
comparable <unit1> <unit2> |
Check if units are comparable |
search <query> |
Search for units by name/code |
Apache-2.0