keroosha.cybergulag.today/quartz/bootstrap-cli.mjs

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-05-29 03:44:08 +03:00
#!/usr/bin/env node
2023-07-23 03:27:41 +03:00
import yargs from "yargs"
import { hideBin } from "yargs/helpers"
import {
handleBuild,
handleCreate,
handleUpdate,
handleRestore,
handleSync,
} from "./cli/handlers.js"
import { CommonArgv, BuildArgv, CreateArgv, SyncArgv } from "./cli/args.js"
import { version } from "./cli/constants.js"
2023-08-03 09:29:28 +03:00
2023-05-30 18:02:20 +03:00
yargs(hideBin(process.argv))
.scriptName("quartz")
.version(version)
2023-07-23 03:27:41 +03:00
.usage("$0 <cmd> [args]")
.command("create", "Initialize Quartz", CreateArgv, async (argv) => {
await handleCreate(argv)
})
2023-07-23 03:27:41 +03:00
.command("update", "Get the latest Quartz updates", CommonArgv, async (argv) => {
await handleUpdate(argv)
})
.command(
"restore",
"Try to restore your content folder from the cache",
CommonArgv,
async (argv) => {
await handleRestore(argv)
},
)
2023-07-23 03:27:41 +03:00
.command("sync", "Sync your Quartz to and from GitHub.", SyncArgv, async (argv) => {
await handleSync(argv)
})
2023-07-23 03:27:41 +03:00
.command("build", "Build Quartz into a bundle of static HTML files", BuildArgv, async (argv) => {
await handleBuild(argv)
2023-05-30 18:02:20 +03:00
})
.showHelpOnFail(false)
.help()
.strict()
2023-07-23 03:27:41 +03:00
.demandCommand().argv