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

This commit is contained in:
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") ->name("*.json")
->in(share()); ->in(share());
my %results; my %results;
foreach my $file (@files) { foreach my $file (@files) {
open my $fh, $file or warn "Error opening file: $file\n" and next; open my $fh, $file or warn "Error opening file: $file\n" and next;
my $json = do { local $/; <$fh> }; my $json = do { local $/; <$fh> };
@ -37,13 +37,13 @@ sub getAliases {
warn "Failed to decode $file: $@"; warn "Failed to decode $file: $@";
next; next;
}; };
my $defaultName = File::Basename::fileparse($file); my $defaultName = File::Basename::fileparse($file);
$defaultName =~ s/-/ /g; $defaultName =~ s/-/ /g;
$defaultName =~ s/.json//; $defaultName =~ s/.json//;
$results{$defaultName} = $file; $results{$defaultName} = $file;
if ($data->{'aliases'}) { if ($data->{'aliases'}) {
foreach my $alias (@{$data->{'aliases'}}) { foreach my $alias (@{$data->{'aliases'}}) {
$results{$alias} = $file; $results{$alias} = $file;
@ -59,7 +59,7 @@ handle remainder => sub {
# If needed we could jump through a few more hoops to check # If needed we could jump through a few more hoops to check
# terms against file names. # terms against file names.
open my $fh, $aliases->{join(' ', split /\s+/o, lc($_))} or return; open my $fh, $aliases->{join(' ', split /\s+/o, lc($_))} or return;
my $json = do { local $/; <$fh> }; my $json = do { local $/; <$fh> };
my $data = decode_json($json); my $data = decode_json($json);

View File

@ -6,7 +6,10 @@
"sourceName": "WP-CLI", "sourceName": "WP-CLI",
"sourceUrl": "http://wp-cli.org/" "sourceUrl": "http://wp-cli.org/"
}, },
"template_type": "terminal", "aliases": [
"wp-cli"
],
"template_type": "terminal",
"section_order": [ "section_order": [
"Installing", "Installing",
"Core Commands", "Core Commands",