diff options
Diffstat (limited to 'lib/Getopt/Dakkar.pm')
-rw-r--r-- | lib/Getopt/Dakkar.pm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Getopt/Dakkar.pm b/lib/Getopt/Dakkar.pm index 1432987..739985b 100644 --- a/lib/Getopt/Dakkar.pm +++ b/lib/Getopt/Dakkar.pm @@ -1,13 +1,22 @@ package Getopt::Dakkar; use Getopt::Dakkar::Style qw(class); -use Module::Runtime qw(use_module); # VERSION # ABSTRACT: the best command line parser ever with 'Getopt::Dakkar::Role::Command'; has '+name' => ( default => $0 ); +has '+class' => ( default => 'Getopt::Dakkar::Stash' ); -sub go($self,$args=\@ARGV) { - return $self->parse($args,undef); +sub parse($self,$args=\@ARGV,$=) { + my $stash = $self->_parse($args,undef) // + $self->make_stash(Getopt::Dakkar::ArgPack->new()); + # we're top-level, we should really have used all the command line + # elements + if ($args->@*) { + Getopt::Dakkar::X::ExtraArgs->throw({ + args => $args, + }); + } + return $stash; } |