-
-
Save antoniogamiz/3a824c2fd8d4727fa6340d2fabc6c05b to your computer and use it in GitHub Desktop.
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 Test; | |
use Test::Output; | |
use File::Directory::Tree; | |
use CLI; | |
# you can comment one of the subtests block and it will still print the text. | |
subtest 'no arguments provided' => { | |
output-like {CLI::MAIN()}, /Execute/, "show help message"; | |
} | |
subtest 'version command' => { | |
output-like {CLI::MAIN(:version)}, /Documentable\sversion/, "long version"; | |
} | |
done-testing; |
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
package CLI { | |
sub RUN-MAIN(|c) is export { | |
my %*SUB-MAIN-OPTS = :named-anywhere; | |
CORE::<&RUN-MAIN>(|c) | |
} | |
our proto MAIN(|) is export { * } | |
multi MAIN ( | |
"setup", | |
Bool :y(:$yes) = False | |
) { | |
say "setup"; | |
} | |
multi MAIN ( | |
"start" , | |
Str :$topdir = "doc", | |
Str :$conf = "config.json", | |
Bool :v(:verbose($v)) = False, | |
Bool :p(:primary($p)) = False, | |
Bool :s(:secondary($s)) = False, | |
Bool :$search-index = False, | |
Bool :i(:indexes($i)) = False, | |
Bool :t(:typegraph($t)) = False, | |
Bool :f(:force($f)) = False, | |
Bool :$highlight = False, | |
Str :$typegraph-file = "type-graph.txt", | |
Str :$highlight-path = "./highlights", | |
Str :$dirs?, | |
Bool :a(:$all) = False | |
) { | |
say "start"; | |
} | |
multi MAIN ( | |
"update", | |
Str :$topdir = "doc", | |
Str :$conf = "config.json", | |
Bool :v(:$verbose) = True , | |
Bool :$highlight = False, | |
Str :$highlight-path = "./highlights" | |
) {} | |
multi MAIN ( | |
"clean" | |
) { | |
say "clean"; | |
} | |
multi MAIN ( | |
Bool :V(:$version)! | |
) { | |
say "version"; | |
} | |
multi MAIN() { | |
note 'Execute "documentable --help" for more information.'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment