summaryrefslogtreecommitdiff
path: root/lib/Getopt/Dakkar.pm
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2018-07-13 18:52:08 +0100
committerdakkar <dakkar@thenautilus.net>2018-07-13 18:52:08 +0100
commit9c7b213f58fe533953953e90b5bc77087ca4d45d (patch)
treec78cd04844a4ba1e92f1bf1dc29c14b3813e4bc7 /lib/Getopt/Dakkar.pm
parentI'm losing the plot, here (diff)
downloadGetopt-Dakkar-9c7b213f58fe533953953e90b5bc77087ca4d45d.tar.gz
Getopt-Dakkar-9c7b213f58fe533953953e90b5bc77087ca4d45d.tar.bz2
Getopt-Dakkar-9c7b213f58fe533953953e90b5bc77087ca4d45d.zip
we can now parse boolean optionsHEADmaster
Diffstat (limited to 'lib/Getopt/Dakkar.pm')
-rw-r--r--lib/Getopt/Dakkar.pm15
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;
}