Ixchel
view release on metacpan or search on metacpan
src_bin/ixchel view on Meta::CPAN
#!perl
=head1 NAME
ixchel - Automate various sys admin stuff.
=head1 SYNOPSIS
ixchel -a <action> [B<--config> <config>] [B<--noConfig>]
ixchel --help [B<-a> <action>]
=head1 DESCRIPTION
=head1 FLAGS
The following are just the base flags. Actions can have additional configs.
=head2 -a <action>
The action to perform.
To get a list of available actions use 'list_actions'.
If this is undef, it will be set to 'list_actions'.
=head2 --config <file>
The config file to load. May be JSON, YAML, or TOML.
If not specified the first one found below is used.
If it is not found, a empty hash is used.
Default: /usr/local/etc/ixchel/server.yaml
/usr/local/etc/ixchel/server.json
/usr/local/etc/ixchel/server.toml
This option will be ignored if --noConfig specified.
=head2 --noConfig
Do not attempt to load the config even if it exists.
This is automatic for the action 'list_actions' and 'sys_info'
The option --config will be ignored if this is specified.
=head1 ENVIROMENTAL VARIABLES
If the following values are defined, the matching ENV is set.
.proxy.ftp -> FTP_PROXY
.proxy.http -> HTTP_PROXY
.proxy.https -> HTTPS_PROXY
.perl.cpanm_home -> PERL_CPANM_HOME
Additionally any of the variables defined under .env will also be
set. So .env.TMPDIR will set $ENV{TMPDIR}.
=cut
use strict;
use warnings;
use Getopt::Long qw(:config pass_through);
use File::Slurp;
use JSON qw(decode_json);
use YAML::XS qw(Load);
use Ixchel;
use utf8;
use Pod::Usage;
use Pod::Find qw(pod_where);
sub version {
print 'ixchel v. ' . $Ixchel::VERSION . "\n";
}
# disable color if asked
if ( defined( $ENV{NO_COLOR} ) ) {
$ENV{ANSI_COLORS_DISABLED} = 1;
}
my $config_file;
my $action;
my $help;
my $version;
my $noConfig;
GetOptions(
'a=s' => \$action,
'config=s' => \$config_file,
'noConfig' => \$noConfig,
'help' => \$help,
'version' => \$version,
);
if ($version) {
&version;
exit 0;
}
if ($help) {
&version;
print '
-a <action> The action to perform.
--config <file> The config file to load. May be JSON, YAML, or TOML.
If not specified the first one found below is used.
If it is not found, a empty hash is used.
Default: /usr/local/etc/ixchel/server.yaml
/usr/local/etc/ixchel/server.json
/usr/local/etc/ixchel/server.toml
( run in 0.465 second using v1.01-cache-2.11-cpan-71847e10f99 )