我正在使用clojure使用Lein(Leiningen) - 并编写一个插件来自动执行一些常见的任务。我想让我的插件依靠,并致电另一个插件功能 - 但是我不确定没有任何东西的想法,该怎么做?

有帮助吗?

解决方案

只需将另一个插件声明为您正在处理的插件的依赖项,然后在代码中需要其名称空间并调用所需的函数。

;;; in project.clj
(defproject your-plugin "0.1.0-SNAPSHOT"
   :dependencies [... [other-plugin "1.2.3"] ...]
   )

;;; in src/leiningen/your_plugin.clj
(ns leiningen.your-plugin
  (:require [leiningen.other-plugin :as other])
  ...)

... (other/foo ...) ...

Lein-Margauto (这取决于 Lein-Marginalia)对于实际的工作示例。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top