### 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.
(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.
(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.
(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.
(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.
(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.
(asStrVec s)
Whatever we get in, we want a vector of strings out.
Whatever we get in, we want a vector of strings out.
(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.
(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.
(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.
(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
(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.
(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]].
(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.
(indent-string s)
Indents a single string by one space.
Indents a single string by one space.
(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.
(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.
(mk-long-opt option placeholder type)
Converts long climatic option to long tools.cli option
Converts long climatic option to long tools.cli option
(mk-short-opt short)
Converts short climatic option to short tools.cli option
Converts short climatic option to short tools.cli option
(pad s s1 len)
Pads 's[, s1]' to so many characters
Pads 's[, s1]' to so many characters
(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.
(printErr s)
Like printString
but writes on stderr
Like [[printString]] but writes on stderr
(printString s)
Prints a string (either single, or a nested vector of it).
Prints a string (either single, or a nested vector of it).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close