Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lein-binplus instead of lein-bin #48

Merged
merged 3 commits into from
Apr 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[camel-snake-kebab "0.4.0"]]
:profiles {:dev {:dependencies [[org.clojure/clojure "1.8.0"]
[cavia "0.4.0"]]
:plugins [[lein-bin "0.3.5"]
:plugins [[lein-binplus "0.6.2"]
[lein-codox "0.10.3"]
[lein-marginalia "0.9.0" :exclusions [org.clojure/clojure]]
[lein-cloverage "1.0.9" :exclusions [org.clojure/clojure]]]
Expand All @@ -30,7 +30,8 @@
:uberjar {:main cljam.main
:aot :all}}
:aliases {"docs" ["do" "codox" ["marg" "-d" "target/literate" "-m"]]}
:bin {:name "cljam"}
:bin {:name "cljam"
:bootclasspath true}
:codox {:namespaces [#"^cljam\.(?!cli)(?!lsb)(?!main)(?!util)[^\.]+$"]
:output-path "target/docs"
:source-uri "https://github.com/chrovis/cljam/blob/{version}/{filepath}#L{line}"}
Expand Down
17 changes: 14 additions & 3 deletions src/cljam/cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -359,23 +359,33 @@
(level/add-level r w))))
nil)

;; ### version command

(defn version [args]
(let [ver (with-open [r (-> "META-INF/maven/cljam/cljam/pom.properties"
(clojure.java.io/resource)
(clojure.java.io/reader))]
(.getProperty (doto (java.util.Properties.) (.load r)) "version"))]
(exit 0 ver)))

;; Main command
;; ------------

(defn run [args]
(let [[opts cmd args help cands]
(sub-command args
"Usage: cljam {view,convert,sort,index,pileup,faidx,dict} ..."
"Usage: cljam {view,convert,normalize,sort,index,pileup,faidx,dict,level,version} ..."
:options [["-h" "--help" "Show help" :default false :flag true]]
:commands [["view" "Extract/print all or sub alignments in SAM or BAM format."]
["convert" "Convert SAM to BAM or BAM to SAM."]
["normalize" "Normalize references of alignments"]
["normalize" "Normalize references of alignments."]
["sort" "Sort alignments by leftmost coordinates."]
["index" "Index sorted alignment for fast random access."]
["pileup" "Generate pileup for the BAM file."]
["faidx" "Index reference sequence in the FASTA format."]
["dict" "Create a FASTA sequence dictionary file."]
["level" "Add level of alignments."]])]
["level" "Add level of alignments."]
["version" "Print version number."]])]
(when (:help opts)
(exit 0 help))
(case cmd
Expand All @@ -388,6 +398,7 @@
:faidx (faidx args)
:dict (dict args)
:level (level args)
:version (version args)
(do (println "Invalid command. See 'cljam --help'.")
(when (seq cands)
(newline)
Expand Down