hello/README.md

103 lines2,855 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 line1# hello
2
3Greets people from the command line.
4
Add Usage section to README5## Usage
6
7| Argument | Description |
8| -------- | ----------- |
9| `NAME` | Optional. The name to greet. Only the first argument is read. Defaults to the `USER` environment variable, then to `world`. |
Document --shout, --version and --times in README usage10| `--shout` | Upper-cases the greeting. |
11| `--version` | Prints the crate version and exits. |
12| `--times N` | Prints the greeting `N` times. Defaults to 1. |
Merge #55: Document --lang in the README usage section13| `--lang LANG` | Greets in the given language. Supported values are `en`, `es` and `fr`. Defaults to `en`. |
Document every command-line option in the README14| `--loud`, `-L` | Ends the greeting with `!!!` instead of `!`. |
15| `--bye` | Prints `Goodbye, NAME!` after the greeting. |
16| `--wave` | Prints `o/` after the greeting. |
17| `--quiet` | Prints no greeting at all. `--version` still prints the version. |
Add Usage section to README18
Greet people from the command line19```sh
20$ cargo run -- Ada
Merge #42: Greet with Hi instead of Hello21Hi, Ada!
Greet people from the command line22```
23
Document --shout, --version and --times in README usage24```sh
25$ cargo run -- --shout Ada
Merge #42: Greet with Hi instead of Hello26HI, ADA!
Document --shout, --version and --times in README usage27```
28
29```sh
30$ cargo run -- --times 2 Ada
Merge #42: Greet with Hi instead of Hello31Hi, Ada!
32Hi, Ada!
Document --shout, --version and --times in README usage33```
34
35```sh
Merge #55: Document --lang in the README usage section36$ cargo run -- --lang es Ana
37¡Hola, Ana!
38```
39
40```sh
41$ cargo run -- --lang fr Luc
42Bonjour, Luc !
43```
44
45```sh
Document --shout, --version and --times in README usage46$ cargo run -- --version
470.1.0
48```
49
Document every command-line option in the README50With no arguments it greets whoever is signed in (the `USER` environment variable), or `world` if that is not set, and prints `Hi, NAME!`. Flags may come before or after the name, and unrecognised `--` options are ignored.
Greet people from the command line51
Add Examples section to the README52## Examples
53
54```sh
55$ cargo run -- --shout --times 2 Ada
56HI, ADA!
57HI, ADA!
58```
59
60```sh
61$ cargo run -- --lang es --times 2 Ana
62¡Hola, Ana!
63¡Hola, Ana!
64```
65
66```sh
67$ cargo run -- --shout --lang fr Luc
68BONJOUR, LUC !
69```
70
Show program output in README71## Output
72
73```sh
74$ cargo run -- Grace
Show Hi in README output example75Hi, Grace!
Show program output in README76```
77
Greet people from the command line78## Develop
79
Mention Rust edition in README Develop section80This project uses the Rust 2021 edition.
81
Greet people from the command line82```sh
83cargo test
84```
Merge main into main85
Add Troubleshooting section to README86## Troubleshooting
87
88**`error: --times value must be a number, got "abc"`**
89
90`--times` needs a whole number of zero or more. If the value is anything else, such as `abc`, `-1` or `2.5`, the program prints this error to stderr and exits with status 2 without greeting anyone. Pass a plain number, for example `--times 3`. A `--times` with no value after it also fails, with `--times requires a value`.
91
Merge #42: Greet with Hi instead of Hello92**The greeting says `Hi, world!` when I gave a name**
Add Troubleshooting section to README93
94An empty or whitespace-only name, such as `cargo run -- ""`, is treated as no name and the greeting uses `world`. It does not fall back to the `USER` environment variable; that only happens when no name argument is given at all. Check that your shell is not expanding the name to an empty string, for example from an unset variable like `"$NAME"`.
95
Merge #55: Document --lang in the README usage section96**`error: --lang value must be one of en, es, fr, got "de"`**
97
98`--lang` only accepts `en`, `es` or `fr`. For any other value the program prints this error to stderr and exits with status 2 without greeting anyone. Pass one of the supported languages, for example `--lang es`.
99
Merge main into main100## License
101
102This project is licensed under the MIT License.
Link MIT license text from README License section103The full license text is available at https://opensource.org/license/mit.

This file's history is long; its oldest lines are credited to the oldest commit read.