本文整理汇总了TypeScript中@argdown/node.argdown.loadConfig方法的典型用法代码示例。如果您正苦于以下问题:TypeScript argdown.loadConfig方法的具体用法?TypeScript argdown.loadConfig怎么用?TypeScript argdown.loadConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@argdown/node.argdown
的用法示例。
在下文中一共展示了argdown.loadConfig方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
export const handler = async (args: Arguments<IGeneralCliOptions>) => {
let config = await argdown.loadConfig(args.config);
config.logLevel = args.verbose ? "verbose" : config.logLevel;
config.watch = args.watch || config.watch;
config.logParserErrors = args.logParserErrors || config.logParserErrors;
await argdown.load(config).catch(e => console.log(e));
};
示例2: function
export const handler = async function(
args: Arguments<IGeneralCliOptions & IHtmlCliOptions>
) {
let config = await argdown.loadConfig(args.config);
config.html = config.html || {};
if (args.headless) {
config.html.headless = true;
}
if (args.title) {
config.title = args.title;
}
if (args.lang) {
config.html.lang = args.lang;
}
if (args.inputGlob) {
config.inputPath = args.inputGlob;
}
config.saveAs = config.saveAs || {};
if (args.outputDir) {
config.saveAs.outputDir = args.outputDir;
}
config.logLevel = args.verbose ? "verbose" : config.logLevel;
config.watch = args.watch || config.watch;
config.process = ["load-file", "parse-input"];
config.logParserErrors = args.logParserErrors || config.logParserErrors;
if (config.logParserErrors) {
config.process.push("log-parser-errors");
}
config.process.push("build-model");
config.process.push("colorize");
config.process.push("export-html");
if (!args.stdout || args.outputDir) {
config.process.push("save-as-html");
}
if (args.css) {
config.html.css = args.css;
} else if (!args.stdout || args.outputDir) {
config.process.push("copy-default-css");
}
if (args.stdout) {
config.process.push("stdout-html");
}
await argdown.load(config).catch((e: Error) => console.log(e.message));
};
示例3: loadConfig
public async loadConfig(
configFile: string | undefined,
resource: vscode.Uri
): Promise<IArgdownRequest> {
if (!configFile) {
return {};
}
const workspaceFolder = vscode.workspace.getWorkspaceFolder(resource);
let configPath = configFile;
if (workspaceFolder) {
let rootPath = workspaceFolder.uri.fsPath;
configPath = path.resolve(rootPath, configFile);
} else if (!path.isAbsolute(configPath)) {
return {};
}
return await argdown.loadConfig(configPath);
}
示例4: async
export const handler = async (
args: Arguments<IGeneralCliOptions & IJSONCliOptions>
) => {
let config = await argdown.loadConfig(args.config);
config.json = config.json || {};
if (args.spaces !== null) {
config.json.spaces = args.spaces;
}
if (args.removeEmbeddedRelations) {
config.json.removeEmbeddedRelations = true;
}
if (args.removeMap) {
config.json.exportMap = false;
}
if (args.inputGlob) {
config.inputPath = args.inputGlob;
}
config.saveAs = config.saveAs || {};
if (args.outputDir) {
config.saveAs.outputDir = args.outputDir;
}
config.logLevel = args.verbose ? "verbose" : config.logLevel;
config.watch = args.watch || config.watch;
config.process = ["load-file", "parse-input"];
config.logParserErrors = args.logParserErrors || config.logParserErrors;
if (config.logParserErrors) {
config.process.push("log-parser-errors");
}
config.process.push("build-model");
config.process.push("colorize");
config.process.push("export-json");
if (!args.stdout || args.outputDir) {
config.process.push("save-as-json");
}
if (args.stdout) {
config.process.push("stdout-json");
}
await argdown.load(config).catch(e => console.log(e));
};
示例5: async
export const handler = async (
args: Arguments<IGeneralCliOptions & ICompileCliOptions>
) => {
let config = await argdown.loadConfig(args.config);
if (args.inputGlob) {
config.inputPath = args.inputGlob;
}
config.saveAs = config.saveAs || {};
if (args.outputDir) {
config.saveAs.outputDir = args.outputDir;
}
config.logLevel = args.verbose ? "verbose" : config.logLevel;
config.watch = args.watch || config.watch;
config.process = ["load-file"];
if (!args.stdout || args.outputDir) {
config.process.push("save-as-argdown");
}
if (args.stdout) {
config.process.push("stdout-argdown");
}
await argdown.load(config).catch((e: Error) => console.log(e));
};
示例6: async
export const handler = async (
args: Arguments<IGeneralCliOptions & IMapCliOptions>
) => {
let config = await argdown.loadConfig(args.config);
config.dot = config.dot || {};
config.map = config.map || {};
config.group = config.group || {};
config.selection = config.selection || {};
config.color = config.color || {};
const format = args.format || "pdf";
if (format === "pdf") {
config.svgToPdf = config.svgToPdf || {};
} else {
config.saveAs = config.saveAs || {};
}
if (args.useHtmlLabels) {
config.dot.useHtmlLabels = true;
}
if (args.argumentLabelMode) {
config.map.argumentLabelMode = args.argumentLabelMode;
}
if (args.statementLabelMode) {
config.map.statementLabelMode = args.statementLabelMode;
}
if (args.statementSelectionMode) {
config.selection.statementSelectionMode = args.statementSelectionMode;
}
if (args.inclusive) {
config.selection.excludeDisconnected = false;
}
if (args.graphName) {
config.dot.graphname = args.graphName;
}
config.dot.graphVizSettings = config.dot.graphVizSettings || {};
if (args.size) {
config.dot.graphVizSettings.size = args.size;
}
if (args.ratio) {
config.dot.graphVizSettings.ratio = args.ratio;
}
if (args.rankdir) {
config.dot.graphVizSettings.rankdir = args.rankdir;
}
if (args.inputGlob) {
config.inputPath = args.inputGlob;
}
if (args.outputDir) {
if (format === "pdf") {
config.svgToPdf!.outputDir = args.outputDir;
} else {
config.saveAs!.outputDir = args.outputDir;
}
}
config.logLevel = args.verbose ? "verbose" : config.logLevel;
config.watch = args.watch || config.watch;
config.process = ["load-file", "parse-input"];
config.logParserErrors = args.logParserErrors || config.logParserErrors;
if (config.logParserErrors) {
config.process.push("log-parser-errors");
}
config.process.push("build-model");
config.process.push("build-map");
config.process.push("colorize");
if (format != "graphml") {
config.process.push("export-dot");
if (format !== "dot") {
config.process.push("export-svg");
}
} else {
config.process.push("export-graphml");
}
if (!args.stdout || args.outputDir) {
if (format === "dot") {
config.process.push("save-as-dot");
} else if (format === "svg") {
config.process.push("save-svg-as-svg");
} else if (format === "graphml") {
config.process.push("save-as-graphml");
} else {
config.process.push("save-svg-as-pdf");
}
}
if (args.stdout) {
if (format === "dot") {
config.process.push("stdout-dot");
} else if (format === "graphml") {
config.process.push("stdout-graphml");
} else {
// pdf and png to stdout is currently not supported
config.process.push("stdout-svg");
}
}
await argdown.load(config).catch(e => console.log(e));
//.........这里部分代码省略.........