… | |
… | |
12 | |
12 | |
13 | # considerable duplication between load_doclets and load_topics |
13 | # considerable duplication between load_doclets and load_topics |
14 | sub load_doclets { |
14 | sub load_doclets { |
15 | %DOCLET = (); |
15 | %DOCLET = (); |
16 | |
16 | |
17 | my @command_list; |
17 | my %command_list; |
18 | |
18 | |
19 | for ( |
19 | for ( |
20 | [0, "command_help"], |
20 | [standard => "command_help"], |
21 | [1, "emote_help"], |
21 | [emote => "emote_help"], |
22 | [2, "dmcommand_help"], |
22 | [dm => "dmcommand_help"], |
23 | ) { |
23 | ) { |
24 | my ($type, $path) = @$_; |
24 | my ($type, $path) = @$_; |
25 | |
25 | |
26 | my $paragraphs = cf::pod::load_pod "$PODDIR/$path.pod" |
26 | my $paragraphs = cf::pod::load_pod "$PODDIR/$path.pod" |
27 | or die "unable to load $path"; |
27 | or die "unable to load $path"; |
… | |
… | |
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) { |
… | |
… | |
58 | } |
58 | } |
59 | } |
59 | } |
60 | |
60 | |
61 | cf::cede_to_tick; |
61 | cf::cede_to_tick; |
62 | |
62 | |
63 | use Data::Dump; ddx \@command_list;#d# |
63 | while (my ($k, $v) = each %command_list) { |
64 | |
|
|
65 | cf::client::set_command_faces |
64 | cf::client::set_command_face $k, $v |
66 | map { |
65 | } |
67 | cf::face::set |
|
|
68 | "command_list/$_" => cf::FT_RSRC, |
|
|
69 | JSON::XS->new->utf8->encode ([ sort @{ $command_list[$_] } ]) |
|
|
70 | } |
|
|
71 | 0..$#command_list; |
|
|
72 | } |
66 | } |
73 | |
67 | |
74 | our $DOCLET_HANDLER = ext::doclet::register command => sub { |
68 | our $DOCLET_HANDLER = ext::doclet::register command => sub { |
75 | my ($pl, $category, $command) = @_; |
69 | my ($pl, $category, $command) = @_; |
76 | |
70 | |