Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(cli): address second CodeRabbit review round

PeterTakahashie31e6317b604
diff --git a/docs/cli.md b/docs/cli.md
index 046e5696d..b9a95b51c 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -82,7 +82,22 @@ GUI picker uses — so scripts and agents can choose `--display`, `--window`, an
```bash
openscreen sources # human-readable
-openscreen sources --json # {"event":"done","sources":{displays,windows,microphones,...}}
+openscreen sources --json
+```
+
+`--json` emits the payload on the final `done` event:
+
+```json
+{
+ "event": "done",
+ "success": true,
+ "sources": {
+ "displays": [{ "index": 0, "id": "screen:1:0", "name": "Entire screen" }],
+ "windows": [{ "id": "window:210:0", "name": "My App" }],
+ "microphones": [{ "label": "MacBook Pro Microphone (Built-in)" }],
+ "microphoneLabelsUnavailable": false
+ }
+}
```
### `openscreen export`
@@ -205,7 +220,8 @@ node -e '
# 3. Narrate with any TTS (macOS `say` shown; any engine producing mp3/wav/m4a works)
say -o voice.m4a --file-format=m4af "Welcome to my product. Here's a quick tour."
-# 4. Render with auto-zooms and the voiceover mixed in
+# 4. Render with auto-zooms; the voiceover replaces the recording's own audio
+# (drop --audio-mode replace to duck the original under the narration instead)
openscreen export demo.openscreen -o demo.mp4 --auto-zoom --audio voice.m4a --audio-mode replace --json
```
diff --git a/electron/cli/args.test.ts b/electron/cli/args.test.ts
index 575e0f7c5..3c00bc200 100644
--- a/electron/cli/args.test.ts
+++ b/electron/cli/args.test.ts
@@ -154,6 +154,7 @@ describe("parseCliArgs", () => {
it("parses sources", () => {
expect(parse(["sources", "--json"])).toMatchObject({ kind: "sources", json: true });
expect(parse(["sources", "--bogus"])).toMatchObject({ kind: "error" });
+ expect(parse(["sources", "extra-arg"])).toMatchObject({ kind: "error" });
});
it("parses pack", () => {
@@ -163,6 +164,13 @@ describe("parseCliArgs", () => {
outDir: inCwd("bundle"),
});
expect(parse(["pack", "demo.openscreen"])).toMatchObject({ kind: "error" });
+ expect(parse(["pack", "--out", "bundle"])).toMatchObject({ kind: "error" });
+ expect(parse(["pack", "demo.openscreen", "--out", "bundle", "--bogus"])).toMatchObject({
+ kind: "error",
+ });
+ expect(parse(["pack", "a.openscreen", "b.openscreen", "--out", "bundle"])).toMatchObject({
+ kind: "error",
+ });
});
it("parses captions", () => {