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

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