Skip to content

Instantly share code, notes, and snippets.

@hoelzro
Created July 7, 2014 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoelzro/e03fc6ab275563643d65 to your computer and use it in GitHub Desktop.
Save hoelzro/e03fc6ab275563643d65 to your computer and use it in GitHub Desktop.
use v6;
my role App::Subcommander {
my role OptionCanonicalizer {
submethod BUILD(:&command) {
say &command.perl;
gather {
say &command.perl;
};
}
}
my class DefaultOptionCanonicalizer does OptionCanonicalizer {
}
method run(@args) returns int {
my $subcommand = self.can('go-bool')[0];
my $canonicalizer = DefaultOptionCanonicalizer.new(:command($subcommand));
return 0;
}
}
my class App does App::Subcommander {
method go-bool(Str $arg?, Bool :$flag, Str :$node) {}
}
App.new.run(['go-bool', '--noflag', '--node', 'value']);
=begin output
method go-bool (App: Str $arg?, Bool :flag($flag), Str :node($node), *%_) { #`(Method|140026856274400) ... }
Nil
=end output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment