Using console-panel package?


#1

Hi,

This is probably a silly question, as I’m very new to Atom and trying to understand how packages are built as well as being new to coffee script… but here it is:

I’ve successfully created my own package using tool-bar to add my own tool bar to Atom. My aim is for one of the tool bar button to compile C code and display the output of that on a console. The console-panel package seems like exactly what I need.

Problem is that I have no idea how to use it. Any help greatly appreciated!

So far I have:

package.json:

  "consumedServices": {
    "tool-bar": {
      "versions": {
        "^0.0.1": "consumeToolBar"
      }
    },
    "console-panel": {
      "versions": {
        "^0.0.1": "consumeConsolePanel"
      }
    }
  }

main.coffee:

path = require 'path'
utils = require './utils'
pkg = require '../package.json'

toolBarEpics = {};

toolBarEpics.consumeToolBar = (toolBar) ->
  @toolBar = toolBar 'tool-bar-epics'

  @toolBar.addButton
    icon: 'package-variant'
    iconset: 'mdi'
    callback: -> utils.make()
    tooltip: 'Make'


toolBarEpics.deactivate = ->
  @toolBar?.removeItems()

module.exports = toolBarEpics;

and utils.coffee is

utils = {};

utils.make = ->
    {exec} = require 'child_process'
    exec "make", (err, stdout, stderr) ->
      alert "stdout: " + stdout

module.exports = utils;

As you can see, the only thing the tool bar button does is use the alert function to show the output of the make command. I’d like to be able to show this on the console instead.