From 1e28c6726ba601f43330c1b9a82389b17393442b Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 29 Jun 2026 11:14:20 +0200 Subject: Initial commit: is_installed script with GPLv2 license Slackware package query tool plus bash completion. Add GPLv2 LICENSE, per-file headers, README, and CLAUDE.md. Co-Authored-By: Claude Opus 4.8 --- CLAUDE.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 CLAUDE.md (limited to 'CLAUDE.md') diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..22a0916 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,26 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## What this is + +`is_installed` is a single Bash script for Slackware (and derivatives) that queries the package database in `/var/log/packages` (each installed package = one file there). No build, no tests, no dependencies beyond Bash + coreutils + grep. + +## Layout + +- `is_installed` — the script. All logic lives here. +- `is_installed.bash-completion` — bash completion. Sourced/installed separately (e.g. into `/usr/share/bash-completion/completions/is_installed`). + +## Architecture + +Dispatch happens at the bottom `case` on `$1`: +- `file-search ` → `search_file()`: greps file contents of every package manifest in `$PKGS_PATH`, groups hits by package name. +- `info ` → `info()`: `less` the matching manifest. +- `help` → `help()`. +- anything else → treated as a package-name query → `search_package()`: lists `$PKGS_PATH` and greps the names. + +`PKGS_PATH` (`/var/log/packages`) is the single source of truth and is hardcoded. The completion script mirrors this path in the `info` case, so changing the path means editing both files. + +Exit codes are named vars at the top: `SHOWHELP=69`, `E_NOPKGFOUND=70`, `E_NOARGS=71`. Reuse these rather than literals. + +Output uses ANSI color vars (`RED`/`ORANGE`/`GREEN`/`MAGENTA`/`NC`) with `echo -e`. Match this style for any new user-facing output. -- cgit v1.2.3