Commit

Merge #55: Document --lang in the README usage section

g1t merge queuecommitted Parents3227d44d59bc47Browse files
1 file+15−00/1 viewed
+15−0
1010 | `--shout` | Upper-cases the greeting. |
1111 | `--version` | Prints the crate version and exits. |
1212 | `--times N` | Prints the greeting `N` times. Defaults to 1. |
13+| `--lang LANG` | Greets in the given language. Supported values are `en`, `es` and `fr`. Defaults to `en`. |
1314
1415 ```sh
1516 $ cargo run -- Ada
2829 ```
2930
3031 ```sh
32+$ cargo run -- --lang es Ana
33+¡Hola, Ana!
34+```
35+
36+```sh
37+$ cargo run -- --lang fr Luc
38+Bonjour, Luc !
39+```
40+
41+```sh
3142 $ cargo run -- --version
3243 0.1.0
3344 ```
5970
6071 An 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"`.
6172
73+**`error: --lang value must be one of en, es, fr, got "de"`**
74+
75+`--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`.
76+
6277 ## License
6378
6479 This project is licensed under the MIT License.