Skip to content

Commit

Permalink
Merge pull request #48 from chrovis/feature/lein-binplus
Browse files Browse the repository at this point in the history
Use lein-binplus instead of lein-bin
  • Loading branch information
alumi authored Apr 18, 2017
2 parents b57d314 + 92c1da8 commit e1da2ef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
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

0 comments on commit e1da2ef

Please sign in to comment.