How to call an atom package?

atom-editor, github

Solution

To call a Command Palette command from code, you can use `atom.workspaceView.trigger` and give it the name of the command as a string. For example:

atom.workspaceView.command 'custom:runner', ->
  editor = atom.workspace.getActiveEditor()
  editor.save()
  atom.workspaceView.trigger 'runner:run'

I changed the name of your custom command to `custom:runner` to fit in with the conventions of command naming in Atom and the conventions we've been using in the Atom community for simple commands in one's `init.coffee`. If you wanted to retain the use of "my entry" as the package name (or anything else that has two words in it), I'd recommend formatting it as `my-entry:runner`.

Problem

I installed the atom-runner package. I want to create a custom command to execute from the palette to save the current file and then execute the runner. Getting the editor and saving the file works. `runner:run` fails as does `AtomRunner.run()` ` atom.workspaceView.command 'MyEntry:runner', -> editor = atom.workspace.getActiveEditor() editor.save() runner:run `

Original source