Skip to content

Commit 4e14254

Browse files
doc: CLI documentation improvements
1 parent 9b76013 commit 4e14254

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

Sources/CLI/Convert.swift

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,32 @@ struct Convert: ParsableCommand {
55
static var configuration = CommandConfiguration(
66
abstract: "Convert a measurement to a specified unit.",
77
discussion: """
8-
This command uses the unit and measurement serialization format. For more details, see
9-
https://github.com/NeedleInAJayStack/Units/blob/main/README.md#serialization
10-
11-
Note that for convenience, you may use an underscore `_` to represent the normally
12-
serialized space. Also, unless arguments are wrapped in quotes, the `*` character may
13-
need to be escaped.
8+
Run `unit list` to see the supported unit symbols and names. Unless arguments are wrapped \
9+
in quotes, the `*` character may need to be escaped.
1410
15-
Run `unit list` to see the available symbols.
11+
The arguments use the unit and measurement serialization format. For more details, see \
12+
https://github.com/NeedleInAJayStack/Units/blob/main/README.md#serialization
1613
1714
EXAMPLES:
18-
19-
unit convert 1_ft m
20-
unit convert 5.4_kW\\*hr J
21-
unit convert 5.4e-3_km/s mi/hr
22-
unit convert "12 kg*m/s^2" "N"
23-
unit convert 12_m^1\\*s^-1\\*kg^1 kg\\*m/s
15+
unit convert 1_ft m
16+
unit convert 1_ft meter
17+
unit convert 5.4_kW\\*hr J
18+
unit convert 5.4e-3_km/s mi/hr
19+
unit convert "12 kg*m/s^2" "N"
20+
unit convert 12_m^1\\*s^-1\\*kg^1 kg\\*m/s
2421
"""
2522
)
2623

27-
@Argument(help: "The measurement to convert from")
24+
@Argument(help: """
25+
The measurement to convert. This is a number, followed by a space, followed by a unit \
26+
symbol. For convenience, you may use an underscore `_` to represent the space.
27+
""")
2828
var from: Measurement
2929

30-
@Argument(help: "The unit to convert from")
30+
@Argument(help: """
31+
The unit to convert to. This can either be a unit name, a unit symbol, or an equation of \
32+
unit symbols.
33+
""")
3134
var to: Units.Unit
3235

3336
func run() throws {

0 commit comments

Comments
 (0)