Commit 6e8e91c
authored
fix(cli): fix help message starting with
While testing #110, I realised when running fact with `--help` the usage
message would start with the `Error: ` string, like this:
```
Error: Usage: fact [OPTIONS] [URL]
```
This is due to us incorrectly using the `try_parse` method on our CLI
configuration and propagating the error up. Instead, we can call `parse`
and the application will come to a full stop whenever a wrong argument
is found or the `-h` or `--help` arguments are provided, showing the
correct usage message.
The change also makes it so configuration is parsed before dumping
system information. This is more of a nitpick, having the system
information dumped before the usage message is not a big deal, but I
think this way makes more sense. Additionally, errors parsing
configuration and CLI arguments _should not_ be caused by the actual
system, so I don't think we are losing anything.Error: (#116)1 parent 27fe4c5 commit 6e8e91c
3 files changed
+4
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 6 | | |
12 | 7 | | |
13 | 8 | | |
| |||
0 commit comments