diff options
-rwxr-xr-x | scripts/mana | 75 |
1 files changed, 64 insertions, 11 deletions
diff --git a/scripts/mana b/scripts/mana index ee3da644..2910025b 100755 --- a/scripts/mana +++ b/scripts/mana @@ -1,19 +1,59 @@ #!/usr/bin/perl +# vim: set et ts=4 sw=4: +#***************************************************************************** +# +# Copyright (c) 2014 Angelo naselli <anaselli@linux.it> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +#***************************************************************************** use AdminPanel::Privileges; use yui; # TODO from configuration file? +# TODO localization for descriptions my %modules = ( - log => '/usr/bin/manalog', - user => '/usr/bin/manauser', - service => '/usr/bin/manaservice', - clock => '/usr/bin/manaclock', - host => '/usr/bin/manahost', - pan => '/usr/bin/mpan.pl', - proxy => '/usr/bin/manaproxy', - + log => { + exec => '/usr/bin/manalog', + descr => "manalog: journalct log reader", + }, + user => { + exec => '/usr/bin/manauser', + descr => "manauser: user manager", + }, + service => { + exec => '/usr/bin/manaservice', + descr => "manaservice: service manager", + }, + clock => { + exec => '/usr/bin/manaclock', + descr => "manaclock: date/time manager", + }, + host => { + exec => '/usr/bin/manahost', + descr => "manahost: hosts manager", + }, + pan => { + esxec => '/usr/bin/mpan.pl', + descr => "mpan: admin panel", + }, + proxy => { + exec => '/usr/bin/manaproxy', + descr => "manaproxy: proxy manager", + }, ); my $cmdline = new yui::YCommandLine; @@ -25,7 +65,7 @@ my $cmd = $ARGV[0]; die "Command ". $cmd . " not found!\n" if !defined($modules{$cmd}); -my $mod = $modules{$cmd}; +my $mod = $modules{$cmd}->{exec}; shift(@ARGV); if(is_root_capability_required()) { @@ -34,14 +74,27 @@ if(is_root_capability_required()) { system($mod, @ARGV); } +#============================================================= + +=head2 usage + + +=head3 DESCRIPTION + +usage print the mana usage help + +=cut + +#============================================================= + sub usage { print "\n"; print "Usage mana --help | -h print this help\n"; print "Usage mana <command> [args...]\n\n"; - print "valid <commands>:\n\t"; + print "valid <commands>:\n"; # TODO better presentation while ( my ($key, $value) = each(%modules) ) { - print " " . $key; + print "<" . $key . ">\t\t". $value->{descr} . "\n"; } print "\n"; exit(0); |