#!/usr/bin/env bash

# omarchy:summary=Install the CLI utilities fd, lazygit, sesh, tmuxinator and zoxide
# omarchy:requires-sudo=true

# Based: fd-find, lsof, tmuxinator, zoxide and lazygit come from apt, the
# same tools from brew. sesh has no package on either OS, so Go builds it
# into ~/.local/bin, next to the fd name Debian's fd-find does not provide.

set -eo pipefail

echo "Installing the CLI utilities..."
omarchy-pkg-add fd-find brew=fd lsof linux=only tmuxinator zoxide lazygit golang-go brew=go

mkdir -p ~/.local/bin
if omarchy-cmd-present fdfind && omarchy-cmd-missing fd; then
  ln -sf /usr/bin/fdfind ~/.local/bin/fd
fi

if omarchy-cmd-missing sesh && [[ ! -x ~/.local/bin/sesh ]]; then
  echo "Building sesh..."
  GOBIN="$HOME/.local/bin" go install github.com/joshmedeski/sesh/v2@latest
fi
