Liking cljdoc? Tell your friends :D

cli-matic.utils

Utilities used in the project

  • the general section contains low-level stuff that could be anywhere
  • the cli-matic section contain low-level functions used by the parser and the help generators.
### Utilities used in the project

* the *general* section contains low-level
  stuff that could be anywhere
* the *cli-matic* section contain low-level functions
  used by the parser and the help generators.


raw docstring

a-positional-parmclj/s

(a-positional-parm args option)

Reads one positional parameter from the arguments. Returns a vector [parm value] The value is NOT solved, so it's always a string.

Reads one positional parameter from the arguments.
Returns a vector [parm value]
The value is NOT solved, so it's always a string.
sourceraw docstring

all-subcommandsclj/s

(all-subcommands climatic-args)

Returns all subcommands, as strings. We get all versions of all subcommands.

Returns all subcommands, as strings.
We get all versions of all subcommands.
sourceraw docstring

all-subcommands-aliasesclj/s

(all-subcommands-aliases climatic-args)

Maps all subcommands and subcommand aliases to their canonical name. E.g. {'add': 'add', 'a': 'add'}.

We basically add them all, then remove nil keys.

Maps all subcommands and subcommand aliases
to their canonical name.
E.g. {'add': 'add', 'a': 'add'}.

We basically add them all, then remove
nil keys.

sourceraw docstring

assoc-new-multivalueclj/s

(assoc-new-multivalue parameter-map option v)

Associates a new multiple value to the current parameter map. If the current value is not a vector, creates a new vector with the new value.

Associates a new multiple value to the
current parameter map.
If the current value is not a vector, creates
a new vector with the new value.
sourceraw docstring

asStringclj/s

(asString s)

Turns a collection of strings into one string, or the string itself.

If the collection includes multiple sub-arrays, those are flattened into lines as well.

Turns a collection of strings into one string,
or the string itself.

If the collection includes multiple sub-arrays,
those are flattened into lines as well.
sourceraw docstring

asStrVecclj/s

(asStrVec s)

Whatever we get in, we want a vector of strings out.

Whatever we get in, we want a vector of strings out.
sourceraw docstring

canonicalize-subcommandclj/s

(canonicalize-subcommand commands subcmd)

Returns the 'canonical' name of a subcommand, i.e. the one that appears in :command, even if we pass an alias or short version.

Returns the 'canonical' name of a subcommand,
i.e. the one that appears in :command, even
if we pass an alias or short version.
sourceraw docstring

capture-positional-parmsclj/s

(capture-positional-parms cfg subcmd remaining-args)

Captures positional parameters in the remaining-args of a subcommand.

Captures positional parameters in the remaining-args of
a subcommand.
sourceraw docstring

cm-opts->cli-optsclj/s

(cm-opts->cli-opts climatic-opts)

Out of a cli-matic arg list, generates a set of options for tools.cli. It also adds in the -? and --help options to trigger display of helpness.

Out of a cli-matic arg list, generates a set of
options for tools.cli.
It also adds in the -? and --help options
to trigger display of helpness.
sourceraw docstring

deep-mergeclj/s

(deep-merge & maps)

Merges a number of maps, considering values in inner maps.

See https://gist.github.com/danielpcox/c70a8aa2c36766200a95#gistcomment-2308595

Merges a number of maps, considering values in inner maps.

See https://gist.github.com/danielpcox/c70a8aa2c36766200a95#gistcomment-2308595
sourceraw docstring

get-cli-optionclj/s

(get-cli-option type)
source

get-options-forclj/s

(get-options-for climatic-args subcmd)

Gets specific :options for a subcommand or, if nil, for global.

Gets specific :options for a subcommand or,
if nil, for global.
sourceraw docstring

get-subcommandclj/s

(get-subcommand climatic-args subcmd)

Given args and the canonical name of a subcommand, returns the map describing it.

Given args and the canonical name of a subcommand,
returns the map describing it.
sourceraw docstring

indentclj/s

(indent s)

Indents a single string, or each string in a collection of strings.

Indents a single string, or each string
in a collection of strings.
sourceraw docstring

indent-stringclj/s

(indent-string s)

Indents a single string by one space.

Indents a single string by one space.
sourceraw docstring

list-positional-parmsclj/s

(list-positional-parms cfg subcmd)

Extracts all positional parameters from the configuration.

Extracts all positional parameters from the configuration.
sourceraw docstring

mk-cli-optionclj/s

(mk-cli-option {:keys [option short as type default multiple env]
                :as cm-option})

Builds a tools.cli option out of our own format.

If for-parsing is true, the option will be used for parsing; if false, for generating help messages.

Builds a tools.cli option out of our own format.

If for-parsing is true, the option will be used for parsing;
if false, for generating help messages.

sourceraw docstring

mk-env-nameclj/s

(mk-env-name description env for-parsing?)

Writes a description with the env name by the end.

Writes a description with the env name by the end.
sourceraw docstring

padclj/s

(pad s s1 len)

Pads 's[, s1]' to so many characters

Pads 's[, s1]' to so many characters
sourceraw docstring

rewrite-optsclj/s

(rewrite-opts climatic-args subcmd)

Out of a cli-matic arg list, generates a set of options for tools.cli. It also adds in the -? and --help options to trigger display of helpness.

Out of a cli-matic arg list, generates a set of
options for tools.cli.
It also adds in the -? and --help options
to trigger display of helpness.
sourceraw docstring

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

× close