From 0209b5fb5112a144465db81a3f2abcc15152b989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20=C3=98deg=C3=A5rd?= Date: Sun, 7 Jun 2026 17:27:15 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20Add=20make.sh=20for=20pass=20and?= =?UTF-8?q?=20wrapper=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README | 72 ++++++++++++++++++++++++++++++++++++++++++------ pass/README.md | 75 -------------------------------------------------- pass/build.sh | 47 +++++++++++++++++++++++++++++++ shell/make.sh | 30 ++++++++++++++++++++ 4 files changed, 141 insertions(+), 83 deletions(-) delete mode 100644 pass/README.md create mode 100644 pass/build.sh create mode 100644 shell/make.sh diff --git a/README b/README index 52dcb26..1072a46 100644 --- a/README +++ b/README @@ -6,22 +6,31 @@ Some simple tools for my own productivity. ## pass - Password Store Replacement -Windows-compatible `pass` (password-store) replacement in Go. +Windows-compatible `pass` (password-store) replacement in Go. Manages GPG-encrypted password files in `~/.password-store/` with git integration. + +### Features + +- GPG-encrypted password storage +- Git integration for version control +- Interactive fuzzy search with TUI (Bubble Tea) +- Cross-platform (Windows, Linux, macOS) +- Copy to clipboard support +- Edit existing passwords with your favorite editor ### Build ```bash -cd pass -go build -o pass.exe . # Windows -go build -o pass . # Linux/macOS +cd pass && ./build.sh # native build → ../shell/pass[.exe] +cd pass && ./build.sh build # same +cd pass && ./build.sh build-all # cross-compile linux amd64/arm64 + windows arm64 ``` ### Install ```bash # Windows: copy pass.exe to PATH -copy pass\pass.exe C:\Windows\System32\ +copy shell\pass.exe C:\Windows\System32\ # Linux/macOS: -sudo cp pass/pass /usr/local/bin/ +sudo cp shell/pass /usr/local/bin/ ``` ### Test @@ -50,6 +59,22 @@ pass -c # Interactive fuzzy search with clipboard copy pass rm # Interactive fuzzy search to remove ``` +### TUI + +When running `pass`, `pass -c`, `pass rm`, or `pass edit` without arguments, an interactive TUI is displayed: +- Use up/down arrows to navigate the list +- Use left/right arrows to move cursor in search input +- Use Tab to cycle through results +- Type to filter passwords using fuzzy matching (subsequence matching) +- Press Enter to select (show, copy, remove, or edit based on command) +- Press Esc, Ctrl+C, Ctrl+D, or Ctrl+Q to exit + +### Configuration + +- `PASSWORD_STORE_DIR`: Custom password store location (default: `~/.password-store`) +- `EDITOR`: Editor to use for editing passwords (default: `notepad` on Windows, `vi` on Unix) +- Requires GPG to be installed and configured + ### Prerequisites - Go 1.20+ - GnuPG (GPG4Win on Windows) @@ -57,6 +82,37 @@ pass rm # Interactive fuzzy search to remove --- -## Other Tools +## gitprompt - Git Prompt Utility -- `shell/gitprompt.exe` - Git prompt utility +Git prompt utility for shell integration. + +### Build +```bash +cd gitprompt && ./build.sh # native build → ../shell/gitprompt[.exe] +cd gitprompt && ./build.sh build # same +cd gitprompt && ./build.sh build-all # cross-compile linux amd64/arm64 + windows arm64 +``` + +### Install +```bash +# Windows: copy gitprompt.exe to PATH +copy shell\gitprompt.exe C:\Windows\System32\ + +# Linux/macOS: +sudo cp shell/gitprompt /usr/local/bin/ +``` + +### Prerequisites +- Go 1.25+ (go-git v5.19 dependency) + +--- + +## Building All Tools + +Use the wrapper script to build both tools at once: +```bash +./shell/make.sh # build both gitprompt and pass +./shell/make.sh build # same +./shell/make.sh build-all # cross-compile both +./shell/make.sh clean # clean both builds +``` diff --git a/pass/README.md b/pass/README.md deleted file mode 100644 index 8cb7004..0000000 --- a/pass/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# pass - Windows-compatible password store - -A Windows-compatible replacement for the Unix password-store tool. Manages GPG-encrypted password files in `~/.password-store/` with git integration. - -## Features - -- ✅ GPG-encrypted password storage -- ✅ Git integration for version control -- ✅ Interactive fuzzy search with TUI (Bubble Tea) -- ✅ Cross-platform (Windows, Linux, macOS) -- ✅ Copy to clipboard support -- ✅ Edit existing passwords with your favorite editor - -## Usage - -```bash -# Show password -pass email/gmail.com - -# Interactive fuzzy search -pass - -# Copy to clipboard -pass -c email/gmail.com - -# Remove password -pass rm email/old.com - -# List passwords (files only, not directories) -pass ls - -# Find passwords -pass find gmail - -# Insert new password -pass insert email/new.com - -# Edit existing password (opens in $EDITOR) -pass edit email/gmail.com - -# Edit with fuzzy search -pass edit -``` - -## TUI - -When running `pass`, `pass -c`, `pass rm`, or `pass edit` without arguments, an interactive TUI is displayed: -- Use ↑/↓ arrows to navigate the list -- Use ←/→ arrows to move cursor in search input -- Use Tab to cycle through results -- Type to filter passwords using **fuzzy matching** (subsequence matching) -- Press Enter to select (show, copy, remove, or edit based on command) -- Press Esc, Ctrl+C, Ctrl+D, or Ctrl+Q to exit - -**Fuzzy Matching Examples:** -- Type `"g"` → shows all items containing "g" -- Type `"ga"` → shows items with "g" followed by "a" (in any position after) -- Type `"gmail"` → shows items like `email/gmail.com/user` where characters appear in order -- Matching characters are highlighted in the results - -## Installation - -```bash -go build -o pass.exe -``` - -## Configuration - -- `PASSWORD_STORE_DIR`: Custom password store location (default: `~/.password-store`) -- `EDITOR`: Editor to use for editing passwords (default: `notepad` on Windows, `vi` on Unix) -- Requires GPG to be installed and configured - -## Documentation - -See `docs/` for detailed documentation and `specs/` for specifications. diff --git a/pass/build.sh b/pass/build.sh new file mode 100644 index 0000000..42a56e3 --- /dev/null +++ b/pass/build.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# Build helper for systems without GNU make (e.g. BusyBox ash on Windows arm64). +# Equivalent to the targets in ./Makefile. +# +# Usage: +# ./build.sh # native build → ../shell/pass[.exe] +# ./build.sh build # same +# ./build.sh build-all # cross-compile linux amd64/arm64 + windows arm64 +# ./build.sh clean +# +# Requires Go 1.20+. + +set -eu + +OUTDIR=../shell +LDFLAGS="-s -w" +# Resolves to ".exe" on Windows, "" elsewhere — so the native build is +# named correctly without sniffing uname. +EXT=$(go env GOEXE) + +cmd=${1:-build} + +case "$cmd" in + build) + go build -ldflags="$LDFLAGS" -o "$OUTDIR/pass$EXT" . + ;; + build-all) + GOOS=linux GOARCH=amd64 go build -ldflags="$LDFLAGS" -o "$OUTDIR/pass-linux-amd64" . + GOOS=linux GOARCH=arm64 go build -ldflags="$LDFLAGS" -o "$OUTDIR/pass-linux-arm64" . + GOOS=windows GOARCH=arm64 go build -ldflags="$LDFLAGS" -o "$OUTDIR/pass-windows-arm64.exe" . + ;; + clean) + rm -f "$OUTDIR/pass" \ + "$OUTDIR/pass.exe" \ + "$OUTDIR/pass-linux-amd64" \ + "$OUTDIR/pass-linux-arm64" \ + "$OUTDIR/pass-windows-arm64.exe" + ;; + update-deps) + go get -u ./... + go mod tidy + ;; + *) + echo "Usage: $0 [build|build-all|update-deps|clean]" >&2 + exit 1 + ;; +esac diff --git a/shell/make.sh b/shell/make.sh new file mode 100644 index 0000000..28d92ec --- /dev/null +++ b/shell/make.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Wrapper script to build both gitprompt and pass. +# +# Usage: +# ./make.sh # build both tools +# ./make.sh build # same +# ./make.sh build-all # cross-compile both tools +# ./make.sh clean # clean both builds +# ./make.sh update-deps # update dependencies for both + +set -eu + +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) +REPO_ROOT=$(dirname "$SCRIPT_DIR") + +cmd=${1:-build} + +case "$cmd" in + build|build-all|clean|update-deps) + echo "Building gitprompt..." + (cd "$REPO_ROOT/gitprompt" && ./build.sh "$cmd") + + echo "Building pass..." + (cd "$REPO_ROOT/pass" && ./build.sh "$cmd") + ;; + *) + echo "Usage: $0 [build|build-all|clean|update-deps]" >&2 + exit 1 + ;; +esac