add alias, fix indentation, remove trailing spaces from cheatsheets.pm
This commit is contained in:
parent
3af2d452a1
commit
ae37b4bc9b
@ -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);
|
||||||
|
|
||||||
|
@ -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",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user