Skip to content

Commit

Permalink
path-correction
Browse files Browse the repository at this point in the history
Signed-off-by: urgetolearn <[email protected]>
  • Loading branch information
urgetolearn committed Nov 28, 2024
1 parent 8cd3d46 commit 375f62a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 26 deletions.
47 changes: 21 additions & 26 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,54 +24,49 @@ let loadedConnectionProfile = null;
const fabricsamples = require("./src/fabricsamples");

function activate(context) {
const fabricDebuggerPath = 'C:\\Users\\Public\\fabric-debugger';
function runupBashScript() {
const fabricDebuggerPath = 'C:\\Users\\chinm\\fabric-debugger';

let greenButton = vscode.commands.registerCommand('myview.button1', () => {
const platform = process.platform;
const changeDirCommand = `cd "${fabricDebuggerPath}"`;
let runScriptCommand;
let command;
if (platform === 'win32') {
runScriptCommand = `wsl bash local-networkup.sh`;
command = `cd "${fabricDebuggerPath}" && wsl bash local-networkup.sh`;
} else {
runScriptCommand = `bash local-networkup.sh`;
command = `cd "${fabricDebuggerPath}" && bash local-networkup.sh`;
}
const fullCommand = `${changeDirCommand} && ${runScriptCommand}`;
exec(fullCommand, (err, stdout, stderr) => {

exec(command, (err, stdout, stderr) => {
if (err) {
vscode.window.showErrorMessage(`Error: ${stderr}`);
console.error(`Error: ${stderr}`);
return;
}
vscode.window.showInformationMessage(`Output: ${stdout}`);
console.log(`Output: ${stdout}`);
vscode.window.showInformationMessage("network is up and running");
});
}
let greenButton = vscode.commands.registerCommand('myview.button1', () => {
runupBashScript();
});
context.subscriptions.push(greenButton);
function rundownBashScript() {

let redButton = vscode.commands.registerCommand('myview.button2', () => {
const platform = process.platform;
const changeDirCommand = `cd "${fabricDebuggerPath}"`;
let runScriptCommand;

let command;
if (platform === 'win32') {
runScriptCommand = `wsl bash local-networkdown.sh`;
command = `cd "${fabricDebuggerPath}" && wsl bash local-networkdown.sh`;
} else {
runScriptCommand = `bash local-networkdown.sh`;
command = `cd "${fabricDebuggerPath}" && bash ocal-networkdown.sh`;
}
const fullCommand = `${changeDirCommand} && ${runScriptCommand}`;
exec(fullCommand, (err, stdout, stderr) => {

// Execute the command
exec(command, (err, stdout, stderr) => {
if (err) {
vscode.window.showErrorMessage(`Error: ${stderr}`);
console.error(`Error: ${stderr}`);
return;
}
vscode.window.showInformationMessage(`Output: ${stdout}`);
console.log(`Output: ${stdout}`);
vscode.window.showInformationMessage("network is down");
});
}
let redButton = vscode.commands.registerCommand('myview.button2', () => {
rundownBashScript();
});

context.subscriptions.push(greenButton);
context.subscriptions.push(redButton);


Expand Down
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@
"command": "wallets.uploadWallet",
"when": "view == wallets",
"group": "navigation"
},
{
"command": "myview.button1",
"when": "view == start-local-network",
"group": "navigation"
},
{
"command": "myview.button2",
"when": "view == start-local-network",
"group": "navigation"
}
],
"view/item/context": [
Expand Down Expand Up @@ -134,6 +144,14 @@
"command": "extension.extractFunctions",
"title": "Debug-Chaincode ▶"
},
{
"command": "myview.button1",
"title": "🟢"
},
{
"command": "myview.button2",
"title": "🔴"
},
{
"command": "fabric-network.start",
"title": "Connection profile form",
Expand Down

0 comments on commit 375f62a

Please sign in to comment.