NAME

CLI::Driver - Drive your cli tool with YAML

SYNOPSIS

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"
        

ATTRIBUTES

path

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

file

Name of your YAML driver file.

isa: Str

default: cli-driver.yml

use_file_sharedir

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

file_sharedir_dist_name

Your distro name. For example: 'CLI-Driver'.

isa: Str

default: undef

argv_map

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

default: undef

actions

A list of actions parsed from the driver file.

isa: ArrayRef[CLI::Driver::Action]