mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-23 12:06:22 +00:00
4b89202f7e
* refactor: move `bootstrap-cli.mjs` tp cli also update reference in docs * refactor(cli): move build handler to `cli-functions` * refactor(cli): move create to handler + helpers * refactor(cli): extract arg definitions * refactor: rename handlers and helpers * refactor(cli): move update, await handlers * refactor(cli): create constants, migrate to helpers * refactor(cli): migrate `restore` * refactor(cli): migrate `sync` * format * refactor(cli): remove old imports/functions * refactor(cli): remove unused imports + format * chore: remove old log statement * fix: fix imports, clean duplicate code * fix: relative import * fix: simplified cacheFile path * fix: update cacheFile import path * refactor: move bootstrap-cli to quartz * format * revert: revert path to bootstrap-cli * ci: re-run * ci: fix execution permission
41 lines
1.1 KiB
JavaScript
Executable file
41 lines
1.1 KiB
JavaScript
Executable file
#!/usr/bin/env node
|
|
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"
|
|
|
|
yargs(hideBin(process.argv))
|
|
.scriptName("quartz")
|
|
.version(version)
|
|
.usage("$0 <cmd> [args]")
|
|
.command("create", "Initialize Quartz", CreateArgv, async (argv) => {
|
|
await handleCreate(argv)
|
|
})
|
|
.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)
|
|
},
|
|
)
|
|
.command("sync", "Sync your Quartz to and from GitHub.", SyncArgv, async (argv) => {
|
|
await handleSync(argv)
|
|
})
|
|
.command("build", "Build Quartz into a bundle of static HTML files", BuildArgv, async (argv) => {
|
|
await handleBuild(argv)
|
|
})
|
|
.showHelpOnFail(false)
|
|
.help()
|
|
.strict()
|
|
.demandCommand().argv
|