From: Harvie Date: Tue, 24 Aug 2010 02:43:02 +0000 (+0200) Subject: more fancy menu script example X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=8ddbf94e3bd6d96862182bc6a054a2d411016e02;p=mirrors%2Flibpurple-core-answerscripts.git more fancy menu script example --- diff --git a/purple/answerscripts.d/10-menu.pl b/purple/answerscripts.d/10-menu.pl index d7afa4e..40f22b4 100755 --- a/purple/answerscripts.d/10-menu.pl +++ b/purple/answerscripts.d/10-menu.pl @@ -5,12 +5,13 @@ use warnings; use Switch; switch ($ENV{ANSW_MSG}) { - case /^!help$/ { print "What did you expected? A help?! :-P"; } + case /^!help$/ { print qx{ grep -o 'case /[^\$/]*' "$0" | grep -o '!.*' | tr '\n' ',' }; } case /^!ping$/ { print "PONG"; } case /^!whoami$/ { print "You are: $ENV{ANSW_FROM}"; } + case /^!status$/ { print "[$ENV{ANSW_STATUS}] $ENV{ANSW_STATUS_MSG}"; } case /^!(reboot|reset|restart|halt)$/ { print "Broadcast message: The system is going down for reboot NOW !!"; } case /^!google/ { print "UTFG Yourself: http://google.com/"; } case /^!uptime$/ { print qx{uptime}; } case /^!date$/ { print qx{date}; } - case /^!dmesg$/ { print qx{ dmesg | tail -n 5 | tr '\n' '^' } } + case /^!dmesg$/ { print qx{ dmesg | tail -n 5 | tr '\n' '\t' } } }