Liking cljdoc? Tell your friends :D

cli-matic.utils-v2

Utils to work with nested configuration trees (cfg v2)

  • Convert commands v1 to v2 (fully nested).
  • Accessors for data in a nested structure
#  Utils to work with nested configuration trees (cfg v2)

- Convert commands v1 to v2 (fully nested).
- Accessors for data in a nested structure

raw docstring

add-setup-defaults-v1clj/s

(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.
sourceraw docstring

as-canonical-pathclj/s

(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]].
sourceraw docstring

can-walk?clj/s

(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.
sourceraw docstring

canonical-path-to-stringclj/s

(canonical-path-to-string path)
source

cfg-v2clj/s

(cfg-v2 cfg)

Converts a config object into v2, if not already v2.

 Converts a config object into v2, if not already v2.

sourceraw docstring

convert-config-v1->v2clj/s

(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.

sourceraw docstring

get-most-specific-valueclj/s

(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.

sourceraw docstring

get-options-forclj/s

(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.
sourceraw docstring

get-subcommandclj/s

(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.
sourceraw docstring

is-runnable?clj/s

(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.
sourceraw docstring

isRightCmd?clj/s

(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.
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

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

SETUP-DEFAULTS-v1clj/s

source

walkclj/s

(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:

  • 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.

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]].

sourceraw docstring

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

× close