hello/README.md

107 lines3,110 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. |
Add --whisper flag11| `--whisper` | Lower-cases the greeting and ends it with `...` instead of `!`. With `--shout`, the last one given wins. |
Add --reverse flag12| `--reverse` | Spells the name backwards. Applies to the default name too. |
Document --shout, --version and --times in README usage13| `--version` | Prints the crate version and exits. |
14| `--times N` | Prints the greeting `N` times. Defaults to 1. |
Merge #55: Document --lang in the README usage section15| `--lang LANG` | Greets in the given language. Supported values are `en`, `es` and `fr`. Defaults to `en`. |
Document every command-line option in the README16| `--loud`, `-L` | Ends the greeting with `!!!` instead of `!`. |
17| `--bye` | Prints `Goodbye, NAME!` after the greeting. |
18| `--wave` | Prints `o/` after the greeting. |
19| `--quiet` | Prints no greeting at all. `--version` still prints the version. |
Add Usage section to README20
Greet people from the command line21```sh
22$ cargo run -- Ada
Merge #42: Greet with Hi instead of Hello23Hi, Ada!
Greet people from the command line24```
25
Document --shout, --version and --times in README usage26```sh
27$ cargo run -- --shout Ada
Merge #42: Greet with Hi instead of Hello28HI, ADA!
Document --shout, --version and --times in README usage29```
30
31```sh
32$ cargo run -- --times 2 Ada
Merge #42: Greet with Hi instead of Hello33Hi, Ada!
34Hi, Ada!
Document --shout, --version and --times in README usage35```
36
37```sh
Merge #55: Document --lang in the README usage section38$ cargo run -- --lang es Ana
39¡Hola, Ana!
40```
41
42```sh
43$ cargo run -- --lang fr Luc
44Bonjour, Luc !
45```
46
47```sh
Document --shout, --version and --times in README usage48$ cargo run -- --version
490.1.0
50```
51
Document every command-line option in the README52With 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 line53
Add Examples section to the README54## Examples
55
56```sh
57$ cargo run -- --shout --times 2 Ada
58HI, ADA!
59HI, ADA!
60```
61
62```sh
63$ cargo run -- --lang es --times 2 Ana
64¡Hola, Ana!
65¡Hola, Ana!
66```
67
68```sh
69$ cargo run -- --shout --lang fr Luc
70BONJOUR, LUC !
71```
72
Show program output in README73## Output
74
75```sh
76$ cargo run -- Grace
Show Hi in README output example77Hi, Grace!
Show program output in README78```
79
Greet people from the command line80## Develop
81
Mention Rust edition in README Develop section82This project uses the Rust 2021 edition.
83
Greet people from the command line84```sh
85cargo test
86```
Merge main into main87
Add CI workflow for formatting, lints and tests88Every pull request runs formatting, lints and tests.
89
Add Troubleshooting section to README90## Troubleshooting
91
92**`error: --times value must be a number, got "abc"`**
93
94`--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`.
95
Merge #42: Greet with Hi instead of Hello96**The greeting says `Hi, world!` when I gave a name**
Add Troubleshooting section to README97
98An 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"`.
99
Merge #55: Document --lang in the README usage section100**`error: --lang value must be one of en, es, fr, got "de"`**
101
102`--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`.
103
Merge main into main104## License
105
106This project is licensed under the MIT License.
Link MIT license text from README License section107The 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.