add alias, fix indentation, remove trailing spaces from cheatsheets.pm
parent
3af2d452a1
commit
ae37b4bc9b
|
@ -29,7 +29,7 @@ sub getAliases {
|
|||
->name("*.json")
|
||||
->in(share());
|
||||
my %results;
|
||||
|
||||
|
||||
foreach my $file (@files) {
|
||||
open my $fh, $file or warn "Error opening file: $file\n" and next;
|
||||
my $json = do { local $/; <$fh> };
|
||||
|
@ -37,13 +37,13 @@ sub getAliases {
|
|||
warn "Failed to decode $file: $@";
|
||||
next;
|
||||
};
|
||||
|
||||
|
||||
my $defaultName = File::Basename::fileparse($file);
|
||||
$defaultName =~ s/-/ /g;
|
||||
$defaultName =~ s/.json//;
|
||||
|
||||
|
||||
$results{$defaultName} = $file;
|
||||
|
||||
|
||||
if ($data->{'aliases'}) {
|
||||
foreach my $alias (@{$data->{'aliases'}}) {
|
||||
$results{$alias} = $file;
|
||||
|
@ -59,7 +59,7 @@ handle remainder => sub {
|
|||
# If needed we could jump through a few more hoops to check
|
||||
# terms against file names.
|
||||
open my $fh, $aliases->{join(' ', split /\s+/o, lc($_))} or return;
|
||||
|
||||
|
||||
my $json = do { local $/; <$fh> };
|
||||
my $data = decode_json($json);
|
||||
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
"sourceName": "WP-CLI",
|
||||
"sourceUrl": "http://wp-cli.org/"
|
||||
},
|
||||
"template_type": "terminal",
|
||||
"aliases": [
|
||||
"wp-cli"
|
||||
],
|
||||
"template_type": "terminal",
|
||||
"section_order": [
|
||||
"Installing",
|
||||
"Core Commands",
|
||||
|
|
Loading…
Reference in New Issue