From 6ad7412d7cc92fdde36bf39f5e2c1dc3bdea6414 Mon Sep 17 00:00:00 2001 From: Dana Sherson Date: Mon, 4 Dec 2023 03:40:42 +1300 Subject: [PATCH] WIP --- .gitmodules | 3 ++ README.markdown | 1 - bash_profile | 12 +++---- bashrc | 8 ++--- bin/colors | 20 +++++++++++ bin/copy_functions | 3 +- bin/crt | 2 +- bin/echo_color | 8 ----- bin/echo_suggest | 2 +- bin/echodo | 22 +----------- bin/echodont | 23 +++++++++++++ bin/echoerr | 2 +- bin/edot | 2 +- bin/gbf | 6 ++-- bin/git_bisect | 2 +- bin/git_branch_if_exist | 7 ++++ bin/git_branch_name | 2 +- bin/git_head_pushed | 2 +- bin/git_log_oneline | 12 ++++--- bin/git_log_oneline_new | 3 ++ bin/git_log_oneline_new_2 | 2 ++ bin/git_log_oneline_process | 64 +++++++++++++++++++++++++++++++++++ bin/git_main_base_branch | 3 +- bin/git_main_branch | 22 +++--------- bin/git_main_branch_no_remote | 9 +++++ bin/git_main_remote_branch | 31 +++++++++++++---- bin/git_modified | 2 +- bin/git_remote_main_branch | 11 ------ bin/git_unfork | 18 +++++----- bin/prompt_base_style | 7 ++++ bin/prompt_git_color | 16 +++++---- bin/prompt_last_command_style | 7 ---- functions/colors | 3 -- functions/functionify | 2 +- monokai.terminal | 1 + scripts/install.sh | 41 ++++++++++++---------- scripts/update.sh | 3 -- scripts/watch_prefs.sh | 3 +- 38 files changed, 241 insertions(+), 146 deletions(-) create mode 100755 bin/colors delete mode 100755 bin/echo_color create mode 100755 bin/echodont create mode 100755 bin/git_branch_if_exist create mode 100755 bin/git_log_oneline_new create mode 100755 bin/git_log_oneline_new_2 create mode 100755 bin/git_log_oneline_process create mode 100755 bin/git_main_branch_no_remote delete mode 100644 bin/git_remote_main_branch create mode 100755 bin/prompt_base_style delete mode 100755 bin/prompt_last_command_style create mode 160000 monokai.terminal diff --git a/.gitmodules b/.gitmodules index 32fd8c9..74c3df6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "github-cctray"] path = github-cctray url = git@github.com:robotdana/github-cctray.git +[submodule "monokai.terminal"] + path = monokai.terminal + url = git@github.com:robotdana/monokai.terminal.git diff --git a/README.markdown b/README.markdown index 789892e..5e0cf82 100644 --- a/README.markdown +++ b/README.markdown @@ -7,7 +7,6 @@ xcode-select --install git clone git@github.com:robotdana/dotfiles.git ~/.dotfiles ~/.dotfiles/scripts/install.sh change the computer name -set Terminal.app to bash sign in to 1pass copy istatmenus config from 1pass sign in to everything else diff --git a/bash_profile b/bash_profile index 5927c8e..e1921d7 100755 --- a/bash_profile +++ b/bash_profile @@ -45,18 +45,18 @@ track_source ~/.dotfiles/functions/colors track_source ~/.dotfiles/functions/functionify # have functions for things i call _all the time_ -track_functionify_q echodo echoerr echo_color be +track_functionify_q echodo echodont echoerr be # have functions for things called by prompt -track_functionify_q prompt_last_command_style +track_functionify_q prompt_base_style track_functionify_q prompt_version -track_functionify_q prompt_git_color git_status_clean git_head_pushed +track_functionify_q prompt_git_color git_status_clean track_functionify_q prompt_git git_branch_name - +# # some thing just work better as functions track_functionify_q resource # as a function it won't reset history -export PS2="\[$COLOR_PINK\]» \[$COLOR_RESET\]" -export PS1="\[\$(prompt_last_command_style)$COLOR_PINK\]\w\[$COLOR_LIGHT_PINK\]\$(prompt_version)\[\$(prompt_git_color)\]\$(prompt_git)$PS2" +export PS2='\[\033[1K\r$(prompt_base_style)\]» \[\033]0m\]' +export PS1='\[\033[1K\r$(prompt_base_style)\]\w\[\033[38;5;205m\]$(prompt_version)\[$(prompt_git_color)\]$(prompt_git)\[\033[38;5;199m\]» \[\033[0m\]' track_and_resource diff --git a/bashrc b/bashrc index e58e14a..f16ac56 100644 --- a/bashrc +++ b/bashrc @@ -1,6 +1,2 @@ -. ~/.dotfiles/functions/color -PATH="~/.dotfiles/bin:$PATH" - -export PS2="\[$COLOR_PINK\]» \[$COLOR_RESET\]" -export PS1="\[\$(last_command_style)$COLOR_PINK\]\w\$(prompt_version)\[\$(prompt_git_color)\]\$(prompt_git)$PS2" -export GPG_TTY=$(tty) +export PS2='\[\033[2K\r$(prompt_base_style)\]> \[\033]0m\]' +export PS1='\[\033[2K\r$(prompt_base_style)\]\w\[\033[38;5;205m\]$(prompt_version)\[$(prompt_git_color)\]$(prompt_git)\[\033[38;5;199m\]> \[\033[0m\]' diff --git a/bin/colors b/bin/colors new file mode 100755 index 0000000..1a48a06 --- /dev/null +++ b/bin/colors @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# modified from https://askubuntu.com/a/279014 +for background in 49 40 41 42 43 44 45 46 47; do + echo -ne "\033[${background}m \033[0m" +done +echo +for style in 22 '1' '2'; do + for foreground in 39 30 31 32 33 34 35 36 37; do + for background in 49 40 41 42 43 44 45 46 47; do + echo -ne "\033[${style};${foreground};${background}m $((( style < 10 )) && echo ' ')${style};${foreground};${background} \033[0m" + done + echo + done + for background in 49 40 41 42 43 44 45 46 47; do + echo -ne "\033[${background}m \033[0m" + done + echo +done +echo "" diff --git a/bin/copy_functions b/bin/copy_functions index e99937e..07b53c5 100755 --- a/bin/copy_functions +++ b/bin/copy_functions @@ -1,11 +1,10 @@ #!/usr/bin/env bash -output=~/.dotfiles/bin_new +output=~/.dotfiles/bin rm -rf $output mkdir -p $output functions=( $(bash -lc 'declare -F' | cut -d' ' -f3 | sort | grep -v '^_') ) -# already_bin=( $(ls -1 ~/.dotfiles/bin | sort) ) for fn in "${functions[@]}"; do if which -s "$fn"; then diff --git a/bin/crt b/bin/crt index 199e198..338b8d9 100755 --- a/bin/crt +++ b/bin/crt @@ -1,4 +1,4 @@ #!/usr/bin/env bash -echo -n $COLOR_GREY"COVERAGE=1 MIN_COVERAGE=100 "$COLOR_RESET +echo -n $'\033[0;2m'COVERAGE=1 MIN_COVERAGE=100 COVERAGE=1 MIN_COVERAGE=100 rt "$@" || echodo open coverage/index.html diff --git a/bin/echo_color b/bin/echo_color deleted file mode 100755 index 801febe..0000000 --- a/bin/echo_color +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -COLOR_NAME=COLOR_${1:-RESET} -if (( $# > 1 )); then - echo "${!COLOR_NAME:-$COLOR_RESET}""${@:2}""$COLOR_RESET" -else - echo -n "${!COLOR_NAME:-$COLOR_RESET}" -fi diff --git a/bin/echo_suggest b/bin/echo_suggest index 8434954..1a239a0 100755 --- a/bin/echo_suggest +++ b/bin/echo_suggest @@ -1,4 +1,4 @@ #!/usr/bin/env bash -echo_color AQUA run: "$@" +echo $'\033[36m'run: "$@"$'\033[0m' false diff --git a/bin/echodo b/bin/echodo index 7c517cf..503dfbb 100755 --- a/bin/echodo +++ b/bin/echodo @@ -1,24 +1,4 @@ #!/usr/bin/env bash -str="$COLOR_GREY" -space='' -for string in "$@"; do - str="$str$space" - - if [[ -z "$string" ]]; then - str="$str''" - elif [[ "$string" =~ \'|\"|\ |\&|\{|\}|\(|\)|\[|\]|\$|\<|\>|\||\;|$'\n' ]]; then - if [[ "$string" =~ \' ]]; then - str="$str"\""${string//\"/\\\"}"\" - else - str="$str"\'"$string"\' - fi - else - str="$str$string" - fi - - space=" " -done - -echo -e "$str\033[0m" >&2 +echodont "$@" "$@" diff --git a/bin/echodont b/bin/echodont new file mode 100755 index 0000000..887b173 --- /dev/null +++ b/bin/echodont @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +str=$'\033[0;2m' +space='' +for string in "$@"; do + str="$str$space" + + if [[ -z "$string" ]]; then + str="$str''" + elif [[ "$string" =~ \'|\"|\ |\&|\{|\}|\(|\)|\[|\]|\$|\<|\>|\||\;|$'\n' ]]; then + if [[ "$string" =~ \' ]]; then + str="$str"\""${string//\"/\\\"}"\" + else + str="$str"\'"$string"\' + fi + else + str="$str$string" + fi + + space=" " +done + +echo -e "$str"$'\033[0m' >&2 diff --git a/bin/echoerr b/bin/echoerr index 1286387..110fb99 100755 --- a/bin/echoerr +++ b/bin/echoerr @@ -1,4 +1,4 @@ #!/usr/bin/env bash -echo_color RED error: "$@" >&2 +echo $'\033[31m'error: "$@"$'\033[0m' >&2 false diff --git a/bin/edot b/bin/edot index b363ef0..faf692a 100755 --- a/bin/edot +++ b/bin/edot @@ -5,4 +5,4 @@ if (( $# > 0 )); then files=( $(grep -rn "${@/#/-e }" ~/.dotfiles | cut -f1,2 -d:) ) fi -echodo code ${files[@]/#/-g } -n ~/.dotfiles +echodo code -n ~/.dotfiles diff --git a/bin/gbf b/bin/gbf index 9403b32..4a3303d 100755 --- a/bin/gbf +++ b/bin/gbf @@ -1,8 +1,6 @@ #!/usr/bin/env bash -# `gbf []` git branch file -# shows commits modifying since this branch forked from or main branch. +# `gbf ` git branch file filename=$1; -base_branch=${2:-"$(git_main_base_branch)"}; -echodo git log --oneline --follow --patch $(git_log_range "$base_branch") -- "$filename" +git_log_oneline_new --follow --patch -- "$filename" diff --git a/bin/git_bisect b/bin/git_bisect index 67591e8..cd2f4ed 100755 --- a/bin/git_bisect +++ b/bin/git_bisect @@ -1,7 +1,7 @@ #!/usr/bin/env bash if echodo "${@:2}"; then - echo ${COLOR_GREEN}HEAD passes$COLOR_RESET + echo HEAD passes else echodo git bisect reset # TODO: don't do this if you're not bisecting so there's no error echodo git bisect start diff --git a/bin/git_branch_if_exist b/bin/git_branch_if_exist new file mode 100755 index 0000000..fdf3fd5 --- /dev/null +++ b/bin/git_branch_if_exist @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [[ ! -z "$1" ]] && git rev-parse --verify -q "$1" >/dev/null 2>/dev/null; then + echo $1 +else + false +fi diff --git a/bin/git_branch_name b/bin/git_branch_name index 455839b..d5d7644 100755 --- a/bin/git_branch_name +++ b/bin/git_branch_name @@ -1,3 +1,3 @@ #!/usr/bin/env bash -git rev-parse --symbolic-full-name --abbrev-ref ${1:-HEAD} 2>/dev/null +git rev-parse --verify --symbolic-full-name --abbrev-ref=strict ${1:-HEAD} 2>/dev/null diff --git a/bin/git_head_pushed b/bin/git_head_pushed index 7515231..1329677 100755 --- a/bin/git_head_pushed +++ b/bin/git_head_pushed @@ -1,3 +1,3 @@ #!/usr/bin/env bash -[[ "$(git rev-parse @{u} 2>/dev/null)" == "$(git rev-parse HEAD 2>/dev/null)" ]] + diff --git a/bin/git_log_oneline b/bin/git_log_oneline index 6ce1f25..0a420c3 100755 --- a/bin/git_log_oneline +++ b/bin/git_log_oneline @@ -1,10 +1,14 @@ #!/usr/bin/env bash + + + + echo ${COLOR_GREY}git log --oneline $(git_log_range "$1")$COLOR_RESET 1>&2; commits_in_origin=$(echo $(git log --format="%h" $(git merge-base --fork-point $(git_main_base_branch)) 2>/dev/null)); # local commits_in_origin=$(echo -e $(git log --format="%h" $(git_log_range "$1" HEAD) 2>/dev/null)) commit_in_origin_condition='index("'$commits_in_origin'", $2) > 0'; -git log --format="%b%n§%h§%s§%cr" $(git_log_range "$1") | awk -F'§' '{ +git log --reverse --format="%b%n§%h§%s§%cr" | awk -F'§' '{ if ($0 ~ "^$") { # do nothing } else if ($1 != "" ) { @@ -15,15 +19,15 @@ git log --format="%b%n§%h§%s§%cr" $(git_log_range "$1") | awk -F'§' '{ } else { printf "%s", "'$COLOR_GREEN'" } - printf "%s%s%s%s%s", $2, " '$COLOR_RESET'", $3, " \033[2m", $4 + printf "%s%s%s%s%s", $2, " '$COLOR_RESET'", $3, " '$COLOR_LOWLIGHT", $4 if (body != "") { gsub("\r", "", body) - printf "%s%s", "'$COLOR_GREY'\033[2m", body + printf "%s%s", "'$COLOR_GREY''$COLOR_LOWLIGHT'", body } body="" - print "\033[0m" + print "'$COLOR_RESET'" } }' diff --git a/bin/git_log_oneline_new b/bin/git_log_oneline_new new file mode 100755 index 0000000..fd5421d --- /dev/null +++ b/bin/git_log_oneline_new @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# git_main_remote_branch >/dev/null 2>&1 # ensure we have origin/HEAD and upstream/HEAD if we should +git --no-pager log --color --reverse --format='%h%Creset%(decorate) %s %C(dim)%cr - %cn%Creset' "$@" diff --git a/bin/git_log_oneline_new_2 b/bin/git_log_oneline_new_2 new file mode 100755 index 0000000..20d602b --- /dev/null +++ b/bin/git_log_oneline_new_2 @@ -0,0 +1,2 @@ +#!/usr/bin/env bash + diff --git a/bin/git_log_oneline_process b/bin/git_log_oneline_process new file mode 100755 index 0000000..962d152 --- /dev/null +++ b/bin/git_log_oneline_process @@ -0,0 +1,64 @@ +#!/usr/bin/env ruby --disable-all + +if ARGV.delete('--off') + while gets + puts $_ + end + exit 0 +end + +def branch_exist?(branch) + ( + @branch_exist ||= Hash.new do |hash, key| + hash[key] = key && !`git_branch_if_exist #{key}`.chomp.empty? + end + )[branch] +end + +def main_branch + @main_branch ||= `git_main_branch`.chomp +end + +def current_branch + @current_branch ||= `git_branch_name`.chomp +end + +def current_branch_main? + main_branch == current_branch +end + +$forks = { + magenta: 'upstream/HEAD', + blue: (branch_exist?('origin/HEAD') ? 'origin/HEAD' : main_branch), + cyan: ('@{u}' unless current_branch_main?) +} + +$forks.select! { |k, v| branch_exist?(v) } + +gets +exit 0 unless $_ +sha, rest = $_.split("\e", 2) +first = `git rev-parse --short #{sha}^ 2>/dev/null`.chomp +first = first.empty? ? '' : "#{first}.." +$forks.transform_values! do |v| + `git log --format=%h #{first}#{v}`.chomp.split("\n").to_h { |k| [k, nil] } +end +def render(sha, rest) + color = if $forks[:magenta]&.key?(sha) + "\e[35m" + elsif $forks[:blue]&.key?(sha) + "\e[34m" + elsif $forks[:cyan]&.key?(sha) + "\e[36m" + else + "\e[32m" + end + "#{color}#{sha}\e#{rest.chomp}\e[0m" +end +print "\x1b[?7l" +print render(sha, rest) +while gets + puts + print render(*$_.split("\e", 2)) +end +puts "\x1b[?7h" diff --git a/bin/git_main_base_branch b/bin/git_main_base_branch index 371745d..f900722 100755 --- a/bin/git_main_base_branch +++ b/bin/git_main_base_branch @@ -1,5 +1,4 @@ #!/usr/bin/env bash # The most canonical branch - -git_main_remote_branch || git_main_branch +git_main_remote_branch || git_main_branch_no_remote diff --git a/bin/git_main_branch b/bin/git_main_branch index e0e816d..5906ce0 100755 --- a/bin/git_main_branch +++ b/bin/git_main_branch @@ -1,20 +1,6 @@ #!/usr/bin/env bash -branch_if_exist() -{ - git branch --list --format="%(refname:short)" "$1" -} -branch_fallback() -{ - branch_if_exist "$(git config init.defaultBranch)" || \ - branch_if_exist main || \ - branch_if_exist master || \ - branch_if_exist trunk || \ - branch_if_exist primary || \ - git_branch_name -} - -remote_branch=$(git_main_remote_branch) -branch=${remote_branch#*/} - -echo ${branch:-$(branch_fallback)} +# the local version of the most canonical branch +remote_branch="$(git_main_remote_branch)" +branch="${remote_branch#*/}" +echo "${branch:-"$(git_main_branch_no_remote)"}" diff --git a/bin/git_main_branch_no_remote b/bin/git_main_branch_no_remote new file mode 100755 index 0000000..8dbc597 --- /dev/null +++ b/bin/git_main_branch_no_remote @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# origin/HEAD only works if we have an origin, otherwise, guess. +git_branch_if_exist "$(git config init.defaultBranch)" || \ + git_branch_if_exist main || \ + git_branch_if_exist master || \ + git_branch_if_exist trunk || \ + git_branch_if_exist primary || \ + git_branch_name diff --git a/bin/git_main_remote_branch b/bin/git_main_remote_branch index db9449f..2758d95 100755 --- a/bin/git_main_remote_branch +++ b/bin/git_main_remote_branch @@ -1,12 +1,31 @@ #!/usr/bin/env bash -remotes=( $(git remote) ); -if (( ${#remotes[@]} == 0 )); then +# remotes can't contain spaces: +unsorted_remotes=( $(git remote) ); + +if (( ${#unsorted_remotes[@]} == 0 )); then false else - for remote in ${remotes[@]}; do - git rev-parse --verify --quiet $remote/HEAD >/dev/null 2>&1 || git remote set-head "$remote" -a >/dev/null 2>&1 - git rev-parse --verify --symbolic-full-name --abbrev-ref=strict remotes/"$remote"/HEAD 2>/dev/null && break - false + # sort origin and upstream first + origin=() + upstream=() + rest_remotes=() + + for remote in "${unsorted_remotes[@]}"; do + case "$remote" in + origin) origin+=(origin) ;; + upstream) upstream+=(upstream) ;; + *) rest_remotes+=($remote) ;; + esac + done + + found='' + + for remote in "${origin[@]}" "${upstream[@]}" "${rest_remotes[@]}"; do + git_branch_if_exist "$remote"/HEAD >/dev/null 2>&1 || \ + git remote set-head "$remote" -a >/dev/null 2>&1 || \ + ( git fetch "$remote" >/dev/null 2>&1 && \ git remote set-head "$remote" -a >/dev/null 2>&1 ) + [[ -z "$found" ]] && found=$(git_branch_name "$remote"/HEAD 2>/dev/null) done + [[ ! -z "$found" ]] && echo $found || false fi diff --git a/bin/git_modified b/bin/git_modified index 132f09c..2993a21 100755 --- a/bin/git_modified +++ b/bin/git_modified @@ -1,3 +1,3 @@ #!/usr/bin/env bash - git diff --name-only HEAD --diff-filter=ACM -- "${@/#/*}" +git diff --name-only HEAD --diff-filter=ACM -- "${@/#/*}" diff --git a/bin/git_remote_main_branch b/bin/git_remote_main_branch deleted file mode 100644 index 28152b6..0000000 --- a/bin/git_remote_main_branch +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -remotes=( $(git branch -vv -r | grep -E '^\s+[^/]+/HEAD' | cut -d'>' -f2) ) -remote_heads=() -if (( ${#remotes[@]} > 0 )); then - for remote in "${$remotes[@]}"; do - - done -else - false -fi diff --git a/bin/git_unfork b/bin/git_unfork index b3e7648..caef2c1 100755 --- a/bin/git_unfork +++ b/bin/git_unfork @@ -1,12 +1,10 @@ #!/usr/bin/env bash -function git_unfork { - if git config remote.upstream.url >/dev/null; then - git remote remove origin - git remote rename upstream origin --no-progress - else - echoerr "No upstream remote" - echodo git remote -v - return false - fi -} +if git config remote.upstream.url >/dev/null; then + git remote remove origin + git remote rename upstream origin --no-progress +else + echoerr "No upstream remote" + echodo git remote -v + false +fi diff --git a/bin/prompt_base_style b/bin/prompt_base_style new file mode 100755 index 0000000..117da96 --- /dev/null +++ b/bin/prompt_base_style @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if (( $? == 0 )); then + echo -n $'\033[0;1;38;5;199m' +else + echo -n $'\033[0;2;38;5;199m' +fi diff --git a/bin/prompt_git_color b/bin/prompt_git_color index 9e9673c..601e014 100755 --- a/bin/prompt_git_color +++ b/bin/prompt_git_color @@ -2,14 +2,18 @@ if [[ -e .git ]]; then if git_status_clean; then - if git_head_pushed; then - echo -en $COLOR_AQUA + if [[ "$(git rev-parse --verify -q @{u} 2>/dev/null)" == "$(git rev-parse -q HEAD 2>/dev/null)" ]]; then + if [[ "$(git_branch_name)" == "$(git_main_branch)" ]]; then + echo -en $'\033[34m' # blue is main + else + echo -en $'\033[36m' # cyan is origin/branch + fi + elif [[ -z $(git remote) ]] && [[ "$(git_branch_name)" == "$(git_main_branch)" ]]; then + echo -en $'\033[34m' # blue is main else - echo -en $COLOR_GREEN + echo -en $'\033[32m' # green is branch unpushed fi else - echo -en $COLOR_YELLOW + echo -en '\033[33m' # yellow is dirty working branch fi -else - echo -en $COLOR_RESET fi diff --git a/bin/prompt_last_command_style b/bin/prompt_last_command_style deleted file mode 100755 index 5d3836f..0000000 --- a/bin/prompt_last_command_style +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -if (( $? == 0 )); then - echo -en "\033[1m" -else - echo -en "\033[2m" -fi diff --git a/functions/colors b/functions/colors index 83612d5..f600c3d 100644 --- a/functions/colors +++ b/functions/colors @@ -6,10 +6,7 @@ export COLOR_YELLOW=$'\033[38;5;227m' export COLOR_BLUE=$'\033[1;34m' export COLOR_AQUA=$'\033[1;36m' export COLOR_GREY=$'\033[0;90m' -export COLOR_PINK=$'\033[38;5;199m' export COLOR_RESET=$'\033[0m' -export COLOR_LIGHT_PINK=$'\033[38;5;205m' - # Have less display colours # from: https://wiki.archlinux.org/index.php/Color_output_in_console#man export LESS_TERMCAP_mb=$COLOR_BLUE # begin bold diff --git a/functions/functionify b/functions/functionify index 07cc1ea..46089cd 100644 --- a/functions/functionify +++ b/functions/functionify @@ -6,7 +6,7 @@ functionify() local OPTIND=1 while getopts ":q" opts; do case "$opts" in - q) local q=-q; ;; + q) local q=-q ;; esac done; shift $((OPTIND - 1)) diff --git a/monokai.terminal b/monokai.terminal new file mode 160000 index 0000000..6a459c0 --- /dev/null +++ b/monokai.terminal @@ -0,0 +1 @@ +Subproject commit 6a459c0de75308b33e191264dfbfb9e396836248 diff --git a/scripts/install.sh b/scripts/install.sh index 0a36f88..eb9f0bf 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -4,30 +4,35 @@ set -e ~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/bash_profile ~/.bash_profile ~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/bashrc ~/.bashrc -~/.dotfiles/bin/resource +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/Brewfile ~/Brewfile +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/gemrc ~/.gemrc +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/gitconfig ~/.gitconfig +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/gitignore ~/.gitignore +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/gemrc ~/.gemrc +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/irbrc ~/.irbrc +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/finicky.js ~/.finicky.js +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/vimrc ~/.vimrc +~/.dotfiles/bin/echodo mkdir -p ~/.ssh +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/ssh_config ~/.ssh/config +~/.dotfiles/bin/echodo mkdir -p ~/.bundle +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/bundle_config ~/.bundle/config +~/.dotfiles/bin/echodo ln -sf ~/.dotfiles/mycnf ~/.my.cnf +~/.dotfiles/bin/echodo ln -sf ~/.ruby-version ~/.ruby-version +~/.dotfiles/bin/echodo mkdir -p ~/.dotfiles/locals +~/.dotfiles/bin/echodo touch ~/.dotfiles/locals/secrets -echodo ln -sf ~/.dotfiles/Brewfile ~/Brewfile -echodo ln -sf ~/.dotfiles/gemrc ~/.gemrc -echodo ln -sf ~/.dotfiles/gitconfig ~/.gitconfig -echodo ln -sf ~/.dotfiles/gitignore ~/.gitignore -echodo ln -sf ~/.dotfiles/gemrc ~/.gemrc -echodo ln -sf ~/.dotfiles/irbrc ~/.irbrc -echodo ln -sf ~/.dotfiles/finicky.js ~/.finicky.js -echodo ln -sf ~/.dotfiles/vimrc ~/.vimrc -echodo mkdir -p ~/.ssh -echodo ln -sf ~/.dotfiles/ssh_config ~/.ssh/config -echodo mkdir -p ~/.bundle -echodo ln -sf ~/.dotfiles/bundle_config ~/.bundle/config -echodo ln -sf ~/.dotfiles/mycnf ~/.my.cnf -echodo ln -sf ~/.ruby-version ~/.ruby-version -echodo mkdir -p ~/.dotfiles/locals -echodo touch ~/.dotfiles/locals/secrets if [[ -z "$CI" ]]; then - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew tap homebrew/cask brew tap homebrew/cask-fonts brew install mas fi ~/.dotfiles/scripts/update.sh + +open monokai.terminal/Monokai.terminal +defaults write com.apple.Terminal Shell -string /bin/bash +defaults write com.apple.Terminal "Default Window Settings" -string Monokai +defaults write com.apple.Terminal "Man Page Window Settings" -string Monokai +defaults write com.apple.Terminal "Startup Window Settings" -string Monokai diff --git a/scripts/update.sh b/scripts/update.sh index 672f620..462c2d6 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -24,7 +24,6 @@ if [[ $(wc -l ~/.dotfiles/locals/git-completion.bash | awk -F' ' '{print $1}') = exit 1 fi -git submodule add git@github.com:robotdana/github-cctray.git git_update_submodules ( cd github-cctray && git remote add upstream git@github.com:joejag/github-cctray.git ) @@ -34,5 +33,3 @@ ruby-install 3.2 ruby-install 3.3.0-preview3 install_launchagents.sh - -resource diff --git a/scripts/watch_prefs.sh b/scripts/watch_prefs.sh index 7ef92ed..288fbc1 100755 --- a/scripts/watch_prefs.sh +++ b/scripts/watch_prefs.sh @@ -4,6 +4,7 @@ set -euo pipefail domains=($(defaults domains)) +echo "Loading prefs..." before=$(mktemp -d) for domain in ${domains[@]//,}; do set +e @@ -15,8 +16,8 @@ echo "Change preference, then hit enter" read enter +echo "Loading prefs..." after=$(mktemp -d) - for domain in ${domains[@]//,}; do set +e defaults read $domain >"$after/$domain" 2>/dev/null