Liking cljdoc? Tell your friends :D

piotr-yuxuan.malli-cli


-parse-optionclj

(-parse-option {:keys [in update-fn arg-number schema] :as value-schema}
               options
               arg
               argstail)

Take the current arglist head arg, the tail args-tail. Depending on the value schema consume some items from the tail and when applicable pass them on toupdate-fn`. This is actually the core of the work that transforms a vector of string to a map of options.

Take the current arglist head `arg`, the tail args-tail`. Depending
on the value schema consume some items from the tail and when
applicable pass them on to `update-fn`. This is actually the core of
the work that transforms a vector of string to a map of options.
sourceraw docstring

args-transformerclj

The malli transformer wrapping parse-args. To be used it with m/decode, wrapped by mt/transformer. Merely turn a sequence of arguments args into a map that (maybe) conforms to a schema. You can compose this transformer to further refine command-line argument parsing. See simple-cli-transformer for an example.

The malli transformer wrapping `parse-args`. To be used it with
`m/decode`, wrapped by `mt/transformer`. Merely turn a sequence of
arguments `args` into a map that (maybe) conforms to a `schema`. You
can compose this transformer to further refine command-line argument
parsing. See `simple-cli-transformer` for an example.
sourceraw docstring

break-long-option-and-valueclj

(break-long-option-and-value arg argstail)

Expand an argument that contains both an option label and a value into two arguments: the label, and the value.

Expand an argument that contains both an option label and a value
into two arguments: the label, and the value.
sourceraw docstring

break-short-option-groupclj

(break-short-option-group label+value-schemas arg argstail)

Expand a group of short option labels into a several short labels and interpolate them with the tail of the arglist args-tail` depending on the number of arguments each option needs.

Expand a group of short option labels into a several short labels and
interpolate them with the tail of the arglist args-tail` depending
on the number of arguments each option needs. 
sourceraw docstring

children-successorclj

(children-successor schema)

Given a schema [:enum :a :b :c :d], return a Clojure map (that is, a queryable data structure) that returns the next item of :a -> :b -> :c -> :d <-> :d. The last item is mapped onto itself. If the schema has a default value as a property, like in [:enum {:default :b} :a :b :c :d] an additional mapping will be made nil -> :c.

Primarily intended to be used on enum schema for non-idempotent options (like :verbose), but code is generic so you might think of a use case on another schema type.

Given a schema `[:enum :a :b :c :d]`, return a Clojure map (that is,
a queryable data structure) that returns the next item of
:a -> :b -> :c -> :d <-> :d. The last item is mapped onto itself. If
the schema has a default value as a property, like in
`[:enum {:default :b} :a :b :c :d]` an additional mapping will be
made nil -> :c.

Primarily intended to be used on enum schema for non-idempotent
options (like :verbose), but code is generic so you might think of a
use case on another schema type.
sourceraw docstring

cli-transformerclj

Use it for dumb, do-what-I-mean cli args parsing. Simple transformer for the most common use cases when you only want to get a (nested) map of options out of command-line arguments:

  • mt/strip-extra-keys-transformer will remove any extraneous keys;

  • m'/default-value-transformer with :env-var injects environment variables (read at decode time);

  • (mt/default-value-transformer {:key :default}) fills the blank with default values when applicable.

Use it for dumb, do-what-I-mean cli args parsing. Simple transformer
for the most common use cases when you only want to get a (nested)
map of options out of command-line arguments:

- `mt/strip-extra-keys-transformer` will remove any extraneous keys;

- `m'/default-value-transformer` with `:env-var` injects environment
  variables (read at decode time);

- `(mt/default-value-transformer {:key :default})` fills the blank
  with default values when applicable.
sourceraw docstring

default-arg-numberclj

source

default-valueclj

(default-value value-schema)
source

label+value-schemaclj

(label+value-schema {:keys [in schema] :as value-schema})

Return MapEntry items, when applicable one for short, and long option names.

Return `MapEntry` items, when applicable one for short, and long
option names.
sourceraw docstring

long-option->value-schemaclj

(long-option->value-schema default-label value-schema)
source

name-itemsclj

(name-items x)

Take an argument and return a vector of items that will form an option name. For example the option name for :a/b will be a-b.

Take an argument and return a vector of items that will form an
option name. For example the option name for `:a/b` will be a-b.
sourceraw docstring

non-idempotent-optionclj

source

parse-argsclj

(parse-args label+value-schemas args)

Entry point to the technical work of turning a sequence of arguments args into a map that (maybe) conforms to a schema. It returns a map of the options as parsed according to the schema, but with two additional keys:

  • ::operands is a vector of application arguments, that is to say command-line arguments that do not represent an option value.

  • ::cli-args is the raw, untouched vector of command-line arguments received as input. Perhaps you need it for some additional validation of positional logic.

Entry point to the technical work of turning a sequence of arguments
`args` into a map that (maybe) conforms to a `schema`. It returns a
map of the options as parsed according to the schema, but with two
additional keys:

- `::operands` is a vector of application arguments, that is to say
  command-line arguments that do not represent an option value.

- `::cli-args` is the raw, untouched vector of command-line
  arguments received as input. Perhaps you need it for some
  additional validation of positional logic.
sourceraw docstring

ParsingResultclj

source

prefix-shadowingclj

(prefix-shadowing value-schemas)
source

short-option->value-schemaclj

(short-option->value-schema default-label value-schema)
source

start-with?clj

(start-with? prefix path)

Return true if the collection path starts with all the items of collection prefix.

Return true if the collection `path` starts with all the items of
collection `prefix`.
sourceraw docstring

summaryclj

(summary schema)
source

summary-headerclj

source

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

× close