Compare commits

...

6 Commits

6 changed files with 86 additions and 4 deletions

View File

@@ -181,3 +181,5 @@ fi
# ble.sh
# https://github.com/akinomyoga/ble.sh#13-set-up-bashrc
[[ ${BLE_VERSION-} ]] && ble-attach
if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init bash)"; fi

View File

@@ -0,0 +1,2 @@
# worktrunk completions for fish
complete --keep-order --exclusive --command wt --arguments "(test -n \"\$WORKTRUNK_BIN\"; or set -l WORKTRUNK_BIN (type -P wt 2>/dev/null); and COMPLETE=fish \$WORKTRUNK_BIN -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"

View File

@@ -7,6 +7,7 @@
#
set AUTOENV_AUTH_FILE ~/.autoenv_authorized
set AUTOENV_TRUSTED_FILE ~/.autoenv_trusted
if [ -z "$AUTOENV_ENV_FILENAME" ]
set AUTOENV_ENV_FILENAME ".env"
end
@@ -77,6 +78,27 @@ function autoenv_hashline
echo "$envfile:$hash"
end
function autoenv_content_hash
set envfile $argv[1]
shasum "$envfile" | cut -d' ' -f 1
end
function autoenv_check_trusted
set envfile $argv[1]
set hash (autoenv_content_hash "$envfile")
touch $AUTOENV_TRUSTED_FILE
grep -Fxq "$hash" $AUTOENV_TRUSTED_FILE
end
function autoenv_trust_env
set envfile $argv[1]
set hash (autoenv_content_hash "$envfile")
touch $AUTOENV_TRUSTED_FILE
if not grep -Fxq "$hash" $AUTOENV_TRUSTED_FILE
echo "$hash" >>$AUTOENV_TRUSTED_FILE
end
end
function autoenv_check_authz
# typeset envfile hash
set envfile $argv[1]
@@ -87,7 +109,7 @@ end
function autoenv_check_authz_and_run
set envfile $argv[1]
if autoenv_check_authz "$envfile"
if autoenv_check_authz "$envfile"; or autoenv_check_trusted "$envfile"
autoenv_source "$envfile"
return 0
end
@@ -100,11 +122,16 @@ function autoenv_check_authz_and_run
autoenv_indent "$envfile"
autoenv_env " --- (end contents) -----------------------------------------"
autoenv_env
autoenv_printf "Are you sure you want to allow this? (y/N) \n"
autoenv_printf "Are you sure you want to allow this? (y/t/N) \n"
autoenv_env " y - approve for this path only"
autoenv_env " t - trust these contents everywhere"
read answer
if [ $answer = y -o $answer = Y ]
if [ "$answer" = y -o "$answer" = Y ]
autoenv_authorize_env "$envfile"
autoenv_source "$envfile"
else if [ "$answer" = t -o "$answer" = T ]
autoenv_trust_env "$envfile"
autoenv_source "$envfile"
end
end
end
@@ -131,3 +158,7 @@ function autoenv_source
#set -e AUTOENV_CUR_FILE
#set -e AUTOENV_CUR_DIR
end
# Run once on shell startup so .env files are sourced in the initial
# working directory (PWD is already set, so --on-variable PWD won't fire).
autoenv_init

View File

@@ -0,0 +1,29 @@
function dev -d "Create and attach to a tmux dev session for the current git branch"
set -l branch (git branch --show-current 2>/dev/null)
if test -z "$branch"
echo "Not in a git repository"
return 1
end
set -l session (string replace -a '/' '-' -- $branch | string replace -a '\\' '-')
if not tmux has-session -t "$session" 2>/dev/null
tmux new-session -d -s "$session" -c (pwd) -n dev
tmux split-window -h -t "$session:dev" -c (pwd)
tmux split-window -v -t "$session:dev.0" -c (pwd)
tmux split-window -v -t "$session:dev.2" -c (pwd)
tmux send-keys -t "$session:dev.1" 'vim' Enter
tmux send-keys -t "$session:dev.2" 'claude' Enter
tmux send-keys -t "$session:dev.3" 'pnpm i && pnpm dev' Enter
tmux select-pane -t "$session:dev.0"
end
if test -z "$TMUX"
exec tmux attach-session -t "$session"
else
set -l current_session (tmux display-message -p '#S')
if test "$current_session" != "$session"
exec tmux switch-client -t "$session"
end
end
end

View File

@@ -0,0 +1,15 @@
# worktrunk shell integration for fish
# Sources full integration from binary on first use.
# Docs: https://worktrunk.dev/config/#shell-integration
# Check: wt config show | Uninstall: wt config shell uninstall
function wt
command wt config shell init fish | source
# Check both command exit code ($pipestatus[1]) and source exit code ($pipestatus[2])
# If source fails, the function isn't replaced and we'd infinite-loop calling ourselves
set -l wt_status $pipestatus[1]
set -l source_status $pipestatus[2]
test $wt_status -eq 0; or return $wt_status
test $source_status -eq 0; or return $source_status
wt $argv
end

View File

@@ -21,13 +21,15 @@ brew install \
gh \
git \
git-delta \
hmans/beans/beans \
jq \
lazygit \
neovim \
restic \
ripgrep \
stow \
tmux
tmux \
worktrunk
#crane \
#deno \
#go \
@@ -83,6 +85,7 @@ flatpak install flathub org.gimp.GIMP
flatpak install flathub org.gimp.GIMP.Plugin.GMic
flatpak install flathub org.musicbrainz.Picard
flatpak install flathub fr.handbrake.ghb
flatpak install flathub com.github.jeromerobert.pdfarranger
# Install devbox
# https://www.jetify.com/docs/devbox/installing-devbox