NAME

Mojo::Commands - Commands

SYNOPSIS

    use Mojo::Commands;

    # Command line interface
    my $commands = Mojo::Commands->new;
    $commands->run(@ARGV);

DESCRIPTION

Mojo::Commands is the interactive command line interface to the Mojo framework. It will automatically detect available commands in the Mojo::Command namespace. Commands are implemented by subclassing Mojo::Command.

These commands are available by default.

help
    mojo
    mojo help

List available commands with short descriptions.

    mojo help <command>

List available options for the command with short descriptions.

cgi
    mojo cgi
    script/myapp cgi

Start application with CGI backend.

daemon
    mojo cgi
    script/myapp daemon

Start application with standalone HTTP 1.1 server backend.

fastcgi
    mojo fastcgi
    script/myapp fastcgi

Start application with FastCGI backend.

get
   mojo get http://mojolicious.org
   script/myapp get /foo

Perform GET request to remote host or local application.

test
   mojo test
   script/myapp test
   script/myapp test t/foo.t

Runs application tests from the t directory.

version
    mojo version

List version information for installed core and optional modules, very useful for debugging.

ATTRIBUTES

Mojo::Commands inherits all attributes from Mojo::Command and implements the following new ones.

hint

    my $hint  = $commands->hint;
    $commands = $commands->hint('Foo!');

Short hint shown after listing available commands.

message

    my $message  = $commands->message;
    $commands    = $commands->message('Hello World!');

Short usage message shown before listing available commands.

namespaces

    my $namespaces = $commands->namespaces;
    $commands      = $commands->namespaces(['Mojo::Command']);

Namespaces to search for available commands, defaults to Mojo::Command.

METHODS

Mojo::Commands inherits all methods from Mojo::Command and implements the following new ones.

detect

    my $env = $commands->detect;
    my $env = $commands->detect($guess);

Try to detect environment.

run

    $commands->run;
    $commands->run(@ARGV);

Load and run commands.

start

    Mojo::Commands->start;
    Mojo::Commands->start(@ARGV);

Start the command line interface.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicious.org.