Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/src/command/dev-call/make-ast-diagram/cmd.ts
3588 views
1
/*
2
* cmd.ts
3
*
4
* Copyright (C) 2025 Posit Software, PBC
5
*/
6
7
import { Command } from "cliffy/command/mod.ts";
8
import { join } from "../../../deno_ral/path.ts";
9
import { resourcePath } from "../../../core/resources.ts";
10
import { execProcess } from "../../../core/process.ts";
11
12
export const makeAstDiagramCommand = new Command()
13
.name("make-ast-diagram")
14
.hidden()
15
.option("-m, --mode <mode:string>", "Diagram mode (default: full)")
16
.arguments("<arguments...>")
17
.description(
18
"Creates a diagram of the Pandoc AST.\n\n",
19
)
20
//deno-lint-ignore no-explicit-any
21
.action(async (options: any, ...args: string[]) => {
22
const renderOpts = {
23
cmd: Deno.execPath(),
24
args: [
25
"run",
26
"--allow-read",
27
"--allow-write",
28
"--allow-run",
29
resourcePath(join("tools", "ast-diagram", "main.ts")),
30
...args,
31
"--mode",
32
options.mode || "full",
33
],
34
};
35
await execProcess(renderOpts);
36
});
37
38