mirror of
https://github.com/1disk/edp445.git
synced 2024-08-14 22:47:02 +00:00
Changed alot of things.
This commit is contained in:
parent
a5a0523e5a
commit
3513d5390c
2016 changed files with 336930 additions and 9 deletions
43
node_modules/canvacord/bin/canvacord.js
generated
vendored
Executable file
43
node_modules/canvacord/bin/canvacord.js
generated
vendored
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env node
|
||||
const { version, repository } = require("../package.json");
|
||||
const args = process.argv.slice(2).map(parseArgs);
|
||||
|
||||
function parseArgs(arg) {
|
||||
if (arg.includes("=")) {
|
||||
const [k, v] = arg.split("=");
|
||||
return { [k]: v };
|
||||
}
|
||||
return { [arg]: arg };
|
||||
}
|
||||
|
||||
function getArgs(name) {
|
||||
const found = args.find(x => x[name]);
|
||||
if (found) return found[name];
|
||||
}
|
||||
|
||||
const assetsBuilder = (force) => import("../scripts/assets/build.mjs").then(res => res.build(force));
|
||||
const chalkImport = import("chalk").then(res => res.default || res);
|
||||
/**
|
||||
* @type {import("chalk").default}
|
||||
*/
|
||||
let chalk;
|
||||
|
||||
async function main() {
|
||||
if (!chalk) chalk = await chalkImport;
|
||||
const helpMessage = `Commands usage: ${chalk.grey(`${chalk.yellow("canvacord")} ${chalk.blue("<command_name>")} [options]`)}
|
||||
${chalk.blue("help")} : shows this menu
|
||||
${chalk.blue("rebuild")} ${chalk.grey(`[--force]`)} : rebuilds assets
|
||||
${chalk.blue("version")} : shows canvacord version info
|
||||
${chalk.blue("github")} : returns github repository url for canvacord
|
||||
|
||||
${chalk.cyanBright(`Canvacord v${version}`)}`;
|
||||
if (getArgs("rebuild")) {
|
||||
if (getArgs("--help")) return console.log(`Rebuilds assets cache.\n\nExamples:\n${chalk.blue("canvacord")} ${chalk.blue("rebuild")}\n${chalk.blue("canvacord")} ${chalk.blue("rebuild")} ${chalk.grey("--force")}`);
|
||||
return await assetsBuilder(!!getArgs("--force"));
|
||||
}
|
||||
if (getArgs("version")) return console.log(chalk.cyan(`Canvacord v${version}`));
|
||||
if (getArgs("github")) return console.log(chalk.blue(repository.url.replace("git+", "")));
|
||||
console.log(helpMessage);
|
||||
}
|
||||
|
||||
main();
|
||||
Loading…
Add table
Add a link
Reference in a new issue