mirror of
https://github.com/bitwarden/server.git
synced 2025-02-26 03:31:34 +01:00
Change function names in bitwarden.ps1 (#1024)
Change functions name to follow naming recommendations in Powershell.
This commit is contained in:
parent
4be01c9518
commit
d694ac6052
@ -31,30 +31,30 @@ $webVersion = "2.24.2"
|
|||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
|
|
||||||
function Download-Self {
|
function Get-Self {
|
||||||
Invoke-RestMethod -OutFile $scriptPath -Uri "${githubBaseUrl}/scripts/bitwarden.ps1"
|
Invoke-RestMethod -OutFile $scriptPath -Uri "${githubBaseUrl}/scripts/bitwarden.ps1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Download-Run-File {
|
function Get-Run-File {
|
||||||
if (!(Test-Path -Path $scriptsDir)) {
|
if (!(Test-Path -Path $scriptsDir)) {
|
||||||
New-Item -ItemType directory -Path $scriptsDir | Out-Null
|
New-Item -ItemType directory -Path $scriptsDir | Out-Null
|
||||||
}
|
}
|
||||||
Invoke-RestMethod -OutFile $scriptsDir\run.ps1 -Uri "${githubBaseUrl}/scripts/run.ps1"
|
Invoke-RestMethod -OutFile $scriptsDir\run.ps1 -Uri "${githubBaseUrl}/scripts/run.ps1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Check-Output-Dir-Exists {
|
function Test-Output-Dir-Exists {
|
||||||
if (!(Test-Path -Path $output)) {
|
if (!(Test-Path -Path $output)) {
|
||||||
throw "Cannot find a Bitwarden installation at $output."
|
throw "Cannot find a Bitwarden installation at $output."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Check-Output-Dir-Not-Exists {
|
function Test-Output-Dir-Not-Exists {
|
||||||
if (Test-Path -Path "$output\docker") {
|
if (Test-Path -Path "$output\docker") {
|
||||||
throw "Looks like Bitwarden is already installed at $output."
|
throw "Looks like Bitwarden is already installed at $output."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function List-Commands {
|
function Show-Commands {
|
||||||
Write-Line "
|
Write-Line "
|
||||||
Available commands:
|
Available commands:
|
||||||
|
|
||||||
@ -112,53 +112,53 @@ Write-Line ""
|
|||||||
# Commands
|
# Commands
|
||||||
|
|
||||||
if ($install) {
|
if ($install) {
|
||||||
Check-Output-Dir-Not-Exists
|
Test-Output-Dir-Not-Exists
|
||||||
New-Item -ItemType directory -Path $output -ErrorAction Ignore | Out-Null
|
New-Item -ItemType directory -Path $output -ErrorAction Ignore | Out-Null
|
||||||
Download-Run-File
|
Get-Run-File
|
||||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -install -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
#Invoke-Expression "& `"$scriptsDir\run.ps1`" -install -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||||
}
|
}
|
||||||
elseif ($start -Or $restart) {
|
elseif ($start -Or $restart) {
|
||||||
Check-Output-Dir-Exists
|
Test-Output-Dir-Exists
|
||||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -restart -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
Invoke-Expression "& `"$scriptsDir\run.ps1`" -restart -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||||
}
|
}
|
||||||
elseif ($update) {
|
elseif ($update) {
|
||||||
Check-Output-Dir-Exists
|
Test-Output-Dir-Exists
|
||||||
Download-Run-File
|
Get-Run-File
|
||||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -update -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
Invoke-Expression "& `"$scriptsDir\run.ps1`" -update -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||||
}
|
}
|
||||||
elseif ($rebuild) {
|
elseif ($rebuild) {
|
||||||
Check-Output-Dir-Exists
|
Test-Output-Dir-Exists
|
||||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -rebuild -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
Invoke-Expression "& `"$scriptsDir\run.ps1`" -rebuild -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||||
}
|
}
|
||||||
elseif ($updateconf) {
|
elseif ($updateconf) {
|
||||||
Check-Output-Dir-Exists
|
Test-Output-Dir-Exists
|
||||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -updateconf -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
Invoke-Expression "& `"$scriptsDir\run.ps1`" -updateconf -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||||
}
|
}
|
||||||
elseif ($updatedb) {
|
elseif ($updatedb) {
|
||||||
Check-Output-Dir-Exists
|
Test-Output-Dir-Exists
|
||||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -updatedb -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
Invoke-Expression "& `"$scriptsDir\run.ps1`" -updatedb -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||||
}
|
}
|
||||||
elseif ($stop) {
|
elseif ($stop) {
|
||||||
Check-Output-Dir-Exists
|
Test-Output-Dir-Exists
|
||||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -stop -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
Invoke-Expression "& `"$scriptsDir\run.ps1`" -stop -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||||
}
|
}
|
||||||
elseif ($renewcert) {
|
elseif ($renewcert) {
|
||||||
Check-Output-Dir-Exists
|
Test-Output-Dir-Exists
|
||||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -renewcert -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
Invoke-Expression "& `"$scriptsDir\run.ps1`" -renewcert -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||||
}
|
}
|
||||||
elseif ($updaterun) {
|
elseif ($updaterun) {
|
||||||
Check-Output-Dir-Exists
|
Test-Output-Dir-Exists
|
||||||
Download-Run-File
|
Get-Run-File
|
||||||
}
|
}
|
||||||
elseif ($updateself) {
|
elseif ($updateself) {
|
||||||
Download-Self
|
Get-Self
|
||||||
Write-Line "Updated self."
|
Write-Line "Updated self."
|
||||||
}
|
}
|
||||||
elseif ($help) {
|
elseif ($help) {
|
||||||
List-Commands
|
Show-Commands
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Line "No command found."
|
Write-Line "No command found."
|
||||||
Write-Line ""
|
Write-Line ""
|
||||||
List-Commands
|
Show-Commands
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user