alternative updates

This commit is contained in:
kepler155c@gmail.com 2019-11-09 22:26:11 -07:00
parent 340e37da82
commit 4a6af34d7c
1 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,4 @@
local Array = require('opus.array')
local Config = require('opus.config')
local Util = require('opus.util')
@ -33,10 +34,22 @@ end
function Alt.set(key, value)
local config = getConfig()
Alt.addChoice(key, value)
config.default[key] = value
Config.update('alternate', config)
end
function Alt.remove(key, value)
local config = getConfig()
Array.removeByValue(config.choices[key], value)
if config.default[key] == value then
config.default[key] = config.choices[key][1]
end
Config.update('alternate', config)
end
function Alt.addChoice(key, value)
local config = getConfig()