1 #!/usr/bin/env node
2 import { Command, Option } from "commander"
3 import generate from "./commands/generate.js"
4
5 const program = new Command()
6
7 program
8 .name("workflows-diagram-generator")
9 .description("Generate diagram(s) for workflow(s).")
10
11 program
12 .command("run")
13 .description(
14 "Generate Mermaid.js diagrams for your workflows based on the type you choose."
15 )
16 .argument(
17 "<workflowPath>",
18 "The path to a workflow file or a directory of workflow files."
19 )
20 .requiredOption(
21 "-o, --output <output>",
22 "The directory to output the files in."
23 )
24 .addOption(
25 new Option("-t, --type <type>", "Type of diagrams to be generated.")
26 .choices(["docs", "markdown", "mermaid", "console", "svg", "png", "pdf"])
27 .default("docs")
28 )
29 .option("--no-theme", "Remove theming from outputted diagrams.", true)
30 .option(
31 "--pretty-names",
32 "Prettify step names. Useful for creating presentational diagrams.",
33 false
34 )
35 .action(generate)
36
37 program.parse()