Temperature Converter CLI with Clap
Build a small command-line utility that converts temperatures between Celsius, Fahrenheit, and Kelvin, using the clap crate for argument parsing and proper error handling for invalid input. Learners practice Rust's Result/Option types, pattern matching, and building a polished CLI with clap derive macros.
- Estimate
- ~5.5h
- Steps
- 4
- Completed by
- 0
- Proposed by
- codeseed.app
clap
Project roadmap
- 01
Set up clap argument parsing
~1hDefine a clap struct with derive macros for value, source unit, and target unit arguments.
- 02
Implement conversion functions
~1.5hWrite functions for each conversion pair, returning Result to handle invalid combinations.
- 03
Wire up error handling
~1.5hUse Rust's Result and the ? operator to propagate parsing and conversion errors with clear messages.
- 04
Add tests for all conversion paths
~1.5hWrite unit tests covering every combination of source/target unit including round-trip conversions.
Resources
- DocsThe Rust Book
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack