diff options
| author | Ahmed <git@gumx.cc> | 2026-06-14 01:46:29 +0300 |
|---|---|---|
| committer | Ahmed <git@gumx.cc> | 2026-06-14 01:46:29 +0300 |
| commit | 5a8d568931d9b23ce0df1265d05259a7012081c9 (patch) | |
| tree | 4ea19b8bb1763a38246f342f172c285f6579e09b /alfred/helpstrings.py | |
init: mostly vibed
Diffstat (limited to 'alfred/helpstrings.py')
| -rw-r--r-- | alfred/helpstrings.py | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/alfred/helpstrings.py b/alfred/helpstrings.py new file mode 100644 index 0000000..6711340 --- /dev/null +++ b/alfred/helpstrings.py @@ -0,0 +1,78 @@ +TOPICS = "topics: srv, bot, files, irc, coffee. type !help <topic> for details" + +SRV_TOPIC = "srv: uptime disk mem load status net top topmem io conns who logs. type !help srv <cmd> for details" +SRV = { + "uptime": "srv uptime: system uptime and load averages. usage: !srv uptime", + "disk": "srv disk: disk usage for root. usage: !srv disk", + "mem": "srv mem: RAM and swap usage. usage: !srv mem", + "load": "srv load: 1 5 15 min load averages and process count. usage: !srv load", + "status": "srv status: rc-service status, all or one. usage: !srv status or !srv status service", + "net": "srv net: RX TX bytes for a network interface. usage: !srv net or !srv net iface", + "top": "srv top: top n processes by CPU. usage: !srv top or !srv top n", + "topmem": "srv topmem: top n processes by memory. usage: !srv topmem or !srv topmem n", + "io": "srv io: disk read write stats for the main block device. usage: !srv io", + "conns": "srv conns: TCP connection summary. usage: !srv conns", + "who": "srv who: currently logged-in users. usage: !srv who", + "logs": "srv logs: last n lines from a service log. usage: !srv logs service or !srv logs service n", +} + +BOT_TOPIC = "bot: list, all, name start stop restart status. type !help bot <cmd> for details" +BOT = { + "list": "bot list: show all managed bots and their running state. usage: !bot list", + "all": "bot all: control all bots at once. usage: !bot all start or stop or restart", +} +BOT_NAME = "bot name: control or check a specific bot. usage: !bot name start or stop or restart or status" + +FILES_TOPIC = "files: stats list shorten mirror prune vscan remove. type !help files <cmd> for details" +FILES = { + "stats": "files stats: live permanent removed count and total size. usage: !files stats", + "list": "files list: last n uploads with name size and expiry. usage: !files list or !files list n", + "shorten": "files shorten: shorten a URL. usage: !files shorten url or !files shorten url wkfo or gumx", + "mirror": "files mirror: mirror a remote URL into this instance. usage: !files mirror url or !files mirror url wkfo or gumx", + "prune": "files prune: delete all expired files from disk. usage: !files prune", + "vscan": "files vscan: run ClamAV scan on all stored files. usage: !files vscan", + "remove": "files remove: permanently delete a file by filename. usage: !files remove filename", +} + +IRC_TOPIC = "irc: user net bouncer notice. type !help irc <cmd> for details" +IRC = { + "user": "irc user: list, add nick pass, remove nick, passwd nick pass, enable nick, disable nick. usage: !irc user sub", + "net": "irc net: list user, status user, add user name, add user name addr, remove user name, quote user net cmd, presets. usage: !irc net sub", + "bouncer": "irc bouncer: show bouncer-wide stats and status. usage: !irc bouncer", + "notice": "irc notice: broadcast a notice to all bouncer users. usage: !irc notice message", +} + +COFFEE_TOPIC = "coffee: stats n +n -n yes no. type !help coffee <cmd> for details" +COFFEE = { + "stats": "coffee stats: today cups, 7-day chart, streak, all-time average. usage: !coffee stats", + "n": "coffee n: set cup count for today or a past date. usage: !coffee n or !coffee n yyyy-mm-dd", + "+n": "coffee +n: add cups, warns if over 5. usage: !coffee +n or !coffee +n yyyy-mm-dd", + "-n": "coffee -n: remove cups, warns if hitting 0. usage: !coffee -n or !coffee -n yyyy-mm-dd", + "yes": "coffee yes or no: confirm or cancel a pending change. usage: !coffee yes or !coffee no", + "no": "coffee yes or no: confirm or cancel a pending change. usage: !coffee yes or !coffee no", +} + +TOPIC_MAP = { + "srv": (SRV_TOPIC, SRV), + "bot": (BOT_TOPIC, BOT), + "files": (FILES_TOPIC, FILES), + "irc": (IRC_TOPIC, IRC), + "coffee": (COFFEE_TOPIC, COFFEE), +} + +_ALL = {**SRV, **BOT, **FILES, **IRC, **COFFEE} + + +def lookup(args): + if not args: + return TOPICS + first = args[0].lower() + if first in TOPIC_MAP: + if len(args) == 1: + return TOPIC_MAP[first][0] + cmd = args[1].lower() + result = TOPIC_MAP[first][1].get(cmd) + if result is None and first == "bot": + return BOT_NAME + return result + return _ALL.get(first) |
