Liking cljdoc? Tell your friends :D

nl.jomco.envopts


as-floatclj

(as-float s)

as-httpclj

(as-http s)

Parses s as a web address. s must contain the http or https scheme.

Valid: "https://jomco.nl/" Invalid: "mailto:test@example.com" Invalid: "jomco.nl"

Parses s as a web address. s must contain the `http` or `https`
scheme.

Valid: "https://jomco.nl/"
Invalid: "mailto:test@example.com"
Invalid: "jomco.nl"
raw docstring

as-intclj

(as-int s)

as-strclj

(as-str s)

errs-descriptionclj

(errs-description errs)

Return a multi-line string description of the errors, suitable for printing to the user.

Return a multi-line string description of the errors, suitable for
printing to the user.
raw docstring

optsclj

(opts specs)
(opts env specs)

Parse options from the environment map given an option spec.

Returns an [options errs] tuple.

If env is not provided, uses environ.core/env.

specs must be a map of keys to option descriptions, one for every option:

{:environment-key {:parser envopts/as-str :default some-value :opt-key option-key} ...}

:parser

Parser function for expected type, one of the built-in parsers or your own (see below). The default is nl.jomco.envopts/as-str.

:default

The default value for the option. If no default is specified, the key is required.

:opt-key

The key used for the option in the resulting option map. Of not specified, the key in the specs is used.

Return value

Returns an [options errs] tuple.

options

When env can be parsed into a valid set of options, returns [options nil].

errs

When any option cannot be parsed, of when a required option is not provided in env, returns [nil errs]. errs can be printed using errs-description.

Parse options from the environment map given an option spec.

Returns an `[options errs]` tuple.

If `env` is not provided, uses `environ.core/env`.

`specs` must be a map of keys to option descriptions, one for every
option:

  {:environment-key {:parser  envopts/as-str
                     :default some-value
                     :opt-key option-key}
  ...}

## :parser

Parser function for expected type, one of the built-in parsers or
your own (see below). The default is `nl.jomco.envopts/as-str`.

## :default

The default value for the option. If no default is specified, the key
is *required*.

## :opt-key

The key used for the option in the resulting option map. Of not
specified, the key in the `specs` is used.

# Return value

Returns an `[options errs]` tuple.

## options

When `env` can be parsed into a valid set of options, returns
`[options nil]`.

## errs

When any option cannot be parsed, of when a required option is not
provided in `env`, returns `[nil errs]`. `errs` can be printed
using [[errs-description]].
raw docstring

specs-descriptionclj

(specs-description specs)

Return a multi-line string description of the option specs, suitable for printing to the user.

Return a multi-line string description of the option specs, suitable
for printing to the user.
raw docstring

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

× close