@@ -146,27 +146,33 @@ func main() {
146
146
var found bool
147
147
for i := range manifest .Routes {
148
148
rt := & manifest .Routes [i ]
149
- if rt .Title != "Command Line " {
149
+ if rt .Title != "Reference " {
150
150
continue
151
151
}
152
- rt .Children = nil
153
- found = true
154
- for path , cmd := range wroteMap {
155
- relPath , err := filepath .Rel (docsDir , path )
156
- if err != nil {
157
- flog .Fatalf ("getting relative path: %v" , err )
152
+ for j := range rt .Children {
153
+ child := & rt .Children [j ]
154
+ if child .Title != "Command Line" {
155
+ continue
156
+ }
157
+ child .Children = nil
158
+ found = true
159
+ for path , cmd := range wroteMap {
160
+ relPath , err := filepath .Rel (docsDir , path )
161
+ if err != nil {
162
+ flog .Fatalf ("getting relative path: %v" , err )
163
+ }
164
+ child .Children = append (child .Children , route {
165
+ Title : fullName (cmd ),
166
+ Description : cmd .Short ,
167
+ Path : relPath ,
168
+ })
158
169
}
159
- rt . Children = append ( rt . Children , route {
160
- Title : fullName ( cmd ),
161
- Description : cmd . Short ,
162
- Path : relPath ,
170
+ // Sort children by title because wroteMap iteration is
171
+ // non-deterministic.
172
+ sort . Slice ( child . Children , func ( i , j int ) bool {
173
+ return child . Children [ i ]. Title < child . Children [ j ]. Title
163
174
})
164
175
}
165
- // Sort children by title because wroteMap iteration is
166
- // non-deterministic.
167
- sort .Slice (rt .Children , func (i , j int ) bool {
168
- return rt .Children [i ].Title < rt .Children [j ].Title
169
- })
170
176
}
171
177
172
178
if ! found {
@@ -183,3 +189,4 @@ func main() {
183
189
flog .Fatalf ("writing manifest: %v" , err )
184
190
}
185
191
}
192
+
0 commit comments