… | |
… | |
43 | |
43 | |
44 | my @variants = map "$cmd$_", sort { (length $a) <=> (length $b) } @args; |
44 | my @variants = map "$cmd$_", sort { (length $a) <=> (length $b) } @args; |
45 | |
45 | |
46 | $rpar = \($DOCLET{$cmd} = &cf::pod::as_cfpod ([$par])); |
46 | $rpar = \($DOCLET{$cmd} = &cf::pod::as_cfpod ([$par])); |
47 | |
47 | |
48 | push @command_list, [$type, \@variants]; |
48 | push @{ $command_list[$type] }, @variants; |
49 | $level = $par->{level}; |
49 | $level = $par->{level}; |
50 | } else { |
50 | } else { |
51 | cf::error "$par->{markup}: unparsable command heading"; |
51 | cf::error "$par->{markup}: unparsable command heading"; |
52 | } |
52 | } |
53 | } elsif ($par->{level} > $level) { |
53 | } elsif ($par->{level} > $level) { |
… | |
… | |
56 | |
56 | |
57 | cf::cede_to_tick; |
57 | cf::cede_to_tick; |
58 | } |
58 | } |
59 | } |
59 | } |
60 | |
60 | |
61 | @command_list = sort { |
|
|
62 | $a->[0] <=> $b->[0] |
|
|
63 | or $a->[1] cmp $b->[1] |
|
|
64 | } @command_list; |
|
|
65 | |
|
|
66 | cf::cede_to_tick; |
61 | cf::cede_to_tick; |
67 | |
62 | |
|
|
63 | use Data::Dump; ddx \@command_list;#d# |
|
|
64 | |
|
|
65 | cf::client::set_command_faces |
|
|
66 | map { |
68 | cf::face::set |
67 | cf::face::set |
69 | "res/command_list" => cf::FT_RSRC, |
68 | "command_list/$_" => cf::FT_RSRC, |
70 | JSON::XS->new->utf8->encode (\@command_list); |
69 | JSON::XS->new->utf8->encode ([ sort @{ $command_list[$_] } ]) |
|
|
70 | } |
|
|
71 | 0..$#command_list; |
71 | } |
72 | } |
72 | |
73 | |
73 | our $DOCLET_HANDLER = ext::doclet::register command => sub { |
74 | our $DOCLET_HANDLER = ext::doclet::register command => sub { |
74 | my ($pl, $category, $command) = @_; |
75 | my ($pl, $category, $command) = @_; |
75 | |
76 | |