How to use the alfy.output function in alfy

To help you get started, we’ve selected a few alfy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CoderMageFox / alfredMagic / VariableNameTransLate / MainLogic / FeachDataFromServer.js View on Github external
subtitle: `标准翻译结果: ${item}`,
                        arg: Name(item),
                    });
                });
                // 网络翻译结果
                if (Result.web) {
                    let WebResult = Result.web;
                    WebResult.map((item) => {
                        ResultValueArr.push({
                            title: Name(item.value[0]),
                            subtitle: `其他翻译结果:${Name(item.value[0])}`,
                            arg: Name(item.value[0]),
                        });
                    })
                }
                alfy.output(ResultValueArr);
            } else {
                alfy.output(ErrResult);
            }
        });
    },
github bikenik / alfred-reverso / index.js View on Github external
}

	try {
		if (alfy.cache.get('start-PID') === process.pid) {
			await runApplescript(`
				tell application id "com.runningwithcrayons.Alfred"
					run trigger ¬
						"refresh" in workflow ¬
						"com.bikenik.reverso" with argument "#runref"
				end tell
		`)
		}

		if (/!.*/.test(alfy.input) || alfy.input === '') {
			const out = await option(alfy.input)
			alfy.output(out)
		} else if (/\*.*/.test(alfy.input)) {
			const fav = await favorites.fetching(alfy.input)
			alfy.input = alfy.input.replace(/^\*/g, '')
			alfy.output(fav)
			const variantsAll = alfy.inputMatches(fav, 'title').map(x => ({
				arg: x.arg
			})).filter(x => x.arg)
			alfy.config.set('allPhrases', variantsAll.map(x => JSON.parse(x.arg)))
		} else {
			const encodeInput = encodeURIComponent(alfy.input.normalize())
			await searchContext.fetching(encodeInput)
		}
	} catch (error) {
		alfy.output([await ankiInfo()])
	}
})()
github skibitsky / alfred-timing / projects.js View on Github external
}).then(result => {
	const data = result.data.map(pr => {
		return {
			uid: pr.self,
			title: pr.title,
			autocomplete: pr.title,
			arg: pr.title
		};
	});

	output(inputMatches(data, 'title'));
});
github SamVerschueren / alfred-rxjs / index.js View on Github external
.then(methods => {
		const items = alfy
			.inputMatches(methods, 'title')
			.map(method => {
				return {
					title: method.title,
					subtitle: method.type,
					autocomplete: method.title,
					arg: method.url,
					quicklookurl: method.url,
					icon: method.icon
				};
			});

		alfy.output(items);
	});
github sindresorhus / alfred-npms / index.js View on Github external
arg: pkg.links.npm,
						subtitle: 'Open the npm page instead of the GitHub repo'
					},
					cmd: {
						subtitle: cmdSubtitle(pkg)
					},
					ctrl: {
						arg: pkg.name,
						subtitle: 'Copy package name'
					}
				},
				quicklookurl: pkg.links.repository && `${pkg.links.repository}#readme`
			};
		});

	alfy.output(items);
})();
github importre / alfred-awe / index.js View on Github external
.then(items => {
    const output = filter(items);
    alfy.output(output);
    alfredNotifier();
  });
github importre / alfred-hl / src / index.js View on Github external
const output = fs
  .readdirSync(languagesDir)
  .filter(lang => lang.endsWith('.js') && lang.includes(input))
  .sort(comp)
  .map(lang => {
    lang = lang.replace('.js', '');
    return {
      title: lang,
      subtitle: 'theme: ' + utils.theme,
      arg: lang,
    };
  })
  .sort();

alfredNotifier();
alfy.output(output);
github kyleshevlin / alfred-ember-module-lookup / index.js View on Github external
return {
        key: localName,
        value: `import ${localName} from '${module}'`
      }
    }

    return {
      key: exportName,
      value: `import { ${exportName} } from '${module}'`
    }
  }
)

const matches = alfy.inputMatches(pairs, 'key')

alfy.output(
  matches.map(match => ({
    title: match.key,
    subtitle: match.value,
    arg: match.value
  }))
)
github bchatard / alfred-jetbrains / src / index.js View on Github external
matchItems = alfy.matches(query, items, search);
      matchTime = new Date();
    }

    debug.addTimeItem(
      matchItems,
      `Match Projects: ${matchTime - projectsTime}ms`
    );

    if (matchItems.length) {
      alfy.output(matchItems);
    } else {
      alfy.error(`No matching project for ${query}`);
    }
  } else {
    alfy.output(items);
  }
} else {
  alfy.error("No project found");
}