I am trying to write a concise function that allows me to turn wemo highlights on and off from the command line. Basically, I have a command that, if I type wemo status, will return either Switch: Lights 1if the light is on, or 0 if they are off. I would like to write a fish function that essentially allows me to switch them:
function lights --description 'Toggle lights'
if contains (wemo status) "Lights 1"
wemo switch "Lights" off
else
wemo switch "Lights" on
end
end
Although this does not work. I think that perhaps the paranas are doing text replacement? Does anyone know how I can check if a string contains another string in Fish?
Billy source
share