NAME

Lim::CLI - The command line interface to Lim

VERSION

See Lim for version.

SYNOPSIS

    use Lim::CLI;

    $cli = Lim::CLI->new(...);

DESCRIPTION

This is the CLI that takes the input from the user and sends it to the plugin in question. It uses AnyEvent::ReadLine::Gnu if it is available and that enables command line completion and history functions. It will load all modules present on the system and use their CLI part if it exists.

Failing to have a supported readline module it will use a basic AnyEvent::Handle to read each line of input and process it.

Built in commands that can not be used by any plugins are:

    quit - Will quit the CLI exit - Will exit the relative section or quit the CLI help - Will show help for the relative section where the user is

METHODS

$cli = Lim::CLI->new(key => value...)

Create a new Lim::CLI object.

on_quit => $callback->($cli_object)

Callback to call when the CLI quits, either with the user doing CTRL-D, CTRL-C or the command 'quit'.

$cli->process($line)

Process a line of input, called from the input watcher (AnyEvent::ReadLine::Gnu or AnyEvent::Handle).

$cli->prompt

Print the prompt, called from process.

$cli->set_prompt

Set the prompt, called from process.

$cli->clear_line

Reset the input.

$cli->unknown_command

Prints the "unknown command" error if the command can not be found.

$cli->print

Print some output, called from Lim::Component::CLI and here.

$cli->println

Print some output and add a newline, called from Lim::Component::CLI and here.

$cli->print_command_help($module->Commands)

Print the help for all commands from a module.

$cli->Successful

Called from Lim::Component::CLI when a command was successful.

$cli->Error($LimError || @error_text)

Called from Lim::Component::CLI when a command issued an error. The error can be a Lim::Error object or list of strings that will be joined to produce an error string.

$cli->Editor($content)

Call up an editor for the $content provided. Will return the new content if it has changed or undef on error or if nothing was changed.

Will use Lim::Config->{cli}->{editor} which will be the environment variable EDITOR or what ever your configure it to be.

AUTHOR

Jerry Lundström, <lundstrom.jerry at gmail.com>

BUGS

Please report any bugs or feature requests to https://github.com/jelu/lim/issues.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Lim::CLI

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012-2013 Jerry Lundström.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.