add command

This commit is contained in:
monoid 2023-01-06 17:48:40 +09:00
parent b7da837654
commit b5a1ab29bc

10
main.ts
View File

@ -17,6 +17,9 @@ import { fromFileUrl, join } from "path/mod.ts";
import { prepareSecretKey } from "./util/secret.ts"; import { prepareSecretKey } from "./util/secret.ts";
import { serve } from "http/server.ts"; import { serve } from "http/server.ts";
import { user_command } from "./user.ts";
import { key_out_cmd } from "./keyout.ts";
const github_markdown= await Deno.readTextFile(join(fromFileUrl(import.meta.url), "..", "static", "github-markdown.css")) const github_markdown= await Deno.readTextFile(join(fromFileUrl(import.meta.url), "..", "static", "github-markdown.css"))
const CSSPlugin: Plugin = { const CSSPlugin: Plugin = {
@ -45,7 +48,7 @@ async function startServer(manifest: Manifest, options: StartOptions = {}){
} }
} }
async function start({port = 8000, hostname = "localhost"}: {port?: number, hostname?: string}){ async function start({port = 8000, hostname = "localhost"}: {port?: number, hostname?: string} = {}){
await startServer(manifest, { plugins: [twindPlugin(twindConfig), CSSPlugin], await startServer(manifest, { plugins: [twindPlugin(twindConfig), CSSPlugin],
port: port, port: port,
hostname: hostname, hostname: hostname,
@ -77,10 +80,11 @@ if (import.meta.main){
}); });
} }
) )
//.command("user") .command("user", user_command)
.command("keyout", key_out_cmd)
; ;
await cmd.parse(Deno.args); await cmd.parse(Deno.args);
} }
else { else {
await start({}); await start();
} }