+
+(defn unixify
+ "Make a function `f` behave like a UNIX shell command.
+
+ Examples:
+
+ # Multiple arguments
+ $ install-deb url1 url2 url3
+
+ # Read from file with one url on each line
+ $ install-deb `cat urls.txt`
+
+ # Piping from another process
+ $ ls | install-deb # Note: install-deb doesn't work with ls
+ "
+ [f]
+ (when (= *file* (System/getProperty "babashka.file"))
+ (if (> (.available System/in) 0)
+ (->> (slurp *in*)
+ (str/split-lines)
+ (filter seq)
+ (run! f))
+ (->> (vec *command-line-args*)
+ (map #(str/split % #" "))
+ (flatten)
+ (run! f)))))