# Utils to work with nested configuration trees (cfg v2) - Convert commands v1 to v2 (fully nested). - Accessors for data in a nested structure
(add-setup-defaults-v1 supplied-setup)
Adds all elements that need to be in the setup spec but we allow the caller not specify explicitly.
Adds all elements that need to be in the setup spec but we allow the caller not specify explicitly.
(as-canonical-path subcommands)
Gets the canonical path from an executable-sequence
of subcommands, as obtained from walk
.
Gets the canonical path from an executable-sequence of subcommands, as obtained from [[walk]].
(can-walk? cfg path)
Check that you can walk up to a point. It basically traps the exception.
Check that you can walk up to a point. It basically traps the exception.
(cfg-v2 cfg)
Converts a config object into v2, if not already v2.
Converts a config object into v2, if not already v2.
(convert-config-v1->v2 cmd_v1)
Converts a command version 1 to v2.
A command v1 has always an outer ::S/climatic-cfg
while a v2 is fully nested.
Note that even in the case where there is only one command to be run, we still retain the same invocation format as it originally was - no surprises.
Converts a command version 1 to v2. A command v1 has always an outer `::S/climatic-cfg` while a v2 is fully nested. Note that even in the case where there is only one command to be run, we still retain the same invocation format as it originally was - no surprises.
(get-most-specific-value cfg path a-key)
(get-most-specific-value cfg path a-key default)
Given a configuration and a path through it, gets the most specific value for an option.
For example, the help generator might be defined on each subcommand, or on the root node, or nowhere. We always take the most specific value.
If the value is defined nowhere, we return a default.
Given a configuration and a path through it, gets the most specific value for an option. For example, the help generator might be defined on each subcommand, or on the root node, or nowhere. We always take the most specific value. If the value is defined nowhere, we return a default.
(get-options-for cfg path)
Given a configuration and a path through it, returns :opts for the last subcommmand.
Given a configuration and a path through it, returns :opts for the last subcommmand.
(get-subcommand cfg path)
Given a configuration and a path through it, reeturns the last subcommand.
Given a configuration and a path through it, reeturns the last subcommand.
(is-runnable? xp)
Checks if the last element if the executable path is actually runnable, that is, a command.
Checks if the last element if the executable path is actually runnable, that is, a command.
(isRightCmd? command-or-short-name cfg)
Check if this is the right command or not, by name or alias.
Check if this is the right command or not, by name or alias.
(list-positional-parms cfg subcmd)
Extracts all positional parameters from the configuration.
Extracts all positional parameters from the configuration.
(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.
(walk cfg path)
Walks a path through a configuration object, and returns a list of all elements, in order from root to leaf, as an executable path.
Does not assert that the last element is a leaf.
The path:
It is possible to convert an executable-path back
into a path with as-canonical-path
.
Walks a path through a configuration object, and returns a list of all elements, in order from root to leaf, as an executable path. Does not assert that the last element is a leaf. The path: - A subcommand path. - If empty, no subcommands and no globals - Each member is the canonical name of a subcommand. - Each member but the last is of type ::branch-subcommand It is possible to convert an executable-path back into a path with [[as-canonical-path]].
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close