Be able to specify the name of the skeleton query file

We introduced this QlPackGenerator a while ago. It always creates an `example.ql` query file as part of the skeleton pack.

We'd like to set the name of the query file, since we'll allow the user to create queries multiple times in the same skeleton pack folder.

The folder will be named `codeql-custom-queries-${language}` and will first receive an `example.ql` file.

If the user then tries to create a new query for the same language, we'll just create an `example2.ql`, `example3.ql` etc. file in the existing folder.
This commit is contained in:
Elena Tanasoiu
2023-03-29 14:42:47 +00:00
parent 2995b0120d
commit e63f0fc0af

View File

@@ -66,8 +66,8 @@ export class QlPackGenerator {
await writeFile(qlPackFilePath, this.header + dump(qlPackYml), "utf8");
}
private async createExampleQlFile() {
const exampleQlFilePath = join(this.folderUri.fsPath, "example.ql");
public async createExampleQlFile(fileName = "example.ql") {
const exampleQlFilePath = join(this.folderUri.fsPath, fileName);
const exampleQl = `
/**