"git@web.lueluesay.top:root/oh-my-zsh.git" did not exist on "9f4dfc0a231d0ddf76e6b3d998193acda916791e"
Unverified Commit 18ee5dff authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into clipboard

parents d81cd753 368198b7
...@@ -29,4 +29,4 @@ alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443 ...@@ -29,4 +29,4 @@ alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443
alias nmap_traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute " alias nmap_traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all " alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy " alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
alias nmap_ping_scan="nmap -n -sP"
(( $+commands[npm] )) && { (( $+commands[npm] )) && {
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion" rm -f "${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion"
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then _npm_completion() {
npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null local si=$IFS
[[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE compadd -- $(COMP_CWORD=$((CURRENT-1)) \
fi COMP_LINE=$BUFFER \
COMP_POINT=0 \
[[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE npm completion -- "${words[@]}" \
2>/dev/null)
unset __NPM_COMPLETION_FILE IFS=$si
}
compdef _npm_completion npm
} }
# Install dependencies globally # Install dependencies globally
......
# OC - OpenShift CLI
This plugin provides autocompletion for [OC](https://docs.openshift.com/container-platform/3.7/cli_reference/index.html) commands, building, managing and updating operations.
To use it, add `oc` to the plugins array of your zshrc file:
```bash
plugins=(... oc)
```
## Contributors
+ [kevinkirkup](https://github.com/kevinkirkup) - Plugin Author
...@@ -42,20 +42,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -42,20 +42,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Commands ## Commands
| Command | Description | | Command | Description |
| :-------------- | :-------------------------------------------------- | | :-------------- | :---------------------------------------------------- |
| `tab` | Open the current directory in a new tab | | `tab` | Open the current directory in a new tab |
| `split_tab` | Split the current terminal tab horizontally | | `split_tab` | Split the current terminal tab horizontally |
| `vsplit_tab` | Split the current terminal tab vertically | | `vsplit_tab` | Split the current terminal tab vertically |
| `ofd` | Open the current directory in a Finder window | | `ofd` | Open the current directory in a Finder window |
| `pfd` | Return the path of the frontmost Finder window | | `pfd` | Return the path of the frontmost Finder window |
| `pfs` | Return the current Finder selection | | `pfs` | Return the current Finder selection |
| `cdf` | `cd` to the current Finder directory | | `cdf` | `cd` to the current Finder directory |
| `pushdf` | `pushd` to the current Finder directory | | `pushdf` | `pushd` to the current Finder directory |
| `quick-look` | Quick-Look a specified file | | `quick-look` | Quick-Look a specified file |
| `man-preview` | Open a specified man page in Preview app | | `man-preview` | Open a specified man page in Preview app |
| `showfiles` | Show hidden files | | `showfiles` | Show hidden files |
| `hidefiles` | Hide the hidden files | | `hidefiles` | Hide the hidden files |
| `itunes` | Control iTunes. Use `itunes -h` for usage details | | `itunes` | DEPRECATED. Use `music` from macOS Catalina on |
| `spotify` | Control Spotify and search by artist, album, track… | | `music` | Control Apple Music. Use `music -h` for usage details |
| `rmdsstore` | Remove .DS\_Store files recursively in a directory | | `spotify` | Control Spotify and search by artist, album, track… |
| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
...@@ -219,7 +219,19 @@ function vncviewer() { ...@@ -219,7 +219,19 @@ function vncviewer() {
} }
# iTunes control function # iTunes control function
function itunes() { function itunes music() {
local APP_NAME=Music
autoload is-at-least
if is-at-least 10.15 $(sw_vers -productVersion); then
if [[ $0 = itunes ]]; then
echo >&2 The itunes function name is deprecated. Use \`music\' instead.
return 1
fi
else
APP_NAME=iTunes
fi
local opt=$1 local opt=$1
local playlist=$2 local playlist=$2
shift shift
...@@ -236,7 +248,7 @@ function itunes() { ...@@ -236,7 +248,7 @@ function itunes() {
opt="$opt track" opt="$opt track"
;; ;;
vol) vol)
local new_volume volume=$(osascript -e 'tell application "iTunes" to get sound volume') local new_volume volume=$(osascript -e "tell application \"$APP_NAME\" to get sound volume")
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
echo "Current volume is ${volume}." echo "Current volume is ${volume}."
return 0 return 0
...@@ -251,26 +263,26 @@ function itunes() { ...@@ -251,26 +263,26 @@ function itunes() {
opt="set sound volume to ${new_volume}" opt="set sound volume to ${new_volume}"
;; ;;
playlist) playlist)
# Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
if [[ ! -z "$playlist" ]]; then if [[ ! -z "$playlist" ]]; then
osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null; osascript -e "tell application \"$APP_NAME\"" -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
opt="play" opt="play"
else else
opt="stop" opt="stop"
fi fi
else else
opt="set allPlaylists to (get name of every playlist)" opt="set allPlaylists to (get name of every playlist)"
fi fi
;; ;;
playing|status) playing|status)
local state=`osascript -e 'tell application "iTunes" to player state as string'` local state=`osascript -e "tell application \"$APP_NAME\" to player state as string"`
if [[ "$state" = "playing" ]]; then if [[ "$state" = "playing" ]]; then
currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'` currenttrack=`osascript -e "tell application \"$APP_NAME\" to name of current track as string"`
currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'` currentartist=`osascript -e "tell application \"$APP_NAME\" to artist of current track as string"`
echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color"; echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color";
else else
echo "iTunes is" $state; echo "$APP_NAME is" $state;
fi fi
return 0 return 0
;; ;;
...@@ -284,7 +296,7 @@ if [[ ! -z "$playlist" ]]; then ...@@ -284,7 +296,7 @@ if [[ ! -z "$playlist" ]]; then
if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]] if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]]
then then
print "Usage: itunes shuffle [on|off|toggle]. Invalid option." print "Usage: $0 shuffle [on|off|toggle]. Invalid option."
return 1 return 1
fi fi
...@@ -305,14 +317,14 @@ EOF ...@@ -305,14 +317,14 @@ EOF
esac esac
;; ;;
""|-h|--help) ""|-h|--help)
echo "Usage: itunes <option>" echo "Usage: $0 <option>"
echo "option:" echo "option:"
echo "\tlaunch|play|pause|stop|rewind|resume|quit" echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tcontrol volume set" echo "\tmute|unmute\tcontrol volume set"
echo "\tnext|previous\tplay next or previous track" echo "\tnext|previous\tplay next or previous track"
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer." echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume." echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
echo "\tplaying|status\tShow what song is currently playing in iTunes." echo "\tplaying|status\tShow what song is currently playing in Music."
echo "\tplaylist [playlist name]\t Play specific playlist" echo "\tplaylist [playlist name]\t Play specific playlist"
echo "\thelp\tshow this message and exit" echo "\thelp\tshow this message and exit"
return 0 return 0
...@@ -322,7 +334,7 @@ EOF ...@@ -322,7 +334,7 @@ EOF
return 1 return 1
;; ;;
esac esac
osascript -e "tell application \"iTunes\" to $opt" osascript -e "tell application \"$APP_NAME\" to $opt"
} }
# Spotify control function # Spotify control function
......
...@@ -148,11 +148,11 @@ if [ $# = 0 ]; then ...@@ -148,11 +148,11 @@ if [ $# = 0 ]; then
else else
if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
echo "The Spotify application must be installed." echo "The Spotify application must be installed."
exit 1 return 1
fi fi
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
osascript -e 'tell application "Spotify" to activate' || exit 1 osascript -e 'tell application "Spotify" to activate' || return 1
sleep 2 sleep 2
fi fi
fi fi
...@@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do ...@@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do
if [ -z "${CLIENT_ID}" ]; then if [ -z "${CLIENT_ID}" ]; then
cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}"; cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}";
showAPIHelp; showAPIHelp;
exit 1; return 1
fi fi
if [ -z "${CLIENT_SECRET}" ]; then if [ -z "${CLIENT_SECRET}" ]; then
cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}"; cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}";
showAPIHelp; showAPIHelp;
exit 1; return 1
fi fi
SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r'); SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
SPOTIFY_PLAY_URI=""; SPOTIFY_PLAY_URI="";
...@@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do ...@@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
cecho "Autorization failed, please check ${USER_CONFG_FILE}" cecho "Autorization failed, please check ${USER_CONFG_FILE}"
cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}" cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}"
showAPIHelp showAPIHelp
exit 1 return 1
fi fi
SPOTIFY_ACCESS_TOKEN=$( \ SPOTIFY_ACCESS_TOKEN=$( \
printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \ printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \
...@@ -307,7 +307,7 @@ while [ $# -gt 0 ]; do ...@@ -307,7 +307,7 @@ while [ $# -gt 0 ]; do
"quit" ) cecho "Quitting Spotify."; "quit" ) cecho "Quitting Spotify.";
osascript -e 'tell application "Spotify" to quit'; osascript -e 'tell application "Spotify" to quit';
exit 0 ;; break ;;
"next" ) cecho "Going to next track." ; "next" ) cecho "Going to next track." ;
osascript -e 'tell application "Spotify" to next track'; osascript -e 'tell application "Spotify" to next track';
...@@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do ...@@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
echo " vol down # Decreases the volume by 10%."; echo " vol down # Decreases the volume by 10%.";
echo " vol [amount] # Sets the volume to an amount between 0 and 100."; echo " vol [amount] # Sets the volume to an amount between 0 and 100.";
echo " vol # Shows the current Spotify volume."; echo " vol # Shows the current Spotify volume.";
exit 1; return 1
fi fi
osascript -e "tell application \"Spotify\" to set sound volume to $newvol"; osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
...@@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do ...@@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do
"help" ) "help" )
showHelp; showHelp;
break ;; break ;;
* ) * )
showHelp; showHelp;
exit 1; return 1 ;;
esac esac
done done
......
# otp plugin
This plugin allows you to create one-time passwords using [`oathtool`](https://www.nongnu.org/oath-toolkit/man-oathtool.html),
able to replace MFA devices. The oathtool key is kept in a GPG-encrypted file so the codes
can only be generated by a user able to decrypt it.
To use it, add `otp` to the plugins array in your zshrc file:
```zsh
plugins=(... otp)
```
Provided aliases:
- `otp_add_device`: creates a new encrypted storage for an oathtool key and stores it
on the disk. For encrypting the key, it will ask for a GPG user ID (your GPG key's
email address). Then the OTP key needs to be pasted, followed by a CTRL+D character
inserted on an empty line.
- `ot`: generates a MFA code based on the given key and copies it to the clipboard
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
The plugin uses `$HOME/.otp` to store its internal files.
...@@ -12,32 +12,23 @@ function ot () { ...@@ -12,32 +12,23 @@ function ot () {
return 1 return 1
fi fi
if [[ `uname` == 'Darwin' ]] then # MacOS X COPY_CMD='true'
export COPY_CMD='pbcopy'
elif command -v xsel > /dev/null 2>&1; then # Any Unix with xsel installed
export COPY_CMD='xsel --clipboard --input'
else
COPY_CMD='true'
fi
if [[ "x$1" == "x" ]]; then if [[ -z "$1" ]]; then
echo "usage: otpw <profile.name>" echo "usage: $0 <profile.name>"
return 1 return 1
elif [ ! -f $OTP_HOME/$1.otp.asc ]; then elif [ ! -f $OTP_HOME/$1.otp.asc ]; then
echo "missing profile $1, you might need to create it first using otp_add_device" echo "missing profile $1, you might need to create it first using otp_add_device"
return 1 return 1
else else
totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc) totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc)
oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD` oathtool --totp --b $totpkey | tee /dev/stderr | clipcopy
if [[ $COPY_CMD == 'true' ]] then
echo "Note: you might consider installing xsel for clipboard integration"
fi
fi fi
} }
function otp_add_device () { function otp_add_device () {
if [[ "x$1" == "x" ]] then if [[ "x$1" == "x" ]] then
echo "usage: otp_add <profile.name>" echo "usage: $0 <profile.name>"
return 1 return 1
else else
echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D" echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D"
......
# pass
This plugin provides completion for the [pass](https://www.passwordstore.org/) password manager.
To use it, add `pass` to the plugins array in your zshrc file.
```
plugins=(... pass)
```
## Configuration
### Multiple repositories
If you use multiple repositories, you can configure completion like this:
```zsh
compdef _pass workpass
zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
workpass() {
PASSWORD_STORE_DIR=$HOME/work/pass pass $@
}
```
# Paver
This plugin adds completion for the `paver` command-line tool of [Paver](https://pythonhosted.org/Paver/).
To use it, add `paver` to the plugins array of your zshrc file:
```zsh
plugins=(... paver)
```
The completion function creates a cache of paver tasks with the name `.paver_tasks`,
in the current working directory. It regenerates that cache when the `pavement.py`
changes.
_paver_does_target_list_need_generating () { _paver_does_target_list_need_generating () {
[ ! -f .paver_targets ] && return 0; [ ! -f .paver_targets ] && return 0
[ pavement.py -nt .paver_targets ] && return 0; [ pavement.py -nt .paver_targets ] && return 0
return 1; return 1
} }
_paver () { _paver () {
......
## percol ## percol
Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh)
### Requirements ### Requirements
...@@ -8,7 +8,7 @@ Provides some useful function to make [percol](https://github.com/mooz/percol) w ...@@ -8,7 +8,7 @@ Provides some useful function to make [percol](https://github.com/mooz/percol) w
pip install percol pip install percol
``` ```
And [jump](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement. And [jump](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
### Usage ### Usage
......
# Perl
This plugin adds [perl](https://www.perl.org/) useful aliases/functions.
To use it, add `perl` to the plugins array in your zshrc file:
```zsh
plugins=(... perl)
```
## Aliases
| Aliases | Command | Description |
| :------------ | :----------------- | :------------------------------------- |
| pbi | `perlbrew install` | Install specific perl version |
| pbl | `perlbrew list` | List all perl version installed |
| pbo | `perlbrew off` | Go back to the system perl |
| pbs | `perlbrew switch` | Turn it back on |
| pbu | `perlbrew use` | Use specific version of perl |
| pd | `perldoc` | Show the perl documentation |
| ple | `perl -wlne` | Use perl like awk/sed |
| latest-perl | `curl ...` | Show the latest stable release of Perl |
## Functions
* `newpl`: creates a basic Perl script file and opens it with $EDITOR.
* `pgs`: Perl Global Substitution: `pgs <find_pattern> <replace_pattern> <filename>`
Looks for `<find_pattern>` and replaces it with `<replace_pattern>` in `<filename>`.
* `prep`: Perl grep, because 'grep -P' is terrible: `prep <pattern> [<filename>]`
Lets you work with pipes or files (if no `<filename>` provided, use stdin).
## Requirements
In order to make this work, you will need to have perl installed.
More info on the usage and install: https://www.perl.org/get.html
# Phing plugin
This plugin adds autocompletion for [`phing`](https://github.com/phingofficial/phing) targets.
To use it, add `phing` to the plugins array of your `.zshrc` file:
```
plugins=(... eecms)
```
# pip plugin
This plugin adds completion for [pip](https://pip.pypa.io/en/latest/),
the Python package manager.
To use it, add `pip` to the plugins array in your zshrc file:
```zsh
plugins=(... pip)
```
## pip cache
The pip plugin caches the names of available pip packages from the PyPI index.
To trigger the caching process, try to complete `pip install`,
or you can run `zsh-pip-cache-packages` directly.
To reset the cache, run `zsh-pip-clear-cache` and it will be rebuilt next
the next time you autocomplete `pip install`.
...@@ -23,7 +23,8 @@ _togglePipenvShell() { ...@@ -23,7 +23,8 @@ _togglePipenvShell() {
fi fi
fi fi
} }
chpwd_functions+=(_togglePipenvShell) autoload -U add-zsh-hook
add-zsh-hook chpwd _togglePipenvShell
# Aliases # Aliases
alias pch="pipenv check" alias pch="pipenv check"
......
# pod
This plugin adds completion for [`CocoaPods`](https://cocoapods.org/).
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
To use it, add `pod` to the plugins array in your zshrc file:
```zsh
plugins=(... pod)
```
# pow plugin
This plugin adds completion and commands for [pow](http://pow.cx/), a
zero-configuration Rack server for macOS.
To use it, add pow to the plugins array of your zshrc file:
```sh
plugins=(... pow)
```
## Commands
- `kapow` will restart an app.
```bash
kapow myapp
```
- `kaput` will show the standard output from any pow app.
- `repow` will restart the pow process.
# Powder
This plugin provides completion for [powder](https://github.com/powder-rb/powder/).
To use it, add powder to the plugins array of your zshrc file:
```
plugins=(... powder)
```
# powify plugin
This plugin adds autocompletion for [powify](https://github.com/sethvargo/powify),
an easy-to-use wrapper for Basecamp's [pow](https://github.com/basecamp/pow).
To use it, add powify to the plugins array of your zshrc file:
```sh
plugins=(... powify)
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment