mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-10 22:27:01 +01:00
Two levels of pure taxonomy carrying no information, and a 2-directory
cap leaves no room for them. Categories now sit directly under
linux_configuration/: features, fixes, utils, misc, fresh-install,
installers, diagnostics, gaming, boot_recovery, periodic_background, lib,
meta, tests. A script's own lib/ and tests/ are exempt from the cap, so
those stay put.
Depth violations 248 -> 139; roughly 40 of the remainder are inside
digital_wellbeing and hosts, deferred until the guard-lib repoint.
The moves are the easy half. What breaks is every path that counted
levels, and three classes of it had to be found by resolving paths rather
than reading diffs:
- 52 relative `source` lines for lib/common.sh and lib/android.sh. The
correct prefix differs per file: 40 were ../../ and 12 were ../../../,
so a blanket replace would have fixed one set and broken the other.
- REPO_ROOT in 7 fixes/lib/tests harnesses and setup_syncyomi_guard.sh,
each walking up four levels from a directory now two levels shallower.
This caused a real regression -- the fixes suite went red with
"log_warn: command not found" -- caught by running it and comparing
against the pre-move baseline worktree.
- conftest.py's sys.path entries, which took the pytest gate down with
14 collection errors, and the `# shellcheck source=` directives, which
took shellcheck down with SC1091.
16 symlinks in $HOME broke, including the entire i3blocks bar. All
repointed, and cpu_monitor/memory/disk/time/volume were run to confirm
they emit real output rather than merely resolving.
Verified: 1798 tests pass at 100% coverage, 8 of 9 lib/tests suites pass
(the ninth needs the coverage jail, identically at baseline), pre-commit
is clean, and the two untracked secret configs are still ignored after
their gitignore paths changed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
156 lines
7.2 KiB
Bash
Executable File
156 lines
7.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# lib/study_doc_urls.sh — per-language documentation URL builders for the
|
|
# C-family, JS/TS and Python.
|
|
#
|
|
# Sourced by generate_study_materials.sh. Each takes a term and returns the
|
|
# canonical online doc URL for it, or an empty string when the language has no
|
|
# stable URL shape for that term.
|
|
|
|
# Python documentation
|
|
python_doc_url() {
|
|
local term="$1"
|
|
# Category (keyword, builtin, module), reserved for future use and never
|
|
# read. Defaulted rather than required: get_doc_url has always called this
|
|
# with one argument, which only worked because the entry script runs under
|
|
# `set -e` without `-u`, so "$2" silently expanded to empty. Any caller that
|
|
# does enable `set -u` -- a test, or a future lib that sources this -- would
|
|
# otherwise abort here on an argument nothing uses.
|
|
local _type="${2:-}"
|
|
|
|
case "$term" in
|
|
# Keywords
|
|
if | else | elif | for | while | try | except | finally | with | as | import | from | def | class | return | yield | raise | pass | break | continue | and | or | not | in | is | lambda | global | nonlocal | assert | del | True | False | None | async | await)
|
|
echo "https://docs.python.org/3/reference/compound_stmts.html"
|
|
;;
|
|
# Built-in functions
|
|
print | len | range | type | str | int | float | list | dict | set | tuple | bool | open | input | format | sorted | reversed | enumerate | zip | map | filter | any | all | sum | min | max | abs | round | isinstance | issubclass | hasattr | getattr | setattr | delattr | callable | iter | next | super | property | staticmethod | classmethod | vars | dir | help | id | hash | repr | ascii | bin | hex | oct | chr | ord | eval | exec | compile)
|
|
echo "https://docs.python.org/3/library/functions.html#$term"
|
|
;;
|
|
# Common modules
|
|
os | sys | re | json | datetime | collections | itertools | functools | pathlib | subprocess | threading | multiprocessing | asyncio | typing | dataclasses | unittest | pytest | logging | argparse | configparser)
|
|
echo "https://docs.python.org/3/library/$term.html"
|
|
;;
|
|
# Testing
|
|
MagicMock | Mock | patch | PropertyMock)
|
|
echo "https://docs.python.org/3/library/unittest.mock.html"
|
|
;;
|
|
*)
|
|
echo "https://docs.python.org/3/search.html?q=$term"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# JavaScript/TypeScript documentation (MDN)
|
|
js_doc_url() {
|
|
local term="$1"
|
|
|
|
case "$term" in
|
|
# Keywords & statements
|
|
if | else | for | while | do | switch | case | break | continue | return | throw | try | catch | finally | function | class | const | let | var | new | this | super | import | export | default | async | await | yield | typeof | instanceof | in | of | delete | void)
|
|
echo "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements"
|
|
;;
|
|
# Global objects
|
|
Array | Object | String | Number | Boolean | Symbol | Map | Set | WeakMap | WeakSet | Date | RegExp | Error | Promise | Proxy | Reflect | JSON | Math | Intl)
|
|
echo "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/$term"
|
|
;;
|
|
# Array methods
|
|
map | filter | reduce | forEach | find | findIndex | some | every | includes | indexOf | slice | splice | concat | join | push | pop | shift | unshift | sort | reverse | flat | flatMap)
|
|
echo "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/$term"
|
|
;;
|
|
# String methods
|
|
split | replace | match | search | substring | substr | toLowerCase | toUpperCase | trim | padStart | padEnd | startsWith | endsWith | charAt | charCodeAt)
|
|
echo "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/$term"
|
|
;;
|
|
# Promise methods
|
|
then | resolve | reject | all | race | allSettled | any)
|
|
echo "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/$term"
|
|
;;
|
|
# Common Web APIs
|
|
fetch | console | document | window | localStorage | sessionStorage | setTimeout | setInterval | addEventListener | querySelector | querySelectorAll)
|
|
echo "https://developer.mozilla.org/en-US/docs/Web/API"
|
|
;;
|
|
*)
|
|
echo "https://developer.mozilla.org/en-US/search?q=$term"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# TypeScript-specific documentation
|
|
ts_doc_url() {
|
|
local term="$1"
|
|
|
|
case "$term" in
|
|
interface | type | enum | namespace | declare | readonly | abstract | implements | extends | keyof | typeof | infer | as | is | asserts | satisfies | override)
|
|
echo "https://www.typescriptlang.org/docs/handbook/2/everyday-types.html"
|
|
;;
|
|
Partial | Required | Readonly | Record | Pick | Omit | Exclude | Extract | NonNullable | ReturnType | Parameters | InstanceType | Awaited)
|
|
echo "https://www.typescriptlang.org/docs/handbook/utility-types.html"
|
|
;;
|
|
*)
|
|
# Fall back to JS docs for runtime features
|
|
js_doc_url "$term"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# C documentation
|
|
c_doc_url() {
|
|
local term="$1"
|
|
|
|
case "$term" in
|
|
# Keywords
|
|
if | else | for | while | do | switch | case | break | continue | return | goto | sizeof | typedef | struct | union | enum | const | static | extern | register | volatile | inline | restrict | _Bool | _Complex | _Imaginary | _Alignas | _Alignof | _Atomic | _Generic | _Noreturn | _Static_assert | _Thread_local)
|
|
echo "https://en.cppreference.com/w/c/keyword/$term"
|
|
;;
|
|
# Standard library headers
|
|
stdio | stdlib | string | math | time | ctype | stdint | stdbool | stddef | limits | float | errno | assert | signal | setjmp | stdarg | locale)
|
|
echo "https://en.cppreference.com/w/c/header/${term}.h"
|
|
;;
|
|
# Common functions
|
|
printf | fprintf | sprintf | snprintf | scanf | fscanf | sscanf | fopen | fclose | fread | fwrite | fgets | fputs | fseek | ftell | rewind | fflush)
|
|
echo "https://en.cppreference.com/w/c/io"
|
|
;;
|
|
malloc | calloc | realloc | free | memcpy | memmove | memset | memcmp)
|
|
echo "https://en.cppreference.com/w/c/memory"
|
|
;;
|
|
strlen | strcpy | strncpy | strcat | strncat | strcmp | strncmp | strchr | strrchr | strstr | strtok)
|
|
echo "https://en.cppreference.com/w/c/string/byte"
|
|
;;
|
|
*)
|
|
echo "https://en.cppreference.com/mwiki/index.php?search=$term"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# C++ documentation
|
|
cpp_doc_url() {
|
|
local term="$1"
|
|
|
|
case "$term" in
|
|
# C++ specific keywords
|
|
class | public | private | protected | virtual | override | final | explicit | mutable | constexpr | consteval | constinit | concept | requires | co_await | co_yield | co_return | nullptr | noexcept | decltype | auto | template | typename | namespace | using | new | delete | throw | try | catch | static_cast | dynamic_cast | const_cast | reinterpret_cast)
|
|
echo "https://en.cppreference.com/w/cpp/keyword/$term"
|
|
;;
|
|
# STL containers
|
|
vector | list | deque | array | forward_list | set | map | unordered_set | unordered_map | multiset | multimap | stack | queue | priority_queue)
|
|
echo "https://en.cppreference.com/w/cpp/container/$term"
|
|
;;
|
|
# STL algorithms
|
|
sort | find | copy | move | transform | accumulate | count | remove | unique | reverse | rotate | shuffle | partition | merge | binary_search | lower_bound | upper_bound)
|
|
echo "https://en.cppreference.com/w/cpp/algorithm/$term"
|
|
;;
|
|
# Smart pointers
|
|
unique_ptr | shared_ptr | weak_ptr | make_unique | make_shared)
|
|
echo "https://en.cppreference.com/w/cpp/memory/$term"
|
|
;;
|
|
# Common classes
|
|
string | string_view | optional | variant | any | tuple | pair | function | bind | thread | mutex | future | promise | chrono)
|
|
echo "https://en.cppreference.com/w/cpp/utility"
|
|
;;
|
|
*)
|
|
# Try C docs as fallback
|
|
c_doc_url "$term"
|
|
;;
|
|
esac
|
|
}
|