csv2edn
This commit is contained in:
parent
7e763ee267
commit
1c28b834a3
|
@ -0,0 +1,14 @@
|
||||||
|
/target
|
||||||
|
/classes
|
||||||
|
/checkouts
|
||||||
|
profiles.clj
|
||||||
|
pom.xml
|
||||||
|
pom.xml.asc
|
||||||
|
*.jar
|
||||||
|
*.class
|
||||||
|
/.lein-*
|
||||||
|
/.nrepl-port
|
||||||
|
/.prepl-port
|
||||||
|
.clj-kondo/
|
||||||
|
.lsp/
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
```sh
|
||||||
|
cat *.csv | lein run
|
||||||
|
```
|
|
@ -0,0 +1,11 @@
|
||||||
|
(defproject csv2edn "0.1.0-SNAPSHOT"
|
||||||
|
:description "FIXME: write description"
|
||||||
|
:url "http://example.com/FIXME"
|
||||||
|
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
:url "https://www.eclipse.org/legal/epl-2.0/"}
|
||||||
|
:dependencies [[org.clojure/clojure "1.10.3"]
|
||||||
|
[semantic-csv "0.2.1-alpha1"]]
|
||||||
|
:main ^:skip-aot csv2edn.core
|
||||||
|
:target-path "target/%s"
|
||||||
|
:profiles {:uberjar {:aot :all
|
||||||
|
:jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})
|
|
@ -0,0 +1,17 @@
|
||||||
|
(ns csv2edn.core
|
||||||
|
(:require [clojure.java.io :as io]
|
||||||
|
[clojure-csv.core :as csv]
|
||||||
|
[semantic-csv.core :as sc]
|
||||||
|
[clojure.pprint :refer [pprint]])
|
||||||
|
(:gen-class))
|
||||||
|
|
||||||
|
(defn -main
|
||||||
|
([]
|
||||||
|
(-main "/dev/stdin"))
|
||||||
|
([csv-file & args]
|
||||||
|
(->> (io/reader csv-file)
|
||||||
|
(csv/parse-csv)
|
||||||
|
(sc/mappify {:keyify false})
|
||||||
|
(into [])
|
||||||
|
(pprint))))
|
||||||
|
|
Loading…
Reference in New Issue