在 repl 中获取当前 clojure 项目的版本 [英] Getting the version of the current clojure project in the repl
本文介绍了在 repl 中获取当前 clojure 项目的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在clojure repl中抓取项目信息?
Is it possible to grab the project information within the clojure repl?
例如,如果定义了一个项目:
For example, if there was a project defined:
(defproject blahproject "0.1.2" ....)
在项目目录下运行repl时,有没有这样的功能?
When running a repl in the project directory, is there a function like this?
> (project-version)
;=> 0.1.2
推荐答案
Leiningen 项目文件只是 Clojure 数据 :)
Leiningen project files are just Clojure data :)
(-> "/path/to/project.clj" slurp 读取字符串 (nth 2))
这篇关于在 repl 中获取当前 clojure 项目的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文