aboutsummaryrefslogtreecommitdiffstats
path: root/CLAUDE.md
diff options
context:
space:
mode:
Diffstat (limited to 'CLAUDE.md')
-rw-r--r--CLAUDE.md26
1 files changed, 26 insertions, 0 deletions
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 <item>` → `search_file()`: greps file contents of every package manifest in `$PKGS_PATH`, groups hits by package name.
+- `info <item>` → `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.