Liking cljdoc? Tell your friends :D

clj-clapps.core


defcmdcljmacro

(defcmd name docstring? [params*] body)

Like defn, but the resulting function can be invoked from the command line The docstring? and the arguments metadata are used to generate the cli options.

Example: (defcmd say-hello "Say Hello command" [name & [^{:short "-l" :enum ["en" "es"] :default "en"} lang]] ;; do something with name and lang )

The arguments metadata supports the following attributes: :short The short option prefix, e.g "-o" :long? Allow long name option. Defaults to true. Long name is generated from the argument name. :default The default value. :default-fn A function invoke to get the default value :validate A tuple like [validate-fn validate-msg] to validate the passed option value :enum A vector of allowed values :parse-fn A function to convert the option value string to the desired type

Like defn, but the resulting function can be invoked from the command line
The docstring? and the arguments metadata are used to generate the cli options.

Example:
(defcmd say-hello "Say Hello command"
    [name & [^{:short "-l" :enum ["en" "es"] :default "en"} lang]]
    ;; do something with name and lang
    )

The arguments metadata supports the following attributes:
:short			The short option prefix, e.g "-o"
:long?			Allow long name option. Defaults to true. Long name is generated from the argument name.
:default		The default value.
:default-fn	A function invoke to get the default value
:validate		A tuple like [validate-fn validate-msg] to validate the passed option value
:enum				A vector of allowed values
:parse-fn		A function to convert the option value string to the desired type
sourceraw docstring

defoptcljmacro

(defopt name docstring? [options*])

Declares a global variable that's exposed as a command line option. The docstring? and the options are used to generate the cli options. Example: (defopt verbose "Verbosity Level" :long? false :short "-v" :update-fn inc)

The following options are allowed, and have the semantics as the corresponding options in Clojure tools.cli :short The short option prefix, e.g "-o" :long? Allow long name option. Defaults to true. Long name is generated from the argument name. :default The default value. :default-fn A function invoke to get the default value :validate A tuple like [validate-fn validate-msg] to validate the passed option value :enum A vector of allowed values :parse-fn A function to convert the option value string to the desired type

Declares a global variable that's exposed as a command line option.
The docstring? and the options are used to generate the cli options.
Example:
(defopt verbose "Verbosity Level" :long? false :short "-v" :update-fn inc)

The following options are allowed, and have the semantics as the corresponding options in Clojure tools.cli
:short			The short option prefix, e.g "-o"
:long?			Allow long name option. Defaults to true. Long name is generated from the argument name.
:default		The default value.
:default-fn	A function invoke to get the default value
:validate		A tuple like [validate-fn validate-msg] to validate the passed option value
:enum				A vector of allowed values
:parse-fn		A function to convert the option value string to the desired type
sourceraw docstring

exec!clj

(exec! main-class-ns arguments)

Parses the arguments and executes the specified command

Parses the arguments and executes the specified command
sourceraw docstring

exitclj

(exit status msg)

Prints msg and exist with the given status

Prints `msg` and exist with the given `status`
sourceraw docstring

exit-on-errorcljmacro

(exit-on-error action & {:keys [message message-fn]})
source

helpclj

Print help

Print help
sourceraw docstring

promptclj

(prompt message [options*])

Prompts for user input. The following options are supported: :password? If true, it will hide the user input

Prompts for user input.
The following options are supported:
:password?	If true, it will hide the user input
sourceraw docstring

verboseclj

Verbosity level

Verbosity level
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close