]> arthur.barton.de Git - atom-ax-pipe.git/blobdiff - lib/pipe.coffee
Command history
[atom-ax-pipe.git] / lib / pipe.coffee
index ec25ab594b2d63b307ff4aa46424f9277c7c833d..8db43da6be01e501a02c1809e6682f3a6f9f3b19 100644 (file)
@@ -2,6 +2,8 @@
 {spawn} = require 'child_process'
 CommandView = require './command-view'
 
+history = []
+
 module.exports =
   activate: ->
     atom.workspaceView.command 'pipe:run', => @run()
@@ -11,11 +13,15 @@ module.exports =
     view = atom.workspaceView.getActiveView()
     return if not editor?
 
-    new CommandView (commandString) ->
+    new CommandView history, (commandString) ->
       if not commandString
         view.focus()
         return
 
+      history.push commandString
+      if history.length > 300
+        history.shift()
+
       range = editor.getSelectedBufferRange()
       stdout = ''
       stderr = ''