7e2ecba219
- bin/pos: usage() CATEGORIES now auto-derived from pos-* filenames (kill the stale cheat-sheet bug class); only EXAMPLES stays hand-written - # POS: / # POS_FLAGS: headers on all 15 tools = single source of truth for generated docs; template updated - scripts/gen-docs.sh: regenerates GEN-marker sections (bin tree, dispatch table, no-common.sh list, line-count table, completion flags) - scripts/check-sync.sh: bash -n + exec bits + doc/code drift + smoke - Makefile: make gen / make check; scripts/install-hooks.sh: opt-in hook - DEV.md + AGENT_Context: add-a-tool flow is now header + make check
57 lines
2.5 KiB
Bash
Executable File
57 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# ────────────────────────────────────────────────────────────────
|
|
# TEMPLATE — new `pos` CLI tool
|
|
#
|
|
# 1. Copy: cp templates/pos-tool.sh bin/pos-<category>-<command>
|
|
# 2. Header: add a `# POS:` line right after the shebang/strict-mode
|
|
# lines (single source of truth for generated docs):
|
|
# # POS: <category> <command> — one-line description
|
|
# # POS_FLAGS: --flag1 --flag2 (flag-style tools only)
|
|
# 3. Exec bit: chmod +x bin/pos-<category>-<command>
|
|
# 4. If it reads stdin (password/selection prompts), add it to
|
|
# INTERACTIVE_CMDS in bin/pos or its prompt breaks under the log tee.
|
|
# 5. Docs: DOC/POS.md section table + detail block (hand-written).
|
|
# The AGENT_Context tables + completion flags come from
|
|
# `make gen` — never hand-edit between GEN markers.
|
|
# 6. Deps: add apt packages to PACKAGES in preinstall.sh; non-apt
|
|
# installers → `command -v <bin> || err "install from <URL>"`.
|
|
# 7. Done: `make gen && make check`
|
|
#
|
|
# Invoked as: pos <category> <command> [args]
|
|
# ────────────────────────────────────────────────────────────────
|
|
|
|
# Robust common.sh load — works from the repo checkout AND from
|
|
# /usr/local/bin after install.sh (which copies lib/common.sh there).
|
|
source "$(dirname "$0")/../lib/common.sh" 2>/dev/null || source "$(dirname "$0")/common.sh"
|
|
|
|
# Optional runtime config (see DEV.md "Config files"):
|
|
# CONFIG_FILE="$HOME/.config/linux_post_install/<tool>.env"
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
Usage: pos <category> <command> [args]
|
|
|
|
<describe what this command does>
|
|
|
|
Examples:
|
|
pos <category> <command> arg1
|
|
EOF
|
|
exit 0
|
|
}
|
|
|
|
case "${1:-}" in
|
|
-h|--help) usage ;;
|
|
esac
|
|
|
|
# ── script logic ────────────────────────────────────────────────
|
|
# Use helpers from common.sh: log / warn / err / ok / section /
|
|
# step / run (respects --dry-run) / spawn / confirm.
|
|
#
|
|
# command -v <dep> &>/dev/null || err "<dep> not found"
|
|
# run sudo <command> # dry-run aware
|
|
# log "done" # green [+] message
|
|
#
|
|
# Exit 0 on success, err() exits 1 on failure.
|