hello/src/main.rs

14 lines409 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
Add --shout flag that upper-cases the greeting3use hello::{greeting, parse_args, shout};
Greet people from the command line4
5fn main() {
Add --shout flag that upper-cases the greeting6 let options = parse_args(env::args().skip(1));
Greet people from the command line7 // The name given, or whoever is signed in.
Add --shout flag that upper-cases the greeting8 let name = options
Extract argument parsing into parse_args in lib.rs9 .name
Greet people from the command line10 .or_else(|| env::var("USER").ok())
11 .unwrap_or_else(|| "world".to_owned());
Add --shout flag that upper-cases the greeting12 let message = greeting(&name);
13 println!("{}", if options.shout { shout(&message) } else { message });
Greet people from the command line14}