From 252d70797bb2a7027a628598fac34e5d437a3278 Mon Sep 17 00:00:00 2001 From: Harry Wixley Date: Mon, 19 Feb 2024 18:24:22 +0000 Subject: [PATCH] GPT-commit: Refactored lib.class and wyxd.class for efficiency. Modified `lib.class` and `wyxd.class` in the `src/classes` directory to improve efficiency. --- src/classes/lib/lib.class | 12 +++++++----- src/classes/wyxd/wyxd.class | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/classes/lib/lib.class b/src/classes/lib/lib.class index dae5f06..5a0b41a 100644 --- a/src/classes/lib/lib.class +++ b/src/classes/lib/lib.class @@ -15,7 +15,7 @@ lib.csv.query(){ lib.csv.query.one(){ lines=($(lib.csv.query "$1" "$2" "$3")) - if [[ "$OSTYPE" == "darwin"* ]] || [[ "$(ps -o args= -p $$)" = *"zsh"* ]]; then + if sys.os.mac; then echo "${lines[2]}" else echo "${lines[1]}" @@ -31,14 +31,16 @@ lib.csv.all(){ continue fi IFS=$'\n' scripts=($(lib.csv.query "arg_scripts" "id" "where category_id='$category'")) - if [ "${scripts[1]}" = "" ]; then + if [ sys.os.mac ] && [ "${scripts[2]}" = "" ]; then + continue + elif [ "${scripts[1]}" = "" ]; then continue fi - cat=($(lib.csv.query 'arg_categories' 'name' "where id='$category'")) + cat=$(lib.csv.query.one 'arg_categories' 'name' "where id='$category'") if [ "$type" = "git" ]; then - echo "### ${cat[1]}:" + echo "### ${cat}:" else - sys.log.h1 "${cat[1]}:" + sys.log.h1 "${cat}:" fi for script in "${scripts[@]:1}"; do if [ "$script" = "" ]; then diff --git a/src/classes/wyxd/wyxd.class b/src/classes/wyxd/wyxd.class index 4825eec..2deda0b 100644 --- a/src/classes/wyxd/wyxd.class +++ b/src/classes/wyxd/wyxd.class @@ -352,7 +352,7 @@ wyxd.readme.update() { echo "" cp -f "$WYX_DIR/.github/README_TEMPLATE.md" "$WYX_DIR/.github/README.md" sed -i "s:@VERSION@:$version:g" "$WYX_DIR/.github/README.md" - commands=$(cat "$WYX_DIR/src/data/.cache/cmdinfo.git.wyx" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g") - echo "$commands" >> "$WYX_DIR/.github/README.md" + wyx_commands=$(cat "$WYX_DIR/src/data/.cache/cmdinfo.git.wyx" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g") + echo "$wyx_commands" >> "$WYX_DIR/.github/README.md" sys.log.info "README.md updated successfully!" } \ No newline at end of file