Skip to content

Commit

Permalink
Connect modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Amirhossein authored and Amirhossein committed Dec 26, 2023
1 parent a8d698a commit 355644c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
22 changes: 22 additions & 0 deletions Source/BSN.IpTables.Cli/Connect-BsnIPTablesCli.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function Connect-BsnIPTablesCli {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, HelpMessage = 'Please enter the target server address')]
[string]$ServerAddress
)

process {
Write-Output "Connected To: $ServerAddress"
# Perform other actions related to IPTables or any other tasks here
}

end {
# You can add cleanup or finalization steps here if needed
}
}

# Prompt the user to enter the server address outside the function
$enteredServerAddress = Read-Host "Enter the target server address"

# Call the function with the entered server address
Connect-BsnIPTablesCli -ServerAddress $enteredServerAddress
32 changes: 16 additions & 16 deletions Source/BSN.IpTables.Cli/Generate-PowerShellClient.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ if ($PSEdition -ne 'Core') {
Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.'
}

try {
Write-Host "Nvm is installed, version" $(nvm --version)
}
catch {
Write-Error "Nvm is not installed, install it manually to continue."
}

# 18.18.0 is the latest LTS node version
New-Variable -Name desiredNodeVersion -Value 'v18.18.0' -Option ReadOnly
if ($(nvm current) -ne $desiredNodeVersion) {
nvm install $desiredNodeVersion
nvm use $desiredNodeVersion
}
else {
Write-Host "Node is installed, version" $desiredNodeVersion
}
# try {
# Write-Host "Nvm is installed, version" $(nvm --version)
# }
# catch {
# Write-Error "Nvm is not installed, install it manually to continue."
# }

# # 18.18.0 is the latest LTS node version
# New-Variable -Name desiredNodeVersion -Value 'v18.18.0' -Option ReadOnly
# if ($(nvm current) -ne $desiredNodeVersion) {
# nvm install $desiredNodeVersion
# nvm use $desiredNodeVersion
# }
# else {
# Write-Host "Node is installed, version" $desiredNodeVersion
# }

try {
(autorest --version).Split([Environment]::NewLine) | Select -First 1
Expand Down
8 changes: 4 additions & 4 deletions Source/BSN.IpTables.Cli/custom/Connect-BsnIPTablesCli.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function Connect-BsnIPTablesCli {
[CmdletBinding()]
param()
param(
[Parameter(Mandatory = $true)]
[string]$ServerAddress
)

begin {
# Prompt the user to enter the server address
$ServerAddress = Read-Host "Enter the target server address"

# Save the ServerAddress in a session variable
$env:ServerAddress = $ServerAddress
}
Expand Down

0 comments on commit 355644c

Please sign in to comment.