diff options
| author | Stephen Blott | 2016-02-20 11:56:05 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2016-02-20 11:56:05 +0000 | 
| commit | 70b8645d61a56ea760864d222791494aa6031f92 (patch) | |
| tree | 0d6b26af8babf7dcc1c9e2bfb80d8555e93cb0b7 | |
| parent | 2c634d9b2324c760007d59d5cafd97a364125991 (diff) | |
| download | vimium-70b8645d61a56ea760864d222791494aa6031f92.tar.bz2 | |
Simplify command-option parsing.
| -rw-r--r-- | background_scripts/commands.coffee | 10 | 
1 files changed, 2 insertions, 8 deletions
| diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 8d73c913..d251c7ed 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -80,14 +80,8 @@ Commands =    parseCommandOptions: (command, optionList) ->      options = {}      for option in optionList -      parse = option.split "=" -      switch parse.length -        when 1 -          options[parse[0]] = true -        when 2 -          options[parse[0]] = parse[1] -        else -          console.log "Vimium configuration error: invalid option: #{option}." +      parse = option.split "=", 2 +      options[parse[0]] = if parse.length == 1 then true else parse[1]      # We parse any `count` option immediately (to avoid having to parse it repeatedly later).      unless @availableCommands[command].noRepeat | 
