This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-05
Channels
- # beginners (29)
- # boot (29)
- # cider (54)
- # cljs-dev (99)
- # cljsjs (31)
- # cljsrn (39)
- # clojars (32)
- # clojure (171)
- # clojure-austin (2)
- # clojure-berlin (5)
- # clojure-brasil (3)
- # clojure-greece (2)
- # clojure-italy (1)
- # clojure-korea (11)
- # clojure-spec (202)
- # clojure-uk (166)
- # clojurescript (130)
- # cursive (54)
- # datomic (99)
- # dirac (18)
- # figwheel (6)
- # hoplon (23)
- # lambdaisland (3)
- # leiningen (8)
- # luminus (14)
- # off-topic (11)
- # om (3)
- # om-next (24)
- # onyx (59)
- # planck (25)
- # protorepl (10)
- # re-frame (49)
- # reagent (14)
- # ring-swagger (2)
- # rum (46)
- # schema (1)
- # slack-help (6)
- # specter (7)
- # testing (7)
- # untangled (115)
- # yada (1)
Hey @mfikes --- do you have a moment to be bugged with a planck question? Or any other wise people in the room 🙂...
Does planck.shell/sh support piping? I'm trying to achieve the equivalent of echo "#foo\nbar" | pandoc -o fbb.html
in shell (which just generates a html file from a markdown string). Tried the following, which just silently fails:
#!/usr/bin/env planck
(ns panpdf.core
(:require [planck.shell :refer [sh]]))
(def s "#foo\nbar")
(sh "echo" s "|" "pandoc" "-o" "fbb.html")
looking at the return, I seem to be getting:
{:exit 0, :out #foo
bar | pandoc -o fbb.html
, :err }
also tried it with some extra escaped quotes around the string, i.e., (def s "\"#foo\nbar\"")
-- still no dice
Well, piping is an aspect of a shell itself. The sh
function just launches an executable with arguments. I suspect the same would also fail with clojure.java.shell/sh
The only thing I can think to try would be to spit
the string to a temp file and then have pandoc
operate on the file
#!/usr/bin/env planck
(ns panpdf.core
(:require [planck.shell :refer [sh]]))
(def s "\"#foo\nbar\"")
(sh "bash" "-c" (str "echo " s " | pandoc -o fbb.html"))
works! bam!and now I don't have to write any shell or any haskell to manipulate text before sending it to pandoc. bwahahahaha