Commit Graph
10 Commits
Author SHA1 Message Date
nested-universe d0c0fe63dc Fix path for clashdb.tar.gz extraction 2026-01-05 18:27:53 +08:00
nested-universe 4360f6a702 Refactor dir_avail function
#### **1. Execution Efficiency**
* **Optimized Execution:** Streamlined from 4 external processes to just 2 (`df` and `awk`) by eliminating complex matrix transposition loops and string matching, significantly boosting execution speed and reducing overhead.

#### **2. Readability & Maintainability**
* **Clean Code:** Replaced 3 lines of convoluted logic with a single, clear pipeline.

#### **3. Robustness**
* **Anti-Wrapping:** The `-P` flag ensures the output stays on one line, preventing errors caused by long filesystem names that usually break `df` formatting.
* **Safe Defaults:** Uses `${1:-.}` to gracefully handle cases where no directory path is provided.
* **Dynamic Column Targeting:** Uses `$(NF-2)` to locate the "Available" column by position instead of fragile keyword filtering (e.g., "Available" or "可用"). This ensures locale-independence and correctly identifies the space value even if filesystem names contain spaces or if the system language changes.This is more robust than fixed column numbers because it correctly identifies the space value even if the filesystem name contains spaces or if the system adds extra trailing info.

#### **4. Seamless Compatibility**
* **Drop-in Replacement:** Fully supports your existing call patterns.
* **Zero Refactoring:** No changes are needed in the rest of your script to switch to this version.
2026-01-03 11:06:58 +08:00
nested-universe 8632dd9cb1 Change shebang to use env for bash 2026-01-03 09:26:50 +08:00
nested-universe e57ae68396 Fix installation alias selection 2026-01-03 09:21:57 +08:00
nested-universe 3b4f3220dc Continue replace self-invoked with a while true loop
Currently, there appears to be no large-scale error.
So, keep going.
2026-01-02 17:33:32 +08:00
nested-universe ea2a56f871 Continue replace self-invoked with a while true loop
- Use CASE statements instead of if-elif statements.
- Replace self-invoked with a while true loop.
- Wrap the inner function outside the parent function to prevent duplicate declarations caused by the while true loop.
2026-01-01 14:45:37 +08:00
nested-universe e655259d14 Continue replace self-invoked with a while true loop
- replace self-invoked with a while true loop。
- Wrap the inner function outside the parent function to prevent duplicate declarations caused by the while true loop.
2025-12-31 20:45:59 +08:00
nested-universe aedcfa7403 Add Module Load Guard
Prevents redundant script loading by using a conditional flag to ensure the module is initialized only once.
2025-12-31 14:30:33 +08:00
nested-universe 258267436b Restore source script operation logic 2025-12-31 12:33:05 +08:00
nested-universe c7d5506b38 Improve upgrade function
Replace self-invoking functions with a while-true loop.

Change the menu return logic.
2025-12-31 12:06:11 +08:00