### 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 cfg subcmd 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
(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.
(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.
(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.
(list-positional-parms cfg subcmd)
Extracts all positional parameters from the configuration.
Extracts all positional parameters from the configuration.
(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
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close