(as-float s)
(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"
(as-int s)
(as-str s)
(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.
(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 function for expected type, one of the built-in parsers or
your own (see below). The default is nl.jomco.envopts/as-str
.
The default value for the option. If no default is specified, the key is required.
The key used for the option in the resulting option map. Of not
specified, the key in the specs
is used.
Returns an [options errs]
tuple.
When env
can be parsed into a valid set of options, returns
[options nil]
.
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]].
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close