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 opts 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

exception-infoclj/s

(exception-info e)

Checks the exception; if it was created using exit! we get that data out; if not, standard exception.

Returns [message exit-code].

To understand whether it was created by exit! we check for a top-secret key with a secret value - pls don't tell anyone, man. You might immanentize the eschaton.

Checks the exception; if it was created using [[exit!]]
we get that data out; if not, standard exception.

Returns [message exit-code].

To understand whether it was created by [[exit!]] we
check for a *top-secret* key with a secret value - pls don't tell
anyone, man. You might immanentize the eschaton.
sourceraw docstring

exit!clj/s

(exit! message errorcode)

Raises an exception that will print a message without the stack trace. Can specify an optional exit code; if not specified, zero.

See exception-info.

Raises an exception that will print a message
without the stack trace. Can specify an optional
exit code; if not specified, zero.

See [[exception-info]].
sourceraw docstring

get-cli-optionclj/s

(get-cli-option type)
source

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

mk-cli-optionclj/s

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

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

mk-long-optclj/s

(mk-long-opt option placeholder type)

Converts long climatic option to long tools.cli option

Converts long climatic option to long tools.cli option
sourceraw docstring

mk-short-optclj/s

(mk-short-opt short)

Converts short climatic option to short tools.cli option

Converts short climatic option to short tools.cli option
sourceraw docstring

padclj/s

(pad s s1 len)

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

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

positional-parms-from-optsclj/s

(positional-parms-from-opts opts)

Returns a list of positional parameters from a subcommand option.

Returns a list of positional parameters from a subcommand option.
sourceraw docstring

printErrclj/s

(printErr s)

Like printString but writes on stderr

Like [[printString]] but writes on stderr
sourceraw docstring

printStringclj/s

(printString s)

Prints a string (either single, or a nested vector of it).

Prints a string (either single, or a nested vector of it).
sourceraw docstring

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

× close