travel/admin/node_modules/omelette/example/githubber

40 lines
1.1 KiB
Plaintext
Raw Normal View History

2024-06-24 11:28:18 +08:00
#!/usr/bin/env node
(function() {
var complete, fs, omelette;
fs = require("fs");
omelette = require("../src/omelette");
// omelette`githubber|gh
// ${['pull', 'push', 'star']}
// ${() => fs.readdirSync("/Users/")}
// ${({ before }) => [
// `${before}/helloworld`,
// `${before}/blabla`]}
// `.init();
complete = omelette("githubber|ghb|gh|g <action> <user> <repo>");
complete.on("action", function({ reply }) {
reply(["star","clone", "update", "push"]);
});
complete.on("user", function({ reply }) {
reply(fs.readdirSync("/Users/"));
});
complete.on("repo", function({ before, reply }) {
var user = before;
reply(["http://github.com/" + user + "/helloworld", "http://github.com/" + user + "/blabla"]);
});
complete.init();
// If you want to setup, you can use `omeletteInstance.setupShellInitFile()` function.
if (~process.argv.indexOf('--setup')) {
complete.setupShellInitFile();
}
console.log("Your program's default workflow.");
console.log(process.argv);
}).call(this);