Liking cljdoc? Tell your friends :D

clj-sub-command.core

A simple subcommand parser for Clojure.

A simple subcommand parser for Clojure.
raw docstring

*max-normalized-levenshtein-distance*clj/s

Max value of normalized levenshtein distance used in searching candidate commands. The default value is 0.5.

Max value of normalized levenshtein distance used in searching candidate
commands. The default value is 0.5.
sourceraw docstring

candidate-messageclj/s

(candidate-message candidates)

Returns message for telling a user candidate commands. Returns nil if candidates is empty or nil.

Returns message for telling a user candidate commands. Returns nil if
candidates is empty or nil.
sourceraw docstring

formatcljs

(format fmt & args)
source

parse-cmdsclj/s

(parse-cmds args option-specs command-specs & options)

Parses arguments sequence according to given option and subcommand specifications.

parse-cmds returns a map with seven entries:

{:options The options map, keyed by :id, mapped to the parsed value :command The keyword of the detected subcommand :arguments A vector of unprocessed arguments :options-summary A string containing a minimal options summary :commands-summary A string containing a minimal subcommands summary :errors A possible vector of error message strings generated during parsing; nil when no errors exist :candidates A vector of candidate commands}

A few function options may be specified to influence the behavior of parse-cmds:

:strict Parse required option arguments strictly: if a required argument value matches any other option, it is considered to be missing (and you have a parse error).

:allow-empty-command Allow an empty command if true. By default, the empty command causes "Unknown command" error.

:options-summary-fn A function that receives the sequence of compiled option specs, and returns a custom option summary string.

:commands-summary-fn A function that receives the sequence of compiled command specs, and returns a custom command summary string.

Parses arguments sequence according to given option and subcommand
specifications.

parse-cmds returns a map with seven entries:

  {:options          The options map, keyed by :id, mapped to the parsed value
   :command          The keyword of the detected subcommand
   :arguments        A vector of unprocessed arguments
   :options-summary  A string containing a minimal options summary
   :commands-summary A string containing a minimal subcommands summary
   :errors           A possible vector of error message strings generated
                     during parsing; nil when no errors exist
   :candidates       A vector of candidate commands}

A few function options may be specified to influence the behavior of
parse-cmds:

  :strict               Parse required option arguments strictly: if a
                        required argument value matches any other option, it
                        is considered to be missing (and you have a parse
                        error).

  :allow-empty-command  Allow an empty command if true. By default, the empty
                        command causes "Unknown command" error.

  :options-summary-fn   A function that receives the sequence of compiled
                        option specs, and returns a custom option summary
                        string.

  :commands-summary-fn  A function that receives the sequence of compiled
                        command specs, and returns a custom command summary
                        string.
sourceraw docstring

sub-commandclj/s

(sub-command args & specs)

THIS IS A LEGACY FUNCTION and may be deprecated in the future. Please use clj-sub-command.core/parse-cmds in new applications.

THIS IS A LEGACY FUNCTION and may be deprecated in the future. Please use
clj-sub-command.core/parse-cmds in new applications.
sourceraw docstring

summarize-cmdsclj/s

(summarize-cmds command-specs)

Reduces subcommands specs into a subcommands summary for printing at a terminal.

Reduces subcommands specs into a subcommands summary for printing at a
terminal.
sourceraw docstring

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

× close