perks/codegen-csharp/project.ts

31 строка
1.0 KiB
TypeScript
Исходник Обычный вид История

2018-11-06 22:03:52 +03:00
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Initializer, DeepPartial } from '@azure-tools/codegen';
2019-09-03 21:02:12 +03:00
import { pall } from '@azure-tools/codegen';
2018-11-06 22:03:52 +03:00
import { Namespace } from './namespace';
export class Project extends Initializer {
private namespaces = new Array<Namespace>();
constructor(objectInitializer?: DeepPartial<Project>) {
2018-11-06 22:03:52 +03:00
super();
this.apply(objectInitializer);
}
public addNamespace(n: Namespace): Namespace {
this.namespaces.push(n);
return n;
}
public async init(): Promise<this> {
return this;
}
public async writeFiles(writer: (filename: string, content: string) => Promise<void>) {
await pall(this.namespaces, async ns => ns.writeFiles(writer));
}
}