Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions lazygit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: Lazygit
homepage: https://github.com/jesseduffield/lazygit
tagline: |
simple terminal UI for git commands
---

To update or switch versions, run `webi lazygit@stable` (or `@v0.59`, etc).

### Files

```text
~/.config/envman/PATH.env
~/.local/bin/lazygit
```

## Cheat Sheet

lazygit is a simple terminal UI for git commands, written in Go. It provides an
interactive interface for common git operations like staging, committing,
branching, and more.

[Watch the official tutorial on YouTube](https://www.youtube.com/watch?v=CPLdltN7wgE)

To start in the current directory:

```sh
lazygit
```

### Common Keybindings

| Key | Action |
|---------|----------------------|
| `q` | Quit |
| `Space` | Stage/unstage file |
| `Enter` | Open file in editor |
| `c` | Commit changes |
| `p` | Push changes |
| `P` | Pull changes |
| `b` | Checkout branch |
| `a` | Amend last commit |
| `s` | Stash changes |
| `?` | Show all keybindings |
55 changes: 55 additions & 0 deletions lazygit/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env pwsh

###################
# Install lazygit #
###################

# Every package should define these variables
$pkg_cmd_name = "lazygit"

$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\lazygit.exe"
$pkg_dst = "$pkg_dst_cmd"

$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\lazygit-v$Env:WEBI_VERSION\bin\lazygit.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\lazygit-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\lazygit-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"

New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | Out-Null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"

# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE")) {
Write-Output "Downloading lazygit from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& Move-Item "$pkg_download.part" "$pkg_download"
}

IF (!(Test-Path -Path "$pkg_src_cmd")) {
Write-Output "Installing lazygit"

# TODO: create package-specific temp directory
# Enter tmp
Push-Location .local\tmp

# Remove any leftover tmp cruft
Remove-Item -Path ".\lazygit-v*" -Recurse -ErrorAction Ignore
Remove-Item -Path ".\lazygit.exe" -Recurse -ErrorAction Ignore

# Unpack archive file into this temporary directory
# Windows BSD-tar handles zip. Imagine that.
Write-Output "Unpacking $pkg_download"
& tar xf "$pkg_download"

# Settle unpacked archive into place
Write-Output "Install Location: $pkg_src_cmd"
New-Item "$pkg_src_bin" -ItemType Directory -Force | Out-Null
Move-Item -Path ".\lazygit.exe" -Destination "$pkg_src_bin"

# Exit tmp
Pop-Location
}

Write-Output "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | Out-Null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
44 changes: 44 additions & 0 deletions lazygit/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh

__init_lazygit() {
set -e
set -u

###################
# Install lazygit #
###################

# Every package should define these 6 variables
pkg_cmd_name="lazygit"

pkg_dst_cmd="$HOME/.local/bin/lazygit"
pkg_dst="$pkg_dst_cmd"

pkg_src_cmd="$HOME/.local/opt/lazygit-v$WEBI_VERSION/bin/lazygit"
pkg_src_dir="$HOME/.local/opt/lazygit-v$WEBI_VERSION"
pkg_src="$pkg_src_cmd"

# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/gh-v0.99.9/bin
mkdir -p "$(dirname "$pkg_src_cmd")"

# mv ./lazygit-*/lazygit ~/.local/opt/lazygit-v0.99.9/bin/lazygit
mv ./lazygit "$pkg_src_cmd"
}

# pkg_get_current_version is recommended, but (soon) not required
pkg_get_current_version() {
# 'lazygit --version' has output in this format:
# commit=, build date=, build source=nix, version=0.44.1, os=linux, arch=amd64, git version=2.47.0
# This trims it down to just the version number:
# 0.44.1
output=$(lazygit --version)
version=${output#*version=}
version=${version%%,*}
echo "$version"
}

}

__init_lazygit
20 changes: 20 additions & 0 deletions lazygit/releases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var github = require('../_common/github.js');
var owner = 'jesseduffield';
var repo = 'lazygit';

module.exports = function () {
return github(null, owner, repo).then(function (all) {
return all;
});
};

if (module === require.main) {
module.exports().then(function (all) {
all = require('../_webi/normalize.js')(all);
// just select the first 5 for demonstration
all.releases = all.releases.slice(0, 5);
console.info(JSON.stringify(all, null, 2));
});
}
1 change: 1 addition & 0 deletions test/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ __test() {
koji \
kubectx \
kubens \
lazygit \
lf \
lsd \
mutagen \
Expand Down