Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | 24x 24x 24x 24x 24x 8x 8x 8x 8x 8x 2x 6x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 6x 2x 4x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 4x 8x 6x 2x 4x 2x 2x 8x 2x 2x 8x | import { argdown, ISaveAsRequest, ISvgToPdfRequest, ILogParserErrorsRequest } from "@argdown/node";
import { Arguments } from "yargs";
import { IDotRequest, IMapRequest } from "@argdown/core";
export const command = "map [inputGlob] [outputDir]";
export const desc = "export Argdown input as DOT files";
export const builder = {
logParserErrors: {
alias: "e",
describe: "Log parser errors to console",
type: "boolean",
default: true
},
useHtmlLabels: {
alias: "html-labels",
describe: "Use HTML node labels",
type: "boolean"
},
argumentLabelMode: {
alias: "argument-labels",
choices: [undefined, "hide-untitled", "title", "description"],
type: "string",
describe: "The method by which argument label content is selected"
},
statementLabelMode: {
alias: "statement-labels",
choices: [undefined, "hide-untitled", "title", "text"],
type: "string",
describe: "The method by which statement label content is selected"
},
statementSelectionMode: {
alias: "statement-selection",
type: "string",
choices: [undefined, "all", "titled", "roots", "statement-trees", "with-relations"]
},
graphName: {
alias: "name",
type: "string",
describe: "Name of the graph"
},
lineLength: {
alias: "line",
type: "number",
describe: "Number of chars in a label line."
},
groupColors: {
type: "array",
describe: "Colors for groups sorted by stacking order"
},
inclusive: {
type: "boolean",
describe: "Include disconnected nodes."
},
rankdir: {
type: "string",
describe: "Graphviz rankdir setting"
},
concentrate: {
type: "string",
describe: "Graphviz concentrate setting"
},
ratio: {
type: "string",
describe: "Graphviz ratio setting"
},
size: {
type: "string",
describe: "Graphviz size setting"
},
format: {
alias: "f",
type: "string",
describe: "the file format (dot, svg, pdf)",
default: "pdf"
}
};
export const handler = async (argv: Arguments) => {
let config = <IDotRequest & IMapRequest & ISaveAsRequest & IDotRequest & ISvgToPdfRequest & ILogParserErrorsRequest>(
await argdown.loadConfig(argv.config)
);
config.dot = config.dot || {};
config.map = config.map || {};
const format = argv.format || "pdf";
if (format === "pdf") {
config.svgToPdf = config.svgToPdf || {};
} else {
config.saveAs = config.saveAs || {};
}
Iif (argv.useHtmlLabels) {
config.dot.useHtmlLabels = true;
}
Iif (argv.argumentLabelMode) {
config.map.argumentLabelMode = argv.argumentLabelMode;
}
Iif (argv.statementLabelMode) {
config.map.statementLabelMode = argv.statementLabelMode;
}
Iif (argv.statementSelectionMode) {
config.map.statementSelectionMode = argv.statementSelectionMode;
}
Iif (argv.inclusive) {
config.map.excludeDisconnected = false;
}
Iif (argv.graphName) {
config.dot.graphname = argv.graphName;
}
Iif (argv.lineLength) {
config.dot.lineLength = argv.lineLength;
}
Iif (argv.groupColors) {
config.dot.groupColors = argv.groupColors;
}
config.dot.graphVizSettings = config.dot.graphVizSettings || {};
Iif (argv.concentration) {
config.dot.graphVizSettings.concentration = argv.contentration;
}
Iif (argv.size) {
config.dot.graphVizSettings.size = argv.size;
}
Iif (argv.ratio) {
config.dot.graphVizSettings.ratio = argv.ratio;
}
Iif (argv.rankdir) {
config.dot.graphVizSettings.rankdir = argv.rankdir;
}
Eif (argv.inputGlob) {
config.inputPath = argv.inputGlob;
}
if (argv.outputDir) {
if (format === "pdf") {
config.svgToPdf!.outputDir = argv.outputDir;
} else {
config.saveAs!.outputDir = argv.outputDir;
}
}
config.logLevel = argv.verbose ? "verbose" : config.logLevel;
config.watch = argv.watch || config.watch;
config.process = ["load-file", "parse-input"];
config.logParserErrors = argv.logParserErrors || config.logParserErrors;
Eif (config.logParserErrors) {
config.process.push("log-parser-errors");
}
config.process.push("build-model");
config.process.push("build-map");
config.process.push("export-dot");
if (format !== "dot") {
config.process.push("export-svg");
}
if (!argv.stdout || argv.outputDir) {
if (format === "dot") {
config.process.push("save-as-dot");
} else if (format === "svg") {
config.process.push("save-svg-as-svg");
} else {
config.process.push("save-svg-as-pdf");
}
}
if (argv.stdout) {
Eif (format === "dot") {
config.process.push("stdout-dot");
} else {
// pdf and png to stdout is currently not supported
config.process.push("stdout-svg");
}
}
await argdown.load(config).catch(e => console.log(e));
};
|