Skip to content

Instantly share code, notes, and snippets.

@1syo
Created January 17, 2020 12:15
Show Gist options
  • Save 1syo/593044c64f46be76fdfdd2f85ad4c4b0 to your computer and use it in GitHub Desktop.
Save 1syo/593044c64f46be76fdfdd2f85ad4c4b0 to your computer and use it in GitHub Desktop.
function run() {
var query = "{query}"
if (query == '' || isNaN(query)) {
query = 30;
}
var app = Application.currentApplication();
app.includeStandardAdditions = true;
var commands = [
'pwgen -y -B ' + query + ' 1',
'pwgen -B ' + query + ' 1'
];
var json = {items:[]};
for(var command of commands) {
var password = app.doShellScript("zsh --login -c '" + command + "'");
json.items.push({
type: "default",
title: password,
subtitle: command,
arg: password,
valid: true,
})
}
return JSON.stringify(json);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment