Sam Therapy
6ef64eeea6
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Sam Therapy <sam@samtherapy.net>
45 lines
930 B
TypeScript
45 lines
930 B
TypeScript
import commandLineArgs from "command-line-args"
|
|
import commandLineUsage from "command-line-usage"
|
|
import { exit } from "node: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 Mastodon, 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
|