testsAndMisc/linux_configuration/scripts/single_use/utils/lib/offline_rust.sh
Krzysztof kuhy Rudnicki 63650fbc45 Split offline docs and arch optimiser; defer libre_translate
setup_offline_docs.sh 713 -> 121 across six libs, carved one language at
a time since the first cut left offline_cpp at 545. optimize_arch_
desktop.sh 623 -> 118.

Two recurring traps again: a script with no SCRIPT_DIR at all, and libs
that chained rather than being sourced from the entry. Both now checked
for routinely.

libre_translate.sh is reverted and stays at 488. Exporting GENERATED to
fix one SC2034 revealed eighteen more - when a fix uncovers more of the
same, the seam is imaginary, not the fix wrong.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-16 20:09:54 +02:00

31 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Rust documentation download and indexing.
#
# Sourced by setup_offline_docs.sh; split out to keep offline_js.sh under the
# 250-line cap. Sourced rather than run, so it inherits the caller's
# strict mode and the variables defined above the source line.
#==============================================================================
# Rust Documentation (via rustup)
#==============================================================================
download_rust_docs() {
print_header "Rust Documentation"
local dest="$DOCS_DIR/rust"
if command -v rustup &> /dev/null; then
print_status "Rust docs available via 'rustup doc'"
# Get the rust doc path
local rust_doc_path
rust_doc_path=$(rustup doc --path 2> /dev/null | head -1 | xargs dirname 2> /dev/null)
if [ -n "$rust_doc_path" ] && [ -d "$rust_doc_path" ]; then
ln -sf "$rust_doc_path" "$dest/std"
print_success "Linked Rust std docs from $rust_doc_path"
build_rust_index
fi
else
print_status "Rust not installed. Install with: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
fi
}