From 6d4c7f5033350698f476ac7ab0c3099a650e7b9d Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sun, 9 Jan 2011 10:58:15 +0000 Subject: uberprompt: added /help prompt to mimic built-in help stuffs. --- prompt_info/uberprompt.pl | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'prompt_info') diff --git a/prompt_info/uberprompt.pl b/prompt_info/uberprompt.pl index 407119d..0706d29 100644 --- a/prompt_info/uberprompt.pl +++ b/prompt_info/uberprompt.pl @@ -23,12 +23,16 @@ # # /prompt set - sets the prompt to the given argument. $p in the argument will # be replaced by the original prompt content. +# A parameter corresponding to the UP_* constants listed below +# is required, in the format `/prompt set -inner Hello!' # /prompt clear - clears the additional data provided to the prompt. # /prompt on - enables the uberprompt (things may get confused if this is used # whilst the prompt is already enabled) # /prompt off - restore the original irssi prompt and prompt_empty statusbars. # unloading the script has the same effect. # +# /help prompt - show help for uberprompt commands +# # Additionally, the format for the prompt can be set via: # # UBERPROMPT FORMAT: @@ -174,6 +178,47 @@ sub _debug_print($) { Irssi::active_win->print($msg, Irssi::MSGLEVEL_CLIENTCRAP); } +sub _print_help { + my ($args) = @_; + if ($args =~ m/^\s*prompt/i) { + my @help_lines = + ( + "", + "PROMPT ON", + "PROMPT OFF", + "PROMPT CLEAR", + "PROMPT SET { -pre | -post | -only | -inner } ", + "", + "Commands for manipulating the UberPrompt.", + "", + "/PROMPT ON enables uberprompt, replacing the existing prompt ", + " statusbar-item", + "/PROMPT OFF disables it, and restores the original prompt item", + "/PROMPT CLEAR resets the value of any additional data set by /PROMPT SET", + " or a script", + "/PROMPT SET changes the contents of the prompt, according to the mode", + " and content provided.", + " -inner sets the value of the \$uber psuedo-variable in the", + " /set uberprompt_format setting.", + " -pre places the content before the current prompt string", + " -post places the content after the prompt string", + " -only replaces the entire prompt contents with the given string", + "", + "See Also:", + '', + '/SET uberprompt_format -- defaults to [$*$uber]', + "/SET uberprompt_autostart -- determines whether /PROMPT ON is run", + " automatically when the script loads", + "/set uberprompt_use_replaces -- toggles the use of the current theme", + " \"replaces\" setting. Especially", + " noticeable on brackets \"[ ]\" ", + "", + ); + + Irssi::print($_, Irssi::MSGLEVEL_CLIENTCRAP) for @help_lines; + Irssi::signal_stop; + } +} sub UNLOAD { deinit(); @@ -214,6 +259,8 @@ sub init { my $prompt_set_args_format = "inner pre post only"; Irssi::command_set_options('prompt set', $prompt_set_args_format); + Irssi::command_bind('help', \&_print_help); + Irssi::signal_add('setup changed', \&reload_settings); # intialise the prompt format. -- cgit v1.2.3