Rex
view release on metacpan or search on metacpan
lib/Rex/CLI.pm view on Meta::CPAN
#
# (c) Jan Gehring <jan.gehring@gmail.com>
#
package Rex::CLI;
use v5.14.4;
use warnings;
our $VERSION = '1.16.1'; # VERSION
use English qw(-no_match_vars);
use FindBin;
use File::Basename qw(basename dirname);
use Time::HiRes qw(gettimeofday tv_interval);
use Cwd qw(getcwd);
use List::Util qw(max);
use Text::Wrap;
use Term::ANSIColor;
use Term::ReadKey;
use Sort::Naturally;
use if $OSNAME eq 'MSWin32', 'Win32::Console::ANSI';
use Rex;
use Rex::Args;
use Rex::Config;
use Rex::Group;
use Rex::Batch;
use Rex::TaskList;
use Rex::Logger;
use YAML;
use Data::Dumper;
my $no_color = 0;
# preload some modules
use Rex -base;
$OUTPUT_AUTOFLUSH++;
my ( %opts, @help, @exit );
if ( $#ARGV < 0 ) {
@ARGV = qw(-h);
}
sub new {
my $that = shift;
my $proto = ref($that) || $that;
my $self = {@_};
bless( $self, $proto );
return $self;
}
sub __run__ {
my ( $self, %more_args ) = @_;
Rex::Args->parse_rex_opts;
%opts = Rex::Args->getopts;
if ( $opts{'Q'} ) {
my $stdout;
open( my $newout, '>', \$stdout );
select $newout;
close(STDERR);
}
if ( $opts{'m'} ) {
$no_color = 1;
$Rex::Logger::no_color = 1;
}
if ( $opts{'d'} ) {
$Rex::Logger::debug = $opts{'d'};
$Rex::Logger::silent = 0;
}
( run in 1.930 second using v1.01-cache-2.11-cpan-63c85eba8c4 )