find-depshelpsyouquicklyfinddependenciesviatheClojarsandMavensearchAPIs.Useitviathecommandline,orfromtheREPL.
find-depsutilizesclj-fuzzytorefinethesearchresultsreturnedfromrepositoryAPIs.Italsofactorsinthefreshnessofthedependencies,andthepopularityofthedependency’sgroupID.Wehopethisresultsinanear-perfectsuggestioneverytime!
SeetheFuturesectionbelowforsomeideasaroundwherethiscanbetaken.Inparticular,itwouldbegreattoenablesearchingfordeps.ednfilesongithub…
TL;DRAddadependencytoyourcurrentdeps.ednaseasilyasthis:
clj-A:find-deps-F:savepriority-mapChangelogNotetakenon[2018-06-25Mon10:39]2018-06-25hidesnapshotversionsbydefaultinclojars(fixes#2)2018-06-24merged@pesterhazy’sREADMEfix2018-06-23fixedbugwhereinitwasn’tpossibletosavedepswithoutapreexistingdeps.ednadded-F:cliformatflagtoprintdepsascommandlineoptionto`clojure`binary2018-06-17change-Sflagto-stoavoidconflictwithtools.depsclienablepipingofinvocationstogethertoproducedmergeddeps.ednmapenablesavingofdeps.ednmapwithformat:saverenamed:mergedto:merge2018-06-16InitialcommitCLIUsageTousefind-depsfromthecommandline,createanaliasinyour~/.clojure/deps.ednmap:
{:aliases{:find-deps{:extra-deps{find-deps{:git/url"https://github.com/hagmonk/find-deps",:sha"6fc73813aafdd2288260abb2160ce0d4cdbac8be"}},:main-opts["-m""find-deps.core"]}}}Youcaninvokefind-depswith-htoseethesupportedoptions:
%clj-A:find-deps-hfind-depsUsage:[options*][search-strings*]Options:-s,--sourcesSOURCES:clojars:mvnConcatenatedsourcetypes-R,--rankMETHOD:fuzzyRankingmethod-:fuzzy,:regex-F,--formatFORMAT:depsFormatforprintingresults-:deps,:merge,:table,:save,:cli-l,--limitNUM1Limitper-searchresultstoNUM-h,--helpExamplesSearchforadependencylikehttp-kit:
clj-A:find-depshttp-kit{:deps{http-kit/http-kit{:mvn/version"2.3.0"}}}Searchformultipledependencies:
clj-A:find-depshttp-kittools.loggingpriority-map{:deps{http-kit/http-kit{:mvn/version"2.3.0"},org.clojure/tools.logging{:mvn/version"0.5.0-alpha"},org.clojure/data.priority-map{:mvn/version"0.0.9"}}}Chaintogethermultipleinvocationsusingdifferentqueryarguments:
clj-A:find-deps-s:mvnroaringbitmap|clj-A:find-deps-s:clojars-R:regex-l5io.pedestal{:deps{org.roaringbitmap/RoaringBitmap{:mvn/version"0.7.13"},io.pedestal/pedestal.jetty{:mvn/version"0.5.3"},io.pedestal/pedestal.tomcat{:mvn/version"0.5.3"},io.pedestal/pedestal.log{:mvn/version"0.5.3"},io.pedestal/pedestal.service{:mvn/version"0.5.3"},io.pedestal/pedestal.interceptor{:mvn/version"0.5.3"}}}Mergethesearchresultsintothecurrentproject’sdeps.edn.Youcanalsosavetheseresultstodeps.ednbyspecifying:saveinstead.
clj-A:find-deps-F:mergehttp-kittools.loggingpriority-map{:paths["src"],:deps{org.clojure/clojure{:mvn/version"1.9.0"},org.clojure/tools.logging{:mvn/version"0.5.0-alpha"},org.clojure/spec.alpha{:mvn/version"0.1.143"},clj-fuzzy{:mvn/version"0.4.1"},http-kit{:mvn/version"2.3.0"},tools.deps.alpha{:git/url"https://github.com/clojure/tools.deps.alpha",:sha"884d7ae5b9c228ff795e4385291708102f1cd46d"},metosin/jsonista{:mvn/version"0.1.1"},org.clojure/data.priority-map{:mvn/version"0.0.9"},inflections{:mvn/version"0.13.0"},http-kit/http-kit{:mvn/version"2.3.0"}};;...snip}Stringsearchreturningmultiplematchesinatable:
clj-A:find-deps-F:table-l10"apachekafka"|:lib|:version||-----------------------------------+----------||org.apache.kafka/kafka-tools|1.1.0||org.apache.kafka/kafka_2.9.2|0.8.2.2||org.apache.kafka/kafka_2.9.1|0.8.2.2||org.apache.kafka/kafka_2.8.0|0.8.1.1||org.apache.kafka/kafka_2.8.2|0.8.1||org.apache.hadoop/hadoop-kafka|3.1.0||org.apache.kafka/kafka-streams|1.1.0||org.apache.kafka/kafka-clients|1.1.0||org.apache.kafka/kafka-examples|1.1.0||org.apache.kafka/kafka-perf_2.8.0|0.8.1.1|Printoutacommandlineinvocationofthedeps:
clj-A:find-deps-F:clihttp-kitjsonistaclojure-Sdeps'{:deps{http-kit/http-kit{:mvn/version"2.3.0"},metosin/jsonista{:mvn/version"0.2.1"}}}'APIThefind-deps.corenamespacecontainsanumberofhelpersyoucanusefromtheREPL.Assumingyouhaveanaliasforrebel-readline:
clj-A:rebel[Rebelreadline]Type:repl/helpforonlinehelpinfouser=>(use'find-deps.core)niluser=>(print-deps"http-kit")|:lib|:version||-------------------+----------||http-kit/http-kit|2.3.0|niluser=>(deps"http-kit"){:deps#:http-kit{http-kit#:mvn{:version"2.3.0"}}}Seethefind-deps.corenamespaceformorehelpers.
Future[]searchgithubfordeps.ednfiles[]searchgithubforproject.cljfiles[]pagerankdepsbasedondependencygraph[]recommendedotherdependenciesbasedonclustering[]incorporatedownloadcountsintoweightingfactor[x]supportwritingdirectlyintodeps.edn[]supportadd-lib[]addvalidationsupporttocliparser
评论