2023-05-23 18:53:53 +00:00
|
|
|
import.meta.main = false;
|
2022-10-24 11:51:26 +00:00
|
|
|
import { Command } from "https://deno.land/x/cliffy@v0.25.2/command/command.ts";
|
|
|
|
|
|
|
|
import { version } from "./version.ts";
|
|
|
|
|
|
|
|
import { upgradeCommand } from "./cmd/upgrade.ts";
|
|
|
|
import { versionCommand } from "./cmd/version.ts";
|
|
|
|
import { serveCommand } from "./cmd/server.ts";
|
2022-11-01 14:00:37 +00:00
|
|
|
import { plugCompileCommand } from "./cmd/plug_compile.ts";
|
2022-10-24 11:51:26 +00:00
|
|
|
|
|
|
|
await new Command()
|
|
|
|
.name("silverbullet")
|
|
|
|
.description("Markdown as a platform")
|
|
|
|
.version(version)
|
|
|
|
.help({
|
|
|
|
colors: false,
|
|
|
|
})
|
|
|
|
.usage("<options> <folder> | <command> (see below)")
|
|
|
|
// Main command
|
2023-05-24 03:42:02 +00:00
|
|
|
.arguments("[folder:string]")
|
2023-05-23 18:53:53 +00:00
|
|
|
.option(
|
|
|
|
"--hostname, -L <hostname:string>",
|
|
|
|
"Hostname or address to listen on",
|
|
|
|
)
|
2022-10-24 11:51:26 +00:00
|
|
|
.option("-p, --port <port:number>", "Port to listen on")
|
2022-12-05 11:14:21 +00:00
|
|
|
.option(
|
|
|
|
"--user <user:string>",
|
|
|
|
"'username:password' combo for BasicAuth authentication",
|
|
|
|
)
|
2023-05-23 18:53:53 +00:00
|
|
|
.option(
|
|
|
|
"--cert <certFile:string>",
|
|
|
|
"Path to TLS certificate",
|
|
|
|
)
|
|
|
|
.option(
|
|
|
|
"--key <keyFile:string>",
|
|
|
|
"Path to TLS key",
|
|
|
|
)
|
|
|
|
.option(
|
|
|
|
"--maxFileSize [type:number]",
|
|
|
|
"Do not sync/expose files larger than this (in MB)",
|
|
|
|
)
|
2022-10-24 11:51:26 +00:00
|
|
|
.action(serveCommand)
|
2022-11-01 14:00:37 +00:00
|
|
|
// plug:compile
|
2022-10-25 16:49:33 +00:00
|
|
|
.command("plug:compile", "Bundle (compile) one or more plug manifests")
|
2022-10-24 14:06:36 +00:00
|
|
|
.arguments("<...name.plug.yaml:string>")
|
2022-11-01 14:00:37 +00:00
|
|
|
.option("--debug [type:boolean]", "Do not minifiy code", { default: false })
|
|
|
|
.option("--info [type:boolean]", "Print out size info per function", {
|
|
|
|
default: false,
|
|
|
|
})
|
2022-10-24 14:06:36 +00:00
|
|
|
.option("--watch, -w [type:boolean]", "Watch for changes and rebuild", {
|
|
|
|
default: false,
|
|
|
|
})
|
|
|
|
.option(
|
|
|
|
"--dist <path:string>",
|
|
|
|
"Folder to put the resulting .plug.json file into",
|
|
|
|
{ default: "." },
|
|
|
|
)
|
|
|
|
.option("--importmap <path:string>", "Path to import map file to use")
|
2023-05-23 18:53:53 +00:00
|
|
|
.option("--runtimeUrl <url:string>", "URL to worker_runtime.ts to use")
|
2022-11-01 14:00:37 +00:00
|
|
|
.action(plugCompileCommand)
|
2022-10-24 14:06:36 +00:00
|
|
|
// upgrade
|
2023-01-16 15:45:55 +00:00
|
|
|
.command("upgrade", "Upgrade SilverBullet")
|
2022-10-24 11:51:26 +00:00
|
|
|
.action(upgradeCommand)
|
2022-10-24 14:06:36 +00:00
|
|
|
// version
|
2022-10-24 11:51:26 +00:00
|
|
|
.command("version", "Get current version")
|
|
|
|
.action(versionCommand)
|
|
|
|
.parse(Deno.args);
|