Skip to content

hello/README.md

106 lines3,032 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. |
Document --shout, --version and --times in README usage12| `--version` | Prints the crate version and exits. |
13| `--times N` | Prints the greeting `N` times. Defaults to 1. |
Merge #55: Document --lang in the README usage section14| `--lang LANG` | Greets in the given language. Supported values are `en`, `es` and `fr`. Defaults to `en`. |
Document every command-line option in the README15| `--loud`, `-L` | Ends the greeting with `!!!` instead of `!`. |
16| `--bye` | Prints `Goodbye, NAME!` after the greeting. |
17| `--wave` | Prints `o/` after the greeting. |
18| `--quiet` | Prints no greeting at all. `--version` still prints the version. |
Add Usage section to README19
Greet people from the command line20```sh
21$ cargo run -- Ada
Merge #42: Greet with Hi instead of Hello22Hi, Ada!
Greet people from the command line23```
24
Document --shout, --version and --times in README usage25```sh
26$ cargo run -- --shout Ada
Merge #42: Greet with Hi instead of Hello27HI, ADA!
Document --shout, --version and --times in README usage28```
29
30```sh
31$ cargo run -- --times 2 Ada
Merge #42: Greet with Hi instead of Hello32Hi, Ada!
33Hi, Ada!
Document --shout, --version and --times in README usage34```
35
36```sh
Merge #55: Document --lang in the README usage section37$ cargo run -- --lang es Ana
38¡Hola, Ana!
39```
40
41```sh
42$ cargo run -- --lang fr Luc
43Bonjour, Luc !
44```
45
46```sh
Document --shout, --version and --times in README usage47$ cargo run -- --version
480.1.0
49```
50
Document every command-line option in the README51With 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 line52
Add Examples section to the README53## Examples
54
55```sh
56$ cargo run -- --shout --times 2 Ada
57HI, ADA!
58HI, ADA!
59```
60
61```sh
62$ cargo run -- --lang es --times 2 Ana
63¡Hola, Ana!
64¡Hola, Ana!
65```
66
67```sh
68$ cargo run -- --shout --lang fr Luc
69BONJOUR, LUC !
70```
71
Show program output in README72## Output
73
74```sh
75$ cargo run -- Grace
Show Hi in README output example76Hi, Grace!
Show program output in README77```
78
Greet people from the command line79## Develop
80
Mention Rust edition in README Develop section81This project uses the Rust 2021 edition.
82
Greet people from the command line83```sh
84cargo test
85```
Merge main into main86
Add CI workflow for formatting, lints and tests87Every pull request runs formatting, lints and tests.
88
Add Troubleshooting section to README89## Troubleshooting
90
91**`error: --times value must be a number, got "abc"`**
92
93`--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`.
94
Merge #42: Greet with Hi instead of Hello95**The greeting says `Hi, world!` when I gave a name**
Add Troubleshooting section to README96
97An 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"`.
98
Merge #55: Document --lang in the README usage section99**`error: --lang value must be one of en, es, fr, got "de"`**
100
101`--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`.
102
Merge main into main103## License
104
105This project is licensed under the MIT License.
Link MIT license text from README License section106The 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.