mirror of
https://github.com/Runnin4ik/dpi-detector.git
synced 2026-10-19 17:33:18 +00:00
docs: the Windows installer takes its flags through -AppArgs
`irm <url> | iex` cannot pass anything: `iex` has no parameter channel, and the `sh -s --` idiom the Linux line uses is not something PowerShell has — measured, it fails with "a parameter cannot be found that matches parameter name 's'". The installer itself could already forward flags (`& $out @AppArgs`); it just had no documented way in. Documented the `[scriptblock]::Create` form, and the array it needs: for a `[CmdletBinding()]` script `-d` is an abbreviation of the common parameter `-Debug`, so a bare `-t 2 -d example.com` binds the domain to `-InstallDir` (measured against the installer's own param block: `InstallDir='danbooru.donmai.us'`, `AppArgs=[-t 2]`) and would install into a directory named after the domain. Verified end to end against the published release: checksum verified, `5.0.0-alpha.21`, test 2 on the one domain, exit 0; a second run skips the download and starts the installed binary with the same arguments.
This commit is contained in:
parent
6866e1c1c5
commit
d4b36bfbcd
2 changed files with 16 additions and 0 deletions
|
|
@ -43,6 +43,14 @@ curl -fsSL https://raw.githubusercontent.com/Runnin4ik/dpi-detector/rust/install
|
|||
irm https://raw.githubusercontent.com/Runnin4ik/dpi-detector/rust/install.ps1 | iex
|
||||
```
|
||||
|
||||
Аргументы тестеру передаются так же, как на Linux, но `sh -s --` у PowerShell нет: `iex` параметров не принимает вовсе, поэтому установщик вызывается напрямую, а его аргументы идут одним массивом в `-AppArgs`:
|
||||
|
||||
```powershell
|
||||
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/Runnin4ik/dpi-detector/rust/install.ps1))) -AppArgs '-t','2','-d','danbooru.donmai.us'
|
||||
```
|
||||
|
||||
Массив обязателен: для скрипта с `[CmdletBinding()]` голое `-d` — это сокращение общего параметра `-Debug`, поэтому `-t 2 -d danbooru.donmai.us` разберётся как «домен — это каталог установки», и тестер уйдёт в каталог `danbooru.donmai.us` без `-d`. Повторный запуск той же версии трафик не тратит: установленный бинарник стартует сразу с переданными аргументами.
|
||||
|
||||
---
|
||||
|
||||
## 📦 Готовые бинарные сборки
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
# `irm <url> | iex` takes no arguments — `iex` has no parameter channel at all —
|
||||
# so the tester's flags are passed as an array through `-AppArgs`:
|
||||
#
|
||||
# & ([scriptblock]::Create((irm <url>))) -AppArgs '-t','2','-d','example.com'
|
||||
#
|
||||
# Bare flags do not work: for a `[CmdletBinding()]` script `-d` is an
|
||||
# abbreviation of the common parameter `-Debug`, so `-t 2 -d example.com` binds
|
||||
# the domain to `-InstallDir` and forwards `-t 2` alone.
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$InstallDir = "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue