summaryrefslogtreecommitdiff
path: root/lib/Katana/Exec/Command.rakumod
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Katana/Exec/Command.rakumod')
-rw-r--r--lib/Katana/Exec/Command.rakumod22
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;
+}
+