💾 Archived View for tbeseda.smol.pub › gitclean-zsh captured on 2024-05-10 at 10:46:34. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

tbeseda

Home

All Posts

gitclean zsh command

gitclean() {
  git clean -Xdn
  if read -q REPLY\?"Clean these? (Y/y)"; then
    git clean -Xdf
  else
    echo "Still dirty."
  fi
}

For more fancy, use "gum":

gitclean() {
  DIRTY=$(git clean -Xdn | sed 's/Would remove //g')

  gum style \
    --foreground 196 --border thick --border-foreground 88 \
    --margin "1 2" --padding "1 3" "$DIRTY"

  gum confirm "🧹 Delete these?" \
    && git clean -Xdf \
    || echo "Still dirty."
}

gum docs

gist version with preview image

---

All Posts