From 8ddbf94e3bd6d96862182bc6a054a2d411016e02 Mon Sep 17 00:00:00 2001 From: Harvie Date: Tue, 24 Aug 2010 04:43:02 +0200 Subject: [PATCH] more fancy menu script example --- purple/answerscripts.d/10-menu.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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' } } } -- 2.30.2