سؤال

I am using lein (leiningen) with clojure - and writing a plugin to automate some common tasks. I would like to have my plugin depend on, and call another plugins functionality - but I am not sure how to do that without something hacky - any ideas?

هل كانت مفيدة؟

المحلول

Just declare the other plugin as a dependency of the one you are working on, then require its namespace in your code and call the functions you need.

;;; 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 ...) ...

See lein-margauto (which depends on lein-marginalia) for an actual working example.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top