35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
// Generated by `vbs ide plugin`. Requires the `vbs` executable in PATH or VBS_BIN.
|
|
const vscode = require('vscode');
|
|
const vbs = process.env.VBS_BIN || "vbs";
|
|
|
|
function projectArgs() {
|
|
const folders = vscode.workspace.workspaceFolders;
|
|
return folders && folders.length ? ['--project', folders[0].uri.fsPath] : [];
|
|
}
|
|
|
|
function runTerminal(name, args) {
|
|
const terminal = vscode.window.createTerminal({ name });
|
|
terminal.show(true);
|
|
const full = [...args, ...projectArgs()];
|
|
terminal.sendText([vbs, ...full].map((a) => (a.includes(' ') ? `'${a}'` : a)).join(' '));
|
|
}
|
|
|
|
const commands = [
|
|
["vbs.build", "VBS: Build", ["build"]],
|
|
["vbs.test", "VBS: Test", ["test"]],
|
|
["vbs.install", "VBS: Install", ["install","--prefix","build/install"]],
|
|
["vbs.package", "VBS: Package (installer)", ["install","--prefix","build/install","--archive","build/install/installer.sh","--archive-format","sh"]],
|
|
["vbs.daemonStart", "VBS: Start Daemon", ["daemon","run"]],
|
|
["vbs.daemonStatus", "VBS: Daemon Status", ["daemon","status"]],
|
|
];
|
|
|
|
function activate(context) {
|
|
for (const [id, title, args] of commands) {
|
|
context.subscriptions.push(vscode.commands.registerCommand(id, () => runTerminal(title, args)));
|
|
}
|
|
}
|
|
|
|
function deactivate() {}
|
|
|
|
module.exports = { activate, deactivate };
|