flagon-io/hello

public

Greets people from the command line. The sample repository for g1t.

hello/README.md

108 lines3,179 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. |
Catch up with main18| `--both` | Prints the greeting and `Goodbye, NAME!` on one line. |
Document every command-line option in the README19| `--wave` | Prints `o/` after the greeting. |
20| `--quiet` | Prints no greeting at all. `--version` still prints the version. |
Add Usage section to README21
Greet people from the command line22```sh
23$ cargo run -- Ada
Merge #42: Greet with Hi instead of Hello24Hi, Ada!
Greet people from the command line25```
26
Document --shout, --version and --times in README usage27```sh
28$ cargo run -- --shout Ada
Merge #42: Greet with Hi instead of Hello29HI, ADA!
Document --shout, --version and --times in README usage30```
31
32```sh
33$ cargo run -- --times 2 Ada
Merge #42: Greet with Hi instead of Hello34Hi, Ada!
35Hi, Ada!
Document --shout, --version and --times in README usage36```
37
38```sh
Merge #55: Document --lang in the README usage section39$ cargo run -- --lang es Ana
40¡Hola, Ana!
41```
42
43```sh
44$ cargo run -- --lang fr Luc
45Bonjour, Luc !
46```
47
48```sh
Document --shout, --version and --times in README usage49$ cargo run -- --version
500.1.0
51```
52
Document every command-line option in the README53With 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 line54
Add Examples section to the README55## Examples
56
57```sh
58$ cargo run -- --shout --times 2 Ada
59HI, ADA!
60HI, ADA!
61```
62
63```sh
64$ cargo run -- --lang es --times 2 Ana
65¡Hola, Ana!
66¡Hola, Ana!
67```
68
69```sh
70$ cargo run -- --shout --lang fr Luc
71BONJOUR, LUC !
72```
73
Show program output in README74## Output
75
76```sh
77$ cargo run -- Grace
Show Hi in README output example78Hi, Grace!
Show program output in README79```
80
Greet people from the command line81## Develop
82
Mention Rust edition in README Develop section83This project uses the Rust 2021 edition.
84
Greet people from the command line85```sh
86cargo test
87```
Merge main into main88
Add CI workflow for formatting, lints and tests89Every pull request runs formatting, lints and tests.
90
Add Troubleshooting section to README91## Troubleshooting
92
93**`error: --times value must be a number, got "abc"`**
94
95`--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`.
96
Merge #42: Greet with Hi instead of Hello97**The greeting says `Hi, world!` when I gave a name**
Add Troubleshooting section to README98
99An 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"`.
100
Merge #55: Document --lang in the README usage section101**`error: --lang value must be one of en, es, fr, got "de"`**
102
103`--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`.
104
Merge main into main105## License
106
107This project is licensed under the MIT License.
Link MIT license text from README License section108The 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.