mirror of
https://github.com/pragma-/pbot.git
synced 2024-10-04 10:28:45 +02:00
Add quotes around keys in more places
This commit is contained in:
parent
1bedb74720
commit
5fe46db2ce
@ -254,13 +254,15 @@ sub set {
|
||||
my $secondary = $self->find_index($primary, $secondary_index_key);
|
||||
|
||||
if (not $secondary) {
|
||||
my $result = "No such $self->{name} object [$primary_index_key] $secondary_index_key; similiar matches: ";
|
||||
my $secondary_text = $secondary_index_key =~ / / ? "\"$secondary_index_key\"" : $secondary_index_key;
|
||||
my $result = "No such $self->{name} object [$primary_index_key] $secondary_text; similiar matches: ";
|
||||
$result .= $self->levenshtein_matches($primary, $secondary_index_key);
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (not defined $key) {
|
||||
my $result = "[" . ($primary eq '.*' ? 'global' : $primary) . "] $secondary keys:\n";
|
||||
my $secondary_text = $secondary =~ / / ? "\"$secondary\"" : $secondary;
|
||||
my $result = "[" . ($primary eq '.*' ? 'global' : $primary) . "] $secondary_text keys:\n";
|
||||
my $comma = '';
|
||||
foreach my $key (sort keys %{ $self->hash->{$primary}->{$secondary} }) {
|
||||
$result .= $comma . "$key => " . $self->hash->{$primary}->{$secondary}->{$key};
|
||||
@ -278,6 +280,7 @@ sub set {
|
||||
}
|
||||
|
||||
$primary = 'global' if $primary eq '.*';
|
||||
$secondary = "\"$secondary\"" if $secondary =~ / /;
|
||||
return "[$primary] $secondary: '$key' " . (defined $value ? "set to '$value'" : "is not set.");
|
||||
}
|
||||
|
||||
@ -304,6 +307,7 @@ sub unset {
|
||||
$self->save();
|
||||
|
||||
$primary = 'global' if $primary eq '.*';
|
||||
$secondary = "\"$secondary\"" if $secondary =~ / /;
|
||||
return "[$self->{name}] ($primary) $secondary: '$key' unset.";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user