first
This commit is contained in:
commit
8f688f4105
5 changed files with 314 additions and 0 deletions
19
bin/wide
Executable file
19
bin/wide
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/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=perl6 :
|
Loading…
Add table
Add a link
Reference in a new issue