Skip to content

Commit 27ac5ea

Browse files
authored
Merge pull request #225 from redjax/feat/fresh-editor
Feat/fresh editor
2 parents 6f97cad + c60575a commit 27ac5ea

File tree

5 files changed

+319
-0
lines changed

5 files changed

+319
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Fresh
2+
3+
[Fresh](https://github.com/sinelaw/fresh) is a terminal IDE like Helix or Neovim. It is a "zero configuration" editor like Helix, it will integrate and start working with the environment it's installed in, with minimal setup.
4+
5+
## Links
6+
7+
- [Fresh Github](https://github.com/sinelaw/fresh)
8+
- [Homepage](https://getfresh.dev/)
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
## Detect OS
6+
OS="$(uname -s)"
7+
ARCH="$(uname -m)"
8+
9+
function detect_linux_distro() {
10+
if [ -f /etc/os-release ]; then
11+
. /etc/os-release
12+
echo "$ID"
13+
else
14+
echo "unknown"
15+
fi
16+
}
17+
18+
function install_fresh_brew() {
19+
if ! command -v brew &>/dev/null; then
20+
echo "Error: Homebrew is not installed. Install it from https://brew.sh"
21+
exit 1
22+
fi
23+
24+
brew tap sinelaw/fresh
25+
brew install fresh-editor
26+
}
27+
28+
function install_fresh_arch() {
29+
if command -v yay &>/dev/null; then
30+
yay -S fresh-editor-bin
31+
elif command -v paru &>/dev/null; then
32+
paru -S fresh-editor-bin
33+
else
34+
echo "Installing fresh-editor from AUR manually"
35+
local tmpdir
36+
tmpdir="$(mktemp -d)"
37+
git clone https://aur.archlinux.org/fresh-editor-bin.git "$tmpdir/fresh-editor-bin"
38+
cd "$tmpdir/fresh-editor-bin"
39+
makepkg --syncdeps --install
40+
cd -
41+
rm -rf "$tmpdir"
42+
fi
43+
}
44+
45+
function install_fresh_deb() {
46+
echo "Downloading latest .deb package"
47+
48+
local deb_url
49+
50+
deb_url="$(curl -s https://api.github.com/repos/sinelaw/fresh/releases/latest \
51+
| grep "browser_download_url.*_$(dpkg --print-architecture)\.deb" \
52+
| cut -d '"' -f 4)"
53+
54+
if [ -z "$deb_url" ]; then
55+
echo "Error: Could not find .deb download URL for architecture $(dpkg --print-architecture)"
56+
exit 1
57+
fi
58+
59+
local tmpfile
60+
tmpfile="$(mktemp --suffix=.deb)"
61+
62+
curl -sL "$deb_url" -o "$tmpfile"
63+
sudo dpkg -i "$tmpfile"
64+
rm -f "$tmpfile"
65+
}
66+
67+
function install_fresh_rpm() {
68+
echo "Downloading latest .rpm package"
69+
70+
local rpm_url
71+
72+
rpm_url="$(curl -s https://api.github.com/repos/sinelaw/fresh/releases/latest \
73+
| grep "browser_download_url.*\.$(uname -m)\.rpm" \
74+
| cut -d '"' -f 4)"
75+
76+
if [ -z "$rpm_url" ]; then
77+
echo "Error: Could not find .rpm download URL for architecture $(uname -m)"
78+
exit 1
79+
fi
80+
81+
local tmpfile
82+
tmpfile="$(mktemp --suffix=.rpm)"
83+
84+
curl -sL "$rpm_url" -o "$tmpfile"
85+
sudo rpm -U "$tmpfile"
86+
rm -f "$tmpfile"
87+
}
88+
89+
function install_fresh_gentoo() {
90+
echo "Installing fresh-editor from GURU overlay"
91+
sudo emerge --ask app-editors/fresh
92+
}
93+
94+
function install_fresh_binary() {
95+
echo "No native package method available. Installing from pre-built binary"
96+
97+
local target=""
98+
case "$OS" in
99+
Linux)
100+
target="${ARCH}-unknown-linux-gnu"
101+
;;
102+
Darwin)
103+
target="${ARCH}-apple-darwin"
104+
;;
105+
*)
106+
echo "Error: Unsupported OS '$OS' for binary install."
107+
exit 1
108+
;;
109+
esac
110+
111+
## Normalize arch name (x86_64 is already correct, arm64 -> aarch64)
112+
target="${target/arm64/aarch64}"
113+
114+
local tarball="fresh-editor-${target}.tar.xz"
115+
local download_url
116+
download_url="$(curl -s https://api.github.com/repos/sinelaw/fresh/releases/latest \
117+
| grep "browser_download_url.*${target}\.tar\.xz\"" \
118+
| cut -d '"' -f 4)"
119+
120+
if [ -z "$download_url" ]; then
121+
echo "Error: Could not find binary release for target '$target'"
122+
exit 1
123+
fi
124+
125+
local tmpdir
126+
tmpdir="$(mktemp -d)"
127+
echo "Downloading $download_url "
128+
curl -sL "$download_url" -o "$tmpdir/$tarball"
129+
130+
echo "Extracting"
131+
tar -xf "$tmpdir/$tarball" -C "$tmpdir"
132+
133+
## Install binary to ~/.local/bin
134+
mkdir -p ~/.local/bin
135+
local fresh_bin
136+
fresh_bin="$(find "$tmpdir" -name 'fresh' -type f -executable | head -n 1)"
137+
138+
if [ -z "$fresh_bin" ]; then
139+
## Try without executable bit (tar might not preserve it)
140+
fresh_bin="$(find "$tmpdir" -name 'fresh' -type f | head -n 1)"
141+
fi
142+
143+
if [ -z "$fresh_bin" ]; then
144+
echo "Error: Could not find 'fresh' binary in extracted archive."
145+
rm -rf "$tmpdir"
146+
exit 1
147+
fi
148+
149+
cp "$fresh_bin" ~/.local/bin/fresh
150+
chmod +x ~/.local/bin/fresh
151+
rm -rf "$tmpdir"
152+
153+
echo "Installed fresh to ~/.local/bin/fresh"
154+
if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then
155+
echo "Warning: ~/.local/bin is not in your PATH. Add it to your shell profile."
156+
fi
157+
}
158+
159+
echo "Installing Fresh terminal IDE"
160+
echo " OS: $OS ($ARCH)"
161+
162+
case "$OS" in
163+
Darwin)
164+
echo " Method: Homebrew"
165+
install_fresh_brew
166+
;;
167+
168+
Linux)
169+
DISTRO="$(detect_linux_distro)"
170+
echo " Distro: $DISTRO"
171+
172+
case "$DISTRO" in
173+
## Brew-based immutable distros
174+
bazzite|bluefin|aurora)
175+
echo " Method: Homebrew"
176+
install_fresh_brew
177+
;;
178+
179+
## Arch Linux and derivatives
180+
arch|endeavouros|manjaro)
181+
echo " Method: AUR"
182+
install_fresh_arch
183+
;;
184+
185+
## Debian/Ubuntu family
186+
debian|ubuntu|pop|linuxmint|elementary|zorin|kali)
187+
echo " Method: .deb package"
188+
install_fresh_deb
189+
;;
190+
191+
## RPM-based distros
192+
fedora|rhel|centos|rocky|alma|ol|opensuse*|sles)
193+
echo " Method: .rpm package"
194+
install_fresh_rpm
195+
;;
196+
197+
## Gentoo
198+
gentoo)
199+
echo " Method: GURU overlay"
200+
install_fresh_gentoo
201+
;;
202+
203+
## Anything else: fall back to pre-built binary
204+
*)
205+
echo " Method: Pre-built binary (fallback)"
206+
install_fresh_binary
207+
;;
208+
esac
209+
;;
210+
211+
*)
212+
echo "Unsupported OS: $OS"
213+
exit 1
214+
;;
215+
esac
216+
217+
if [[ $? -ne 0 ]]; then
218+
echo "Fresh installation failed."
219+
exit 1
220+
fi
221+
222+
echo ""
223+
echo "Fresh terminal IDE installed successfully."
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Fresh
2+
3+
[Fresh](https://github.com/sinelaw/fresh) is a terminal IDE like Helix or Neovim. It is a "zero configuration" editor like Helix, it will integrate and start working with the environment it's installed in, with minimal setup.
4+
5+
## Links
6+
7+
- [Fresh Github](https://github.com/sinelaw/fresh)
8+
- [Homepage](https://getfresh.dev/)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<#
2+
.SYNOPSIS
3+
Installs Fresh terminal IDE on Windows.
4+
5+
.DESCRIPTION
6+
This script installs the Fresh terminal IDE on a Windows machine.
7+
It uses winget as the preferred method, falling back to scoop,
8+
then npm if winget is not available.
9+
10+
.LINK
11+
https://github.com/sinelaw/fresh
12+
13+
.EXAMPLE
14+
.\install-fresh-ide.ps1
15+
#>
16+
17+
[CmdletBinding()]
18+
Param()
19+
20+
function Install-FreshWinget {
21+
Write-Host "Installing Fresh via winget" -ForegroundColor Cyan
22+
try {
23+
winget install fresh-editor
24+
}
25+
catch {
26+
Write-Error "Failed to install Fresh via winget. Details: $($_.Exception.Message)"
27+
exit 1
28+
}
29+
}
30+
31+
function Install-FreshScoop {
32+
Write-Host "Installing Fresh via scoop" -ForegroundColor Cyan
33+
try {
34+
scoop install fresh-editor
35+
}
36+
catch {
37+
Write-Error "Failed to install Fresh via scoop. Details: $($_.Exception.Message)"
38+
exit 1
39+
}
40+
}
41+
42+
function Install-FreshNpm {
43+
Write-Host "Installing Fresh via npm" -ForegroundColor Cyan
44+
try {
45+
npm install -g fresh-editor
46+
}
47+
catch {
48+
Write-Error "Failed to install Fresh via npm. Details: $($_.Exception.Message)"
49+
exit 1
50+
}
51+
}
52+
53+
## Main execution
54+
Write-Host "Installing Fresh terminal IDE" -ForegroundColor Cyan
55+
56+
if (Get-Command winget -ErrorAction SilentlyContinue) {
57+
Install-FreshWinget
58+
}
59+
elseif (Get-Command scoop -ErrorAction SilentlyContinue) {
60+
Write-Host "winget not found, falling back to scoop." -ForegroundColor Yellow
61+
Install-FreshScoop
62+
}
63+
elseif (Get-Command npm -ErrorAction SilentlyContinue) {
64+
Write-Host "winget and scoop not found, falling back to npm." -ForegroundColor Yellow
65+
Install-FreshNpm
66+
}
67+
else {
68+
Write-Error "Neither winget, scoop, nor npm were found. Install one of them and try again."
69+
exit 1
70+
}
71+
72+
Write-Host "Fresh terminal IDE installed successfully." -ForegroundColor Green

windows/powershell/installs/packagemanagers/app_lists/development.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,13 @@
166166
"scoop_id": "azure-developer-cli",
167167
"choco_id": "azd",
168168
"aqua_id": ""
169+
},
170+
{
171+
"name": "Fresh Terminal IDE",
172+
"description": "Terminal-based, 'zero config' IDE (like Helix).",
173+
"winget_id": "fresh-dev.fresh",
174+
"scoop_id": "fresh",
175+
"choco_id": "",
176+
"aqua_id": ""
169177
}
170178
]

0 commit comments

Comments
 (0)