| 248 | } |
| 249 | |
| 250 | function parseApplication(parser: IObjectParserProp<Application>): Application { |
| 251 | const application: Application = { |
| 252 | provides: [], |
| 253 | arguments: [], |
| 254 | name: '', |
| 255 | }; |
| 256 | parser.prop('provides').arrayRaw((item) => application.provides.push(str(item))); |
| 257 | parser.prop('name', v => application.name = str(v)); |
| 258 | parser.prop('command', v => application.command = str(v), true); |
| 259 | parser.prop('arguments', true).arrayRaw(v => application.arguments.push(str(v))); |
| 260 | parser.prop('path', v => application.path = str(v), true); |
| 261 | parser.prop('url', v => application.url = str(v), true); |
| 262 | const numDefined = num(!!application.command) + num(!!application.path) + num(!!application.url); |
| 263 | if (numDefined !== 1) { throw new Error('Exactly one "path", "url" or "command" variable must be defined for an application, not both.'); } |
| 264 | if (application.provides.length === 0) { throw new Error('Application must provide something. (Empty provides array)'); } |
| 265 | return application; |
| 266 | } |
| 267 | |
| 268 | function parseConfiguration(parser: IObjectParserProp<ExtConfiguration>): ExtConfiguration { |
| 269 | const configuration: ExtConfiguration = { |