[32205] | 1 | package Mojolicious::Command::generate;
|
---|
| 2 | use Mojo::Base 'Mojolicious::Commands';
|
---|
| 3 |
|
---|
| 4 | has description => 'Generate files and directories from templates';
|
---|
| 5 | has hint => <<EOF;
|
---|
| 6 |
|
---|
| 7 | See 'APPLICATION generate help GENERATOR' for more information on a specific
|
---|
| 8 | generator.
|
---|
| 9 | EOF
|
---|
| 10 | has message => sub { shift->extract_usage . "\nGenerators:\n" };
|
---|
| 11 | has namespaces => sub { ['Mojolicious::Command::generate'] };
|
---|
| 12 |
|
---|
| 13 | sub help { shift->run(@_) }
|
---|
| 14 |
|
---|
| 15 | 1;
|
---|
| 16 |
|
---|
| 17 | =encoding utf8
|
---|
| 18 |
|
---|
| 19 | =head1 NAME
|
---|
| 20 |
|
---|
| 21 | Mojolicious::Command::generate - Generator command
|
---|
| 22 |
|
---|
| 23 | =head1 SYNOPSIS
|
---|
| 24 |
|
---|
| 25 | Usage: APPLICATION generate GENERATOR [OPTIONS]
|
---|
| 26 |
|
---|
| 27 | mojo generate app
|
---|
| 28 | mojo generate lite_app
|
---|
| 29 |
|
---|
| 30 | =head1 DESCRIPTION
|
---|
| 31 |
|
---|
| 32 | L<Mojolicious::Command::generate> lists available generators.
|
---|
| 33 |
|
---|
| 34 | This is a core command, that means it is always enabled and its code a good
|
---|
| 35 | example for learning to build new commands, you're welcome to fork it.
|
---|
| 36 |
|
---|
| 37 | See L<Mojolicious::Commands/"COMMANDS"> for a list of commands that are
|
---|
| 38 | available by default.
|
---|
| 39 |
|
---|
| 40 | =head1 ATTRIBUTES
|
---|
| 41 |
|
---|
| 42 | L<Mojolicious::Command::generate> inherits all attributes from
|
---|
| 43 | L<Mojolicious::Commands> and implements the following new ones.
|
---|
| 44 |
|
---|
| 45 | =head2 description
|
---|
| 46 |
|
---|
| 47 | my $description = $generator->description;
|
---|
| 48 | $generator = $generator->description('Foo');
|
---|
| 49 |
|
---|
| 50 | Short description of this command, used for the command list.
|
---|
| 51 |
|
---|
| 52 | =head2 hint
|
---|
| 53 |
|
---|
| 54 | my $hint = $generator->hint;
|
---|
| 55 | $generator = $generator->hint('Foo');
|
---|
| 56 |
|
---|
| 57 | Short hint shown after listing available generator commands.
|
---|
| 58 |
|
---|
| 59 | =head2 message
|
---|
| 60 |
|
---|
| 61 | my $msg = $generator->message;
|
---|
| 62 | $generator = $generator->message('Bar');
|
---|
| 63 |
|
---|
| 64 | Short usage message shown before listing available generator commands.
|
---|
| 65 |
|
---|
| 66 | =head2 namespaces
|
---|
| 67 |
|
---|
| 68 | my $namespaces = $generator->namespaces;
|
---|
| 69 | $generator = $generator->namespaces(['MyApp::Command::generate']);
|
---|
| 70 |
|
---|
| 71 | Namespaces to search for available generator commands, defaults to
|
---|
| 72 | L<Mojolicious::Command::generate>.
|
---|
| 73 |
|
---|
| 74 | =head1 METHODS
|
---|
| 75 |
|
---|
| 76 | L<Mojolicious::Command::generate> inherits all methods from
|
---|
| 77 | L<Mojolicious::Commands> and implements the following new ones.
|
---|
| 78 |
|
---|
| 79 | =head2 help
|
---|
| 80 |
|
---|
| 81 | $generator->help('app');
|
---|
| 82 |
|
---|
| 83 | Print usage information for generator command.
|
---|
| 84 |
|
---|
| 85 | =head1 SEE ALSO
|
---|
| 86 |
|
---|
| 87 | L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
|
---|
| 88 |
|
---|
| 89 | =cut
|
---|