Liking cljdoc? Tell your friends :D

noahtheduke.clein.cli


base-help-messageclj

(base-help-message specs cmd-specs)
source

clein-versionclj

source

cli-helpclj

source

cmd-help-messageclj

(cmd-help-message command)
source

make-cmd-summary-partclj

(make-cmd-summary-part spec)
source

parse-commandclj

(parse-command [cmd-arg & args] subcommand-specs)

Inspired by clojure.tools.cli/parse-opts.

Parses a command and optional trailing arguments into a map of the command, the action function, and command-specific options/arguments, along with any errors and all of the command specs for use in printing later.

Given command specification:

["clean" "Clean the target directory." :action #'clean-target :opts [["-p" "--path PATH" "Which directory to clean."]]]

and arguments:

["clean" "--path" "pom.xml"]

[[parse-subcommand]] will return:

{:name "clean" :action #'clean-target :options {:path "pom.xml"} :}

Command specifications are a sequence of vectors with the following format:

[name description :property value]

The first two string parameters in a command spec are positional and optional, and may be nil in order to specify a later parameter. The command name must not begin with a '-' to avoid clashing with flags.

The :property value pairs are mostly optional and take precedence over the positional string arguments. The valid properties are:

:name The name of the command. Must not begin with a '-' to avoid clashing with flags. If a string command name parameter is not given, then this property is mandatory.

:desc An short description of this command. If a string description parameter is not given, then this property is mandatory.

:action The IFn that will be executed if the command is chosen. This property is mandatory.

:opts clojure.tools.cli option spec that will be used if the command is chosen. This property is optional.

       ["clean" "Clean the target directory."
        :action #'clean-target
        :opts [["-p" "--path PATH" "Which directory to clean."]]]

:help Boolean, defaults to true. If logical true, then :opts will be appended with a -h/--help option spec.

If desired, the :property value pairs can be a map literal:

[name description {:property value}]

Inspired by clojure.tools.cli/parse-opts.

Parses a command and optional trailing arguments into a map of the command,
the action function, and command-specific options/arguments, along with any
errors and all of the command specs for use in printing later.

Given command specification:

["clean" "Clean the target directory."
 :action #'clean-target
 :opts [["-p" "--path PATH" "Which directory to clean."]]]

and arguments:

["clean" "--path" "pom.xml"]

[[parse-subcommand]] will return:

{:name "clean"
 :action #'clean-target
 :options {:path "pom.xml"}
 :}

Command specifications are a sequence of vectors with the following format:

  [name description
   :property value]

The first two string parameters in a command spec are positional and optional,
and may be nil in order to specify a later parameter. The command name must
not begin with a '-' to avoid clashing with flags.

The :property value pairs are mostly optional and take precedence over the
positional string arguments. The valid properties are:

  :name    The name of the command. Must not begin with a '-' to avoid
           clashing with flags. If a string command name parameter is not
           given, then this property is mandatory.

  :desc    An short description of this command. If a string description
           parameter is not given, then this property is mandatory.

  :action  The IFn that will be executed if the command is chosen. This
           property is mandatory.

  :opts    `clojure.tools.cli` option spec that will be used if the command is
           chosen. This property is optional.

           ["clean" "Clean the target directory."
            :action #'clean-target
            :opts [["-p" "--path PATH" "Which directory to clean."]]]

  :help    Boolean, defaults to true. If logical true, then `:opts` will be
           appended with a `-h/--help` option spec.

If desired, the :property value pairs can be a map literal:

  [name description
   {:property value}]
sourceraw docstring

parse-optsclj

(parse-opts args
            specs
            &
            {:keys [strict in-order] :or {strict true in-order true}})
source

(print-errors errors)
source

summarize-subcommandsclj

(summarize-subcommands specs)
source

validate-argsclj

(validate-args arguments base-specs command-specs)
source

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

× close