@codejeet/oadm 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +16 -3
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
3
4
|
import chalk from 'chalk';
|
|
4
5
|
import { readConfig, writeConfig } from './config.js';
|
|
5
6
|
import { getJson, postJson } from './http.js';
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const pkg = require('../package.json');
|
|
6
9
|
const program = new Command();
|
|
7
|
-
program
|
|
10
|
+
program
|
|
11
|
+
.name('oadm')
|
|
12
|
+
.description('OADM Inbox CLI')
|
|
13
|
+
.version(pkg.version ?? '0.0.0');
|
|
8
14
|
program
|
|
9
15
|
.option('--api <url>', 'API base URL (or set OADM_API_URL)', '')
|
|
10
16
|
.hook('preAction', (thisCommand) => {
|
|
@@ -58,8 +64,9 @@ program
|
|
|
58
64
|
program
|
|
59
65
|
.command('inbox')
|
|
60
66
|
.option('--unread', 'Only unread', false)
|
|
61
|
-
.option('--
|
|
62
|
-
.option('--
|
|
67
|
+
.option('--received', 'Show received messages only (inbox)', false)
|
|
68
|
+
.option('--sent', 'Show sent messages only (outbox)', false)
|
|
69
|
+
.option('--all', 'Show both received and sent (default)', false)
|
|
63
70
|
.option('--since <timestamp>', 'Only messages since timestamp (ISO 8601 or unix)', '')
|
|
64
71
|
.option('--limit <count>', 'Max messages to return (cap 200)', '')
|
|
65
72
|
.option('--json', 'JSON output', false)
|
|
@@ -70,9 +77,15 @@ program
|
|
|
70
77
|
throw new Error('not_logged_in');
|
|
71
78
|
if (opts.sent && opts.all)
|
|
72
79
|
throw new Error('conflicting_flags_sent_all');
|
|
80
|
+
if (opts.sent && opts.received)
|
|
81
|
+
throw new Error('conflicting_flags_sent_received');
|
|
82
|
+
if (opts.all && opts.received)
|
|
83
|
+
throw new Error('conflicting_flags_all_received');
|
|
73
84
|
const q = new URLSearchParams();
|
|
74
85
|
if (opts.unread)
|
|
75
86
|
q.set('unread', '1');
|
|
87
|
+
if (opts.received)
|
|
88
|
+
q.set('received', '1');
|
|
76
89
|
if (opts.sent)
|
|
77
90
|
q.set('sent', '1');
|
|
78
91
|
if (opts.all)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codejeet/oadm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"oadm": "dist/cli.js"
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"dev": "tsx src/cli.ts",
|
|
13
13
|
"build": "tsc -p tsconfig.json",
|
|
14
14
|
"prepack": "tsc -p tsconfig.json",
|
|
15
|
+
"smoke:version": "pnpm build && node ./scripts/smoke-version.mjs",
|
|
15
16
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|