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ACV,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,2BAAa,CAAC,OAAO;KAC9B,CAAC;4CACa;AA7BnB,wCA4EC","sourcesContent":["import * as typescript from 'typescript';\n\nimport { Application } from './application';\nimport { Option } from './utils/component';\nimport { OptionsReadResult } from './utils/options/options';\nimport { ParameterHint, ParameterType } from './utils/options/declaration';\nimport { getOptionsHelp } from './utils/options/help';\n\nexport const enum ExitCode {\n OptionError = 1,\n NoInputFiles = 2,\n NoOutput = 3,\n CompileError = 4,\n OutputError = 5\n}\n\nexport class CliApplication extends Application {\n @Option({\n name: 'out',\n help: 'Specifies the location the documentation should be written to.',\n hint: ParameterHint.Directory\n })\n out!: string;\n\n @Option({\n name: 'json',\n help: 'Specifies the location and file name a json file describing the project is written to.',\n hint: ParameterHint.File\n })\n json!: string;\n\n @Option({\n name: 'version',\n short: 'v',\n help: 'Print the TypeDoc\\'s version.',\n type: ParameterType.Boolean\n })\n version!: boolean;\n\n @Option({\n name: 'help',\n short: 'h',\n help: 'Print this message.',\n type: ParameterType.Boolean\n })\n help!: boolean;\n\n /**\n * Run TypeDoc from the command line.\n */\n protected bootstrap(options?: Object): OptionsReadResult {\n const result = super.bootstrap(options);\n if (result.hasErrors) {\n return process.exit(ExitCode.OptionError);\n }\n\n if (this.version) {\n typescript.sys.write(this.toString());\n } else if (this.help) {\n typescript.sys.write(getOptionsHelp(this.options));\n } else if (result.inputFiles.length === 0) {\n typescript.sys.write(getOptionsHelp(this.options));\n process.exit(ExitCode.NoInputFiles);\n } else {\n const src = this.expandInputFiles(result.inputFiles);\n const project = this.convert(src);\n if (project) {\n if (this.out) {\n this.generateDocs(project, this.out);\n }\n if (this.json) {\n this.generateJson(project, this.json);\n }\n if (!this.out && !this.json) {\n this.logger.log(\"No 'out' or 'json' option has been set\");\n this.logger.log(\"The './docs' directory has be set as the output location by default\");\n this.generateDocs(project, './docs');\n }\n if (this.logger.hasErrors()) {\n process.exit(ExitCode.OutputError);\n }\n } else {\n process.exit(ExitCode.CompileError);\n }\n }\n\n return result;\n }\n\n get isCLI(): boolean {\n return true;\n }\n}\n"]}
\No newline at end of file