Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
languagePair.delete('target');
languagePair.set('pair', pair);
items.push({
title: `Success, [${q}] assigned.`
});
}
}
} else {
// manual
var pair = q.split('>');
if (pair.length !== 2) {
items.push({
title: `Failure, \'>\' must contain only one.`,
subtitle: `configuration format: source>target or first one&the second.`,
icon: {
path: alfy.icon.error
}
});
} else {
var pair0 = language.getCode(pair[0]);
var pair1 = language.getCode(pair[1]);
if (!pair0 && !pair1) {
items.push({
title: `Failure, source[${pair[0]}] and target[${pair[1]}] languages not supported.`,
subtitle: `Press shift to see full support languages.`,
quicklookurl: 'https://github.com/xfslove/alfred-language-configuration#readme',
icon: {
path: alfy.icon.error
}
});
} else if (!pair0) {
} catch (err) {
const messages = []
if (err.tip) {
messages.push(err.tip)
}
messages.push('Activate this item to try again.')
messages.push('⌘L to see the stack trace')
alfy.output([{
title: `Error: ${err.message}`,
subtitle: messages.join(' | '),
autocomplete: err.autocomplete ? err.autocomplete : '',
icon: {
path: alfy.icon.error
},
valid: false,
text: {
largetype: err.stack,
copy: err.stack
}
}])
}
})()
module.exports.errorOut = err => {
const messages = []
if (err.tip) {
messages.push(err.tip)
}
messages.push('Activate this item to try again.')
messages.push('⌘L to see the stack trace')
return [{
title: err.title ? err.title : `${err.message} `,
subtitle: err.subtitle ? err.subtitle : messages.join(' | '),
autocomplete: err.autocomplete ? err.autocomplete : '',
icon: err.icon ? err.icon : {
path: alfy.icon.error
},
valid: err.valid ? err.valid : true,
variables: err.variables ? err.variables : {},
text: {
largetype: `${err.subtitle} \n\n${err.stack} `,
copy: err.stack
},
mods: err.mods ? err.mods : {
mods: {}
}
}]
}
const addTimeItem = (items, title) => {
if (alfy.debug) {
items.push({ title, icon: { path: alfy.icon.get("Clock") } });
}
};