hello/src/main.rs

12 lines302 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Greet people from the command line1use std::env;
2
Extract argument parsing into parse_args in lib.rs3use hello::{greeting, parse_args};
Greet people from the command line4
5fn main() {
6 // The name given, or whoever is signed in.
Extract argument parsing into parse_args in lib.rs7 let name = parse_args(env::args().skip(1))
8 .name
Greet people from the command line9 .or_else(|| env::var("USER").ok())
10 .unwrap_or_else(|| "world".to_owned());
11 println!("{}", greeting(&name));
12}