Conversation
src/view.coffee
Outdated
| module.exports = | ||
| class View extends Command | ||
| @commandNames: ['view', 'show'] | ||
| @commandNames: ['view', 'show', 'v'] |
There was a problem hiding this comment.
Shouldn't info be added as an alias?
Homebrew uses it, and I'm constantly getting info mixed up with show or view...
There was a problem hiding this comment.
(more than a year later...)
Sounds good, included.
86c7571 to
03a588a
Compare
|
Ha, sure. Added @Alhadis's suggestion and rebased to master. |
|
Alas, it looks like CI on master is broken. The failure isn't related to this patch. |
|
I would much prefer that new specs are added for the abbreviations, rather than changing the existing command names (e.g. |
|
Heh, maybe no tests needed? 94a730e |
167e92d to
9388627
Compare
|
OK, the patch has been updated to just specify the abbreviations, not test them. Agreed, it would be nice to have specs for the abbreviations. I don't see a way to do it that looks clean though... Best I came up with would be to write tests like this: describe 'aliases for install', ->
runs ->
expect(apm.findCommand(['i'])).toBe InstallWhich requires the following patch to diff --git a/src/apm-cli.coffee b/src/apm-cli.coffee
index fde6865..ff0a647 100644
--- a/src/apm-cli.coffee
+++ b/src/apm-cli.coffee
@@ -154,7 +154,12 @@ getPythonVersion = (callback) ->
version = version?.trim()
callback(version)
+findCommand = (command) ->
+ commands[command]
+
module.exports =
+ findCommand: findCommand
+
run: (args, callback) ->
config.setupApmRcFile()
options = parseOptions(args)
@@ -203,7 +208,7 @@ module.exports =
else
showHelp(options)
options.callback()
- else if Command = commands[command]
+ else if Command = findCommand(command)
new Command().run(options)
else
options.callback("Unrecognized command: #{command}")Can finish doing that if you think it's worth it. |
9388627 to
5611b95
Compare
Fixes #435
Also updated some tests to use the abbreviations where convenient.