diff --git a/README.md b/README.md index 9822ae0..751bb7b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,21 @@ -# atom-terminal +# atom-terminal-powershell + +## Difference from Atom-Terminal +Custom edit to atom-terminal plugin to support powershell out of the box. +Provides the same properties as the original plugin except defaults to Powershell. + +Original package can be found here: [https://github.com/karan/atom-terminal](https://github.com/karan/atom-terminal) + +![Default Powershell Option](https://raw.github.com/superkaitokid/atom-terminal-powershell/master/default.png) + +## Usage +If using Powershell, supply a Powershell executable and check the Is Powershell option. + +If using other terminals, uncheck Is Powershell option and follow normal atom-terminal usage. + +![Is PowerShell Option](https://raw.github.com/superkaitokid/atom-terminal-powershell/master/isPowerShell.png) + +## Original Atom-Terminal Instructions Open terminal on current file's directory with `ctrl-shift-t`. @@ -6,7 +23,7 @@ Open a terminal in the project's root directory with `alt-shift-t`. Keybindings: `ctrl-shift-t`, `alt-shift-t` -Install: `apm install atom-terminal` +Install: `apm install atom-terminal-powershell` Config: ```coffeescript diff --git a/default.png b/default.png new file mode 100644 index 0000000..f7b92c4 Binary files /dev/null and b/default.png differ diff --git a/isPowerShell.png b/isPowerShell.png new file mode 100644 index 0000000..1177b6e Binary files /dev/null and b/isPowerShell.png differ diff --git a/keymaps/atom-terminal.cson b/keymaps/atom-terminal-powershell.cson similarity index 76% rename from keymaps/atom-terminal.cson rename to keymaps/atom-terminal-powershell.cson index cacbd19..e382b5d 100644 --- a/keymaps/atom-terminal.cson +++ b/keymaps/atom-terminal-powershell.cson @@ -8,5 +8,5 @@ # For more detailed documentation see # https://atom.io/docs/latest/advanced/keymaps 'atom-workspace': - 'ctrl-shift-t': 'atom-terminal:open' - 'alt-shift-t': 'atom-terminal:open-project-root' + 'ctrl-shift-t': 'atom-terminal-powershell:open' + 'alt-shift-t': 'atom-terminal-powershell:open-project-root' diff --git a/lib/atom-terminal.coffee b/lib/atom-terminal-powershell.coffee similarity index 67% rename from lib/atom-terminal.coffee rename to lib/atom-terminal-powershell.coffee index f462c67..c5f5449 100644 --- a/lib/atom-terminal.coffee +++ b/lib/atom-terminal-powershell.coffee @@ -7,20 +7,26 @@ platform = require('os').platform ### open_terminal = (dirpath) -> # Figure out the app and the arguments - app = atom.config.get('atom-terminal.app') - args = atom.config.get('atom-terminal.args') + app = atom.config.get('atom-terminal-powershell.app') + args = atom.config.get('atom-terminal-powershell.args') # get options - setWorkingDirectory = atom.config.get('atom-terminal.setWorkingDirectory') - surpressDirArg = atom.config.get('atom-terminal.surpressDirectoryArgument') - runDirectly = atom.config.get('atom-terminal.MacWinRunDirectly') + setWorkingDirectory = atom.config.get('atom-terminal-powershell.setWorkingDirectory') + isPowerShell = atom.config.get('atom-terminal-powershell.isPowerShell') + surpressDirArg = atom.config.get('atom-terminal-powershell.surpressDirectoryArgument') + runDirectly = atom.config.get('atom-terminal-powershell.MacWinRunDirectly') # Start assembling the command line - cmdline = "\"#{app}\" #{args}" + if !isPowerShell + cmdline = "\"#{app}\" #{args}" + else + cmdline = "\"#{app}\" #{args} -noexit " # If we do not supress the directory argument, add the directory as an argument - if !surpressDirArg + if !surpressDirArg && !isPowerShell cmdline += " \"#{dirpath}\"" + else if !surpressDirArg && isPowerShell + cmdline += "-command \"cd \'#{dirpath}\'\"" # For mac, we prepend open -a unless we run it directly if platform() == "darwin" && !runDirectly @@ -31,7 +37,7 @@ open_terminal = (dirpath) -> cmdline = "start \"\" " + cmdline # log the command so we have context if it fails - console.log("atom-terminal executing: ", cmdline) + console.log("atom-terminal-powershell executing: ", cmdline) # Set the working directory if configured if setWorkingDirectory @@ -42,8 +48,8 @@ open_terminal = (dirpath) -> module.exports = activate: -> - atom.commands.add "atom-workspace", "atom-terminal:open", => @open() - atom.commands.add "atom-workspace", "atom-terminal:open-project-root", => @openroot() + atom.commands.add "atom-workspace", "atom-terminal-powershell:open", => @open() + atom.commands.add "atom-workspace", "atom-terminal-powershell:open-project-root", => @openroot() open: -> editor = atom.workspace.getActivePaneItem() file = editor?.buffer?.file @@ -65,10 +71,13 @@ if platform() == 'darwin' default: '' surpressDirectoryArgument: type: 'boolean' - default: false + default: true setWorkingDirectory: type: 'boolean' default: true + isPowerShell: + type: 'boolean' + default: true MacWinRunDirectly: type: 'boolean' default: false @@ -77,7 +86,7 @@ else if platform() == 'win32' module.exports.config = app: type: 'string' - default: 'C:\\Windows\\System32\\cmd.exe' + default: '%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Windows PowerShell\\Windows PowerShell' args: type: 'string' default: '' @@ -87,6 +96,9 @@ else if platform() == 'win32' setWorkingDirectory: type: 'boolean' default: true + isPowerShell: + type: 'boolean' + default: true MacWinRunDirectly: type: 'boolean' default: false @@ -101,7 +113,7 @@ else default: '' surpressDirectoryArgument: type: 'boolean' - default: false + default: true setWorkingDirectory: type: 'boolean' default: true diff --git a/menus/darwin.cson b/menus/darwin.cson index 36bdb5d..b13059c 100644 --- a/menus/darwin.cson +++ b/menus/darwin.cson @@ -1,2 +1,2 @@ 'context-menu': - '.platform-darwin .tree-view': [{label: 'Open Terminal at Root', command: 'atom-terminal:open-project-root'}] + '.platform-darwin .tree-view': [{label: 'Open Terminal at Root', command: 'atom-terminal-powershell:open-project-root'}] diff --git a/menus/win32.cson b/menus/win32.cson index 60a1d03..dd7290a 100644 --- a/menus/win32.cson +++ b/menus/win32.cson @@ -1,2 +1,2 @@ 'context-menu': - '.platform-win32 .tree-view': [{label: 'Open Terminal at Root', command: 'atom-terminal:open-project-root'}] + '.platform-win32 .tree-view': [{label: 'Open Terminal at Root', command: 'atom-terminal-powershell:open-project-root'}] diff --git a/package.json b/package.json index c8af193..14a599d 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { - "name": "atom-terminal", - "main": "./lib/atom-terminal", - "version": "0.8.1", - "description": "Open terminal in the current file's directory.", + "name": "atom-terminal-powershell", + "main": "./lib/atom-terminal-powershell", + "version": "1.1.0", + "description": "Open powershell terminal in the current file's directory.", "activationCommands": { "atom-workspace": [ - "atom-terminal:open", - "atom-terminal:open-project-root" + "atom-terminal-powershell:open", + "atom-terminal-powershell:open-project-root" ] }, - "repository": "https://github.com/karan/atom-terminal", + "repository": "https://github.com/superkaitokid/atom-terminal-powershell", "license": "MIT", "engines": { "atom": ">0.50.0"