Skip to content

Commit b1b0595

Browse files
authored
Fix missing option value names in manuals (#473)
- Fixes a manual generation bug where options in the synopsis were not given a value name and flags were.
1 parent e978a38 commit b1b0595

File tree

5 files changed

+50
-50
lines changed

5 files changed

+50
-50
lines changed

Tests/ArgumentParserGenerateManualTests/CountLinesGenerateManualTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ final class CountLinesGenerateManualTests: XCTestCase {
2727
.Sh SYNOPSIS
2828
.Nm
2929
.Ar input-file
30-
.Op Fl -prefix
31-
.Op Fl -verbose Ar verbose
32-
.Fl -help Ar help
30+
.Op Fl -prefix Ar prefix
31+
.Op Fl -verbose
32+
.Fl -help
3333
.Sh DESCRIPTION
3434
.Bl -tag -width 6n
3535
.It Ar input-file
@@ -69,9 +69,9 @@ final class CountLinesGenerateManualTests: XCTestCase {
6969
.Sh SYNOPSIS
7070
.Nm
7171
.Ar input-file
72-
.Op Fl -prefix
73-
.Op Fl -verbose Ar verbose
74-
.Fl -help Ar help
72+
.Op Fl -prefix Ar prefix
73+
.Op Fl -verbose
74+
.Fl -help
7575
.Sh DESCRIPTION
7676
.Bl -tag -width 6n
7777
.It Ar input-file

Tests/ArgumentParserGenerateManualTests/MathGenerateManualTests.swift

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ final class MathGenerateManualTests: XCTestCase {
2626
.Sh SYNOPSIS
2727
.Nm
2828
.Ar subcommand
29-
.Fl -version Ar version
30-
.Fl -help Ar help
29+
.Fl -version
30+
.Fl -help
3131
.Sh DESCRIPTION
3232
.Bl -tag -width 6n
3333
.It Fl -version
@@ -131,8 +131,8 @@ final class MathGenerateManualTests: XCTestCase {
131131
.Sh SYNOPSIS
132132
.Nm
133133
.Ar subcommand
134-
.Fl -version Ar version
135-
.Fl -help Ar help
134+
.Fl -version
135+
.Fl -help
136136
.Sh DESCRIPTION
137137
.Bl -tag -width 6n
138138
.It Fl -version
@@ -166,10 +166,10 @@ final class MathGenerateManualTests: XCTestCase {
166166
.Nd "Print the sum of the values."
167167
.Sh SYNOPSIS
168168
.Nm
169-
.Op Fl -hex-output Ar hex-output
169+
.Op Fl -hex-output
170170
.Op Ar values...
171-
.Fl -version Ar version
172-
.Fl -help Ar help
171+
.Fl -version
172+
.Fl -help
173173
.Sh DESCRIPTION
174174
.Bl -tag -width 6n
175175
.It Fl x , -hex-output
@@ -203,10 +203,10 @@ final class MathGenerateManualTests: XCTestCase {
203203
.Nd "Print the product of the values."
204204
.Sh SYNOPSIS
205205
.Nm
206-
.Op Fl -hex-output Ar hex-output
206+
.Op Fl -hex-output
207207
.Op Ar values...
208-
.Fl -version Ar version
209-
.Fl -help Ar help
208+
.Fl -version
209+
.Fl -help
210210
.Sh DESCRIPTION
211211
.Bl -tag -width 6n
212212
.It Fl x , -hex-output
@@ -241,8 +241,8 @@ final class MathGenerateManualTests: XCTestCase {
241241
.Sh SYNOPSIS
242242
.Nm
243243
.Ar subcommand
244-
.Fl -version Ar version
245-
.Fl -help Ar help
244+
.Fl -version
245+
.Fl -help
246246
.Sh DESCRIPTION
247247
.Bl -tag -width 6n
248248
.It Fl -version
@@ -276,10 +276,10 @@ final class MathGenerateManualTests: XCTestCase {
276276
.Nd "Print the average of the values."
277277
.Sh SYNOPSIS
278278
.Nm
279-
.Op Fl -kind
279+
.Op Fl -kind Ar kind
280280
.Op Ar values...
281-
.Fl -version Ar version
282-
.Fl -help Ar help
281+
.Fl -version
282+
.Fl -help
283283
.Sh DESCRIPTION
284284
.Bl -tag -width 6n
285285
.It Fl -kind Ar kind
@@ -314,8 +314,8 @@ final class MathGenerateManualTests: XCTestCase {
314314
.Sh SYNOPSIS
315315
.Nm
316316
.Op Ar values...
317-
.Fl -version Ar version
318-
.Fl -help Ar help
317+
.Fl -version
318+
.Fl -help
319319
.Sh DESCRIPTION
320320
.Bl -tag -width 6n
321321
.It Ar values...
@@ -350,16 +350,16 @@ final class MathGenerateManualTests: XCTestCase {
350350
.Op Ar one-of-four
351351
.Op Ar custom-arg
352352
.Op Ar values...
353-
.Op Fl -test-success-exit-code Ar test-success-exit-code
354-
.Op Fl -test-failure-exit-code Ar test-failure-exit-code
355-
.Op Fl -test-validation-exit-code Ar test-validation-exit-code
356-
.Op Fl -test-custom-exit-code
357-
.Op Fl -file
358-
.Op Fl -directory
359-
.Op Fl -shell
360-
.Op Fl -custom
361-
.Fl -version Ar version
362-
.Fl -help Ar help
353+
.Op Fl -test-success-exit-code
354+
.Op Fl -test-failure-exit-code
355+
.Op Fl -test-validation-exit-code
356+
.Op Fl -test-custom-exit-code Ar test-custom-exit-code
357+
.Op Fl -file Ar file
358+
.Op Fl -directory Ar directory
359+
.Op Fl -shell Ar shell
360+
.Op Fl -custom Ar custom
361+
.Fl -version
362+
.Fl -help
363363
.Sh DESCRIPTION
364364
.Bl -tag -width 6n
365365
.It Ar one-of-four

Tests/ArgumentParserGenerateManualTests/RepeatGenerateManualTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ final class RepeatGenerateManualTests: XCTestCase {
2323
.Nm repeat
2424
.Sh SYNOPSIS
2525
.Nm
26-
.Op Fl -count
27-
.Op Fl -include-counter Ar include-counter
26+
.Op Fl -count Ar count
27+
.Op Fl -include-counter
2828
.Ar phrase
29-
.Fl -help Ar help
29+
.Fl -help
3030
.Sh DESCRIPTION
3131
.Bl -tag -width 6n
3232
.It Fl -count Ar count
@@ -64,10 +64,10 @@ final class RepeatGenerateManualTests: XCTestCase {
6464
.Nm repeat
6565
.Sh SYNOPSIS
6666
.Nm
67-
.Op Fl -count
68-
.Op Fl -include-counter Ar include-counter
67+
.Op Fl -count Ar count
68+
.Op Fl -include-counter
6969
.Ar phrase
70-
.Fl -help Ar help
70+
.Fl -help
7171
.Sh DESCRIPTION
7272
.Bl -tag -width 6n
7373
.It Fl -count Ar count

Tests/ArgumentParserGenerateManualTests/RollDiceGenerateManualTests.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ final class RollDiceGenerateManualTests: XCTestCase {
2323
.Nm roll
2424
.Sh SYNOPSIS
2525
.Nm
26-
.Op Fl -times
27-
.Op Fl -sides
28-
.Op Fl -seed
29-
.Op Fl -verbose Ar verbose
30-
.Fl -help Ar help
26+
.Op Fl -times Ar n
27+
.Op Fl -sides Ar m
28+
.Op Fl -seed Ar seed
29+
.Op Fl -verbose
30+
.Fl -help
3131
.Sh DESCRIPTION
3232
.Bl -tag -width 6n
3333
.It Fl -times Ar n
@@ -69,11 +69,11 @@ final class RollDiceGenerateManualTests: XCTestCase {
6969
.Nm roll
7070
.Sh SYNOPSIS
7171
.Nm
72-
.Op Fl -times
73-
.Op Fl -sides
74-
.Op Fl -seed
75-
.Op Fl -verbose Ar verbose
76-
.Fl -help Ar help
72+
.Op Fl -times Ar n
73+
.Op Fl -sides Ar m
74+
.Op Fl -seed Ar seed
75+
.Op Fl -verbose
76+
.Fl -help
7777
.Sh DESCRIPTION
7878
.Bl -tag -width 6n
7979
.It Fl -times Ar n

Tools/generate-manual/DSL/ArgumentSynopsis.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ struct ArgumentSynopsis: MDocComponent {
3232
// preferredName cannot be nil
3333
let name = argument.preferredName!
3434
return MDocMacro.CommandOption(options: [name.manualPage])
35+
.withUnsafeChildren(nodes: [argument.manualPageValueName])
3536
case .flag:
3637
// preferredName cannot be nil
3738
let name = argument.preferredName!
3839
return MDocMacro.CommandOption(options: [name.manualPage])
39-
.withUnsafeChildren(nodes: [argument.manualPageValueName])
4040
}
4141
}
4242
}

0 commit comments

Comments
 (0)