forked from iarv/vscode-front-matter
Added sample for custom actions
This commit is contained in:
14
README.md
14
README.md
@@ -32,12 +32,18 @@ The current workspace-, file-path, and front matter data will be passed as an ar
|
||||
|
||||
```javascript
|
||||
const arguments = process.argv;
|
||||
const workspaceArg = arguments[2];
|
||||
const fileArg = arguments[3];
|
||||
const dataArg = arguments[4];
|
||||
const data = dataArg && typeof dataArg === "string" ? JSON.parse(dataArg) : null;
|
||||
|
||||
if (arguments && arguments.length > 0) {
|
||||
const workspaceArg = arguments[2]; // The workspace path
|
||||
const fileArg = arguments[3]; // The file path
|
||||
const frontMatterArg = arguments[4]; // Front matter data
|
||||
|
||||
console.log(`The content returned for your notification.`);
|
||||
}
|
||||
```
|
||||
|
||||
> A sample file can be found here: 
|
||||
|
||||
The output of the script will be passed as a notification, and it allows you to copy the output.
|
||||
|
||||

|
||||
|
||||
10
sample/script-sample.js
Normal file
10
sample/script-sample.js
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
const arguments = process.argv;
|
||||
|
||||
if (arguments && arguments.length > 0) {
|
||||
const workspaceArg = arguments[2]; // The workspace path
|
||||
const fileArg = arguments[3]; // The file path
|
||||
const frontMatterArg = arguments[4]; // Front matter data
|
||||
|
||||
console.log(`The content returned for your notification.`);
|
||||
}
|
||||
Reference in New Issue
Block a user