Skip to content

Commit 59620b2

Browse files
committed
feat(install): add Windows installer and version/force options
Add PowerShell install script for Windows. Both scripts now support --force for reinstalling and version pinning via args or env vars.
1 parent f3750f6 commit 59620b2

3 files changed

Lines changed: 185 additions & 11 deletions

File tree

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,41 @@ Merging conventional commits to `main` triggers [release-please](https://github.
103103

104104
### Quick Install
105105

106+
**macOS / Linux:**
107+
106108
```bash
107109
curl -fsSL https://deepgram.com/install.sh | sh
108110
```
109111

112+
**Windows (PowerShell):**
113+
114+
```powershell
115+
iwr https://deepgram.com/install.ps1 -useb | iex
116+
```
117+
118+
### Install Options
119+
120+
```bash
121+
# Install a specific version
122+
curl -fsSL https://deepgram.com/install.sh | sh -s -- v0.2.1
123+
124+
# Force reinstall over existing installation
125+
curl -fsSL https://deepgram.com/install.sh | sh -s -- --force
126+
127+
# Both
128+
curl -fsSL https://deepgram.com/install.sh | sh -s -- --force v0.2.1
129+
```
130+
131+
**Windows (PowerShell):**
132+
133+
```powershell
134+
# Install a specific version
135+
$env:DEEPCTL_VERSION='0.2.1'; iwr https://deepgram.com/install.ps1 -useb | iex
136+
137+
# Force reinstall
138+
$env:DEEPCTL_FORCE='1'; iwr https://deepgram.com/install.ps1 -useb | iex
139+
```
140+
110141
### Other Methods
111142

112143
```bash

scripts/install.ps1

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Deepgram CLI installer for Windows
2+
# Usage:
3+
# iwr https://deepgram.com/install.ps1 -useb | iex
4+
# $env:DEEPCTL_VERSION='0.2.1'; iwr https://deepgram.com/install.ps1 -useb | iex
5+
# $env:DEEPCTL_FORCE='1'; iwr https://deepgram.com/install.ps1 -useb | iex
6+
7+
$ErrorActionPreference = 'Stop'
8+
9+
$Package = 'deepctl'
10+
$Version = if ($env:DEEPCTL_VERSION) { $env:DEEPCTL_VERSION } else { '' }
11+
$Force = if ($env:DEEPCTL_FORCE -eq '1') { $true } else { $false }
12+
13+
# Clean up env vars so they don't persist
14+
$env:DEEPCTL_VERSION = $null
15+
$env:DEEPCTL_FORCE = $null
16+
17+
function Test-Command($Name) {
18+
return [bool](Get-Command $Name -ErrorAction SilentlyContinue)
19+
}
20+
21+
function Install-Uv {
22+
Write-Host 'Installing uv...'
23+
irm https://astral.sh/uv/install.ps1 | iex
24+
# Refresh PATH
25+
$env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'User') + ';' + [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
26+
if (-not (Test-Command 'uv')) {
27+
Write-Error 'Failed to install uv. Please install manually: https://docs.astral.sh/uv/'
28+
exit 1
29+
}
30+
}
31+
32+
# --- Main ---
33+
34+
Write-Host ''
35+
Write-Host ' Deepgram CLI Installer'
36+
Write-Host ' ======================'
37+
Write-Host ''
38+
39+
$Spec = if ($Version) { "${Package}==${Version}" } else { $Package }
40+
41+
if ($Version) { Write-Host "Version: $Version" }
42+
if ($Force) { Write-Host 'Force: reinstall' }
43+
if ($Version -or $Force) { Write-Host '' }
44+
45+
$ForceFlag = if ($Force) { '--force' } else { $null }
46+
47+
if (Test-Command 'uv') {
48+
Write-Host "Found uv, installing ${Spec}..."
49+
& uv tool install $ForceFlag $Spec
50+
}
51+
elseif (Test-Command 'pipx') {
52+
Write-Host "Found pipx, installing ${Spec}..."
53+
& pipx install $(if ($Force) { '--force' } else { $null }) $Spec
54+
}
55+
elseif (Test-Command 'pip3') {
56+
Write-Host "Found pip3, installing ${Spec}..."
57+
& pip3 install --user $(if ($Force) { '--force-reinstall' } else { $null }) $Spec
58+
}
59+
elseif (Test-Command 'pip') {
60+
Write-Host "Found pip, installing ${Spec}..."
61+
& pip install --user $(if ($Force) { '--force-reinstall' } else { $null }) $Spec
62+
}
63+
else {
64+
Write-Host 'No Python package manager found. Installing uv first...'
65+
Write-Host ''
66+
Install-Uv
67+
Write-Host ''
68+
Write-Host "Installing ${Spec}..."
69+
& uv tool install $ForceFlag $Spec
70+
}
71+
72+
Write-Host ''
73+
74+
if (Test-Command 'deepctl') {
75+
Write-Host 'Deepgram CLI installed successfully!'
76+
Write-Host ''
77+
& deepctl --version
78+
Write-Host ''
79+
Write-Host 'Get started:'
80+
Write-Host ' deepctl login'
81+
Write-Host ' deepctl --help'
82+
}
83+
else {
84+
Write-Host "Installation complete, but 'deepctl' is not in your PATH."
85+
Write-Host ''
86+
Write-Host 'You may need to restart your terminal or add the install location to your PATH.'
87+
Write-Host ''
88+
Write-Host 'Then run: deepctl --help'
89+
}

scripts/install.sh

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
#!/bin/sh
22
# Deepgram CLI installer
3-
# Usage: curl -fsSL https://deepgram.com/install.sh | sh
3+
# Usage:
4+
# curl -fsSL https://deepgram.com/install.sh | sh
5+
# curl -fsSL https://deepgram.com/install.sh | sh -s -- --force
6+
# curl -fsSL https://deepgram.com/install.sh | sh -s -- v0.2.1
7+
# curl -fsSL https://deepgram.com/install.sh | sh -s -- --force v0.2.1
8+
# curl -fsSL https://deepgram.com/install.sh | DEEPCTL_VERSION=0.2.1 sh
9+
# curl -fsSL https://deepgram.com/install.sh | DEEPCTL_FORCE=1 sh
410
set -e
511

612
PACKAGE="deepctl"
13+
FORCE="${DEEPCTL_FORCE:-0}"
14+
VERSION="${DEEPCTL_VERSION:-}"
15+
16+
# --- Parse arguments ---
17+
18+
for arg in "$@"; do
19+
case "$arg" in
20+
--force|-f)
21+
FORCE=1
22+
;;
23+
v*)
24+
VERSION="${arg#v}"
25+
;;
26+
*)
27+
VERSION="$arg"
28+
;;
29+
esac
30+
done
731

832
# --- Helpers ---
933

@@ -38,40 +62,70 @@ install_uv() {
3862
has uv || err "Failed to install uv. Please install manually: https://docs.astral.sh/uv/"
3963
}
4064

65+
# --- Build install args ---
66+
67+
build_install_spec() {
68+
if [ -n "$VERSION" ]; then
69+
echo "${PACKAGE}==${VERSION}"
70+
else
71+
echo "${PACKAGE}"
72+
fi
73+
}
74+
4175
# --- Main ---
4276

4377
say ""
4478
say " Deepgram CLI Installer"
4579
say " ======================"
4680
say ""
4781

82+
SPEC="$(build_install_spec)"
83+
84+
if [ -n "$VERSION" ]; then
85+
say "Version: ${VERSION}"
86+
fi
87+
if [ "$FORCE" = "1" ]; then
88+
say "Force: reinstall"
89+
fi
90+
say ""
91+
4892
# Detect OS
4993
OS="$(uname -s)"
5094
case "$OS" in
5195
Linux|Darwin) ;;
5296
*) err "Unsupported operating system: $OS" ;;
5397
esac
5498

99+
# Build flags
100+
UV_FLAGS=""
101+
PIPX_FLAGS=""
102+
PIP_FLAGS=""
103+
if [ "$FORCE" = "1" ]; then
104+
UV_FLAGS="--force"
105+
PIPX_FLAGS="--force"
106+
PIP_FLAGS="--force-reinstall"
107+
fi
108+
55109
# Try install methods in order of preference
56110
if has uv; then
57-
say "Found uv, installing ${PACKAGE}..."
58-
uv tool install "$PACKAGE"
111+
say "Found uv, installing ${SPEC}..."
112+
uv tool install $UV_FLAGS "$SPEC"
59113
elif has pipx; then
60-
say "Found pipx, installing ${PACKAGE}..."
61-
pipx install "$PACKAGE"
114+
say "Found pipx, installing ${SPEC}..."
115+
pipx install $PIPX_FLAGS "$SPEC"
62116
elif has pip3; then
63-
say "Found pip3, installing ${PACKAGE}..."
64-
pip3 install --user "$PACKAGE"
117+
say "Found pip3, installing ${SPEC}..."
118+
pip3 install --user $PIP_FLAGS "$SPEC"
65119
elif has pip; then
66-
say "Found pip, installing ${PACKAGE}..."
67-
pip install --user "$PACKAGE"
120+
say "Found pip, installing ${SPEC}..."
121+
pip install --user $PIP_FLAGS "$SPEC"
68122
else
69123
say "No Python package manager found. Installing uv first..."
70124
say ""
71125
install_uv
72126
say ""
73-
say "Installing ${PACKAGE}..."
74-
uv tool install "$PACKAGE"
127+
say "Installing ${SPEC}..."
128+
uv tool install $UV_FLAGS "$SPEC"
75129
fi
76130

77131
say ""

0 commit comments

Comments
 (0)