4 Commits
garage ... main

Author SHA1 Message Date
540b18e6e8 add addpaths script 2026-02-03 08:44:37 +02:00
49300923f7 update 2026-01-30 18:14:27 +02:00
5008a3384a update 2026-01-30 18:09:53 +02:00
74e779ff54 update 2026-01-28 06:08:32 +02:00
8 changed files with 111 additions and 4 deletions

85
config/shared/addpaths Executable file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 -c COMMENT_SYMBOL [-e EXCLUDE_PATTERN]... TARGET"
echo " -c Comment symbol (e.g., '#' or '//')"
echo " -e Exclude pattern (can be specified multiple times)"
echo " TARGET File or directory to process"
exit 1
}
comment_sym=""
excludes=()
while getopts "c:e:h" opt; do
case $opt in
c) comment_sym="$OPTARG" ;;
e) excludes+=("$OPTARG") ;;
h) usage ;;
*) usage ;;
esac
done
shift $((OPTIND - 1))
[[ $# -ne 1 ]] && usage
[[ -z "$comment_sym" ]] && usage
target="$(realpath "$1")"
base_dir="$(pwd)"
should_exclude() {
local path="$1"
for pattern in "${excludes[@]}"; do
if [[ "$path" == *"$pattern"* ]]; then
return 0
fi
done
return 1
}
process_file() {
local file="$1"
local rel_path="${file#"$base_dir"/}"
should_exclude "$rel_path" && return
local path_comment="$comment_sym path: $rel_path"
# Read first two lines
local line1 line2
IFS= read -r line1 <"$file" 2>/dev/null || line1=""
IFS= read -r line2 < <(tail -n +2 "$file") 2>/dev/null || line2=""
# Check if path comment exists in first or second line
[[ "$line1" == *"path: "* ]] && return
[[ "$line2" == *"path: "* ]] && return
# Insert after shebang if present, otherwise at top
if [[ "$line1" =~ ^#! ]]; then
{
echo "$line1"
echo "$path_comment"
tail -n +2 "$file"
} >"$file.tmp"
else
{
echo "$path_comment"
cat "$file"
} >"$file.tmp"
fi
mv "$file.tmp" "$file"
}
if [[ -f "$target" ]]; then
process_file "$target"
elif [[ -d "$target" ]]; then
while IFS= read -r -d '' file; do
process_file "$file"
done < <(find "$target" -type f -print0)
else
echo "Error: $target is not a file or directory" >&2
exit 1
fi

View File

@@ -1,6 +1,6 @@
#!/bin/bash
/home/tomas/bin/dev "$@" 2>&1
/home/tomas/bin/flow "$@" 2>&1
exit_code=$?
if [ $exit_code -ne 0 ]; then

View File

@@ -97,6 +97,7 @@ DEFAULT_REGISTRY="registry.tomastm.com"
DEFAULT_TAG="latest"
PROJECT_DIR="$HOME/projects"
PROJECT_ABBR="p"
CONTAINER_HOME="/home/dev"
fail() {
printf 'Error: %b\n' "$*" >&2

View File

@@ -14,6 +14,11 @@
[remote]
pushDefault = origin
[alias]
amend = commit -a --amend --no-edit
amend = commit --amend --no-edit
rename = branch -m
st = status
unstage = reset HEAD
last = log -1 HEAD
tags = tag -l
undo = reset --mixed HEAD~1

View File

@@ -44,6 +44,9 @@ bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
# Last window instead of session
bind ';' last-window
unbind '"'
unbind "%"
unbind s
@@ -63,6 +66,6 @@ bind r source-file ~/.tmux.conf \; display "Reloaded!"
unbind d
bind e detach
bind d command-prompt -I "dev " 'run-shell "/home/tomas/bin/dev-tmux-wrapper.sh %1 --from #{session_name}"'
bind d command-prompt -I "flow " 'run-shell "/home/tomas/bin/dev-tmux-wrapper.sh %1 --from #{session_name}"'

View File

@@ -49,3 +49,9 @@ alias ll='ls -lF'
alias lla='ll -a'
alias ld='ls -ld */'
alias ga='git add'
alias gcm='git commit -m'
alias gp='git push'
alias gst='git status'
alias gd='git diff --patience --color-moved=dimmed-zebra --word-diff=plain --function-context --ignore-space-change -U3'
alias glg='git log --oneline --graph --decorate --all'

View File

@@ -12,6 +12,12 @@
"to": "~/.local/bin/barg"
}
},
"addpaths": {
"link": {
"from": "shared/addpaths",
"to": "~/.local/bin/addpaths"
}
},
"htop": {
"link": {
"from": "shared/htop",
@@ -131,6 +137,7 @@
"linux-vm": [
"bin",
"barg",
"addpaths",
"gitignore",
{
"package": "htop",