Liking cljdoc? Tell your friends :D

cli4clj.cli

cli4clj allows to create simple interactive command line interfaces for Clojure applications. For an example usage scenario please see the namespace cli4clj.example.

cli4clj allows to create simple interactive command line interfaces for Clojure applications.
For an example usage scenario please see the namespace cli4clj.example.
raw docstring

*comment-begin-string*clj


*jline-input-stream*clj


*jline-output-stream*clj


*line-sep*clj


*read-factory*clj


add-args-infoclj

(add-args-info opts)

This function adds information about the arguments of the commands into the configuration. The default behavior can be overridden by setting :fn-args for commands.

This function adds information about the arguments of the commands into the configuration.
The default behavior can be overridden by setting :fn-args for commands.
raw docstring

add-args-info-mcljmacro

(add-args-info-m opts)

Macro version of add-args-info. This is primarily used for testing and directly forwards the evaluation to add-args-info.

Macro version of add-args-info.
This is primarily used for testing and directly forwards the evaluation to add-args-info.
raw docstring

alt-scroll-writerclj

(alt-scroll-writer options)

cli-default-optionsclj


cli-repl-printclj

(cli-repl-print arg)

The default repl print function of cli4clj only prints non-nil values.

The default repl print function of cli4clj only prints non-nil values.
raw docstring

create-arg-hint-completersclj

(create-arg-hint-completers cmds)

This function creates a vector of jline2 ArgumentCompleter instances for displaying hints related to commands via tab-completion.

This function creates a vector of jline2 ArgumentCompleter instances for displaying hints related to commands via tab-completion.
raw docstring

create-cli-eval-fnclj

(create-cli-eval-fn opts)

This function creates the default eval function as used by cli4clj. When allow-eval is false, only commands defined in cmds will be allowed to be executed. In case of exceptions, print-err will be called with the respective exception as argument.

This function creates the default eval function as used by cli4clj.
When allow-eval is false, only commands defined in cmds will be allowed to be executed.
In case of exceptions, print-err will be called with the respective exception as argument.
raw docstring

create-cli-help-fnclj

(create-cli-help-fn options)

This function is used to create the default help function. The help output is created based on the cli4clj configuration that is passed via the options argument.

This function is used to create the default help function.
The help output is created based on the cli4clj configuration that is passed via the options argument.
raw docstring

create-embedded-read-fnclj

(create-embedded-read-fn opts in-chan)

This creates a read fn intended for use in the embedded CLI.

This creates a read fn intended for use in the embedded CLI.
raw docstring

create-jline-read-fnclj

(create-jline-read-fn opts)

This function creates a read function that leverages jline2 for handling input. Thanks to the functionality provided by jline2, this allows, e.g., command history, command editing, or tab-completion. The input that is read is then forwarded to a repl read function that was created with create-repl-read-fn.

This function creates a read function that leverages jline2 for handling input.
Thanks to the functionality provided by jline2, this allows, e.g., command history, command editing, or tab-completion.
The input that is read is then forwarded to a repl read function that was created with create-repl-read-fn.
raw docstring

create-repl-read-fnclj

(create-repl-read-fn opts)

This function creates a function that is intended to be used as repl read function. The created read function is largely based on the existing repl read function: http://clojure.github.io/clojure/clojure.main-api.html#clojure.main/repl-read The main difference is that if the first argument on a line is a keyword, all elements on that line will be forwarded in a vector instead of being forwarded seperately.

This function creates a function that is intended to be used as repl read function.
The created read function is largely based on the existing repl read function:
http://clojure.github.io/clojure/clojure.main-api.html#clojure.main/repl-read
The main difference is that if the first argument on a line is a keyword,
all elements on that line will be forwarded in a vector instead of being
forwarded seperately.
raw docstring

embedded-cli-fncljmacro

(embedded-cli-fn user-options)

Create an embedded CLI. The embedded CLI is different from the classical CLI that can be created via start-cli in the sense that does not aim at providing an interactive CLI that can be used via a command prompt. An example for a use case of the embedded CLI is as part of a client-server application for which commands can be executed, e.g., remotely on the server from the client. For such use cases, the embedded CLI aims on easing the CLI definition similarly to start-cli.

