From 83c6fc2d55cdd7de949f2815b86dfe0b9cc18f27 Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Fri, 13 Jun 2025 20:07:53 +0800 Subject: . --- export/.gitignore | 2 ++ .../completeion/install_completion_powershell.ps1 | 39 ++++++++++++++++++++++ export/docs/How_to_export.md | 2 ++ 3 files changed, 43 insertions(+) create mode 100644 export/dev/bin/completeion/install_completion_powershell.ps1 create mode 100644 export/docs/How_to_export.md (limited to 'export') diff --git a/export/.gitignore b/export/.gitignore index bab68c0..dc96378 100644 --- a/export/.gitignore +++ b/export/.gitignore @@ -5,4 +5,6 @@ !src/** !dev/ !dev/** +!docs/ +!docs/** /dev/bin/pad.exe \ No newline at end of file diff --git a/export/dev/bin/completeion/install_completion_powershell.ps1 b/export/dev/bin/completeion/install_completion_powershell.ps1 new file mode 100644 index 0000000..8707870 --- /dev/null +++ b/export/dev/bin/completeion/install_completion_powershell.ps1 @@ -0,0 +1,39 @@ +$ErrorActionPreference = "Stop" + +try { + # Check if padc.exe exists in the current directory + if (-not (Test-Path -Path ".\..\padc.exe" -PathType Leaf)) { + throw "Error: padc.exe program not found in the current directory" + } + + # Generate completion script + Write-Host "Generating padc.ps1 file..." + .\..\padc.exe generate-completion powershell | Out-File padc.ps1 -Encoding utf8 -Force + + # Get target profile file path + $targetProfile = $PROFILE.CurrentUserAllHosts + + # Ensure the profile directory exists + $profileDir = Split-Path $targetProfile -Parent + if (-not (Test-Path $profileDir)) { + New-Item -ItemType Directory -Path $profileDir -Force | Out-Null + } + + # Copy the generated script to the profile file + Write-Host "Installing to user profile file..." + Copy-Item padc.ps1 $targetProfile -Force + + # Clean up temporary files (optional) + # Remove-Item padc.ps1 -Force + + Write-Host "`nComplete! Auto-completion has been successfully installed to $targetProfile" -ForegroundColor Green + Write-Host "Effective in new terminal sessions (restart PowerShell to use)" +} +catch { + Write-Host "`nError: $_" -ForegroundColor Red + exit 1 +} + +# Pause the script +Write-Host "`nPress any key to continue..." +$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") \ No newline at end of file diff --git a/export/docs/How_to_export.md b/export/docs/How_to_export.md new file mode 100644 index 0000000..5bdfcd5 --- /dev/null +++ b/export/docs/How_to_export.md @@ -0,0 +1,2 @@ +# How to compile project with Cargo + -- cgit