Skip to content

Commit

Permalink
Remove depracated calls (fixes #22) and fallback to open-project-root…
Browse files Browse the repository at this point in the history
… when no file is open (partially handles #20)
  • Loading branch information
tkw1536 committed Jan 23, 2015
1 parent 3a7b930 commit 6528368
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion keymaps/atom-terminal.cson
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

# For more detailed documentation see
# https://atom.io/docs/latest/advanced/keymaps
'.workspace':
'atom-workspace':
'ctrl-shift-t': 'atom-terminal:open'
'alt-shift-t': 'atom-terminal:open-project-root'
12 changes: 7 additions & 5 deletions lib/atom-terminal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ open_terminal = (dirpath) ->

module.exports =
activate: ->
atom.workspaceView.command "atom-terminal:open", => @open()
atom.workspaceView.command "atom-terminal:open-project-root", => @openroot()
atom.commands.add "atom-workspace", "atom-terminal:open", => @open()
atom.commands.add "atom-workspace", "atom-terminal:open-project-root", => @openroot()
open: ->
editor = atom.workspace.getActivePaneItem()
file = editor?.buffer.file
file = editor?.buffer?.file
filepath = file?.path
if filepath
open_terminal path.dirname(filepath)
else
@openroot

openroot: ->
if atom.project.path
open_terminal atom.project.path
open_terminal path for path in atom.project.getPaths()

# Set per-platform defaults
if platform() == 'darwin'
Expand Down

0 comments on commit 6528368

Please sign in to comment.