CLI::Driver - Drive your cli tool with YAML
use CLI::Driver; my $cli = CLI::Driver->new; $cli->run; - or - my $cli = CLI::Driver->new( path => './etc:/etc', file => 'myconfig.yml' ); $cli->run; - or - my $cli = CLI::Driver->new( use_file_sharedir => 1, file_sharedir_dist_name => 'CLI-Driver', ); $cli->run; ################################# # cli-driver.yml example ################################# do-something: desc: "Action description" deprecated: status: false replaced-by: na class: name: My::App attr: required: hard: f: foo soft: h: home a: '@array_arg' optional: flags: dry-run: dry_run_flag method: name: my_method args: required: hard: soft: optional: flags: help: args: f: "Additional help info for argument 'f'" examples: - "-f foo -a val1 -a val2 --dry-run"
Directory where your cli-driver.yml file is located. You can specify multiple directories by separating them with ':'. For example, "etc:/etc".
isa: Str
defaults: .:etc:/etc
Name of your YAML driver file.
default: cli-driver.yml
Flag indicating you want to use File::ShareDir to locate the driver file. Requires the attribute 'file_sharedir_dist_name' to be provided. Is mutually exclusive with the 'path' attribute.
isa: Bool
default: 0
Your distro name. For example: 'CLI-Driver'.
default: undef
A set of command line overrides for retrieving arguments. This can be used in-place of @ARGV args.
Example:
{ classAttrName1 => 'abc', classAttrName2 => 'def', methodArgName1 => 'ghi' }
isa: HashRef
A list of actions parsed from the driver file.
isa: ArrayRef[CLI::Driver::Action]
To install CLI::Driver, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CLI::Driver
CPAN shell
perl -MCPAN -e shell install CLI::Driver
For more information on module installation, please visit the detailed CPAN module installation guide.