Namespace cli4clj.cli

cli4clj allows to create simple interactive command line interfaces for Clojure applications.

Other Namespaces

Show/Hide
cli4clj.cli-tests
Helper functions for testing CLIs.
cli4clj.example
This is a simple example for using cli4clj. The example can be run via "lein run".
Index Page
Alphabetic Var Index

Public Vars

Usage Documentation

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

Details of Public Vars

Dynamic Var: *comment-begin-string*

  No docs attached.
Back to top View Source

Dynamic Var: *jline-input-stream*

  No docs attached.
Back to top View Source

Dynamic Var: *jline-output-stream*

  No docs attached.
Back to top View Source

Dynamic Var: *line-sep*

  No docs attached.
Back to top View Source

Function: *read-factory*

Arglists:
=========


Docstring:
==========

  No docs attached.
Back to top View Source

Function: add-args-info

Arglists:
=========

  (add-args-info opts)

Docstring:
==========

  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.
Back to top View Source

Macro: add-args-info-m

Arglists:
=========

  (add-args-info-m opts)

Docstring:
==========

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

Function: alt-scroll-writer

Arglists:
=========

  (alt-scroll-writer options)

Docstring:
==========

  No docs attached.
Back to top View Source

Var: cli-default-options

  No docs attached.
Back to top View Source

Function: cli-repl-print

Arglists:
=========

  (cli-repl-print arg)

Docstring:
==========

  The default repl print function of cli4clj only prints non-nil values.
Back to top View Source

Function: create-arg-hint-completers

Arglists:
=========

  (create-arg-hint-completers cmds)

Docstring:
==========

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

Function: create-cli-eval-fn

Arglists:
=========

  (create-cli-eval-fn opts)

Docstring:
==========

  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.
Back to top View Source

Function: create-cli-help-fn

Arglists:
=========

  (create-cli-help-fn options)

Docstring:
==========

  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.
Back to top View Source

Function: create-embedded-read-fn

Arglists:
=========

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

Docstring:
==========

  This creates a read fn intended for use in the embedded CLI.
Back to top View Source

Function: create-jline-read-fn

Arglists:
=========

  (create-jline-read-fn opts)

Docstring:
==========

  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.
Back to top View Source

Function: create-repl-read-fn

Arglists:
=========

  (create-repl-read-fn opts)

Docstring:
==========

  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.
Back to top View Source

Macro: embedded-cli-fn

Arglists:
=========

  (embedded-cli-fn user-options)

Docstring:
==========

  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.
Back to top View Source

Function: get-cli-mandatory-default-options

Arglists:
=========

  (get-cli-mandatory-default-options)

Docstring:
==========

  Create a map with the mandatory default options.
   The mandatory default options cannot be overridden by the user.
Back to top View Source

Function: get-cli-opts

Arglists:
=========

  (get-cli-opts user-options)

Docstring:
==========

  This function creates the actual cli4clj configuration based on the supplied user configuration.
Back to top View Source

Function: get-cmd-aliases

Arglists:
=========

  (get-cmd-aliases cmds)

Docstring:
==========

  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.
Back to top View Source

Function: get-writer-to-wrap

Arglists:
=========

  (get-writer-to-wrap wrtr options)

Docstring:
==========

  No docs attached.
Back to top View Source

Function: init

Arglists:
=========

  (init options)

Docstring:
==========

  Internal init function for setting up the environment.
Back to top View Source

Function: merge-options

Arglists:
=========

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

Docstring:
==========

  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.
Back to top View Source

Function: print-err-fn

Arglists:
=========

  (print-err-fn arg opts)

Docstring:
==========

  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.
Back to top View Source

Function: resolve-cmd-alias

Arglists:
=========

  (resolve-cmd-alias input-cmd cmds)

Docstring:
==========

  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.
Back to top View Source

Function: set-up-alternate-scrolling

Arglists:
=========

  (set-up-alternate-scrolling
   height
   width
   alternate-height
   alternate-scroll-separator
   prompt-string
   in-rdr
   &
   [entry-message])

Docstring:
==========

  No docs attached.
Back to top View Source

Function: skip-whitespace

Arglists:
=========

  (skip-whitespace s)

Docstring:
==========

  No docs attached.
Back to top View Source

Macro: start-cli

Arglists:
=========

  (start-cli user-options)

Docstring:
==========

  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.
Back to top View Source

Function: windows-workaround

Arglists:
=========

  (windows-workaround)

Docstring:
==========

  No docs attached.
Back to top View Source

Macro: with-alt-scroll-out

Arglists:
=========

  (with-alt-scroll-out & body)

Docstring:
==========

  No docs attached.
Back to top View Source

Macro: wrap-alt-scroll-writer

Arglists:
=========

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

Docstring:
==========

  No docs attached.
Back to top View Source