From 0bb22304e0611993dbcdb562fbb4f22204972fa4 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Thu, 22 Feb 2018 09:56:10 -0500 Subject: [PATCH] Add scripts --- bin/docker-clean-containers | 2 ++ bin/docker-clean-images | 2 ++ bin/git-blameconflict | 3 +++ recipes/base | 1 + recipes/bin | 5 +++++ recipes/path | 18 ++++++++++++++++++ 6 files changed, 31 insertions(+) create mode 100755 bin/docker-clean-containers create mode 100755 bin/docker-clean-images create mode 100755 bin/git-blameconflict create mode 100644 recipes/bin create mode 100644 recipes/path diff --git a/bin/docker-clean-containers b/bin/docker-clean-containers new file mode 100755 index 0000000..bf7ec7d --- /dev/null +++ b/bin/docker-clean-containers @@ -0,0 +1,2 @@ +#!/bin/bash +docker rm $(docker ps -a -q) diff --git a/bin/docker-clean-images b/bin/docker-clean-images new file mode 100755 index 0000000..7f6dce2 --- /dev/null +++ b/bin/docker-clean-images @@ -0,0 +1,2 @@ +#!/bin/bash +docker rmi $(docker images -q --filter "dangling=true") diff --git a/bin/git-blameconflict b/bin/git-blameconflict new file mode 100755 index 0000000..0012c6f --- /dev/null +++ b/bin/git-blameconflict @@ -0,0 +1,3 @@ +#!/bin/bash + +for f in $(git status --porcelain|grep '^UU'|awk '{print $2}'); do echo "$f"; git --no-pager blame -L '/^<<<>>>/' -- $f; echo; done; diff --git a/recipes/base b/recipes/base index 2981cc4..174282a 100644 --- a/recipes/base +++ b/recipes/base @@ -4,3 +4,4 @@ set +e _recipe brew _recipe git _recipe zsh +_recipe bin diff --git a/recipes/bin b/recipes/bin new file mode 100644 index 0000000..2d1f327 --- /dev/null +++ b/recipes/bin @@ -0,0 +1,5 @@ +#!/bin/bash +set +e + +_recipe path +_run "Add dotfiles/bin to PATH" _path_high ${HOME}/dotfiles/bin diff --git a/recipes/path b/recipes/path new file mode 100644 index 0000000..a09962c --- /dev/null +++ b/recipes/path @@ -0,0 +1,18 @@ +#!/bin/bash +set +e + +function _path_low { + PATH="$1:$PATH" + test -r ~/.bash_profile && echo "export PATH='$1'":'"$PATH"' >>~/.bash_profile + echo "export PATH='$1'":'"$PATH"' >>~/.profile +} + +function _path_high { + PATH="$PATH:$1" + test -r ~/.bash_profile && echo 'export PATH="$PATH"':"'$PATH'" >>~/.bash_profile + echo "export PATH='$1'":'"$PATH"' >>~/.profile +} + +function _path { + _path_low $@ +}