spam-ascii: fuzzy-match helper for /spam alias
New .local/bin/spam-ascii POSIX shell script: resolves a pattern to a file in ~/ascii with this order: 1. exact filename match 2. exact name + common ASCII-art extension (.txt/.ans/.asc) 3. first case-insensitive substring match (sorted alphabetically) Non-zero exit + stderr-ish error if nothing matches, so /spam prints 'no match in ~/ascii for: <pattern>' instead of spewing a missing-file error. Rewire the irssi /spam alias to call the script instead of hardcoding 'cat ~/ascii/$0'. Now: /spam mario -> matches ~/ascii/mario.txt or ~/ascii/Mario_art.ans /spam MARIO -> case-insensitive /spam nothere -> 'no match in ~/ascii for: nothere'
This commit is contained in:
@@ -158,7 +158,7 @@ aliases = {
|
||||
SB = "SCROLLBACK";
|
||||
SBAR = "STATUSBAR";
|
||||
SIGNOFF = "QUIT";
|
||||
SPAM = "EXEC -out cat ~/ascii/$0";
|
||||
SPAM = "EXEC -out ~/.local/bin/spam-ascii $0";
|
||||
SV = "MSG * Irssi $J ($V) - http://www.irssi.org";
|
||||
T = "TOPIC";
|
||||
UB = "UNBAN";
|
||||
|
||||
Reference in New Issue
Block a user