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:
parent
d6b6e1ac50
commit
0236043fe9
10
applets/unicode.pl
vendored
10
applets/unicode.pl
vendored
@ -3,7 +3,7 @@
|
||||
# SPDX-FileCopyrightText: 2023 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# quick-and-dirty
|
||||
# quick-and-dirty simplified interface to https://github.com/garabik/unicode
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
@ -11,7 +11,7 @@ use strict;
|
||||
use Encode;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ my $args = join ' ', @ARGV;
|
||||
|
||||
my $search = 0;
|
||||
|
||||
if ($args =~ s/^-s\s+// || length $args > 1) {
|
||||
if ($args =~ s/^-s\s+//) {
|
||||
$search = 1;
|
||||
}
|
||||
|
||||
@ -32,9 +32,9 @@ if ($args =~ /^u\+/i) {
|
||||
} elsif ($search) {
|
||||
$result = `unicode -r --color=off \Q$args\E --format 'U+{ordc:04X} {pchar} {name}\n'`;
|
||||
} 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";
|
||||
|
@ -25,7 +25,7 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4637,
|
||||
BUILD_REVISION => 4638,
|
||||
BUILD_DATE => "2023-03-23",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user