Skip to content

Commit

Permalink
Use ArgumentCompletions instead of ValidateSet
Browse files Browse the repository at this point in the history
- Allows for user input not restricted by the given choices.
  This is especially useful for non-standard interface names
- Applies to PSX.psm1 and h/Get-InterfaceAddress.ps1
  • Loading branch information
X0RW3LL committed Sep 4, 2023
1 parent b29160a commit 40c8763
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions PSX.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function Convert-Shell
[String]$Type = "conpty",

[Parameter(Mandatory = $false)]
[ValidateSet("tun0", "eth0", "wlan0", "lo")]
[ArgumentCompletions("tun0", "eth0", "wlan0", "lo")]
[Alias("i")]
[String]$Interface = "tun0",

Expand Down Expand Up @@ -127,7 +127,7 @@ function Convert-Shell
[String]$Srvport = "80",

[Parameter(Mandatory = $false)]
[ValidateSet("powershell", "cmd")]
[ArgumentCompletions("powershell", "cmd")]
[Alias("e")]
[String]$Exec = "powershell",

Expand Down
2 changes: 1 addition & 1 deletion helpers/Get-InterfaceAddress.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Get-InterfaceAddress {
param (

[Parameter(Mandatory = $true)]
[ValidateSet("eth0", "wlan0", "tun0", "lo")]
[ArgumentCompletions("eth0", "wlan0", "tun0", "lo")]
[Alias("i")]
[String]$Interface = "tun0"

Expand Down

0 comments on commit 40c8763

Please sign in to comment.