Skip to content

Commit 46c31f0

Browse files
tatanusclaude
andcommitted
refactor: Update install.sh logging and remove Claude md files
- Replace _log_* functions with standard logging fallbacks - Rename BASH_LOG_DIR to BASHDIR for consistency - Remove CLAUDE.md and CLAUDE_HUMAN.md (now in .gitignore) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f74e324 commit 46c31f0

3 files changed

Lines changed: 38 additions & 141 deletions

File tree

CLAUDE.md

Lines changed: 0 additions & 91 deletions
This file was deleted.

CLAUDE_HUMAN.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

install.sh

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,32 @@ set -uo pipefail
1717
IFS=$'\n\t'
1818

1919
#===============================================================================
20-
# Minimal Logging (until common_core is loaded)
20+
# Logging Fallbacks
2121
#===============================================================================
22-
function _log_fail() { printf '[%s] [- FAIL ] %s\n' "$(date +'%Y-%m-%d %H:%M:%S')" "$*" >&2; }
23-
function _log_pass() { printf '[%s] [+ PASS ] %s\n' "$(date +'%Y-%m-%d %H:%M:%S')" "$*"; }
24-
function _log_info() { printf '[%s] [* INFO ] %s\n' "$(date +'%Y-%m-%d %H:%M:%S')" "$*"; }
25-
function _log_warn() { printf '[%s] [! WARN ] %s\n' "$(date +'%Y-%m-%d %H:%M:%S')" "$*" >&2; }
22+
if ! declare -F info > /dev/null 2>&1; then
23+
function info() { printf '[INFO ] %s\n' "${*}" >&2; }
24+
fi
25+
if ! declare -F warn > /dev/null 2>&1; then
26+
function warn() { printf '[WARN ] %s\n' "${*}" >&2; }
27+
fi
28+
if ! declare -F error > /dev/null 2>&1; then
29+
function error() { printf '[ERROR] %s\n' "${*}" >&2; }
30+
fi
31+
if ! declare -F debug > /dev/null 2>&1; then
32+
function debug() { printf '[DEBUG] %s\n' "${*}" >&2; }
33+
fi
34+
if ! declare -F pass > /dev/null 2>&1; then
35+
function pass() { printf '[PASS ] %s\n' "${*}" >&2; }
36+
fi
37+
if ! declare -F fail > /dev/null 2>&1; then
38+
function fail() { printf '[FAIL ] %s\n' "${*}" >&2; }
39+
fi
40+
41+
#===============================================================================
42+
# Globals
43+
#===============================================================================
44+
: "${PASS:=0}"
45+
: "${FAIL:=1}"
2646

2747
#===============================================================================
2848
# Constants
@@ -43,7 +63,7 @@ readonly VERSION
4363
readonly COMMON_CORE_DIR="${HOME}/.config/bash/lib/common_core"
4464
readonly COMMON_CORE_UTIL="${COMMON_CORE_DIR}/util.sh"
4565
readonly BASH_DIR="${HOME}/.config/bash"
46-
readonly BASH_LOG_DIR="${BASH_DIR}/log"
66+
readonly BASHDIR="${BASH_DIR}/log"
4767
readonly DATA_DIR="${HOME}/DATA"
4868

4969
#===============================================================================
@@ -81,7 +101,7 @@ readonly -a BASH_DOT_FILES=(
81101
readonly -a REQUIRED_DIRECTORIES=(
82102
"${DATA_DIR}/LOGS"
83103
"${BASH_DIR}"
84-
"${BASH_LOG_DIR}"
104+
"${BASHDIR}"
85105
)
86106

87107
readonly -a RECOMMENDED_TOOLS=(
@@ -146,29 +166,29 @@ function preflight_checks() {
146166

147167
# Check Bash version
148168
if [[ -z "${BASH_VERSION:-}" ]]; then
149-
_log_fail "This script must be run under Bash."
169+
fail "This script must be run under Bash."
150170
((errors++))
151171
elif [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then
152-
_log_fail "Bash 4.0+ required. Current: ${BASH_VERSION}"
172+
fail "Bash 4.0+ required. Current: ${BASH_VERSION}"
153173
((errors++))
154174
fi
155175

156176
# Check HOME
157177
if [[ -z "${HOME:-}" ]]; then
158-
_log_fail "HOME environment variable not set."
178+
fail "HOME environment variable not set."
159179
((errors++))
160180
fi
161181

162182
# Check common_core
163183
if [[ ! -d "${COMMON_CORE_DIR}" ]]; then
164-
_log_fail "common_core library not found at: ${COMMON_CORE_DIR}"
165-
_log_fail ""
166-
_log_fail "Please install common_core first:"
167-
_log_fail " 1. Clone: git clone https://github.com/tatanus/common_core.git"
168-
_log_fail " 2. Run its installer or copy to: ${COMMON_CORE_DIR}"
184+
fail "common_core library not found at: ${COMMON_CORE_DIR}"
185+
fail ""
186+
fail "Please install common_core first:"
187+
fail " 1. Clone: git clone https://github.com/tatanus/common_core.git"
188+
fail " 2. Run its installer or copy to: ${COMMON_CORE_DIR}"
169189
((errors++))
170190
elif [[ ! -f "${COMMON_CORE_UTIL}" ]]; then
171-
_log_fail "common_core util.sh not found at: ${COMMON_CORE_UTIL}"
191+
fail "common_core util.sh not found at: ${COMMON_CORE_UTIL}"
172192
((errors++))
173193
fi
174194

@@ -189,7 +209,7 @@ function load_common_core() {
189209
pass "Loaded common_core utilities"
190210
return 0
191211
else
192-
_log_fail "Failed to source common_core"
212+
fail "Failed to source common_core"
193213
return 1
194214
fi
195215
}
@@ -481,7 +501,7 @@ function main() {
481501
shift
482502
;;
483503
*)
484-
_log_fail "Unknown option: $1"
504+
fail "Unknown option: $1"
485505
usage >&2
486506
return 1
487507
;;

0 commit comments

Comments
 (0)