This macro accepts the same options map as start-cli. It will return a function that accepts string input. The returned function accepts a single string argument that corresponds to the CLI input. It returns the string resulting from evaluating the provided input.

Create an embedded CLI.
The embedded CLI is different from the classical CLI that can be created via start-cli
in the sense that does not aim at providing an interactive CLI that can be used via a command prompt.
An example for a use case of the embedded CLI is as part of a client-server application for which commands
can be executed, e.g., remotely on the server from the client.
For such use cases, the embedded CLI aims on easing the CLI definition similarly to start-cli.

This macro accepts the same options map as start-cli.
It will return a function that accepts string input.
The returned function accepts a single string argument that corresponds to the CLI input.
It returns the string resulting from evaluating the provided input.
raw docstring

get-cli-mandatory-default-optionsclj

(get-cli-mandatory-default-options)

Create a map with the mandatory default options. The mandatory default options cannot be overridden by the user.

Create a map with the mandatory default options.
The mandatory default options cannot be overridden by the user.
raw docstring

get-cli-optsclj

(get-cli-opts user-options)

This function creates the actual cli4clj configuration based on the supplied user configuration.

This function creates the actual cli4clj configuration based on the supplied user configuration.
raw docstring

get-cmd-aliasesclj

(get-cmd-aliases cmds)

This function is used to find all alias definitions for the respective full command definitions. It takes a map of commands as defined in the cli4clj configuration as argument. The returned map maps the keys of the full command definitions to vectors of their corresponding aliases.

This function is used to find all alias definitions for the respective full command definitions.
It takes a map of commands as defined in the cli4clj configuration as argument.
The returned map maps the keys of the full command definitions to vectors of their corresponding aliases.
raw docstring

get-writer-to-wrapclj

(get-writer-to-wrap wrtr options)

initclj

(init options)

Internal init function for setting up the environment.

Internal init function for setting up the environment.
raw docstring

merge-optionsclj

(merge-options defaults user-options mandatory-defaults)

This function merges the user supplied configuration options with the default and mandatory default options. For creating the actual cli4clj configuration, please use get-cli-opts as get-cli-opts will, e.g., also create and inject the help function.

This function merges the user supplied configuration options with the default and mandatory default options.
For creating the actual cli4clj configuration, please use get-cli-opts as get-cli-opts will, e.g., also create and inject the help function.
raw docstring

(print-err-fn arg opts)

This is the default function for printing error messages. If the supplied argument is an exception, the exception message will be printed to stderr. Otherwise, the string representation of the passed argument is printed to stderr.

This is the default function for printing error messages.
If the supplied argument is an exception, the exception message will be printed to stderr.
Otherwise, the string representation of the passed argument is printed to stderr.
raw docstring

resolve-cmd-aliasclj

(resolve-cmd-alias input-cmd cmds)

This function is used to resolve the full command definition for a given command alias. If a full command definition is passed as input-cmd, the input-cmd will be returned as-is. If an alias is passed as input-cmd, the full command definition will be looked up in cmds and returned.

This function is used to resolve the full command definition for a given command alias.
If a full command definition is passed as input-cmd, the input-cmd will be returned as-is.
If an alias is passed as input-cmd, the full command definition will be looked up in cmds and returned.
raw docstring

set-up-alternate-scrollingclj

(set-up-alternate-scrolling height width alternate-height prompt-string in-rdr)

start-clicljmacro

(start-cli user-options)

This is the primary entry point for starting and configuring cli4clj. Please note that the configuration options can also be defined in a global or local var. However, in order to lookup arguments defined in anonymous functions, the configuration options have to be defined directly in the macro call.

This is the primary entry point for starting and configuring cli4clj.
Please note that the configuration options can also be defined in a global or local var.
However, in order to lookup arguments defined in anonymous functions, the configuration options have to be defined directly in the macro call.
raw docstring

with-alt-scroll-outcljmacro

(with-alt-scroll-out & body)

wrap-alt-scroll-writercljmacro

(wrap-alt-scroll-writer wrtr options & body)

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

× close