Дополни функцию Show-Help, чтобы соответствовало параметрам function Show-Help {…
- User
Дополни функцию Show-Help, чтобы соответствовало параметрам
function Show-Help { Write-Host "Usage: script.ps1 [-S] [-crf=] [files]" Write-Host "-S Save original files after conversion." Write-Host "-crf= Set the CRF (Constant Rate Factor) value (e.g., -crf=20)." Write-Host "files Optional list of files to process. If omitted, all video files in the current directory will be processed." exit }
Check for help argument
if (args -contains "-help" -or $args -contains "--help") { Show-Help }
Default CRF (Constant Rate Factor) value
audioCodec = "libopus" videoPreset = "slow"
- Assistant
To update the
Show-Helpfunction so that it includes all the parameters parsed in your script, you need to add the descriptions for-preset=<value>and-acodec=<value>. Here's the updated function:powershellfunction Show-Help { Write-Host "Usage: script.ps1 [-S] [-crf=<value>] [-preset=<value>] [-acodec=<value>] [files]" Write-Host "-S Save original files after conversion." Write-Host "-crf=<value> Set the CRF (Constant Rate Factor) value (e.g., -crf=20)." Write-Host "-preset=<value> Set the video preset (e.g., -preset=slow)." Write-Host "-acodec=<value> Set the audio codec (e.g., -acodec=libopus)." Write-Host "files Optional list of files to process. If omitted, all video files in the current directory will be processed." exit }