diff options
| author | Paul Buetow <paul@buetow.org> | 2022-04-20 10:12:14 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-04-20 10:12:14 +0100 |
| commit | 6b0d4ee051f650b46af7ec50acf1122d44088fb5 (patch) | |
| tree | 6f44c35dcce84fac1d242ef356d3d06545678e80 /lib/Katana/Exec | |
| parent | c6a252b79db57f3480221cf25213fb8c0993ac3a (diff) | |
modularize more
Diffstat (limited to 'lib/Katana/Exec')
| -rw-r--r-- | lib/Katana/Exec/Command.rakumod | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Katana/Exec/Command.rakumod b/lib/Katana/Exec/Command.rakumod new file mode 100644 index 0000000..6cf0e38 --- /dev/null +++ b/lib/Katana/Exec/Command.rakumod @@ -0,0 +1,22 @@ +use v6.d; +unit module Katana::Exec::Command:api<1>; + +sub prefix:<❱>(*@args) is export { + say "❱ {@args}"; + my \proc = run @args, :out, :err; + .say if .chars > 0 for proc.out.slurp(:close), proc.err.slurp(:close); +} + +sub prefix:<⁉>(*@args) is export { ❱ @args unless @args[*-1].IO.f } + +sub read-exif-info(Str $file) is export { + my %exif; + my \proc = run 'exiftool', $file, :out; + for proc.out.slurp(:close).split("\n") -> $line { + my ($key, $val) = $line.split(':')[0,1]; + next unless defined $val; + %exif{$key.trim} = $val.trim; + } + return %exif; +} + |
