blob: 22a0916014843b1bc1a461c577119d30c640b58a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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.
|