Skip to content

Commit

Permalink
add projectsof script
Browse files Browse the repository at this point in the history
  • Loading branch information
somecho committed May 12, 2023
1 parent 971860d commit fd7b165
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions projectsof.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bb
(require '[clojure.java.shell :refer [sh]]
'[clojure.string :as str]
'[babashka.fs :as fs])

(defn find-java-projects
[]
(-> (sh "rg"
"--type-add" "settings:settings.gradle"
"--type-add" "pom:pom.xml"
"-tsettings" "-tpom" "--files")
(:out)
(str/split #"\n")
(as-> paths (map #(str (fs/cwd) "/" %) paths))
(as-> fullpaths (map fs/parent fullpaths))
(as-> parent (mapv #(println (str %)) parent))))

(defn assign [project-type]
(case project-type
"java" (find-java-projects)
(println "Project type not supported")))

(assign (first *command-line-args*))


0 comments on commit fd7b165

Please sign in to comment.