From e08bb9229f021e2f119ae657985920c3ee60a7bf Mon Sep 17 00:00:00 2001 From: lew Date: Wed, 7 Jan 2026 15:08:10 +0000 Subject: [PATCH] Add .local/bin/fishify-envs Update .local/bin/localhost Add .local/bin/push-chezmoi --- private_dot_local/bin/executable_fishify-envs | 20 ++++++++++++++++ private_dot_local/bin/executable_localhost | 23 ++++++++++++------- private_dot_local/bin/executable_push-chezmoi | 8 +++++++ 3 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 private_dot_local/bin/executable_fishify-envs create mode 100644 private_dot_local/bin/executable_push-chezmoi diff --git a/private_dot_local/bin/executable_fishify-envs b/private_dot_local/bin/executable_fishify-envs new file mode 100644 index 0000000..0d52a68 --- /dev/null +++ b/private_dot_local/bin/executable_fishify-envs @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +in="$1" + +if [[ -z "$in" ]]; then + echo "usage: $0 input_file" + exit 1 +fi + +while IFS= read -r line; do + [[ -z "$line" || "$line" =~ ^# ]] && continue + if [[ "$line" =~ ^([A-Za-z_][A-Za-z0-9_]*)=(.*)$ ]]; then + var="${BASH_REMATCH[1]}" + val="${BASH_REMATCH[2]}" + val="${val%\"}" + val="${val#\"}" + echo "set -Ux $var \"$val\"" + fi +done < "$in" + diff --git a/private_dot_local/bin/executable_localhost b/private_dot_local/bin/executable_localhost index 70617fc..85302c0 100644 --- a/private_dot_local/bin/executable_localhost +++ b/private_dot_local/bin/executable_localhost @@ -1,13 +1,20 @@ -#!/bin/bash +#!/usr/bin/env bash +set -euo pipefail -IP=$(hostname -i | awk '{print $1}') PORT=8000 -YELLOW=$(tput setaf 3) -BLUE=$(tput setaf 4) -BOLD=$(tput bold) -RESET=$(tput sgr0) +IP=$(ip route get 1.1.1.1 2>/dev/null | awk '{print $7; exit}') +IP=${IP:-127.0.0.1} -echo "Serving ${YELLOW}${BOLD}$(pwd)${RESET} at ${BLUE}${BOLD}http://$IP:$PORT${RESET}" +if [[ -t 1 ]]; then + YELLOW=$(tput setaf 3) + BLUE=$(tput setaf 4) + BOLD=$(tput bold) + RESET=$(tput sgr0) +else + YELLOW= BLUE= BOLD= RESET= +fi -python3 -m http.server "$PORT" +echo "Serving ${YELLOW}${BOLD}$(pwd)${RESET} at ${BLUE}${BOLD}http://${IP}:${PORT}${RESET}" + +exec python3 -m http.server "$PORT" diff --git a/private_dot_local/bin/executable_push-chezmoi b/private_dot_local/bin/executable_push-chezmoi new file mode 100644 index 0000000..3b36871 --- /dev/null +++ b/private_dot_local/bin/executable_push-chezmoi @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail + +REPO="$(chezmoi source-path)" + +cd "$REPO" +git push