Files
computer-playbook/scripts/make/help.sh
T
kevinveenbirkenbachandClaude Opus 4.7 f743f7b33f feat(console): add interactive make console REPL for the CLI
Wrap `python -m cli` in a host-side REPL launched via `make console`. The
loop normalizes input (strips leading `infinito`/`cli`, treats bare `help`
as `--help`), ignores Ctrl+C so accidental input cancels don't kill the
session, and exits only on `exit`/`quit`/`:q` or Ctrl+D. Includes a banner
with help/web/docs/license/author hints. Drops the now-redundant
`infinito --help` footer from `make help`. Adds 22 unit tests covering
normalization, subprocess dispatch, and main-loop control flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 17:05:42 +02:00

69 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Print every Make target with its description.
#
# Descriptions are taken from the comment line(s) directly above each
# target in the Makefile. Consecutive comment lines are joined with a
# space. Blank lines, recipe bodies, variable assignments, .PHONY
# blocks and other directives are ignored.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
MAKEFILE="${REPO_ROOT}/Makefile"
if [[ ! -f "${MAKEFILE}" ]]; then
echo "make help: Makefile not found at ${MAKEFILE}" >&2
exit 1
fi
if [[ -t 1 ]]; then
C_BOLD=$'\033[1m'
C_CYAN=$'\033[36m'
C_GREEN=$'\033[32m'
C_DIM=$'\033[2m'
C_RESET=$'\033[0m'
else
C_BOLD=""
C_CYAN=""
C_GREEN=""
C_DIM=""
C_RESET=""
fi
printf '\n%sInfinito.Nexus Make targets%s\n' "${C_BOLD}${C_CYAN}" "${C_RESET}"
printf '%sUsage: make <target>%s\n\n' "${C_DIM}" "${C_RESET}"
awk '
/^#/ {
line = $0
sub(/^#[[:space:]]?/, "", line)
if (comment == "") {
comment = line
} else {
comment = comment " " line
}
next
}
/^\.[A-Za-z]/ { comment = ""; next }
/^[[:space:]]*$/ { comment = ""; next }
/^[A-Za-z][A-Za-z0-9_.-]*:/ && !/:=/ && !/[?+]=/ {
target = $0
sub(/:.*$/, "", target)
if (!seen[target]++) {
printf "%s\t%s\n", target, (comment == "" ? "-" : comment)
}
comment = ""
next
}
/^[[:space:]]/ { next }
{ comment = "" }
' "${MAKEFILE}" |
sort |
awk -F'\t' -v g="${C_GREEN}" -v d="${C_DIM}" -v r="${C_RESET}" '
{ printf " %s%-32s%s %s%s%s\n", g, $1, r, d, $2, r }
'
printf '\n'
printf '%sDocumentation:%s %s%s\n\n' "${C_BOLD}" "${C_RESET}" "${C_CYAN}https://docs.infinito.nexus${C_RESET}" ""