3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-22 11:59:43 +01:00

applets/unicode.pl: more concise output; require -s for search

This commit is contained in:
Pragmatic Software 2023-03-23 17:40:06 -07:00
parent d6b6e1ac50
commit 0236043fe9
2 changed files with 6 additions and 6 deletions

10
applets/unicode.pl vendored
View File

@ -3,7 +3,7 @@
# SPDX-FileCopyrightText: 2023 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2023 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# quick-and-dirty # quick-and-dirty simplified interface to https://github.com/garabik/unicode
use warnings; use warnings;
use strict; use strict;
@ -11,7 +11,7 @@ use strict;
use Encode; use Encode;
if (not @ARGV) { if (not @ARGV) {
print "Usage: unicode <character | U+XXXX code-point | search regex>\n"; print "Usage: unicode <character> | <U+XXXX code-point> | -s <search regex>\n";
exit; exit;
} }
@ -21,7 +21,7 @@ my $args = join ' ', @ARGV;
my $search = 0; my $search = 0;
if ($args =~ s/^-s\s+// || length $args > 1) { if ($args =~ s/^-s\s+//) {
$search = 1; $search = 1;
} }
@ -32,9 +32,9 @@ if ($args =~ /^u\+/i) {
} elsif ($search) { } elsif ($search) {
$result = `unicode -r --color=off \Q$args\E --format 'U+{ordc:04X} {pchar} {name}\n'`; $result = `unicode -r --color=off \Q$args\E --format 'U+{ordc:04X} {pchar} {name}\n'`;
} else { } else {
$result = `unicode -s --color=off \Q$args\E`; $result = `unicode -s --color=off \Q$args\E --format 'U+{ordc:04X} ({utf8}) {pchar} {name} Category: {category} ({category_desc}) {opt_unicode_block}{opt_unicode_block_desc}{mirrored_desc}{opt_combining}{combining_desc}{opt_decomp}{decomp_desc}'`;
} }
$result = join '; ', split /\n/, $result; $result = join '; ', split /\n+/, $result;
print "$result\n"; print "$result\n";

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script # These are set by the /misc/update_version script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 4637, BUILD_REVISION => 4638,
BUILD_DATE => "2023-03-23", BUILD_DATE => "2023-03-23",
}; };