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")
|
2019-12-08 17:14:52 +00:00
|
|
|
.option("-c, --codepen [username]", "specify codepen username")
|
|
|
|
.option("-d, --dev [username]", "specify dev username")
|
|
|
|
.option("-D, --dribbble [username]", "specify dribbble username")
|
2019-12-07 16:18:12 +00:00
|
|
|
.option("-e, --email [username]", "specify email")
|
2019-12-08 17:14:52 +00:00
|
|
|
.option("-i, --instagram [username]", "specify instagram username")
|
2019-12-08 16:23:21 +00:00
|
|
|
.option("-T, --twitter [username]", "specify twitter username")
|
2019-11-17 02:27:32 +00:00
|
|
|
.action(buildCommand);
|
|
|
|
|
|
|
|
program
|
|
|
|
.command("update")
|
|
|
|
.description("Update user and repository data")
|
|
|
|
.action(updateCommand);
|
|
|
|
|
|
|
|
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();
|