My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/infra/nom/clap/lib/Clap/Clap.rakumod

39 lines
751 B

unit module Clap;
say "Loading clap...";
class Subcommand is export {
has Str $.name;
has Str $.about is rw;
method with_name(Str $name) returns Subcommand {
return self.bless(:$name);
}
method about(Str $about) returns Subcommand {
$!about = $about;
return self;
}
}
class App is export {
has Str $.about is rw;
has Str $.author is rw;
has @.subs is rw = Array.new();
method about(Str $about) returns App {
$!about = $about;
return self;
}
method author(Str $author) returns App {
$!author = $author;
return self;
}
method subcommand(Subcommand $cmd) returns App {
@.subs.push($cmd);
return self;
}
}