Created
August 6, 2014 01:13
-
-
Save hoelzro/b7bdbc125849e4aff3a2 to your computer and use it in GitHub Desktop.
Subcommander Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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