diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-07 18:16:05 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-07 18:16:05 +0900 |
| commit | 5ff02959d3069923bca63cb54c4bb246b86bf20d (patch) | |
| tree | 7ef1b56fb85a48c563bb3af51c26f181741282be /fedora/.config/bash/packages.bash | |
| parent | f65fe7591c18d6c8f4ecac5f379407a910aba1bc (diff) | |
deleted .gnupg/gpg-agent.conf, created .gnupg/, created .config/, created .local/, created .gnupg/
Diffstat (limited to 'fedora/.config/bash/packages.bash')
| -rw-r--r-- | fedora/.config/bash/packages.bash | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/fedora/.config/bash/packages.bash b/fedora/.config/bash/packages.bash new file mode 100644 index 0000000..f45925a --- /dev/null +++ b/fedora/.config/bash/packages.bash @@ -0,0 +1,35 @@ +#!/bin/bash + +# --- Packages (bash version) --- +declare -A packages=( + [zoxide]="--cmd cd --hook prompt" +) + +eval_packages() { + local package output + for package in "${!packages[@]}"; do + if command -v "$package" >/dev/null 2>&1; then + # split args by space into array (preserve empty => zero args) + local -a args=() + if [[ -n "${packages[$package]}" ]]; then + # Use builtin read to split on spaces (simple split) + IFS=' ' read -r -a args <<<"${packages[$package]}" + fi + + # Prefer initializing for bash (change to "zsh" if you really want zsh-init) + if ((${#args[@]})); then + output="$("$package" init bash "${args[@]}" 2>/dev/null)" + else + output="$("$package" init bash 2>/dev/null)" + fi + + # If the command produced output, evaluate it in current shell + if [[ -n "$output" ]]; then + eval "$output" + fi + fi + done +} + +# run initialization +eval_packages |
