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 required arguments are converted to positional command arguments. A vector of optional arguments can be specified, and will be converted to optional command arguments.

The following metadata can be used with required and optional arguments: :doc Argument documentation :validate A tuple like [validate-fn validate-msg] to validate the passed argument value :enum A vector of allowed values :parse-fn A function to convert the option value string to the desired type

The optional arguments additionally support the following metadata: :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

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 required arguments are converted to positional command arguments.
A vector of optional arguments can be specified, and will be converted to optional command arguments.

The following metadata can be used with required and optional arguments:
:doc         Argument documentation
:validate    A tuple like [validate-fn validate-msg] to validate the passed argument value
:enum        A vector of allowed values
:parse-fn    A function to convert the option value string to the desired type

The optional arguments additionally support the following metadata:
: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
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 message)
(exit-on-error action message-fn)

Tries to execute the action, if successful returns action result, otherwise prints the given message to std error

Tries to execute the action, if successful returns action result, otherwise prints the given message to std error
sourceraw docstring

helpclj

Print help

Print help
sourceraw docstring

(print-error msg)
source

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