add alias, fix indentation, remove trailing spaces from cheatsheets.pm

master
Zaahir Moolla 2015-10-22 18:57:57 -04:00
parent 3af2d452a1
commit ae37b4bc9b
2 changed files with 9 additions and 6 deletions

View File

@ -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);

View File

@ -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",