diff options
| author | srdusr <trevorgray@srdusr.com> | 2025-09-24 06:10:13 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2025-09-24 06:10:13 +0200 |
| commit | 5e3107a9e3c4bdd87a6cdbd3d7277883e97e5c3d (patch) | |
| tree | 55ca8ff38d342e6aa5b39a2da4463f42a80a209f | |
| parent | 5d76761d77d16b5eb2dc67a2ec8f79b43a5ec39c (diff) | |
| download | dotfiles-5e3107a9e3c4bdd87a6cdbd3d7277883e97e5c3d.tar.gz dotfiles-5e3107a9e3c4bdd87a6cdbd3d7277883e97e5c3d.zip | |
Some changes to config command
| -rw-r--r-- | common/config/zsh/user/functions.zsh | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/common/config/zsh/user/functions.zsh b/common/config/zsh/user/functions.zsh index 0514454..b4fa1c3 100644 --- a/common/config/zsh/user/functions.zsh +++ b/common/config/zsh/user/functions.zsh @@ -18,13 +18,13 @@ if [[ -d "$HOME/.cfg" && -d "$HOME/.cfg/refs" ]]; then _repo_path() { local f="$1" - # If it's an absolute path that's not in HOME, handle it specially + # Absolute paths outside HOME if [[ "$f" == /* && "$f" != "$HOME/"* ]]; then echo "$CFG_OS/${f#/}" return fi - # Check for paths that should go to the repository root + # Files already in repo structure case "$f" in common/*|linux/*|macos/*|windows/*|profile/*|README.md) echo "$f" @@ -35,22 +35,17 @@ if [[ -d "$HOME/.cfg" && -d "$HOME/.cfg/refs" ]]; then ;; esac - # Default: put under OS-specific home + # Default: OS-specific home echo "$CFG_OS/home/$f" } _sys_path() { local repo_path="$1" - local os_path_pattern="$CFG_OS/" - - # Handle OS-specific files that are not in the home subdirectory - if [[ "$repo_path" == "$os_path_pattern"* && "$repo_path" != */home/* ]]; then - echo "/${repo_path#$os_path_pattern}" - return - fi case "$repo_path" in - # Common configs → OS-specific config dirs + common/scripts/*) + echo "$HOME/.scripts/${repo_path#common/scripts/}" + ;; common/config/*) case "$CFG_OS" in linux) @@ -61,6 +56,7 @@ if [[ -d "$HOME/.cfg" && -d "$HOME/.cfg/refs" ]]; then echo "$HOME/Library/Application Support/${repo_path#common/config/}" ;; windows) + # Windows Bash (Git Bash, MSYS, WSL) respects LOCALAPPDATA echo "$LOCALAPPDATA\\${repo_path#common/config/}" ;; *) @@ -68,36 +64,18 @@ if [[ -d "$HOME/.cfg" && -d "$HOME/.cfg/refs" ]]; then ;; esac ;; - - # Common scripts → ~/.scripts - common/scripts/*) - echo "$HOME/.scripts/${repo_path#common/scripts/}" - ;; - # Common assets → stay in repo - common/assets/*) + common/assets/*|profile/*|README.md) echo "$HOME/.cfg/$repo_path" ;; - - # Other common files (dotfiles like .bashrc, .gitconfig, etc.) → $HOME common/*) - echo "$HOME/${repo_path#common/}" + echo "$HOME/.cfg/$repo_path" ;; - - # OS-specific home */home/*) echo "$HOME/${repo_path#*/home/}" ;; - - # Profile configs and README → stay in repo - profile/*|README.md) + *) echo "$HOME/.cfg/$repo_path" ;; - - # Default fallback - *) - echo "$HOME/.cfg/$repo_path" - ;; - esac } |
