Oh-my-zsh Handy Helpers Plugin

September 7, 2020 ยท View on GitHub

Aliases and helper functions that you can use with oh-my-zsh

Installation

git clone https://github.com/jhwohlgemuth/zsh-handy-helpers.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-handy-helpers

Usage

  • Add zsh-handy-helpers to the plugins array in your .zshrc file:
plugins=(... zsh-handy-helpers)
  • Open a new terminal or execute source ~/.zshrc

Aliases

AliasCommand
rfrm -frd

Functions

NameCommandTested
clean FOLDERNAMEDelete FOLDERNAME, create FOLDERNAME, enter FOLDERNAMEyes
create_ssh_keyCreate SSH key (with no passphrase) for use with services like GitHub.comyes
did MESSAGE [TAG]Save MESSAGE to ~/did.txt logyes
dip IDGet Docker container IP address (can use container name or ID)yes
draRemove all Docker containersyes
fix_enospc_issueFix common issue with filesystem event watchersyes
fix_ssh_key_permissionsResolve common permission issue with SSH configuration fileyes
iter FUNCTIONHigher order function that will apply FUNCTION to items in a listyes
prevent_user USERNAME $1Higher order helper functionyes
prevent_root $1Helper function to be used within functions in order to prevent execution as rootyes
qr DATACreate a QR in your terminal with DATA (good for passing a URL to your phone)yes
timestampCreate a timestampyes

Examples

  • Prevent executing a function as root:
foo()  {
    prevent_root "\$0"
    echo "This will only show if not root"
}