2019-08-12 04:10:00 +00:00
|
|
|
#! /usr/bin/env node
|
2019-05-23 09:57:23 +00:00
|
|
|
/* Argument parser */
|
2019-08-12 04:10:00 +00:00
|
|
|
const program = require("commander");
|
2019-05-23 09:57:23 +00:00
|
|
|
|
|
|
|
process.env.OUT_DIR = process.env.OUT_DIR || process.cwd();
|
|
|
|
|
2019-08-12 04:10:00 +00:00
|
|
|
const { buildCommand } = require("../build");
|
|
|
|
const { updateCommand } = require("../update");
|
|
|
|
const { uiCommand } = require("../ui");
|
|
|
|
const { runCommand } = require("../run");
|
|
|
|
const { version } = require("../package.json");
|
2019-05-23 09:57:23 +00:00
|
|
|
|
|
|
|
program
|
2019-08-12 04:10:00 +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")
|
|
|
|
.option("-s, --sort [sort]", "set default sort for repository", "created")
|
|
|
|
.option("-o, --order [order]", "set default order on sort", "asc")
|
|
|
|
.option("-w, --twitter [username]", "specify twitter username")
|
|
|
|
.option("-l, --linkedin [username]", "specify linkedin username")
|
|
|
|
.option("-m, --medium [username]", "specify medium username")
|
|
|
|
.option("-d, --dribbble [username]", "specify dribbble username")
|
|
|
|
.action(buildCommand);
|
2019-05-23 09:57:23 +00:00
|
|
|
|
|
|
|
program
|
2019-08-12 04:10:00 +00:00
|
|
|
.command("update")
|
|
|
|
.description("Update user and repository data")
|
|
|
|
.action(updateCommand);
|
2019-05-23 09:57:23 +00:00
|
|
|
|
|
|
|
program
|
2019-08-12 04:10:00 +00:00
|
|
|
.command("ui")
|
|
|
|
.description("Create and Manage blogs with ease")
|
|
|
|
.action(uiCommand);
|
2019-05-23 09:57:23 +00:00
|
|
|
|
|
|
|
program
|
2019-08-12 04:10:00 +00:00
|
|
|
.command("run")
|
|
|
|
.description("Run build files")
|
|
|
|
.option("-p, --port [port]", "provide a port for localhost, default is 3000")
|
|
|
|
.action(runCommand);
|
|
|
|
|
|
|
|
program.on("command:*", () => {
|
|
|
|
console.log("Unknown Command: " + program.args.join(" "));
|
|
|
|
program.help();
|
2019-05-23 09:57:23 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
program
|
2019-08-12 04:10:00 +00:00
|
|
|
.version(version, "-v --version")
|
|
|
|
.usage("<command> [options]")
|
|
|
|
.parse(process.argv);
|
2019-05-23 09:57:23 +00:00
|
|
|
|
|
|
|
if (program.args.length === 0) program.help();
|