diff --git a/scripts/play.pl b/scripts/play.pl index 961bfd7..402878e 100644 --- a/scripts/play.pl +++ b/scripts/play.pl @@ -13,11 +13,12 @@ our (%queue, %timer); if (weechat::register($SCRIPT_NAME, $SCRIPT_AUTHOR, $SCRIPT_VERSION, $SCRIPT_LICENCE, $SCRIPT_DESC, '', '')) { weechat::hook_command('play', 'Play ASCII art', - qq([-delay ms] [-find] [-pipe "command"] [-fmt "text"] filename\n-stop), + qq([-delay ms] [-find] [-pipe "command"] [-fmt "list"] filename\n-stop), "-delay: delay in milliseconds between lines\n". "-find: list matching files, don't play\n". "-pipe: pipe output into command\n". - "-fmt: treat file as a format string and replace with text\n". + "-fmt: treat file as a format string and replace with arguments in\n". + " list. Arguments are separated by semicolons (;)\n". "filename: file to play. Supports wildcards. By default, searches\n". " subdirectories as well unless '/' is found in the filename\n". "-stop: stop currently playing file in buffer", @@ -114,7 +115,8 @@ sub cmd_play { if ($path and open FH, "<", $path) { my @lines; while () { - $_ = sprintf $_, split ' ', $fmt if $fmt; + no warnings; # sprintf barks if there's nothing to replace + $_ = sprintf $_, split ';', $fmt if $fmt; push @lines, s/[\r\n]*$//r } close FH;