File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed
Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change 1+ foofoofoofoo
Original file line number Diff line number Diff line change @@ -4,29 +4,37 @@ def --env "nu-complete jc" [] {
44 }
55
66 let options = try {
7- let options = ^ jc -- help
8- | collect
9- | parse " {_}Parsers:\n {_}\n\n Options:\n {inherent}\n\n Slice:{_}"
10- | get 0
11-
12- let parsers = ^ jc -- about
7+ let about = ^ jc -- about
138 | from json
9+
10+ let magic = $about
11+ | get parsers
12+ | each { { value : $in.magic_commands ? , description : $in.description } }
13+ | where value != null
14+ | flatten
15+
16+ let parsers = $about
1417 | get parsers
1518 | select argument description
1619 | rename value description
1720
18- let inherent = $options.inherent
21+ let inherent = ^ jc -- help
1922 | lines
20- | parse " {short}, {long} {description}"
23+ | split list " " # Group with empty lines as boundary.
24+ | where { $in.0 ? == " Options:" } | get 0 # Get the first section that starts with "Options:"
25+ | skip 1 # Remove header
26+ | each { str trim }
27+ | parse " {short}, {long} {description}"
2128 | update description { str trim }
2229 | each {|record |
2330 [[value , description ];
2431 [$record.short , $record.description ],
25- [$record.long , $record.description ]]
32+ [$record.long , $record.description ],
33+ ]
2634 }
2735 | flatten
2836
29- $parsers ++ $inherent
37+ $magic ++ $ parsers ++ $inherent
3038 } catch {
3139 []
3240 }
You can’t perform that action at this time.
0 commit comments