diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-02 12:16:38 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-02 12:16:38 -0500 |
| commit | b10cba594db836c0747066addad48bda4d30cd02 (patch) | |
| tree | 063119a623fa3f7139feda4ef302896d8f5f934c /dotfiles/common/.local/bin/dab | |
| parent | 49c2ba9c4510bf6e1acd306687473bc8ba9ad8dd (diff) | |
| download | archsetup-b10cba594db836c0747066addad48bda4d30cd02.tar.gz archsetup-b10cba594db836c0747066addad48bda4d30cd02.zip | |
refactor: drop in-repo dotfiles/, move stow tooling to the dotfiles repo
Since the installer clones DOTFILES_REPO into ~/.dotfiles and stows from there, the in-repo dotfiles/ tree was dead weight. Nothing reads it at install time. I removed it (831 files) now that both machines are migrated.
The Makefile's stow / restow / reset / unstow / import targets and the dotfile-script unit suites moved to the dotfiles repo. They sit alongside the scripts they manage and run standalone (cd ~/.dotfiles && make ...). This Makefile keeps the VM-integration targets and the installer-helper suite (safe-rm-rf).
I updated CLAUDE.md and README.md so stow operations run from ~/.dotfiles, and the dotfile-management, theme, and unit-test sections point at the standalone repo. The README was already describing the old in-repo model from before the installer switched to cloning. This brings it in line.
Diffstat (limited to 'dotfiles/common/.local/bin/dab')
| -rwxr-xr-x | dotfiles/common/.local/bin/dab | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/dotfiles/common/.local/bin/dab b/dotfiles/common/.local/bin/dab deleted file mode 100755 index e7d0fae..0000000 --- a/dotfiles/common/.local/bin/dab +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/env bash -# dab - delete all but -# Craig Jennings <c@cjennings.net> -# deletes all files in current directory that are NOT of a specific extension - -# default switch values -recurse="" -del_dirs="" - -# help function -show_help() { - echo "Usage: $0 [extension] [OPTION]" - echo "Deletes all files that do not match the given extension from the current directory." - echo "" - echo "Options:" - echo "-r Delete files in directories recursively." - echo "-d Delete directories if they become empty after deletions." - echo "-h Display this help message and exit." - echo "" - echo "Example: $0 txt -r -d" - echo "This would delete all non-text files in the current directory and subdirectories. Any directories emptied by this process will also be deleted." - echo "" - echo "Note: Directories that were previously empty will remain untouched." -} - -# if help was requested, show it and exit -if [[ $1 = "-h" ]] || [[ $2 = "-h" ]] || [[ $3 = "-h" ]]; then - show_help - exit -fi - -# error if nothing or * was passed -if [[ -z $1 ]] || [[ $1 = "*" ]]; then - echo "ERROR: No file extension was provided or invalid extension ('*')." - show_help - exit -fi - -# identify rest of arguments -ext=$1 -if [[ $2 == *"-r"* ]] || [[ $3 == *"-r"* ]]; then - recurse="-R" -fi - -if [[ $2 == *"-d"* ]] || [[ $3 == *"-d"* ]]; then - del_dirs="true" -fi - -# Save empty directories into an array before deleting the files -empty_dirs=() -while IFS= read -r -d $'\0'; do - empty_dirs+=("$REPLY") -done < <(find . -type d -empty -print0) - -shopt -s globstar nullglob extglob - -# remove non-matching files -for file in **; do - if [[ -f "$file" ]] && [[ "$file" != *".$ext" ]]; then - rm "$file" - fi -done - -# remove directories emptied by this operation -if [[ $del_dirs == "true" ]]; then - for dir in **/; do - if [[ ! -n "$(ls -A $dir)" ]] && [[ ! "${empty_dirs[*]}" =~ $dir ]]; then - rmdir "$dir" - fi - done -fi - |
