working title
This commit is contained in:
parent
ffbe36efec
commit
1a8657b3d4
13 changed files with 234 additions and 77 deletions
21
lib/command.coffee
Normal file
21
lib/command.coffee
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
ExViewModel = require './ex-view-model'
|
||||
Ex = require './ex'
|
||||
|
||||
class CommandError
|
||||
constructor: (@message) ->
|
||||
@name = 'Command Error'
|
||||
|
||||
class Command
|
||||
constructor: (@editor, @exState) ->
|
||||
@viewModel = new ExViewModel(@)
|
||||
|
||||
execute: (input) ->
|
||||
return unless input.characters.length > 0
|
||||
|
||||
func = (new Ex)[input.characters]
|
||||
if func?
|
||||
func()
|
||||
else
|
||||
throw new CommandError("#{input.characters}")
|
||||
|
||||
module.exports = {Command, CommandError}
|
||||
Loading…
Add table
Add a link
Reference in a new issue