diff --git a/CHANGELOG.md b/CHANGELOG.md index b9725d3..a6756ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## Change Log +### v0.0.10 +* BUG: Added feature for being able to specify the shell to use resolves the one outstanding issue with running on the *nix platform +* FEATURE: Updated *nix support for using different shells. The preference 'hdy.brackets-shell.shell is the string path +to the shell to be used. On Windows machines this will default to "cmd.exe" and on *nix machines this will default to +"/bin/sh". If you wish to you a different shell, say bash, just set this value to something like '/bin/bash' + ### v0.0.9 * BUGFIX: Replace character with charCode 65533 to avoid showing garbage on command result on Windows (10?) * DOC: updated readme file with extension options and usage diff --git a/README.md b/README.md index 5a9b6f8..0ad0bc2 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,6 @@ hdy.Brackets-Shell ================== A brackets extension giving you access to the system shell within brackets. -##Screenshots -![][screenshot] - ##Usage Brackets-Shell adds a new icon on the right panel: click on it to toggle the shell's panel @@ -13,6 +10,10 @@ Brackets-Shell adds the following options to your brackets.json file: * `hdy.brackets-shell.dark`: set to true if you are using Bracket's dark theme (defaults to false) * `hdy.brackets-shell.trackProject`: set to true if you want to have the Bracket's shell automatically be set to your project's root directory +* `hdy.brackets-shell.shell`: set to the path of your shell (i.e "/bin/sh" or "/bin/bash"). For Windows this should be set to "cmd.exe" + +##Screenshots +![][screenshot] ##Change Log Please see [`CHANGELOG.md`](CHANGELOG.md) diff --git a/main.js b/main.js index 552e169..f4cd3d1 100644 --- a/main.js +++ b/main.js @@ -29,6 +29,16 @@ define(function (require, exports, module) { Preferences.save(); } + if(Preferences.get("shell") === undefined) { + Preferences.definePreference("shell", "string", "cmd.exe"); + if (brackets.platform === "win") { + Preferences.set("shell", "cmd.exe"); + } else { + Preferences.set("shell", "/bin/sh"); + } + Preferences.save(); + } + AppInit.appReady(function () { var projectWatcher = require("projectWatcher"), diff --git a/node/hdyShellDomain.js b/node/hdyShellDomain.js index 2027d81..4a5e29a 100644 --- a/node/hdyShellDomain.js +++ b/node/hdyShellDomain.js @@ -14,7 +14,7 @@ if false, return free memory only. * @return {number} The amount of memory. */ - function _execute(cmd, cwd, isWin) { + function _execute(cmd, cwd, isWin, shell) { var spawn = require("child_process").spawn, args, @@ -46,11 +46,11 @@ if (isWin) { args = ["/c", cmd]; - cmd = "cmd.exe"; + cmd = shell; } else { args = ["-c", cmd]; - cmd = "/bin/sh"; + cmd = shell; } child = spawn(cmd, args, { cwd: cwd, env: process.env }); @@ -64,6 +64,7 @@ }); child.on("close", function () { + child.cwd child.kill(); _domainManager.emitEvent("hdyShellDomain", "close", [enddir]); }); @@ -132,8 +133,13 @@ }, { name: "isWin", - type: "Boolean", + type: "boolean", description: "Is Windows System ?" + }, + { + name: "shell", + type: "string", + description: "Path of the Shell used to execute the commands" }] ); diff --git a/package.json b/package.json index d61aba5..cb81981 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "hdy.brackets-shell", "title": "Brackets Shell", - "version": "0.0.9", - "description": "Shell access within Brackets", - "homepage": "http://john.hidey.com/hdy.brackets-shell/", + "version": "0.0.10", + "description": "Shell access within Brackets. Want to run some shell command, install a node package, install from bower the list goes on and on. Well then, this extension is for you.", + "homepage": "https://github.com/johnhidey/hdy.brackets-shell/", "repository": { "type": "git", "url": "https://github.com/johnhidey/hdy.brackets-shell" @@ -14,12 +14,12 @@ }, "license": "MIT", "keywords": [ - "Command", - "Prompt", - "Shell", - "OS-X", - "Linux", - "Windows" + "command", + "prompt", + "shell", + "os-x", + "linux", + "windows" ], "engines": { "brackets": ">=0.40.0" @@ -32,7 +32,6 @@ "mocha": "^2.0.1" }, "dependencies": { - "splitargs": "^0.0.3", "tree-kill": "^0.0.6" } } diff --git a/shellPanel.js b/shellPanel.js index a53e384..a76d388 100644 --- a/shellPanel.js +++ b/shellPanel.js @@ -69,7 +69,8 @@ define(function (require, exports, module) { ShellDomain.exec("execute", currentCommand.text(), cwd, - brackets.platform === "win"); + brackets.platform === "win", + _preferences.get("shell")); CommandRoll.push(currentCommand.text()); console.info(CommandRoll); @@ -159,12 +160,12 @@ define(function (require, exports, module) { function replaceCharAtIndex(str, index, newChar) { var array = str.split(''); - + array[index] = newChar; - + return array.join(''); } - + function _addShellOutput(data) { var currentCommandGroup = $(".hdy-current"), @@ -192,7 +193,7 @@ define(function (require, exports, module) { _scrollToBottom(); } - + function _addShellLine(cwd) { var commandGroups = $(".hdy-command-groups"),