Skip to content

Commit

Permalink
add parameter to set cadl emitter options
Browse files Browse the repository at this point in the history
  • Loading branch information
chunyu3 authored and azure-sdk committed Feb 27, 2023
1 parent bb0c945 commit 2fb72bc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion eng/common/scripts/Cadl-Project-Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
param (
[Parameter(Position=0)]
[ValidateNotNullOrEmpty()]
[string] $ProjectDirectory
[string] $ProjectDirectory,
[Parameter(Position=1)]
[string] $CadlAdditionalOptions ## addtional cadl emitter options, separated by semicolon if more than one
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -78,6 +80,12 @@ try {
}
}
$cadlCompileCommand = "npx cadl compile $mainCadlFile --emit $emitterName$emitterAdditionalOptions"
if ($CadlAdditionalOptions) {
$options = $CadlAdditionalOptions.Split(";");
foreach ($option in $options) {
$cadlCompileCommand += " --option $option"
}
}
Write-Host($cadlCompileCommand)
Invoke-Expression $cadlCompileCommand

Expand Down

0 comments on commit 2fb72bc

Please sign in to comment.