Are you looking for a way to pass commands to the terminal via code? Do you want to run long processes with the ability to kill or destroy them? Do you want to ensure your code can create a command line/terminal in all operating systems? Do you want to use the terminal and enter commands while in atom?
If so, then this package is for you. Even if you do not need the API, you can use the GUI.
A terminal interface and status icon. Fork of terminal-panel.
Added API that allows any package to make a terminal, pass it a command and see the output (all via code).
Works for Windows,Linux and OSX. No Dependencies.
I have used this package for research at University of Auckland (hence the uoa at the end of the name).
Download the "sysj" package in atom or go to https://github.com/arrayoutofbounds/sysj to see an example of a package using the API.
As you can see, I have a running process. At the bottom you can see the blue icon that shows the currently open terminal which you can toggle or destroy.
The package.json supplies the services provided. Consume the service (after reading the services API atom documentation). Then use the service and be able to add a terminal from your package programatically.
The service gives a Cli-status-view object. That has the methods to create new terminals, toggle between them etc Each Cli-status-view object has a command-output-view object that actually runs the processes and displays the output. The code has been commented, so please read it before using it.
"consumedServices": {"terminal-panel-uoa": {"versions": {"^1.2.3": "consumeCommandOutputView"}}}
consumeCommandOutputView: (commandOutputView) ->@commandOutputView = commandOutputView # assigns a instance variableconsole.log "API consumed" # lets you know you have used the APIconsole.log @commandOutputView # prints the command output view object in the logconsole.log "New terminal created" # lets you know a new terminal has been created
createTerminal: ->terminal = @commandOutputView.newTermClick() #create new terminalterminal
Spawning the terminal will create a new terminal with the command you pass into it. Please beware of the path being different in the OS. Use path.sep to ensure it works on windows and linux/MacOSX.
The GUI will be created and the result of the command will be shown.
terminal = @createTerminal()terminal.spawn(jdkPath + " -classpath " + pathToJar + @pathToClass + " com.systemj.SystemJRunner " + filePath,"java",["-classpath", "" + pathToJar + @pathToClass , 'com.systemj.SystemJRunner',"" + filePath])
Terminal-panel executes your commands and displays the output. This means you can do all sorts of useful stuff right inside Atom, like:
Some things it can't do (yet):
Just press ctrl-`
.
Processes are killed via the node js api. You can check via "tasklist" for windows or "top/htop" for unix/linux/OSX. When the process running is killed the pid of the process ceases to exist.
ctrl-`
toggle current terminalcommand-shift-t
new terminalcommand-shift-j
next terminalcommand-shift-k
prev terminalcommand-shift-x
destroy terminalup
and down
for "command history"A fork of guileen/terminal-status.
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.