2019-11-17 02:27:32 +00:00
|
|
|
#! /usr/bin/env node
|
2019-12-07 16:18:12 +00:00
|
|
|
|
2019-11-17 02:27:32 +00:00
|
|
|
/* Argument parser */
|
|
|
|
const program = require("commander");
|
|
|
|
|
|
|
|
process.env.OUT_DIR = process.env.OUT_DIR || process.cwd();
|
|
|
|
|
2019-12-07 16:18:12 +00:00
|
|
|
const
|
|
|
|
{
|
|
|
|
buildCommand
|
|
|
|
} = require("../build");
|
|
|
|
const
|
|
|
|
{
|
|
|
|
updateCommand
|
|
|
|
} = require("../update");
|
|
|
|
const
|
|
|
|
{
|
|
|
|
uiCommand
|
|
|
|
} = require("../ui");
|
|
|
|
const
|
|
|
|
{
|
|
|
|
runCommand
|
|
|
|
} = require("../run");
|
|
|
|
const
|
|
|
|
{
|
|
|
|
version
|
|
|
|
} = require("../package.json");
|
2019-11-17 02:27:32 +00:00
|
|
|
|
2019-12-07 16:18:12 +00:00
|
|
|
function collect(val, memo)
|
|
|
|
{
|
2019-11-17 02:27:32 +00:00
|
|
|
memo.push(val);
|
|
|
|
return memo;
|
|
|
|
}
|
|
|
|
|
|
|
|
program
|
|
|
|
.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")
|
2019-12-07 16:18:12 +00:00
|
|
|
.option("-T, --telegram [username]", "specify telegram username")
|
|
|
|
.option("-e, --email [username]", "specify email")
|
2019-11-17 02:27:32 +00:00
|
|
|
.action(buildCommand);
|
|
|
|
|
|
|
|
program
|
|
|
|
.command("update")
|
|
|
|
.description("Update user and repository data")
|
|
|
|
.action(updateCommand);
|
|
|
|
|
|
|
|
program
|
|
|
|
.command("ui")
|
|
|
|
.description("Create and Manage blogs with ease")
|
|
|
|
.action(uiCommand);
|
|
|
|
|
|
|
|
program
|
|
|
|
.command("run")
|
|
|
|
.description("Run build files")
|
|
|
|
.option("-p, --port [port]", "provide a port for localhost, default is 3000")
|
|
|
|
.action(runCommand);
|
|
|
|
|
2019-12-07 16:18:12 +00:00
|
|
|
program.on("command:*", () =>
|
|
|
|
{
|
2019-11-17 02:27:32 +00:00
|
|
|
console.log("Unknown Command: " + program.args.join(" "));
|
|
|
|
program.help();
|
|
|
|
});
|
|
|
|
|
|
|
|
program
|
|
|
|
.version(version, "-v --version")
|
|
|
|
.usage("<command> [options]")
|
|
|
|
.parse(process.argv);
|
|
|
|
|
2019-12-07 16:18:12 +00:00
|
|
|
if (program.args.length === 0) program.help();
|