Skip to content

JoshLinneburg/toolbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

toolbox

Shared collection of CLI utilities — bash scripts, git subcommands, python tools, whatever's useful. Works on Linux, macOS, and Windows.

Prerequisites

OS Requirement
Linux bash (preinstalled)
macOS bash (preinstalled — 3.2+, or install newer via brew install bash)
Windows Git for Windows (bundles bash + git)

Install

Linux / macOS / WSL

git clone <this-repo> ~/projects/toolbox
cd ~/projects/toolbox
./install.sh

Detects your shell (bash, zsh, fish) and offers to add bin/ to your PATH.

Windows (PowerShell)

git clone <this-repo> ~\projects\toolbox
cd ~\projects\toolbox
.\install.ps1

Generates .cmd wrappers (reads shebangs to pick the right interpreter — bash, python3, node, etc.), then adds bin/ to your user PATH.

After install

New tools added to bin/ are available immediately on Linux/macOS. On Windows, re-run .\install.ps1 after adding new tools to generate their .cmd wrappers.

Commands

git cleanup-branches

Deletes local branches whose remote tracking branch has been deleted — the typical state after a squash merge on GitHub.

git cleanup-branches          # delete stale branches
git cleanup-branches --dry-run # preview what would be deleted

Protected branches (main, master, develop) are never deleted.

Adding new tools

  1. Add an executable to bin/
  2. Run ./lint.sh to check bash scripts
  3. Update this README
  4. Commit and push — teammates get it on git pull

Conventions

  • Add a shebang: #!/usr/bin/env bash, #!/usr/bin/env python3, etc.
  • Name git subcommands git-<command> — git finds them on PATH automatically
  • Skip file extensions for a cleaner CLI
  • Include --help support

Bash compatibility

macOS ships bash 3.2 (Apple won't ship GPLv3). All bash scripts must work on 3.2. Avoid:

  • Associative arrays (declare -A) — bash 4.0+
  • mapfile / readarray — bash 4.0+
  • ${var,,} / ${var^^} case conversion — bash 4.0+
  • |& pipe shorthand — bash 4.0+
  • Negative array indices (${arr[-1]}) — bash 4.2+
  • coproc — bash 4.0+

Run ./lint.sh before committing — it uses ShellCheck to catch issues.

For anything too complex for bash, use Python — it's truly cross-platform and needs no compatibility workarounds.

Cross-platform notes

  • Line endings: .gitattributes enforces LF for scripts. Do not change this — CRLF breaks bash.
  • Windows wrappers: install.ps1 generates .cmd files in bin/ (gitignored). It reads shebangs to route to the correct interpreter.
  • Python tools: Work natively everywhere. Use #!/usr/bin/env python3 and skip the .py extension.
  • Linting: ./lint.sh runs ShellCheck on all bash scripts. Install with apt install shellcheck, brew install shellcheck, or scoop install shellcheck.

About

Shared collection of CLI utilities — bash scripts, git subcommands, python tools, whatever's useful. Works on Linux, macOS, and Windows.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors