Skip to content

Commit

Permalink
chore: add help for install.sh (dagger#8674)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedevc authored Nov 15, 2024
1 parent 0560d20 commit 832606f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
28 changes: 26 additions & 2 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
#Requires -Version 7.0

<#
.Description
Download and install dagger.
.PARAMETER DaggerVersion
Semver version of dagger to install.
.PARAMETER DaggerCommit
Commit SHA for a dev build of dagger to install.
.EXAMPLE
.\install.ps1
Install with default settings.
.EXAMPLE
.\install.ps1 -InstallPath path\to\dir
Install to path/to/dir.
.EXAMPLE
.\install.ps1 -DaggerVersion vX.Y.Z
Install specified version vX.Y.Z.
.EXAMPLE
.\install.ps1 -DaggerCommit head
Install latest dev build.
.EXAMPLE
.\install.ps1 -DaggerCommit [commit]
Install specified dev build [commit].
#>

Param (
[Parameter(Mandatory = $false)][System.Management.Automation.SemanticVersion]$DaggerVersion,
[Parameter(Mandatory = $false)][string][ValidatePattern("^(?:[0-9a-fA-F]{40})?$")]$DaggerCommit,
[Parameter(Mandatory = $false)][string][ValidatePattern("^(?:head|(?:[0-9a-fA-F]{40}))?$")]$DaggerCommit,
[Parameter(Mandatory = $false)][string]$DownloadPath = [System.IO.Path]::GetTempFileName(),
[Parameter(Mandatory = $false)][string]$InstallPath = "$env:USERPROFILE\dagger",
[Parameter(Mandatory = $false)][switch]$AddToPath = $false,
Expand Down Expand Up @@ -412,7 +436,7 @@ if ($isInvoked) {
function Install-Dagger {
Param (
[Parameter(Mandatory = $false)][System.Management.Automation.SemanticVersion]$DaggerVersion,
[Parameter(Mandatory = $false)][string][ValidatePattern("^(?:[0-9a-fA-F]{40})?$")]$DaggerCommit,
[Parameter(Mandatory = $false)][string][ValidatePattern("^(?:head|(?:[0-9a-fA-F]{40}))?$")]$DaggerCommit,
[Parameter(Mandatory = $false)][string]$DownloadPath = [System.IO.Path]::GetTempFileName(),
[Parameter(Mandatory = $false)][string]$InstallPath = "$env:USERPROFILE\dagger",
[Parameter(Mandatory = $false)][switch]$AddToPath = $false,
Expand Down
27 changes: 26 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,26 @@ End of functions from https://github.com/client9/shlib
------------------------------------------------------------------------
EOF

help() {
cat <<EOF
Usage: $0
Install:
$0
Install to <path/to/dir>:
BIN_DIR=<path/to/dir> $0
Install specified version <vX.Y.Z>:
DAGGER_VERSION=<vX.Y.Z> $0
Install latest dev build:
DAGGER_COMMIT=head $0
Install specified dev build <commit sha>:
DAGGER_COMMIT=<commit sha> $0
EOF
}

uname_os() {
os=$(uname -s | tr '[:upper:]' '[:lower:]')
case "$os" in
Expand Down Expand Up @@ -374,4 +394,9 @@ execute() {
rm -rf "${tmpdir}"
}

execute
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
help
else
execute
fi

0 comments on commit 832606f

Please sign in to comment.