Developer documentation
Files And Debugging
Plugins can ask the user to pick text files, save text output, and write to the plugin debug console.
Pick a text file and process it
commands: {
"import.pick": function(ctx) {
return {
__action: "pickTextFile",
allowedExtensions: ["json", "txt"],
nextCommand: "import.process"
};
},
"import.process": function(ctx) {
var text = ctx.file && ctx.file.text ? ctx.file.text : "";
return { __action: "setPluginData", key: "import.lastFile", value: text };
}
}
Save generated text
return {
__action: "saveTextFile",
filename: "buildaplugin-output.json",
text: JSON.stringify(ctx.pluginData, null, 2)
};
Debug log
return {
__action: "debug.log",
pluginId: "my-plugin",
level: "info",
message: "Command ran with URL " + ctx.dollar("#urlInput").val()
};