@profullstack/r3q 0.1.0 → 0.1.1

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/bin/r3q.mjs CHANGED
@@ -1,2 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import "../dist/main.js";
2
+ // `main` is called here rather than by an `import.meta.main` guard inside
3
+ // main.js: that guard is false for a module something else imported, which
4
+ // is exactly what this file does, so the installed command used to do nothing.
5
+ import { main } from "../dist/main.js";
6
+
7
+ main().catch((error) => {
8
+ console.error(error);
9
+ process.exit(1);
10
+ });
package/dist/main.d.ts CHANGED
@@ -23,6 +23,8 @@ export interface State {
23
23
  note: string;
24
24
  }
25
25
  export declare function createState(root: string): State;
26
+ export declare const USAGE = "Usage:\n r3q [dir] browse the .http files in dir (default: the working directory); Enter sends";
27
+ export declare function main(): Promise<void>;
26
28
  /** JSON token colours, drawn from the active theme rather than hard-coded. */
27
29
  export declare function jsonPalette(theme: Theme): JsonPalette;
28
30
  export declare function view({ ui, theme, height }: {
package/dist/main.js CHANGED
@@ -52,7 +52,13 @@ const methodColor = (theme, method) => ({
52
52
  GET: theme.success, POST: theme.accent, PUT: theme.warning,
53
53
  PATCH: theme.warning, DELETE: theme.danger,
54
54
  }[method] ?? theme.secondary);
55
- async function main() {
55
+ export const USAGE = `Usage:
56
+ r3q [dir] browse the .http files in dir (default: the working directory); Enter sends`;
57
+ export async function main() {
58
+ if (process.argv.slice(2).some((a) => a === "-h" || a === "--help")) {
59
+ console.log(USAGE);
60
+ return;
61
+ }
56
62
  const root = resolve(process.argv[2] ?? ".");
57
63
  const state = createState(root);
58
64
  const app = await createApp({ theme: themes.dark, title: "r3q", quitKeys: ["ctrl+c"] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/r3q",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A REST client for your terminal. Requests are files you can commit; the TUI is just a good way to look at them.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/main.ts CHANGED
@@ -65,7 +65,14 @@ const methodColor = (theme: Record<string, number>, method: string): number => (
65
65
  PATCH: theme.warning, DELETE: theme.danger,
66
66
  }[method] ?? theme.secondary) as number;
67
67
 
68
- async function main(): Promise<void> {
68
+ export const USAGE = `Usage:
69
+ r3q [dir] browse the .http files in dir (default: the working directory); Enter sends`;
70
+
71
+ export async function main(): Promise<void> {
72
+ if (process.argv.slice(2).some((a) => a === "-h" || a === "--help")) {
73
+ console.log(USAGE);
74
+ return;
75
+ }
69
76
  const root = resolve(process.argv[2] ?? ".");
70
77
  const state = createState(root);
71
78