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 { fixCommand } from "./cmd/fix.ts"; import { serveCommand } from "./cmd/server.ts"; import { plugCompileCommand } from "./cmd/plug_compile.ts"; import { invokeFunction } from "./cmd/invokeFunction.ts"; await new Command() .name("silverbullet") .description("Markdown as a platform") .version(version) .help({ colors: false, }) .usage(" | (see below)") // Main command .arguments("") .option("--hostname ", "Hostname or address to listen on") .option("-p, --port ", "Port to listen on") .option("--db ", "Filename for the database", { default: "data.db", }) .option( "--user ", "'username:password' combo for BasicAuth authentication", ) .action(serveCommand) // fix .command("fix", "Fix a broken space") .arguments("") .action(fixCommand) // plug:compile .command("plug:compile", "Bundle (compile) one or more plug manifests") .arguments("<...name.plug.yaml:string>") .option("--debug [type:boolean]", "Do not minifiy code", { default: false }) .option("--info [type:boolean]", "Print out size info per function", { default: false, }) .option("--watch, -w [type:boolean]", "Watch for changes and rebuild", { default: false, }) .option( "--dist ", "Folder to put the resulting .plug.json file into", { default: "." }, ) .option("--importmap ", "Path to import map file to use") .action(plugCompileCommand) // invokeFunction .command("invokeFunction", "Invoke a specific plug function from the CLI") .arguments(" [...arguments:string]") .option("--db ", "Filename for the database", { default: "data.db", }) .action(invokeFunction) // upgrade .command("upgrade", "Upgrade Silver Bullet") .action(upgradeCommand) // version .command("version", "Get current version") .action(versionCommand) .parse(Deno.args);