pesterhazy / bash2bb

44 stars 1 forks source link

Support here-document input #7

Closed dundalek closed 1 year ago

dundalek commented 1 year ago

Given here-document:

cat - <<END
hello
world
END

Errors with Redir Op not implemented

Stacktrace ``` {"Type" "CallExpr", "Args" [{"Parts" [{"Type" "Lit", "Value" "cat"}]} {"Parts" [{"Type" "Lit", "Value" "-"}]}]} ----- Error -------------------------------------------------------------------- Type: java.lang.Exception Message: Redir Op not implemented: Location: /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:149:34 ----- Context ------------------------------------------------------------------ 145: (assoc opts :in (-> redir (get "Word") (get "Parts") only (get "Value"))) 146: ;; else 147: (do 148: (pp cmd) 149: (throw (Exception. (str "Redir Op not implemented: " (get redir "op"))))))) ^--- Redir Op not implemented: 150: {} 151: redirs)] 152: (apply list 153: 'shell 154: (into (if (empty? opts) [] [opts]) ----- Stack trace -------------------------------------------------------------- bash2bb.core - /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:149:34 clojure.core/reduce - bash2bb.core/update-shell - /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:122:27 bash2bb.core/update-shell - /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:33:1 bash2bb.core/stmt->form - /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:156:21 ... (run with --debug to see elided elements) bash2bb.core/bash->bb - /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:246:23 bash2bb.core/bash->bb - /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:245:1 bash2bb.core - /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:259:16 clojure.core/apply - user - :1:37 ```

It could be translated like:

(shell {:in "hello\nworld\n"} "cat" "-")