From a111ae0168410ed23e4e201992e7e48d4e25cc19 Mon Sep 17 00:00:00 2001 From: MorganGeek Date: Fri, 6 Mar 2020 12:19:52 +0100 Subject: [PATCH] more git/docker/http CLI friendly tools/aliases - also thank you Kevin --- .pre-commit-config.yaml | 7 +++++++ Brewfile | 8 ++++++++ dot_git-template/.pre-commit-config.yaml | 7 +++++++ dot_zsh_aliases | 3 +++ dot_zsh_functions | 16 +++++++++++++--- dot_zshrc | 2 +- 6 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e2b794f..55ac732 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,6 +34,13 @@ repos: # - id: git-dirty - id: forbid-binary - id: bundler-audit +- repo: https://github.com/cesar-rodriguez/terrascan + rev: v0.2.0 + hooks: + - id: terrascan + pass_filenames: false + args: [-l=infra] #NOTE: that this is the directory you created earlier to host your terraform + verbose: true #- repo: https://github.com/ansible/ansible-lint.git # rev: v4.1.0 # hooks: diff --git a/Brewfile b/Brewfile index e1055ca..49c611a 100644 --- a/Brewfile +++ b/Brewfile @@ -15,6 +15,10 @@ tap "instrumenta/instrumenta" # provides kubeval tap "weaveworks/tap" # provides eksctl tap "b4b4r07/tap" # provides gomi a replacement for rm command tap "eddieantonio/eddieantonio" # provides imgcat, cat but for images +tap "jesseduffield/lazygit" # provides lazygit, simple terminal UI for git commands +tap "jesseduffield/lazydocker" # provides lazydocker, simple terminal UI for managnig docker +tap "skanehira/docui" # provides docui, simple terminal UI for creating/configuring docker services + cask "java" cask "iterm2" cask "zoomus" @@ -169,3 +173,7 @@ brew "kubeval" # linter for kubernetes config files brew "eksctl" brew "gomi" # replacement for rm command brew "imgcat" # cat for images +brew "lazygit" # simple terminal UI for git commands +brew "lazydocker" # simple terminal UI for managing docker +brew "docui" # simple terminal UI for creating/configuring docker services +brew "httpie" # provides http - a command line HTTP client that will make you smile. diff --git a/dot_git-template/.pre-commit-config.yaml b/dot_git-template/.pre-commit-config.yaml index e2b794f..55ac732 100644 --- a/dot_git-template/.pre-commit-config.yaml +++ b/dot_git-template/.pre-commit-config.yaml @@ -34,6 +34,13 @@ repos: # - id: git-dirty - id: forbid-binary - id: bundler-audit +- repo: https://github.com/cesar-rodriguez/terrascan + rev: v0.2.0 + hooks: + - id: terrascan + pass_filenames: false + args: [-l=infra] #NOTE: that this is the directory you created earlier to host your terraform + verbose: true #- repo: https://github.com/ansible/ansible-lint.git # rev: v4.1.0 # hooks: diff --git a/dot_zsh_aliases b/dot_zsh_aliases index 84f25dd..3ef0c73 100644 --- a/dot_zsh_aliases +++ b/dot_zsh_aliases @@ -8,6 +8,8 @@ alias gcls='git clone --depth 1 --recurse-submodules' alias cm='chezmoi' alias grep='rg' alias npmlist='npm list -g --depth 0' +alias lg='lazygit' +alias lzd='lazydocker' # Jira alias jirasearch='issues' @@ -88,6 +90,7 @@ alias hist='history' alias music='baton' alias path='echo -e ${PATH//:/\\n}' # Explode and display current PATH alias ping='prettyping -c 5 --nolegend' # Stop after sending count ECHO_REQUEST packets +alias https='http --default-scheme=https' # useful alias stealed from a colleague. http is provided by httpie alias p='ps -ef | grep -i ' # Show matching processes. Usage : p alias root='sudo -i' alias s=ls diff --git a/dot_zsh_functions b/dot_zsh_functions index 99b8346..3564944 100644 --- a/dot_zsh_functions +++ b/dot_zsh_functions @@ -66,16 +66,16 @@ function top_commands_full() { } function istherenewissues() { LASTISSUE=$(newissues | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' | awk 'FNR==2{print $2}') - if [[ -f ".newjiraissue" ]] + if [[ -f "$HOME/.newjiraissue" ]] then - previous_jira_issue=$(cat ".newjiraissue" | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g') # the sed part is for removing output colors + previous_jira_issue=$(cat "$HOME/.newjiraissue" | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g') # the sed part is for removing output colors if [ "$LASTISSUE" != "$previous_jira_issue" ]; then newissues else echo "no new issue" fi fi - echo "$LASTISSUE" > .newjiraissue + echo "$LASTISSUE" > "$HOME/.newjiraissue" } function aboutpage() { year=$(echo "$*" | egrep -Eo '\b[[:digit:]]{4}\b' | head -n1) @@ -262,3 +262,13 @@ function terragrunt_color { -e "s/\( *.*: *\)\(\".*\"\)\( => \)\(\".*\"\)/${YELLOW}\1${RED}\2${BLACK}\3${GREEN}\4${RESET}/" \ -e "s/\( *.*: *\".*\"\)/${GREEN}\1${RESET}/" } +function git-project { + if [ -d "$REPO_PATH" ]; then + REPO_PATH="$(pwd)" + fi + local preview='lsd --color always --icon always --group-dirs first {}' + local dir=$(find $REPO_PATH -maxdepth 3 -type d -name ".git" | sed 's#.git$##' | fzf --select-1 --query="$*" --preview "$preview") + if [[ -n "$dir" ]]; then + cd "$dir" + fi +} diff --git a/dot_zshrc b/dot_zshrc index 2145f83..0cfd0e8 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -124,7 +124,7 @@ source $ZSH/oh-my-zsh.sh # export SSH_KEY_PATH="~/.ssh/rsa_id" export JETBRAINS_LICENSE_SERVER=https://licenseserver.collibra.com - +export REPO_PATH=$HOME/Code # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder.