diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f7f9b7..b9725d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## Change Log +### 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 +* BUGFIX: Finally have *nix platforms environment pulling it. I have verified this on a Ubuntu 14 x64 installation. Currently +only support the sh (Bourne) shell. + ### v0.0.8 * BUGFIX: Prompt will not focus when you click anywhere within the shell panel * BUGFIX: Prompt disables immediately after pressing enter to prevent the accidently diff --git a/Gruntfile.js b/Gruntfile.js index 78ce161..0b3cd7a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -24,13 +24,6 @@ module.exports = function(grunt) { copy: { main: { files: [ - { - expand: true, - cwd: "node_modules/splitargs/", - src: ["**/*"], - dest: "node/node_modules/splitargs/", - filter: "isFile" - }, { expand: true, cwd: "node_modules/tree-kill/", diff --git a/README.md b/README.md index 5570667..5a9b6f8 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,19 @@ -hdy.Brackets-Shell-- +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 + +##Options +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 + ##Change Log Please see [`CHANGELOG.md`](CHANGELOG.md) diff --git a/node/hdyShellDomain.js b/node/hdyShellDomain.js index ce2c727..2027d81 100644 --- a/node/hdyShellDomain.js +++ b/node/hdyShellDomain.js @@ -17,7 +17,6 @@ function _execute(cmd, cwd, isWin) { var spawn = require("child_process").spawn, - splitarps = require("splitargs"), args, enddir = cwd, tempdir; @@ -45,18 +44,13 @@ _domainManager.emitEvent("hdyShellDomain", "clear"); } - args = splitarps(cmd); - if (args.length === 0) { - args = []; - } - if (isWin) { + args = ["/c", cmd]; cmd = "cmd.exe"; - args.unshift("/c"); } else { - cmd = "sh"; - args.unshift("-c"); + args = ["-c", cmd]; + cmd = "/bin/sh"; } child = spawn(cmd, args, { cwd: cwd, env: process.env }); @@ -99,7 +93,7 @@ function _init(domainManager) { if (!domainManager.hasDomain("hdyShellDomain")) { - domainManager.registerDomain("hdyShellDomain", {major: 0, minor: 1}); + domainManager.registerDomain("hdyShellDomain", {major: 0, minor: 2}); } domainManager.registerCommand( diff --git a/node/node_modules/splitargs/README.md b/node/node_modules/splitargs/README.md deleted file mode 100644 index 455ca30..0000000 --- a/node/node_modules/splitargs/README.md +++ /dev/null @@ -1,63 +0,0 @@ -splitargs -========== -Splits strings into tokens by given separator except treating quoted part as a single token. - -#Installation -`npm install splitargs` - -#Usage -```javascript -var splitargs = require('splitargs'); - -var i1 = "I said 'I am sorry.', and he said \"it doesn't matter.\""; -var o1 = splitargs(i1); -console.log(o1); -/* -[ 'I', - 'said', - 'I am sorry.,', - 'and', - 'he', - 'said', - 'it doesn\'t matter.' ] -*/ - -var i2 = "I said \"I am sorry.\", and he said \"it doesn't matter.\""; -var o2 = splitargs(i2); -console.log(o2); -/* -[ 'I', - 'said', - 'I am sorry.,', - 'and', - 'he', - 'said', - 'it doesn\'t matter.' ] -*/ - -var i3 = 'I said "I am sorry.", and he said "it doesn\'t matter."'; -var o3 = splitargs(i3); -console.log(o3); -/* -[ 'I', - 'said', - 'I am sorry.,', - 'and', - 'he', - 'said', - 'it doesn\'t matter.' ] -*/ - -var i4 = 'I said \'I am sorry.\', and he said "it doesn\'t matter."'; -var o4 = splitargs(i4); -console.log(o4); -/* -[ 'I', - 'said', - 'I am sorry.,', - 'and', - 'he', - 'said', - 'it doesn\'t matter.' ] -*/ -``` \ No newline at end of file diff --git a/node/node_modules/splitargs/package.json b/node/node_modules/splitargs/package.json deleted file mode 100644 index 08190ca..0000000 --- a/node/node_modules/splitargs/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "splitargs", - "version": "0.0.3", - "description": "Splits strings into tokens by given separator except treating quoted part as a single token.", - "main": "splitargs.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "https://github.com/elgs/splitargs" - }, - "keywords": [ - "split", - "args", - "quoted", - "space" - ], - "author": { - "name": "Elgs Chen" - }, - "license": "ISC", - "bugs": { - "url": "https://github.com/elgs/splitargs/issues" - }, - "homepage": "https://github.com/elgs/splitargs", - "readme": "splitargs\n==========\nSplits strings into tokens by given separator except treating quoted part as a single token.\n\n#Installation\n`npm install splitargs`\n\n#Usage\n```javascript\nvar splitargs = require('splitargs');\n\nvar i1 = \"I said 'I am sorry.', and he said \\\"it doesn't matter.\\\"\";\nvar o1 = splitargs(i1);\nconsole.log(o1);\n/*\n[ 'I',\n 'said',\n 'I am sorry.,',\n 'and',\n 'he',\n 'said',\n 'it doesn\\'t matter.' ]\n*/\n\nvar i2 = \"I said \\\"I am sorry.\\\", and he said \\\"it doesn't matter.\\\"\";\nvar o2 = splitargs(i2);\nconsole.log(o2);\n/*\n[ 'I',\n 'said',\n 'I am sorry.,',\n 'and',\n 'he',\n 'said',\n 'it doesn\\'t matter.' ]\n*/\n\nvar i3 = 'I said \"I am sorry.\", and he said \"it doesn\\'t matter.\"';\nvar o3 = splitargs(i3);\nconsole.log(o3);\n/*\n[ 'I',\n 'said',\n 'I am sorry.,',\n 'and',\n 'he',\n 'said',\n 'it doesn\\'t matter.' ]\n*/\n\nvar i4 = 'I said \\'I am sorry.\\', and he said \"it doesn\\'t matter.\"';\nvar o4 = splitargs(i4);\nconsole.log(o4);\n/*\n[ 'I',\n 'said',\n 'I am sorry.,',\n 'and',\n 'he',\n 'said',\n 'it doesn\\'t matter.' ]\n*/\n```", - "readmeFilename": "README.md", - "_id": "splitargs@0.0.3", - "_shasum": "6df2e31387c719b7b4d3d0db022214903763f1ad", - "_from": "splitargs@^0.0.3", - "_resolved": "https://registry.npmjs.org/splitargs/-/splitargs-0.0.3.tgz" -} diff --git a/node/node_modules/splitargs/splitArgsSpec.js b/node/node_modules/splitargs/splitArgsSpec.js deleted file mode 100644 index 0e0f7b4..0000000 --- a/node/node_modules/splitargs/splitArgsSpec.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Created by elgs on 7/2/14. - */ - -(function () { - "use strict"; - - var splitargs = require('./splitargs.js'); - - describe('splitargs Suite', function () { - beforeEach(function () { - }); - afterEach(function () { - }); - - it('should split double quoted string', function () { - var i = "I said 'I am sorry.', and he said \"it doesn't matter.\""; - var o = splitargs(i); - expect(o.length).toBe(7); - expect(o[0]).toBe("I"); - expect(o[1]).toBe("said"); - expect(o[2]).toBe("I am sorry.,"); - expect(o[3]).toBe("and"); - expect(o[4]).toBe("he"); - expect(o[5]).toBe("said"); - expect(o[6]).toBe("it doesn't matter."); - }); - - it('should split pure double quoted string', function () { - var i = "I said \"I am sorry.\", and he said \"it doesn't matter.\""; - var o = splitargs(i); - expect(o.length).toBe(7); - expect(o[0]).toBe("I"); - expect(o[1]).toBe("said"); - expect(o[2]).toBe("I am sorry.,"); - expect(o[3]).toBe("and"); - expect(o[4]).toBe("he"); - expect(o[5]).toBe("said"); - expect(o[6]).toBe("it doesn't matter."); - }); - - it('should split single quoted string', function () { - var i = 'I said "I am sorry.", and he said "it doesn\'t matter."'; - var o = splitargs(i); - expect(o.length).toBe(7); - expect(o[0]).toBe("I"); - expect(o[1]).toBe("said"); - expect(o[2]).toBe("I am sorry.,"); - expect(o[3]).toBe("and"); - expect(o[4]).toBe("he"); - expect(o[5]).toBe("said"); - expect(o[6]).toBe("it doesn't matter."); - }); - - it('should split pure single quoted string', function () { - var i = 'I said \'I am sorry.\', and he said "it doesn\'t matter."'; - var o = splitargs(i); - expect(o.length).toBe(7); - expect(o[0]).toBe("I"); - expect(o[1]).toBe("said"); - expect(o[2]).toBe("I am sorry.,"); - expect(o[3]).toBe("and"); - expect(o[4]).toBe("he"); - expect(o[5]).toBe("said"); - expect(o[6]).toBe("it doesn't matter."); - }); - }); -})(); \ No newline at end of file diff --git a/node/node_modules/splitargs/splitargs.js b/node/node_modules/splitargs/splitargs.js deleted file mode 100644 index bfc2f42..0000000 --- a/node/node_modules/splitargs/splitargs.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Created by elgs on 7/2/14. - */ - -(function () { - "use strict"; - - module.exports = function (input, separator) { - separator = separator || /\s/g; - var singleQuoteOpen = false; - var doubleQuoteOpen = false; - var tokenBuffer = []; - var ret = []; - - var arr = input.split(''); - for (var i = 0; i < arr.length; ++i) { - var element = arr[i]; - var matches = element.match(separator); - if (element === "'") { - if (!doubleQuoteOpen) { - singleQuoteOpen = !singleQuoteOpen; -// if (!singleQuoteOpen) { -// ret.push(tokenBuffer.join('')); -// tokenBuffer = []; -// } - continue; - } - } else if (element === '"') { - if (!singleQuoteOpen) { - doubleQuoteOpen = !doubleQuoteOpen; -// if (!doubleQuoteOpen) { -// ret.push(tokenBuffer.join('')); -// tokenBuffer = []; -// } - continue; - } - } - - if (!singleQuoteOpen && !doubleQuoteOpen) { - if (matches) { - if (tokenBuffer && tokenBuffer.length > 0) { - ret.push(tokenBuffer.join('')); - tokenBuffer = []; - } - } else { - tokenBuffer.push(element); - } - } else if (singleQuoteOpen) { - tokenBuffer.push(element); - } else if (doubleQuoteOpen) { - tokenBuffer.push(element); - } - } - if (tokenBuffer && tokenBuffer.length > 0) { - ret.push(tokenBuffer.join('')); - } - return ret; - }; -})(); \ No newline at end of file diff --git a/package.json b/package.json index b1a4abf..d61aba5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "hdy.brackets-shell", "title": "Brackets Shell", - "version": "0.0.8", + "version": "0.0.9", "description": "Shell access within Brackets", "homepage": "http://john.hidey.com/hdy.brackets-shell/", "repository": { @@ -14,8 +14,12 @@ }, "license": "MIT", "keywords": [ - "command", - "shell" + "Command", + "Prompt", + "Shell", + "OS-X", + "Linux", + "Windows" ], "engines": { "brackets": ">=0.40.0" diff --git a/shellPanel.js b/shellPanel.js index 4543f36..a53e384 100644 --- a/shellPanel.js +++ b/shellPanel.js @@ -157,6 +157,14 @@ 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"), @@ -174,12 +182,17 @@ define(function (require, exports, module) { if(ansiFormat.hasAceptedAnsiFormat(data)){ ansiFormat.formattedText(data, currentCommandResult); } else { + for (var i = 0; i < data.length; i++) { + if (data.charCodeAt(i) === 65533) { + data = replaceCharAtIndex(data, i, "."); + } + } $("pre", currentCommandResult).append(document.createTextNode(data)); } _scrollToBottom(); } - + function _addShellLine(cwd) { var commandGroups = $(".hdy-command-groups"),