From 70b8645d61a56ea760864d222791494aa6031f92 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 20 Feb 2016 11:56:05 +0000 Subject: Simplify command-option parsing. --- background_scripts/commands.coffee | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'background_scripts/commands.coffee') 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 -- cgit v1.2.3