1
0
Fork 0
mirror of https://github.com/dilllxd/gitfolio.git synced 2024-08-14 22:28:09 +00:00
gitfolio/bin/gitfolio.js

75 lines
2.4 KiB
JavaScript
Raw Normal View History

#! /usr/bin/env node
/* Argument parser */
const program = require("commander");
process.env.OUT_DIR = process.env.OUT_DIR || process.cwd();
2020-01-12 09:38:32 +00:00
const { buildCommand } = require("../build");
const { updateCommand } = require("../update");
const { uiCommand } = require("../ui");
const { runCommand } = require("../run");
const { version } = require("../package.json");
2019-12-11 17:10:27 +00:00
function collect(val, memo) {
2020-01-12 09:38:32 +00:00
memo.push(val);
return memo;
}
program
2020-01-12 09:38:32 +00:00
.command("build <username>")
.description(
"Build site with your GitHub username. This will be used to customize your site"
)
.option("-t, --theme [theme]", "specify a theme to use", "light")
.option("-b, --background [background]", "set the background image")
.option("-f, --fork", "includes forks with repos")
2020-01-12 09:38:32 +00:00
.option("-s, --sort [sort]", "set default sort for repository", "created")
.option("-o, --order [order]", "set default order on sort", "asc")
2020-01-12 09:38:32 +00:00
.option("-c, --codepen [username]", "specify codepen username")
.option("-d, --dev [username]", "specify dev username")
.option("-D, --dribbble [username]", "specify dribbble username")
.option("-e, --email [email]", "specify email")
.option("-F, --facebook [username]", "specify facebook username")
2020-01-12 09:38:32 +00:00
.option("-i, --instagram [username]", "specify instagram username")
2020-01-12 10:25:54 +00:00
.option("-k, --keybase [username]", "specify keybase username")
.option("-m, --medium [username]", "specify medium username")
2020-01-12 09:38:32 +00:00
.option("-r, --reddit [username]", "specify reddit username")
.option("-E, --stackexchange [user id]", "specify stackexchange user id")
.option("-S, --steam [username]", "specify steam username")
2020-01-12 09:38:32 +00:00
.option("-T, --telegram [username]", "specify telegram username")
.option("-w, --twitter [username]", "specify twitter username")
.option("-x, --xda [user id]", "specify xda user id")
2020-01-12 09:38:32 +00:00
.action(buildCommand);
program
2020-01-12 09:38:32 +00:00
.command("update")
.description("Update user and repository data")
.action(updateCommand);
program
2020-01-12 09:38:32 +00:00
.command("ui")
.description("Create and Manage gitfolio with ease")
.action(uiCommand);
2020-01-11 16:48:56 +00:00
program
2020-01-12 09:38:32 +00:00
.command("run")
.description("Run build files")
.option("-p, --port [port]", "provide a port for localhost, default is 3000")
.action(runCommand);
2019-12-11 17:10:27 +00:00
program.on("command:*", () => {
2020-01-12 09:38:32 +00:00
console.log("Unknown Command: " + program.args.join(" "));
program.help();
});
program
2020-01-12 09:38:32 +00:00
.version(version, "-v --version")
.usage("<command> [options]")
.parse(process.argv);
2020-01-11 16:48:56 +00:00
if (program.args.length === 0) {
2020-01-12 09:38:32 +00:00
program.help();
2020-01-11 16:48:56 +00:00
}