From 9c7b213f58fe533953953e90b5bc77087ca4d45d Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 13 Jul 2018 18:52:08 +0100 Subject: we can now parse boolean options --- lib/Getopt/Dakkar.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lib/Getopt/Dakkar.pm') 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; } -- cgit v1.2.3