NAME

Ixchel::Actions::template - Fill in a template.

VERSION

Version 0.2.0

CLI SYNOPSIS

ixchel -a template -t <template>

CODE SYNOPSIS

use Data::Dumper;

my $results=$ixchel->action(action=>'template', opts=>{np=>1, t=>$template_name});

print Dumper($results);

DESCRIPTION

Fills in the specified template.

The templates in question are Template::Toolkit templates.

The following are available for use in the template.

    - opts :: A hash with the various options specified. In the case of
            calling this from this CLI, see info on FLAGS.

    - config :: The Ixchel config hash.

    - argv :: @ARGV

	- vars :: Any additional variables passed. Only usable when calling
            via $ixchel->action and not the CLI.

The following functions are available.

- shell_quote :: shell_quote from String::ShellQuote.
    - args :: String to quote.
    - return :: A quoted string.

- file_exists :: Check if the specified path exists and is a file.
    - args :: A FS path, relattive or absolute.
    - return :: 0/1

- dir_exists :: Check if the specified path exists and is a dir.
    - args :: A FS path, relattive or absolute.
    - return :: 0/1

- get_sub_dirs :: Gets a array of directories using...
        File::Find::Rule->directory->maxdepth(1)->in( $_[0] );
    - args :: A FS path, relattive or absolute.
    - return :: An array of directories.

- is_freebsd :: If the OS is FreeBSD or not.
    - args :: A FS path, relattive or absolute.
    - return :: 0/1

- is_linux :: If the OS is Linux or not.
    - args :: A FS path, relattive or absolute.
    - return :: 0/1

- is_systemd :: If the OS is Linux and if the init system is systemd.
    - args :: A FS path, relattive or absolute.
    - return :: 0/1

- read_file :: Reads the specified file.
    - args :: A FS path, relattive or absolute.
    - return :: Contents of the specified file.

FLAGS

--np

Do not print the the filled in template.

-t

The name of the template to use.

This is resolved in order...

./$template
/usr/local/etc/ixchel/templates/$template
/usr/local/etc/ixchel/templates/$template.tt
$share_dir/templates/$template
$share_dir/templates/$template.tt