duologue

https://github.com/mmontone/duologue.git

git clone 'https://github.com/mmontone/duologue.git'

(ql:quickload :duologue)
5

DUOLOGUE

Duologue is high-level interaction library for Common Lisp. Command line interaction is implemented at the moment. It features coloured printing via cl-ansi-text and readline completion.

Functions

ask

(&optional (msg "Yes or no: ") &key (default nil default-p) if-wrong-answer
 (color *prompt-color*) (error-color *prompt-error-color*))

Ask for yes or no.

choose

(msg options &key if-wrong-option default (print-options t) (separator "~%")
 complete completer (color *prompt-color*) (error-color *prompt-error-color*))

Asks the user to choose one of the given options.

Example:

lisp (choose "Choose: " (list "foo" "bar" "baz") :default "baz") Tags: menu, choose

choose-many

(msg options &key if-wrong-option default (print-options t) (separator "~%")
 complete completer (test #'eql) (color *prompt-color*)
 (error-color *prompt-error-color*))

Asks the user to choose many of the given options.

Example:

lisp (choose-many "Choose: " (list "foo" "bar" "baz") :default "baz") Tags: menu, choose

make-list-completer

(options)

Makes a default completer from a list of options

prompt

(&optional msg &key (default nil default-p) (required-p t) validator if-invalid
 parser completer (color *prompt-color*) (error-color *prompt-error-color*))

Prompt for a string.

prompt-datetime

(&optional msg &key default (required-p t) if-invalid (color *prompt-color*)
 (error-color *prompt-error-color*))

Prompts for a timestamp.

Returns: the parsed local-time

The input is parsed with chronicity library and transformed to a local-time. The input is validated and the process does not stop until the user enters a valid timestamp address.

prompt-email

(&optional msg &key default (required-p t) if-invalid (color *prompt-color*)
 (error-color *prompt-error-color*))

Prompts for an email.

Returns: the entered email

The email is validated and the process does not stop until the user enters a valid email address.

prompt-integer

(&optional msg &key default (required-p t) if-invalid (color *prompt-color*)
 (error-color *prompt-error-color*))

Prompts for an integer.

Returns: the entered number

prompt-pathname

(&optional msg &key default (required-p t) if-invalid (color *prompt-color*)
 (error-color *prompt-error-color*) probe if-exists (if-does-not-exist :error)
 absolute-p file-type directory-p (complete t))

Prompts for a pathname.

prompt-url

(&optional msg &key default (required-p t) if-invalid (color *prompt-color*)
 (error-color *prompt-error-color*) probe if-exists (if-does-not-exist :error))

Prompts for an url.

Returns: the entered url

say

(datum &rest args)

Prints a message on the screen.

A newline is printed iff either newline parameter is T or datum doesn't end with a space. That is, if datum ends in a space, then no newline is printed.

Example:

lisp (say "Hello ~A" "John" :color :blue) Categories: printing Tags: printing

Macros

while

(msg (&rest options) &body body)

Asks to repeat a task several times and collects its result.

Returns: A list of collected task results

Example: lisp (while "Add item?: " (:default t) (prompt "Item: ")) Tags: flow

Generic-Functions

Slot-Accessors

Variables

Classs

Conditions

Constants