hello/README.md

99 lines2,425 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`. |
Add Usage section to README14
Greet people from the command line15```sh
16$ cargo run -- Ada
Merge #42: Greet with Hi instead of Hello17Hi, Ada!
Greet people from the command line18```
19
Document --shout, --version and --times in README usage20```sh
21$ cargo run -- --shout Ada
Merge #42: Greet with Hi instead of Hello22HI, ADA!
Document --shout, --version and --times in README usage23```
24
25```sh
26$ cargo run -- --times 2 Ada
Merge #42: Greet with Hi instead of Hello27Hi, Ada!
28Hi, Ada!
Document --shout, --version and --times in README usage29```
30
31```sh
Merge #55: Document --lang in the README usage section32$ cargo run -- --lang es Ana
33¡Hola, Ana!
34```
35
36```sh
37$ cargo run -- --lang fr Luc
38Bonjour, Luc !
39```
40
41```sh
Document --shout, --version and --times in README usage42$ cargo run -- --version
430.1.0
44```
45
Greet people from the command line46With no name it greets whoever is signed in.
47
Add Examples section to the README48## Examples
49
50```sh
51$ cargo run -- --shout --times 2 Ada
52HI, ADA!
53HI, ADA!
54```
55
56```sh
57$ cargo run -- --lang es --times 2 Ana
58¡Hola, Ana!
59¡Hola, Ana!
60```
61
62```sh
63$ cargo run -- --shout --lang fr Luc
64BONJOUR, LUC !
65```
66
Show program output in README67## Output
68
69```sh
70$ cargo run -- Grace
Show Hi in README output example71Hi, Grace!
Show program output in README72```
73
Greet people from the command line74## Develop
75
Mention Rust edition in README Develop section76This project uses the Rust 2021 edition.
77
Greet people from the command line78```sh
79cargo test
80```
Merge main into main81
Add Troubleshooting section to README82## Troubleshooting
83
84**`error: --times value must be a number, got "abc"`**
85
86`--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`.
87
Merge #42: Greet with Hi instead of Hello88**The greeting says `Hi, world!` when I gave a name**
Add Troubleshooting section to README89
90An 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"`.
91
Merge #55: Document --lang in the README usage section92**`error: --lang value must be one of en, es, fr, got "de"`**
93
94`--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`.
95
Merge main into main96## License
97
98This project is licensed under the MIT License.
Link MIT license text from README License section99The 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.