misc/bin/wide
2022-05-20 12:44:13 +02:00

19 lines
436 B
Raku
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env raku
#| convert arguments or stdin to fullwidth characters
unit sub MAIN(*@args);
sub widen(Str $str) {
my %map = (['!'..'~'] Z [''..'']).Map, ' ' => ' ';
my @rejects = $str.comb.grep: {$^x !~~ /\s/ && $^x %map};
note "unknown characters: @rejects.join(', ')" if @rejects;
$str.trans: %map
}
if @args > 0 {
say widen @args.join: ' '
} else {
say widen $_ for $*IN.lines
}
# vim: set ft=raku :