// retoor <retoor@molodetz.nl>
import { fromEnv } from "./client.mjs";
const text = process.argv[2];
const tags = process.argv[3] || "";
if (!text) {
console.log("usage: DEVRANT_USERNAME=.. DEVRANT_PASSWORD=.. node post_rant.mjs <text> [tags]");
process.exit(1);
}
const api = fromEnv();
await api.login();
const result = await api.postRant(text, tags);
if (result.success) {
console.log(`posted rant ${result.rant_id}`);
} else {
console.log(`failed: ${result.error}`);
}