Back
cli (clj)
(source)function
(cli args & specs)
THIS IS A LEGACY FUNCTION and is deprecated. Please use
clojure.tools.cli/parse-opts in new applications.
Parse the provided args using the given specs. Specs are vectors
describing a command line argument. For example:
["-p" "--port" "Port to listen on" :default 3000 :parse-fn #(Integer/parseInt %)]
First provide the switches (from least to most specific), then a doc
string, and pairs of options.
Valid options are :default, :parse-fn, and :flag. See
https://github.com/clojure/tools.cli/wiki/Documentation-for-0.2.4 for more
detailed examples.
Returns a vector containing a map of the parsed arguments, a vector
of extra arguments that did not match known switches, and a
documentation banner to provide usage instructions.
Examples
babashka/babashka
(ns babashka.impl.tools.cli
{:no-doc true}
(:require [clojure.tools.cli :as tools.cli]
[sci.core :as sci :refer [copy-var]]))
(def cli-ns (sci/create-ns 'clojure.tools.cli nil))
(def tools-cli-namespace
{'format-lines (copy-var tools.cli/format-lines cli-ns)
'summarize (copy-var tools.cli/summarize cli-ns)
'get-default-options (copy-var tools.cli/get-default-options cli-ns)
'parse-opts (copy-var tools.cli/parse-opts cli-ns)
'make-summary-part (copy-var tools.cli/make-summary-part cli-ns)})