markpitchless / moosex-getopt-usage

Perl Moose Role to use with MooseX::Getopt to generate a coloured usage message from your classes meta
2 stars 2 forks source link

MooseX::Getopt::Usage

Extend MooseX::Getopt with (colour) usage message and man page generated from attribute meta and POD.

SYNOPSIS


    ## In your class
    package My::App;
    use Moose;

    with 'MooseX::Getopt::Usage',
         'MooseX::Getopt::Usage::Role::Man';

    has verbose => ( is => 'ro', isa => 'Bool', default => 0,
        documentation => qq{Say lots about what we are doing} );

    has gumption => ( is => 'rw', isa => 'Int', default => 23,
        documentation => qq{How much gumption to apply} );

    # ... rest of class

    ## In your script
    #!/usr/bin/perl
    use My::App;
    my $app = My::App->new_with_options;

Can now get help,

Screenshot1

trap errors with usage,

Screenshot2

and get a man page:

 $ synopsis.pl --man

SEE ALSO

See the README for install instructions, the METACPAN page for latest release docs.

LICENSE AND COPYRIGHT

Copyright (C) 2012 Mark Pitchless

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.