Skip to content

Commit 04e46da

Browse files
authored
Document command arguments (jupyter-ai-contrib#15)
* Document command arguments * lint
1 parent e5e35a5 commit 04e46da

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ app.commands.execute('jupyterlab-cell-diff:show-codemirror', {
4848
});
4949
```
5050

51+
#### Command Arguments
52+
53+
The `jupyterlab-cell-diff:show-codemirror` command accepts the following arguments:
54+
55+
| Argument | Type | Required | Description |
56+
| ------------------- | --------- | -------- | ------------------------------------------------------------------------------------ |
57+
| `cellId` | `string` | No | ID of the cell to show diff for. If not provided, uses the active cell |
58+
| `originalSource` | `string` | Yes | Original source code to compare against |
59+
| `newSource` | `string` | Yes | New source code to compare with |
60+
| `showActionButtons` | `boolean` | No | Whether to show action buttons in the diff widget (default: `true`) |
61+
| `notebookPath` | `string` | No | Path to the notebook containing the cell. If not provided, uses the current notebook |
62+
| `openDiff` | `boolean` | No | Whether to open the diff widget automatically (default: `true`) |
63+
5164
## Uninstall
5265

5366
To remove the extension, execute:

src/plugin.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ const codeMirrorPlugin: JupyterFrontEndPlugin<void> = {
105105
'Whether to open the diff widget automatically'
106106
)
107107
}
108-
}
108+
},
109+
required: ['originalSource', 'newSource']
109110
}
110111
},
111112
execute: async (args: any = {}) => {
@@ -118,6 +119,13 @@ const codeMirrorPlugin: JupyterFrontEndPlugin<void> = {
118119
openDiff = true
119120
} = args;
120121

122+
if (!originalSource || !newSource) {
123+
console.error(
124+
trans.__('Missing required arguments: originalSource and newSource')
125+
);
126+
return;
127+
}
128+
121129
const currentNotebook = findNotebook(notebookTracker, notebookPath);
122130
if (!currentNotebook) {
123131
return;

0 commit comments

Comments
 (0)