Skip to content

Commit

Permalink
initial package
Browse files Browse the repository at this point in the history
  • Loading branch information
Karan Goel committed Mar 11, 2014
0 parents commit 8e3f944
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
npm-debug.log
node_modules
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2014 Karan Goel

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# atom-terminal

Open terminal on current file's directory.

Keybinding: `ctrl-shift-t`

![atom-terminal](https://f.cloud.github.com/assets/69169/2290250/c35d867a-a017-11e3-86be-cd7c5bf3ff9b.gif)
11 changes: 11 additions & 0 deletions keymaps/terminal.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.

# For more detailed documentation see
# https://atom.io/docs/latest/advanced/keymaps
'.workspace':
'ctrl-shift-t': 'terminal:open'
18 changes: 18 additions & 0 deletions lib/terminal.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
exec = require('child_process').exec
path = require('path')

module.exports =
configDefaults: {
app: 'Terminal.app'
args: ''
},
activate: ->
atom.workspaceView.command "terminal:open", => @open()

open: ->
filepath = atom.workspaceView.find('.tree-view .selected')?.view()?.getPath?()
if filepath
dirpath = path.dirname(filepath)
app = atom.config.get('terminal.app')
args = atom.config.get('terminal.args')
exec "open -a #{app} #{args} #{dirpath}" if dirpath?
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "terminal",
"main": "./lib/terminal",
"version": "0.0.1",
"description": "Open terminal in the current file's directory.",
"activationEvents": ["terminal:open"],
"repository": "https://github.com/karan/atom-terminal",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
},
"dependencies": {
}
}

0 comments on commit 8e3f944

Please sign in to comment.