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 line | 1 | use std::env; |
| 2 | ||
| Add --shout flag that upper-cases the greeting | 3 | use hello::{greeting, parse_args, shout}; |
| Greet people from the command line | 4 | |
| 5 | fn main() { | |
| Add --shout flag that upper-cases the greeting | 6 | let options = parse_args(env::args().skip(1)); |
| Add --version flag that prints the crate version and exits | 7 | if options.version { |
| 8 | println!("{}", env!("CARGO_PKG_VERSION")); | |
| 9 | return; | |
| 10 | } | |
| Greet people from the command line | 11 | // The name given, or whoever is signed in. |
| Add --shout flag that upper-cases the greeting | 12 | let name = options |
| Extract argument parsing into parse_args in lib.rs | 13 | .name |
| Greet people from the command line | 14 | .or_else(|| env::var("USER").ok()) |
| 15 | .unwrap_or_else(|| "world".to_owned()); | |
| Add --shout flag that upper-cases the greeting | 16 | let message = greeting(&name); |
| 17 | println!("{}", if options.shout { shout(&message) } else { message }); | |
| Greet people from the command line | 18 | } |