octofhir-ucum-cli

Crates.iooctofhir-ucum-cli
lib.rsoctofhir-ucum-cli
version0.4.0
created_at2025-07-20 21:42:15.626048+00
updated_at2025-07-28 13:34:07.643934+00
descriptionUCUM (Unified Code for Units of Measure) command-line interface
homepagehttps://github.com/octofhir/ucum-rs
repositoryhttps://github.com/octofhir/ucum-rs
max_upload_size
id1761445
size46,776
Alexander Streltsov (octoshikari)

documentation

https://github.com/octofhir/ucum-rs

README

UCUM CLI

Command-line interface for UCUM (Unified Code for Units of Measure) operations.

Installation

cargo install octofhir-ucum-cli

Usage

Validate UCUM expressions

octofhir-ucum validate "mg/dL"
# ✅ Valid UCUM expression: mg/dL

Analyze unit expressions

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

Get canonical forms

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]

Convert between units

octofhir-ucum convert 100 "mg" "g"
# 100 mg = 0.1 g

Check unit compatibility

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)

Search for units

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]

Commands

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

License

Apache-2.0

Commit count: 0

cargo fmt