diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ade14b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +npm-debug.log +node_modules diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..29d60bd --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,20 @@ +Copyright (c) 2015 Adam Hull + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..15b0ffc --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Atom aliasCommand + +A 'lil utility to register existing commands with new names. +Useful if you're conditioned to look for a different name, like `Package Control: Install`. + +## Getting Started + +```sh +> npm install -g atom-alias-command +``` + +From you init.coffee (You can open this via `Application: Open Your Init Script`): +```coffee +aliasCommand = require 'atom-alias-command' + +aliasCommand 'tree-view:move', + orig: 'tree-view:rename' + +aliasCommand 'package-control:install', + orig: 'settings-view:install-packages-and-themes' + +# Takes an optional scope for commands that should only +# appear when a particular element has focus +aliasCommand 'grammar-selector:set-syntax', + orig: 'grammar-selector:show' + scope: 'atom-editor' +``` + +## Running Tests +```sh +> apm test +``` diff --git a/lib/atom-alias-command.coffee b/lib/atom-alias-command.coffee new file mode 100644 index 0000000..e7570f5 --- /dev/null +++ b/lib/atom-alias-command.coffee @@ -0,0 +1,4 @@ +module.exports = aliasCommand = (as, {orig, scope}) -> + scope ?= 'atom-workspace' + atom.commands.add scope, as, (event) -> + atom.commands.dispatch event.target, old diff --git a/package.json b/package.json new file mode 100644 index 0000000..095942e --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "atom-alias-command", + "main": "./lib/atom-alias-command", + "version": "0.0.0", + "description": "A short description of your package", + "keywords": [ + "alias", "command" + ], + "activationCommands": { + "atom-workspace": "atom-alias-command:toggle" + }, + "repository": "https://github.com/hurrymaplelad/atom-alias-command", + "license": "MIT", + "engines": { + "atom": ">=1.0.0 <2.0.0" + }, + "dependencies": { + } +} diff --git a/spec/atom-alias-command-spec.coffee b/spec/atom-alias-command-spec.coffee new file mode 100644 index 0000000..046c010 --- /dev/null +++ b/spec/atom-alias-command-spec.coffee @@ -0,0 +1,6 @@ +aliasCommand = require '../lib/atom-alias-command' + +describe "aliasCommand", -> + it "doesn't explode", -> + aliasCommand 'new:action', + orig: 'boring:old-action'