Version 0.35
[gitmo/MooseX-Getopt.git] / lib / MooseX / Getopt / GLD.pm
index 2cfbd7d..5edb937 100644 (file)
@@ -7,6 +7,20 @@ use Getopt::Long::Descriptive 0.081;
 
 with 'MooseX::Getopt::Basic';
 
+has usage => (
+    is => 'rw', isa => 'Getopt::Long::Descriptive::Usage',
+    traits => ['NoGetopt'],
+);
+
+# captures the options: --help --usage --?
+has help_flag => (
+    is => 'ro', isa => 'Bool',
+    traits => ['Getopt'],
+    cmd_flag => 'help',
+    cmd_aliases => [ qw(usage ?) ],
+    documentation => 'Prints this usage information.',
+);
+
 around _getopt_spec => sub {
     shift;
     shift->_gld_spec(@_);
@@ -32,9 +46,9 @@ sub _gld_spec {
             {
                 ( ( $opt->{required} && !exists($constructor_params->{$opt->{init_arg}}) ) ? (required => $opt->{required}) : () ),
                 # NOTE:
-                # remove this 'feature' because it didn't work 
+                # remove this 'feature' because it didn't work
                 # all the time, and so is better to not bother
-                # since Moose will handle the defaults just 
+                # since Moose will handle the defaults just
                 # fine anyway.
                 # - SL
                 #( exists $opt->{default}  ? (default  => $opt->{default})  : () ),