From b8c5990374e828bea9de4b057709a07d230da6ab Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Tue, 06 Oct 2026 18:41:48 +0000
Subject: [PATCH] adding  kursLpGet.js

---
 bin/searchUsers.js |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/bin/searchUsers.js b/bin/searchUsers.js
new file mode 100644
index 0000000..e5888a0
--- /dev/null
+++ b/bin/searchUsers.js
@@ -0,0 +1,38 @@
+const db = require("../lib/db")
+const searchLib = require("../lib/search")
+const yargs = require("yargs")
+
+/////////////////////////////////////////////////////////////////////////
+
+const argv = yargs
+   .usage("$0 <search> [offset] [limit]", "search users",)
+   .option("ids-only", {
+      describe: "only print matching usr_ids",
+      type: "boolean",
+      default: false,
+   })
+   .strict()
+   .parse()
+
+run(argv)
+   .then(print)
+   .catch(console.error)
+   .finally(process.exit)
+
+async function run({search, offset, limit, idsOnly}) {
+   if (idsOnly) {
+      return await searchLib.search(String(search))
+   }
+   offset = offset || 0
+   limit = limit || 20
+   return await db.getUsers(offset, limit, String(search))
+}
+
+function print (res) {
+   if (Array.isArray(res)) {
+      console.log(res)
+      return
+   }
+   const {total, offset, limit, data} = res
+   console.log({data, count: data.length, total, offset, limit})
+}

--
Gitblit v1.8.0