Created
November 17, 2015 03:33
-
-
Save bhurlow/b8dfd8a6adc68f943b00 to your computer and use it in GitHub Desktop.
atom git log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
atom.beep() | |
var path = require('path') | |
var spawn = require("child_process").spawn | |
var options = { | |
pwd: atom.project.getPaths()[0], | |
env: Object.create(process.env) | |
} | |
options.env["ATOM_SHELL_INTERNAL_RUN_AS_NODE"] = 1 | |
atom.commands.add('atom-text-editor', 'gitlog:show', function() { | |
var editor = atom.workspace.getActiveTextEditor() | |
log = spawn('git', [ | |
"log", | |
"--oneline" | |
], options) | |
log.stdout.on('data', function(data) { | |
console.log(data.toString()) | |
editor.setText(data.toString()) | |
}) | |
log.stderr.on('data', function (data) { | |
console.log(data.toString()) | |
editor.setText(data.toString()) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment