news for recent announcement threads, threads show for one discussion’s posts, forums list/forums show to browse a unit’s forums and their discussions, and forums search to search post text across forums. See moodle news, moodle threads and moodle forums for exact flag syntax.
Recent announcements
news returns the latest announcement threads with each thread’s first post included. Each unit’s announcement forum is read separately, so this only surfaces threads from that forum, not general discussion forums. Omit UNIT and moodle-cli merges announcement threads across every enrolled unit, newest first. --limit caps the row count; it defaults to 5.
One discussion’s posts
threads show takes a discussion ID or a /mod/forum/discuss.php?d= URL and returns its posts. --limit and --offset (default 0) page through a long discussion; --post <id> narrows the result to a single post; --body includes the full post body instead of a preview.
A unit’s forums
--limit caps the row count, default 50.
FORUM_ID is the forum’s own ID or its /mod/forum/view.php?id= URL. --limit caps the row count, default 50. --query <query> filters discussion titles by a substring.
Searching forum content
forums search matches against post subject text and post body text, across every forum in every unit you’re enrolled in, by default. It reads each forum’s discussion list and posts to search them, so results reflect what’s actually in the posts, not a stale index.
Narrow the scope before it searches:
--unit and --course both resolve to the same unit restriction; pick whichever reference you have on hand. Without any of the three, the search scans every forum across your enrolled units.
Other flags change what counts as a match or how results are ordered:
--titles-onlymatches discussion titles only, skipping post bodies entirely.--unread-onlykeeps only matches from posts (or discussions) with unread content.--recentsorts results by newest post activity instead of relevance.--limit-forums <number>and--limit-discussions <number>bound how much moodle-cli scans (forums visited, discussions read per forum) — this controls scan cost, not the number of results returned.--limit <number>caps the number of matches returned, default 20.
--unit, --course or --forum doesn’t resolve.