#!/home/product/code/webui-perl/bin/perl -T -I /home/product/code/firmware/current/lib/perl5
#SUDOER_USERS: nobody
#SUDOER_RUNAS_USERS: root, mta
#SUDOER_TAGS: NOPASSWD, EXEC
use strict;
use warnings;
use Barracuda::Sudo::Lib;
use Barracuda::Environment;
use IPC::Run qw(run);

###############################################################################

=pod

=head1 NAME

tw_cli

=head1 DESCRIPTION

Wraps calls to /bin/tw_cli that use the 'show' or 'rescan' arguments.

=cut

###############################################################################


my $outfile = sudo_out();
my @args = get_argv( qr/^\/c/, qr/^(show)|(rescan)$/ );
my $cmd = "${Barracuda::Environment::path_firmware}/bin/tw_cli";

my $status = run([$cmd, @args], \undef, $outfile, $outfile);

exit !$status;
