当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript argdown.loadConfig方法代码示例

本文整理汇总了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));
};
开发者ID:christianvoigt,项目名称:argdown,代码行数:7,代码来源:DefaultCommand.ts

示例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));
};
开发者ID:christianvoigt,项目名称:argdown,代码行数:51,代码来源:HtmlCommand.ts

示例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);
 }
开发者ID:christianvoigt,项目名称:argdown,代码行数:17,代码来源:ArgdownEngine.ts

示例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));
};
开发者ID:christianvoigt,项目名称:argdown,代码行数:45,代码来源:JSONCommand.ts

示例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));
};
开发者ID:christianvoigt,项目名称:argdown,代码行数:24,代码来源:CompileCommand.ts

示例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));
//.........这里部分代码省略.........
开发者ID:christianvoigt,项目名称:argdown,代码行数:101,代码来源:MapCommand.ts


注:本文中的@argdown/node.argdown.loadConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。