This repository has been archived on 2023-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
js-feditoken/src/args.ts
Sam Therapy 261856a128
All checks were successful
continuous-integration/drone/push Build is passing
Relicense + lint
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-06-11 14:19:05 +02:00

44 lines
935 B
TypeScript

import commandLineArgs from "command-line-args";
import commandLineUsage from "command-line-usage";
import { exit } from "process";
const optionDefinitions = [
{
name: "help",
type: Boolean,
alias: "h",
description: "Print this usage guide.",
},
{
name: "verbose",
type: Boolean,
alias: "v",
description: "Print debugging output.",
},
];
const args = commandLineArgs(optionDefinitions);
if (args.help) {
const usage = commandLineUsage([
{
header: "Fediverse Token Grabber",
content:
"Grabs Masotodon, Pleroma or Misskey tokens for your bots to use.",
},
{
header: "Options",
optionList: optionDefinitions,
},
{
content:
"Project home: {underline https://git.froth.zone/sam/js-feditoken}",
},
]);
console.log(usage);
exit(0);
}
if (args.verbose) {
console.log("Running in verbose mode.\n");
}
export default args;