Browse Source

feat: Ask-UseExistingAPI implemented

Vaclav Elias 2 years ago
parent
commit
706aeb91d9
1 changed files with 16 additions and 1 deletions
  1. 16 1
      BuildDocs.ps1

+ 16 - 1
BuildDocs.ps1

@@ -90,6 +90,17 @@ function Ask-IncludeAPI {
     return (Read-Host -Prompt "Your choice (Y/N)").ToLower() -eq "y"
     return (Read-Host -Prompt "Your choice (Y/N)").ToLower() -eq "y"
 }
 }
 
 
+function Ask-UseExistingAPI {
+    Write-Host ""
+    Write-Host -ForegroundColor Cyan "Do you want to use already generated API metadata?"
+    Write-Host ""
+    Write-Host -ForegroundColor Yellow "  [Y] Yes"
+    Write-Host -ForegroundColor Yellow "  [N] No"
+    Write-Host ""
+
+    return (Read-Host -Prompt "Your choice (Y/N)").ToLower() -eq "y"
+}
+
 function Copy-ExtraItems {
 function Copy-ExtraItems {
 
 
     Write-Host -ForegroundColor Yellow "Copying versions.json into $($Settings.WebDirectory)/"
     Write-Host -ForegroundColor Yellow "Copying versions.json into $($Settings.WebDirectory)/"
@@ -401,6 +412,7 @@ if ($BuildAll)
 {
 {
     $isAllLanguages = $true
     $isAllLanguages = $true
     $API = $true
     $API = $true
+    $ReuseAPI = $false
 }
 }
 else
 else
 {
 {
@@ -422,6 +434,7 @@ else
     # Ask if the user wants to include API
     # Ask if the user wants to include API
     if ($isEnLanguage -or $isAllLanguages -or $shouldBuildSelectedLanguage) {
     if ($isEnLanguage -or $isAllLanguages -or $shouldBuildSelectedLanguage) {
         $API = Ask-IncludeAPI
         $API = Ask-IncludeAPI
+        $ReuseAPI = Ask-UseExistingAPI
     } elseif ($isCanceled)
     } elseif ($isCanceled)
     {
     {
         Write-Host -ForegroundColor Red "Operation canceled by user."
         Write-Host -ForegroundColor Red "Operation canceled by user."
@@ -436,7 +449,9 @@ else
 }
 }
 
 
 # Generate API doc
 # Generate API doc
-if ($API)
+if ($ReuseAPI) {
+    Write-Host -ForegroundColor Green "Generating API documentation from existing mete data..."
+} elseif ($API)
 {
 {
     $exitCode = Generate-APIDoc
     $exitCode = Generate-APIDoc
     if($exitCode -ne 0)
     if($exitCode -ne 0)