diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..83e2bc5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "test/test_helper/bats-core"] + path = test/test_helper/bats-core + url = https://github.com/ztombol/bats-core +[submodule "test/test_helper/bats-assert"] + path = test/test_helper/bats-assert + url = https://github.com/ztombol/bats-assert diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5abafb1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: bash +before_install: + - git clone --depth 1 https://github.com/sstephenson/bats.git + - sudo apt-get update -qq + - sudo apt-get install -y coreutils +script: + - ./bats/bin/bats test/*.bats diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..873f7bf --- /dev/null +++ b/circle.yml @@ -0,0 +1,16 @@ +machine: + environment: + + +dependencies: + post: + - git clone --depth 1 https://github.com/sstephenson/bats.git + +checkout: + post: + - git submodule sync + - git submodule update --init + +test: + override: + - bats/bin/bats test/*.bats diff --git a/diff-so-fancy b/diff-so-fancy index 22d1f44..8833bda 100755 --- a/diff-so-fancy +++ b/diff-so-fancy @@ -9,7 +9,8 @@ hash gsed 2> /dev/null && SED=gsed || SED=sed if hash diff-highlight 2> /dev/null; then diff_highlight=diff-highlight else - diff_highlight="$( cd "$( dirname $(realpath "${BASH_SOURCE[0]}") )" && pwd )/third_party/diff-highlight/diff-highlight" + SCRIPT_PATH=$( cd $(dirname $0) ; pwd -P ) + diff_highlight="$SCRIPT_PATH/third_party/diff-highlight/diff-highlight" fi color_code_regex="(\x1B\[([0-9]{1,3}(;[0-9]{1,3}){0,3})[m|K])?" diff --git a/readme.md b/readme.md index 9a42b9d..860548b 100644 --- a/readme.md +++ b/readme.md @@ -79,6 +79,27 @@ git --no-pager diff # will avoid core.pager hook Originated from https://github.com/paulirish/dotfiles/blob/master/bin/diff-so-fancy +## Contributing + +Pull requests quite welcome. + +## Hacking and Testing + +```sh +# fork and clone the repo. then… + +git submodule update --init +brew install entr coreutils +# install bats: github.com/sstephenson/bats#installing-bats-from-source +``` + +```sh +# Run the test suite once: +bats test/diff-so-fancy.bats + +# Run it on every change with `entr` +ls --color=never diff-so-fancy test/*.bats | entr bats test/*.bats +``` ## License diff --git a/test/bugs.bats b/test/bugs.bats new file mode 100644 index 0000000..ad16e2f --- /dev/null +++ b/test/bugs.bats @@ -0,0 +1,18 @@ +#!/usr/bin/env bats + +load 'test_helper/bats-core/load' +load 'test_helper/bats-assert/load' +load 'test_helper/util' + + +output=$( load_fixture "chromium-modaltoelement" | $diff_so_fancy ) + + +empty_remove_highlight="" + +# https://github.com/paulirish/dotfiles/commit/6743b907ff586c28cd36e08d1e1c634e2968893e#commitcomment-13459061 +@test "All removed lines are present in diff" { + assert_output --partial "WebInspector.Dialog = function($empty_remove_highlight)" + assert_output --partial "show: function($empty_remove_highlight)" + assert_output --partial "{!Document} */ (WebInspector.Dialog._modalHostView.element.ownerDocument$empty_remove_highlight)" +} diff --git a/test/diff-so-fancy.bats b/test/diff-so-fancy.bats new file mode 100644 index 0000000..a8bf96e --- /dev/null +++ b/test/diff-so-fancy.bats @@ -0,0 +1,43 @@ +#!/usr/bin/env bats + +load 'test_helper/bats-core/load' +load 'test_helper/bats-assert/load' +load 'test_helper/util' + + +# bats fails to handle our multiline result, so we save to $output ourselves +output=$( load_fixture "ls-function" | $diff_so_fancy ) + +@test "diff-so-fancy runs exits without error" { + load_fixture "ls-function" | $diff_so_fancy + assert_success +} + +@test "original source is indented by a single space" { + assert_output --partial " + if begin" +} + +@test "index line is removed entirely" { + refute_output --partial "index 33c3d8b..fd54db2 100644" +} + +@test "+/- line stars are stripped" { + refute_output --partial " +-" + refute_output --partial " ++" +} + +@test "empty lines added/removed are marked" { + assert_output --partial "  +  set -x CLICOLOR_FORCE 1" + assert_output --partial "  + if not set -q LS_COLORS" +} + +@test "diff-highlight is highlighting changes within lines" { + assert_output --partial 'eval "env CLICOLOR_FORCE=1 command $ls $param $argv"' + assert_output --partial 'eval $ls $param "$argv"' +} + diff --git a/test/fixtures/chromium-modaltoelement.diff b/test/fixtures/chromium-modaltoelement.diff new file mode 100644 index 0000000..8e040d2 --- /dev/null +++ b/test/fixtures/chromium-modaltoelement.diff @@ -0,0 +1,43 @@ +diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js +index 4f9adf8..8c13743 100644 +--- a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js ++++ b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js +@@ -32,7 +32,7 @@ + * @constructor + * @extends {WebInspector.Widget} + */ +-WebInspector.Dialog = function() ++WebInspector.Dialog = function(isModalToElement) + { + WebInspector.Widget.call(this, true); + this.markAsRoot(); +@@ -45,6 +45,9 @@ WebInspector.Dialog = function() +  + this._wrapsContent = false; + this._dimmed = false; ++ this._isModalToElement = isModalToElement; ++ ++ this._glassPane = new WebInspector.GlassPane(relativeToElement, isModalToElement); + /** @type {!Map} */ + this._tabIndexMap = new Map(); + } +@@ -62,16 +65,16 @@ WebInspector.Dialog.prototype = { + /** + * @override + */ +- show: function() ++ show: function(isModalToElement) + { + if (WebInspector.Dialog._instance) + WebInspector.Dialog._instance.detach(); + WebInspector.Dialog._instance = this; +  +- var document = /** @type {!Document} */ (WebInspector.Dialog._modalHostView.element.ownerDocument); ++ var document = /** @type {!Document} */ (WebInspector.Dialog._modalHostView.element.ownerDocument, isModalToElement); + this._disableTabIndexOnElements(document); +  +- this._glassPane = new WebInspector.GlassPane(document, this._dimmed); ++ this._glassPane = new WebInspector.GlassPane(document, isModalToElement); + this._glassPane.element.addEventListener("click", this._onGlassPaneClick.bind(this), false); + WebInspector.GlassPane.DefaultFocusedViewStack.push(this); +  diff --git a/test/fixtures/dotfiles.diff b/test/fixtures/dotfiles.diff new file mode 100644 index 0000000..44f1dc4 --- /dev/null +++ b/test/fixtures/dotfiles.diff @@ -0,0 +1,478 @@ +diff --git a/.aliases b/.aliases +index 30182ef..be9fb1d 100644 +--- a/.aliases ++++ b/.aliases +@@ -18,6 +18,7 @@ alias brwe=brew #typos +  + alias hosts='sudo $EDITOR /etc/hosts' # yes I occasionally 127.0.0.1 twitter.com ;) +  ++alias ag='ag -W 200 -f' +  + ### + # time to upgrade `ls` +@@ -51,7 +52,7 @@ alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup +  + # Networking. IP address, dig, DNS + alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +-alias dig="dig +nocmd any +multiline +noall +answer" ++# alias dig="dig +nocmd any +multiline +noall +answer" +  + # Recursively delete `.DS_Store` files + alias cleanup_dsstore="find . -name '*.DS_Store' -type f -ls -delete" +@@ -68,7 +69,13 @@ alias ungz="gunzip -k" + alias fs="stat -f \"%z bytes\"" +  + # Empty the Trash on all mounted volumes and the main HDD. then clear the useless sleepimage +-alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; rm -rfv ~/.Trash; sudo rm /private/var/vm/sleepimage" ++alias emptytrash=" \  ++ sudo rm -rfv /Volumes/*/.Trashes; \ ++ rm -rfv ~/.Trash/*; \ ++ sudo rm -v /private/var/vm/sleepimage; \ ++ rm -rv \"/Users/paulirish/Library/Application Support/stremio/Cache\"; \ ++ rm -rv \"/Users/paulirish/Library/Application Support/stremio/stremio-cache\" \ ++" +  + # Update installed Ruby gems, Homebrew, npm, and their installed packages + alias brew_update="brew -v update; brew -v upgrade --all; brew cleanup; brew cask cleanup; brew prune; brew doctor" +diff --git a/.bash_profile b/.bash_profile +index 8f17751..def367d 100644 +--- a/.bash_profile ++++ b/.bash_profile +@@ -116,3 +116,9 @@ shopt -s cdspell; +  +  +  ++ ++# The next line updates PATH for the Google Cloud SDK. ++source '/Users/paulirish/google-cloud-sdk/path.bash.inc' ++ ++# The next line enables shell command completion for gcloud. ++source '/Users/paulirish/google-cloud-sdk/completion.bash.inc' +diff --git a/.bash_prompt b/.bash_prompt +index 852d69f..8d3e3d0 100644 +--- a/.bash_prompt ++++ b/.bash_prompt +@@ -4,6 +4,9 @@ + default_username='paulirish' +  +  ++eval "$(thefuck --alias)" ++ ++ + if [[ -n "$ZSH_VERSION" ]]; then # quit now if in zsh + return 1 2> /dev/null || exit 1; + fi; +diff --git a/.bashrc b/.bashrc +index 877b68f..18461ac 100644 +--- a/.bashrc ++++ b/.bashrc +@@ -1,2 +1,4 @@ + [ -n "$PS1" ] && source ~/.bash_profile +  ++ ++# [ -f ~/.fzf.bash ] && source ~/.fzf.bash +diff --git a/.functions b/.functions +index 8292d2e..a548d45 100644 +--- a/.functions ++++ b/.functions +@@ -28,6 +28,19 @@ cdf() { # short for cdfinder + } +  +  ++ ++# git commit browser. needs fzf ++log() { ++ git log --graph --color=always \ ++ --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | ++ fzf --ansi --no-sort --reverse --tiebreak=index --toggle-sort=\` \ ++ --bind "ctrl-m:execute: ++ echo '{}' | grep -o '[a-f0-9]\{7\}' | head -1 | ++ xargs -I % sh -c 'git show --color=always % | less -R'" ++} ++ ++ ++ + # Start an HTTP server from a directory, optionally specifying the port + function server() { + local port="${1:-8000}" +@@ -145,17 +158,14 @@ webmify(){ + ffmpeg -i $1 -vcodec libvpx -acodec libvorbis -isync -copyts -aq 80 -threads 3 -qmax 30 -y $2 $1.webm + } +  ++# direct it all to /dev/null ++function nullify() { ++ "$@" >/dev/null 2>&1 ++} ++ +  + # visual studio code. a la `subl` +-code () { +- if [[ $# = 0 ]] +- then +- open -a "Visual Studio Code" +- else +- [[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}" +- open -a "Visual Studio Code" --args "$F" +- fi +-} ++function code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $*; } +  + # `shellswitch [bash |zsh]` + # Must be in /etc/shells +diff --git a/.gitconfig b/.gitconfig +index d2be05f..d32f98c 100644 +--- a/.gitconfig ++++ b/.gitconfig +@@ -7,11 +7,13 @@ + df = diff --color --color-words --abbrev + lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- + co = checkout ++ cherry = cherry-pick # does this conflict with the real `git cherry`? +  + # Show the diff between the latest commit and the current state + d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" +  +- reup = rebase-update ++ # chromium/depot_tools convenience. manual ++ reup = rebase-update --no_fetch --keep-going +  +  +  +@@ -23,7 +25,7 @@ + excludesfile = ~/.gitignore + attributesfile = ~/.gitattributes + # insanely beautiful diffs +- pager = diff-highlight | diff-so-fancy | less -r ++ pager = diff-so-fancy | less --tabs=1,5 -R + [color "branch"] + current = yellow reverse + local = yellow +@@ -40,7 +42,8 @@ + changed = green + untracked = cyan + [merge] +- tool = opendiff ++ #tool = opendiff ++ tool = kdiff3 +  +  + [color "diff-highlight"] +@@ -86,3 +89,5 @@ + required = true + [init] + templatedir = ~/.git_template ++[http] ++ cookiefile = /Users/paulirish/.gitcookies +diff --git a/.zshrc b/.zshrc +index 410a2ca..dbad355 100644 +--- a/.zshrc ++++ b/.zshrc +@@ -113,3 +113,5 @@ source ~/.bash_profile +  +  + export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting ++ ++[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh +diff --git a/README.md b/README.md +index 496bbbb..171eaea 100644 +--- a/README.md ++++ b/README.md +@@ -55,7 +55,6 @@ Lastly, I use `open .` to open Finder from this path. (That's just available nor + ## overview of files +  + #### Automatic config +-* `.sift.conf` - sift (faster than grep, ack, ag) + * `.vimrc`, `.vim` - vim config, obv. + * `.inputrc` - behavior of the actual prompt line +  +diff --git a/bin/diff-highlight b/bin/diff-highlight +deleted file mode 120000 +index 7c5c827..0000000 +--- a/bin/diff-highlight ++++ /dev/null +@@ -1 +0,0 @@ +-/Users/paulirish/.homebrew/share/git-core/contrib/diff-highlight/diff-highlight +\ No newline at end of file +diff --git a/bin/diff-so-fancy b/bin/diff-so-fancy +deleted file mode 100755 +index 5b004a2..0000000 +--- a/bin/diff-so-fancy ++++ /dev/null +@@ -1,69 +0,0 @@ +-#!/bin/bash +- +-############### +-# diff-so-fancy builds on the good-lookin' output of diff-highlight to upgrade your diffs' appearances +-# * Output will not be in standard patch format, but will be readable +-# * No pesky `+` or `-` at line-stars, making for easier copy-paste. +-# +-# Screenshot: https://github.com/paulirish/dotfiles/commit/6743b907ff58#commitcomment-13349456 +-# +-# +-# Usage +-# +-# git diff | diff-highlight | diff-so-fancy +-# +-# Add to .gitconfig so all `git diff` uses it. +-# git config --global core.pager "diff-highlight | diff-so-fancy | less -r" +-# +-# +-# Requirements / Install +-# +-# * GNU sed. On Mac, install it with Homebrew: +-# brew install gnu-sed --default-names # You'll have to change below to `gsed` otherwise +-# * diff-highlight. It's shipped with Git, but probably not in your $PATH +-# ln -sf "$(brew --prefix)/share/git-core/contrib/diff-highlight/diff-highlight" ~/bin/diff-highlight +-# * Add some coloring to your .gitconfig: +-# git config --global color.diff-highlight.oldNormal "red bold" +-# git config --global color.diff-highlight.oldHighlight "red bold 52" +-# git config --global color.diff-highlight.newNormal "green bold" +-# git config --global color.diff-highlight.newHighlight "green bold 22" +-# +-############### +- +-# TODO: +-# Put on NPM. +- +- +-[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-" +- +-color_code_regex=$'(\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)[m|K])?' +-reset_color="\x1B\[m" +-dim_magenta="\x1B\[38;05;146m" +- +-format_diff_header () { +- # simplify the unified patch diff header +- sed -E "s/^($color_code_regex)diff --git .*$//g" | \ +- sed -E "s/^($color_code_regex)index .*$/\ +-\1$(print_horizontal_rule)/g" | \ +- sed -E "s/^($color_code_regex)\+\+\+(.*)$/\1\+\+\+\5\\ +-\1$(print_horizontal_rule)/g" +-} +- +-colorize_context_line () { +- # extra color for @@ context line +- sed -E "s/@@$reset_color $reset_color(.*$)/@@ $dim_magenta\1/g" +-} +- +-strip_leading_symbols () { +- # strip the + and - +- sed -E "s/^($color_code_regex)[\+\-]/\1 /g" +-} +- +-print_horizontal_rule () { +- printf "%$(tput cols)s\n"|tr " " "─" +-} +- +-# run it. +-cat $input | format_diff_header | colorize_context_line | strip_leading_symbols +- +- +diff --git a/brew-cask.sh b/brew-cask.sh +index 24c2ba5..3f3c02a 100755 +--- a/brew-cask.sh ++++ b/brew-cask.sh +@@ -1,8 +1,8 @@ + #!/bin/bash +  +  +-# to maintain cask ....  +-# brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup`  ++# to maintain cask .... ++# brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup` +  +  + # Install native apps +@@ -14,7 +14,7 @@ brew tap caskroom/versions + brew cask install spectacle + brew cask install dropbox + brew cask install gyazo +-brew cask install onepassword ++brew cask install 1password + brew cask install rescuetime + brew cask install flux +  +@@ -47,6 +47,6 @@ brew cask install utorrent +  + # Not on cask but I want regardless. +  +-# 3Hub https://itunes.apple.com/us/app/3hub/id427515976?mt=12  ++# 3Hub https://itunes.apple.com/us/app/3hub/id427515976?mt=12 + # File Multi Tool 5 + # Phosphor +\ No newline at end of file +diff --git a/brew.sh b/brew.sh +index 8715a37..c4a663e 100755 +--- a/brew.sh ++++ b/brew.sh +@@ -58,7 +58,9 @@ brew install mtr +  +  + # Install other useful binaries +-brew install sift ++brew install the_silver_searcher ++brew install fzf ++ + brew install git + brew install imagemagick --with-webp + brew install node # This installs `npm` too using the recommended installation method +diff --git a/fish/aliases.fish b/fish/aliases.fish +index a0fe9b3..fc990f6 100644 +--- a/fish/aliases.fish ++++ b/fish/aliases.fish +@@ -26,17 +26,14 @@ alias brwe=brew #typos + alias hosts='sudo $EDITOR /etc/hosts' # yes I occasionally 127.0.0.1 twitter.com ;) +  +  +-# `shellswitch [bash|zsh|fish]` +-function shellswitch +- chsh -s (brew --prefix)/bin/$argv +-end +- +- +- + # `cat` with beautiful colors. requires Pygments installed. + # sudo easy_install -U Pygments + alias c='pygmentize -O style=monokai -f console256 -g' +  ++alias ag='ag -W 200 -f' ++ ++alias diskspace_report="df -P -kHl" ++alias free_diskspace_report="diskspace_report" +  +  + # Networking. IP address, dig, DNS +@@ -54,8 +51,7 @@ alias ungz="gunzip -k" + # File size + alias fs="stat -f \"%z bytes\"" +  +-# Empty the Trash on all mounted volumes and the main HDD. then clear the useless sleepimage +-alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; rm -rfv ~/.Trash; sudo rm /private/var/vm/sleepimage" ++# emptytrash written as a function +  + # Update installed Ruby gems, Homebrew, npm, and their installed packages + alias brew_update="brew -v update; brew -v upgrade --all; brew cleanup; brew cask cleanup; brew prune; brew doctor" +diff --git a/fish/config.fish b/fish/config.fish +index 9c4bd70..fd19027 100755 +--- a/fish/config.fish ++++ b/fish/config.fish +@@ -2,9 +2,15 @@ set default_user "paulirish" + set default_machine "paulirish-macbookair2" +  +  ++#set -x DYLD_FALLBACK_LIBRARY_PATH /Users/paulirish/.homebrew/lib ++ + source ~/.config/fish/path.fish + source ~/.config/fish/aliases.fish + source ~/.config/fish/chpwd.fish ++source ~/.config/fish/functions.fish ++ ++ ++ +  +  + # Completions +@@ -22,8 +28,6 @@ end + make_completion g 'git' +  +  +- +- + # Readline colors + set -g fish_color_autosuggestion 555 yellow + set -g fish_color_command 5f87d7 +@@ -83,3 +87,4 @@ set -gx LESS_TERMCAP_so \e'[38;5;246m' # begin standout-mode - info box + set -gx LESS_TERMCAP_ue \e'[0m' # end underline + set -gx LESS_TERMCAP_us \e'[04;38;5;146m' # begin underline +  ++ +diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish +index 04abe4b..96bfa3e 100755 +--- a/fish/functions/fish_prompt.fish ++++ b/fish/functions/fish_prompt.fish +@@ -13,6 +13,9 @@ function _git_current_branch -d "Output git's current branch name" + end ^/dev/null | sed -e 's|^refs/heads/||' + end +  ++function fish_title --description 'Show current path (abbreviated) in iTerm tab title ' ++ echo (prompt_pwd) ++end +  + function fish_prompt --description 'Write out the prompt' +  +diff --git a/fish/functions/gr.fish b/fish/functions/gr.fish +index 4c2722d..1a0ee1b 100644 +--- a/fish/functions/gr.fish ++++ b/fish/functions/gr.fish +@@ -1,3 +1,12 @@ +  + # git root +-alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`' ++function gr --description "Jump to the git root" ++ set -l repo_info (command git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD ^/dev/null) ++  test -n "$repo_info"; or return ++ ++ set -l cd_up_path (command git rev-parse --show-cdup) ++ ++ if test -n $cd_up_path ++ cd $cd_up_path ++ end ++end +diff --git a/fish/functions/ls.fish b/fish/functions/ls.fish +index 33c3d8b..fd54db2 100644 +--- a/fish/functions/ls.fish ++++ b/fish/functions/ls.fish +@@ -7,6 +7,8 @@ + if begin + type gls 1>/dev/null 2>/dev/null + or command ls --version 1>/dev/null 2>/dev/null ++ ++ set -x CLICOLOR_FORCE 1 + end + # This is GNU ls + function ls --description "List contents of directory" +@@ -22,11 +24,11 @@ if begin + set param $param --human-readable + set param $param --sort=extension + set param $param --group-directories-first +- if isatty 1 ++ if isatty 1 + set param $param --indicator-style=classify + end +  +- eval "env CLICOLOR_FORCE=1 command $ls $param $argv" ++ eval $ls $param "$argv" + end +  + if not set -q LS_COLORS +diff --git a/fish/path.fish b/fish/path.fish +index 6e28fad..aa9d014 100644 +--- a/fish/path.fish ++++ b/fish/path.fish +@@ -13,8 +13,10 @@ for entry in (string split \n $PATH_DIRS) + # resolve the {$HOME} substitutions + set -l resolved_path (eval echo $entry) + if test -d "$resolved_path"; # and not contains $resolved_path $PATH +- set -x PA $PA "$resolved_path" ++ set PA $PA "$resolved_path" + end + end +  +-set -x PATH $PA +\ No newline at end of file ++set PA $PA /Users/paulirish/.rvm/gems/ruby-2.2.1/bin ++ ++set --export PATH $PA +\ No newline at end of file +diff --git a/setup-a-new-machine.sh b/setup-a-new-machine.sh +index 7b5996c..7e60889 100755 +--- a/setup-a-new-machine.sh ++++ b/setup-a-new-machine.sh +@@ -215,5 +215,7 @@ sh .osx + # symlink it up! + ./symlink-setup.sh +  ++# add manual symlink for .ssh/config and probably .config/fish ++ + ### + ############################################################################################################## diff --git a/test/fixtures/ls-function.diff b/test/fixtures/ls-function.diff new file mode 100644 index 0000000..0b7a3f4 --- /dev/null +++ b/test/fixtures/ls-function.diff @@ -0,0 +1,27 @@ +diff --git a/fish/functions/ls.fish b/fish/functions/ls.fish +index 33c3d8b..fd54db2 100644 +--- a/fish/functions/ls.fish ++++ b/fish/functions/ls.fish +@@ -7,6 +7,8 @@ + if begin + type gls 1>/dev/null 2>/dev/null + or command ls --version 1>/dev/null 2>/dev/null ++ ++ set -x CLICOLOR_FORCE 1 + end + # This is GNU ls + function ls --description "List contents of directory" +@@ -22,11 +24,11 @@ if begin + set param $param --human-readable + set param $param --sort=extension + set param $param --group-directories-first +- if isatty 1 ++ if isatty 1 + set param $param --indicator-style=classify + end +  +- eval "env CLICOLOR_FORCE=1 command $ls $param $argv" ++ eval $ls $param "$argv" + end +- + if not set -q LS_COLORS \ No newline at end of file diff --git a/test/test_helper/bats-assert b/test/test_helper/bats-assert new file mode 160000 index 0000000..9d6f9a2 --- /dev/null +++ b/test/test_helper/bats-assert @@ -0,0 +1 @@ +Subproject commit 9d6f9a219026789af4097db7d208fbda873002ee diff --git a/test/test_helper/bats-core b/test/test_helper/bats-core new file mode 160000 index 0000000..2c97639 --- /dev/null +++ b/test/test_helper/bats-core @@ -0,0 +1 @@ +Subproject commit 2c97639223e65e54bec2bccda788ba3db338fc22 diff --git a/test/test_helper/util.bash b/test/test_helper/util.bash new file mode 100644 index 0000000..e37afec --- /dev/null +++ b/test/test_helper/util.bash @@ -0,0 +1,22 @@ + +diff_so_fancy="$BATS_TEST_DIRNAME/../diff-so-fancy" + +load_fixture() { + local name="$1" + cat "$BATS_TEST_DIRNAME/fixtures/${name}.diff" +} + + +# applying colors so ANSI color values will match +# FIXME: not everyone will have these set, so we need to test for that. +git config color.diff.meta "yellow bold" +git config color.diff.commit "green bold" +git config color.diff.frag "magenta bold" +git config color.diff.old "red bold" +git config color.diff.new "green bold" +git config color.diff.whitespace "red reverse" + +git config color.diff-highlight.oldNormal "red bold" +git config color.diff-highlight.oldHighlight "red bold 52" +git config color.diff-highlight.newNormal "green bold" +git config color.diff-highlight.newHighlight "green bold 22"