Skip to content

Instantly share code, notes, and snippets.

@hoelzro
Created August 6, 2014 01:13
Show Gist options
  • Save hoelzro/b7bdbc125849e4aff3a2 to your computer and use it in GitHub Desktop.
Save hoelzro/b7bdbc125849e4aff3a2 to your computer and use it in GitHub Desktop.
Subcommander Example
use v6;
use Subcommander;
my class App is Subcommander::Application {
has $.interactive is option;
#| Greet the user
method greet(
Str $name, #= The name of the person to greet
Str :$language = 'en' #= The language to greet them in
) is subcommand {
say "Greetings, $name!";
}
}
App.new.run(@*ARGS);
=begin output
For perl6 app help:
Usage: app [command]
greet Greet the user
help Display help to the user
version Display the current version to the user
=end output
=begin output
For perl6 app help greet:
Usage: app greet [options] name
Greet the user
Arguments:
name The name of the person to greet
Options:
--language The language to greet them in
=end output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment