From 5b4e3ee7f1c48505a3ec56ce38e444b88feda7a4 Mon Sep 17 00:00:00 2001 From: Robert Lankford Date: Mon, 12 Jul 2021 10:16:26 -0500 Subject: feat(gnu-utils): include ggrep in gcmds (#10044) Co-authored-by: Robert Lankford --- plugins/gnu-utils/gnu-utils.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh index 23e00c295..539e7fe4d 100644 --- a/plugins/gnu-utils/gnu-utils.plugin.zsh +++ b/plugins/gnu-utils/gnu-utils.plugin.zsh @@ -36,7 +36,7 @@ __gnu_utils() { gcmds+=('gfind' 'gxargs' 'glocate') # Not part of either coreutils or findutils, installed separately. - gcmds+=('gsed' 'gtar' 'gtime' 'gmake') + gcmds+=('gsed' 'gtar' 'gtime' 'gmake' 'ggrep') for gcmd in "${gcmds[@]}"; do # Do nothing if the command isn't found -- cgit v1.2.3-70-g09d2 From e4f6f1698d4bf2cebe3fd0e2f5bae9f163780a50 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 12 Jul 2021 17:34:34 +0200 Subject: fix(copybuffer): show error below the command line --- plugins/copybuffer/copybuffer.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/copybuffer/copybuffer.plugin.zsh b/plugins/copybuffer/copybuffer.plugin.zsh index 483ed5a5f..87a658d93 100644 --- a/plugins/copybuffer/copybuffer.plugin.zsh +++ b/plugins/copybuffer/copybuffer.plugin.zsh @@ -5,7 +5,7 @@ copybuffer () { if which clipcopy &>/dev/null; then printf "%s" "$BUFFER" | clipcopy else - echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly." + zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly." fi } -- cgit v1.2.3-70-g09d2 From 23f9348e2c2341df71b1891eb4607f60ddd5a204 Mon Sep 17 00:00:00 2001 From: Sergei Shvetsov Date: Tue, 13 Jul 2021 15:05:33 +0700 Subject: fix(aws): allow for profile switch w/o MFA configured (#9924) --- plugins/aws/aws.plugin.zsh | 66 +++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'plugins') diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index e1566b113..2d095635b 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -62,47 +62,47 @@ function acp() { read -r sess_duration fi mfa_opt=(--serial-number "$mfa_serial" --token-code "$mfa_token" --duration-seconds "${sess_duration:-3600}") + fi - # Now see whether we need to just MFA for the current role, or assume a different one - local role_arn="$(aws configure get role_arn --profile $profile)" - local sess_name="$(aws configure get role_session_name --profile $profile)" - - if [[ -n "$role_arn" ]]; then - # Means we need to assume a specified role - aws_command=(aws sts assume-role --role-arn "$role_arn" "${mfa_opt[@]}") + # Now see whether we need to just MFA for the current role, or assume a different one + local role_arn="$(aws configure get role_arn --profile $profile)" + local sess_name="$(aws configure get role_session_name --profile $profile)" - # Check whether external_id is configured to use while assuming the role - local external_id="$(aws configure get external_id --profile $profile)" - if [[ -n "$external_id" ]]; then - aws_command+=(--external-id "$external_id") - fi + if [[ -n "$role_arn" ]]; then + # Means we need to assume a specified role + aws_command=(aws sts assume-role --role-arn "$role_arn" "${mfa_opt[@]}") - # Get source profile to use to assume role - local source_profile="$(aws configure get source_profile --profile $profile)" - if [[ -z "$sess_name" ]]; then - sess_name="${source_profile:-profile}" - fi - aws_command+=(--profile="${source_profile:-profile}" --role-session-name "${sess_name}") + # Check whether external_id is configured to use while assuming the role + local external_id="$(aws configure get external_id --profile $profile)" + if [[ -n "$external_id" ]]; then + aws_command+=(--external-id "$external_id") + fi - echo "Assuming role $role_arn using profile ${source_profile:-profile}" - else - # Means we only need to do MFA - aws_command=(aws sts get-session-token --profile="$profile" "${mfa_opt[@]}") - echo "Obtaining session token for profile $profile" + # Get source profile to use to assume role + local source_profile="$(aws configure get source_profile --profile $profile)" + if [[ -z "$sess_name" ]]; then + sess_name="${source_profile:-profile}" fi + aws_command+=(--profile="${source_profile:-profile}" --role-session-name "${sess_name}") - # Format output of aws command for easier processing - aws_command+=(--query '[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]' --output text) + echo "Assuming role $role_arn using profile ${source_profile:-profile}" + else + # Means we only need to do MFA + aws_command=(aws sts get-session-token --profile="$profile" "${mfa_opt[@]}") + echo "Obtaining session token for profile $profile" + fi - # Run the aws command to obtain credentials - local -a credentials - credentials=(${(ps:\t:)"$(${aws_command[@]})"}) + # Format output of aws command for easier processing + aws_command+=(--query '[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]' --output text) - if [[ -n "$credentials" ]]; then - aws_access_key_id="${credentials[1]}" - aws_secret_access_key="${credentials[2]}" - aws_session_token="${credentials[3]}" - fi + # Run the aws command to obtain credentials + local -a credentials + credentials=(${(ps:\t:)"$(${aws_command[@]})"}) + + if [[ -n "$credentials" ]]; then + aws_access_key_id="${credentials[1]}" + aws_secret_access_key="${credentials[2]}" + aws_session_token="${credentials[3]}" fi # Switch to AWS profile -- cgit v1.2.3-70-g09d2 From dac3314c76e799cddbbe5cf63870d31861626059 Mon Sep 17 00:00:00 2001 From: "MalaGaM @ ARTiSPRETiS" Date: Fri, 16 Jul 2021 11:48:19 +0200 Subject: chore(github): add links to supported tools (#10057) --- plugins/github/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/github/README.md b/plugins/github/README.md index 70b863f64..af2b8a4e7 100644 --- a/plugins/github/README.md +++ b/plugins/github/README.md @@ -2,8 +2,8 @@ This plugin supports working with GitHub from the command line. It provides a few things: -* Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed. -* Completion for the `github` Ruby gem. +* Sets up the `hub` wrapper and completions for the `git` command if you have [`hub`](https://github.com/github/hub) installed. +* Completion for the [`github` Ruby gem](https://github.com/defunkt/github-gem). * Convenience functions for working with repos and URLs. ### Functions -- cgit v1.2.3-70-g09d2 From d9ad99531f74df8b0d6622feeab5e253528b43d0 Mon Sep 17 00:00:00 2001 From: Žiga Šebenik Date: Fri, 23 Jul 2021 12:39:51 +0200 Subject: feat(plugins): add fnm plugin (#9864) Co-authored-by: Ziga Sebenik --- plugins/fnm/.gitignore | 2 ++ plugins/fnm/README.md | 9 +++++++++ plugins/fnm/fnm.plugin.zsh | 12 ++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 plugins/fnm/.gitignore create mode 100644 plugins/fnm/README.md create mode 100644 plugins/fnm/fnm.plugin.zsh (limited to 'plugins') diff --git a/plugins/fnm/.gitignore b/plugins/fnm/.gitignore new file mode 100644 index 000000000..0b2bc9ab7 --- /dev/null +++ b/plugins/fnm/.gitignore @@ -0,0 +1,2 @@ +_fnm + diff --git a/plugins/fnm/README.md b/plugins/fnm/README.md new file mode 100644 index 000000000..00fab5cd4 --- /dev/null +++ b/plugins/fnm/README.md @@ -0,0 +1,9 @@ +# fnm plugin + +This plugin adds autocompletion for [fnm](https://github.com/Schniz/fnm) - a Node.js version manager. + +To use it, add `fnm` to the plugins array in your zshrc file: + +```zsh +plugins=(... fnm) +``` diff --git a/plugins/fnm/fnm.plugin.zsh b/plugins/fnm/fnm.plugin.zsh new file mode 100644 index 000000000..5ce558dcb --- /dev/null +++ b/plugins/fnm/fnm.plugin.zsh @@ -0,0 +1,12 @@ +# COMPLETION FUNCTION +if (( $+commands[fnm] )); then + if [[ ! -f $ZSH_CACHE_DIR/fnm_version ]] \ + || [[ "$(fnm --version)" != "$(< "$ZSH_CACHE_DIR/fnm_version")" ]] \ + || [[ ! -f $ZSH/plugins/fnm/_fnm ]]; then + fnm completions --shell=zsh > $ZSH/plugins/fnm/_fnm + fnm --version > $ZSH_CACHE_DIR/fnm_version + fi + autoload -Uz _fnm + _comps[fnm]=_fnm +fi + -- cgit v1.2.3-70-g09d2 From c8a258698de6a56145211657f05f8b554a8140b7 Mon Sep 17 00:00:00 2001 From: Neil Girdhar Date: Mon, 26 Jul 2021 05:45:02 -0400 Subject: fix(pyenv): fix pyenv PATH settings with a warning (#9935) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change fixes the setting of $PATH for pyenv and its shims, while warning the user about non-interactive shells. Co-authored-by: Marc Cornellà --- plugins/pyenv/pyenv.plugin.zsh | 77 +++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 27 deletions(-) (limited to 'plugins') diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index 82ba6ff8c..fedde6342 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -3,44 +3,67 @@ # Load pyenv only if command not already available if command -v pyenv &> /dev/null && [[ "$(uname -r)" != *icrosoft* ]]; then - FOUND_PYENV=1 + FOUND_PYENV=1 else - FOUND_PYENV=0 + FOUND_PYENV=0 fi +# Look for pyenv and try to load it (will only work on interactive shells) if [[ $FOUND_PYENV -ne 1 ]]; then - pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv") - for dir in $pyenvdirs; do - if [[ -d $dir/bin ]]; then - export PATH="$PATH:$dir/bin" - FOUND_PYENV=1 - break - fi - done -fi + pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv") + for dir in $pyenvdirs; do + if [[ -d "$dir/bin" ]]; then + FOUND_PYENV=1 + break + fi + done -if [[ $FOUND_PYENV -ne 1 ]]; then + if [[ $FOUND_PYENV -ne 1 ]]; then if (( $+commands[brew] )) && dir=$(brew --prefix pyenv 2>/dev/null); then - if [[ -d $dir/bin ]]; then - export PATH="$PATH:$dir/bin" - FOUND_PYENV=1 - fi + if [[ -d "$dir/bin" ]]; then + FOUND_PYENV=1 + fi fi + fi + + # If we found pyenv, load it but show a caveat about non-interactive shells + if [[ $FOUND_PYENV -eq 1 ]]; then + cat <&1 | cut -f 2 -d ' ')" - } + # Fall back to system python + function pyenv_prompt_info() { + echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" + } fi unset FOUND_PYENV pyenvdirs dir -- cgit v1.2.3-70-g09d2 From 5377cc37c0f71fe22484303a4c6f387aa339f3f5 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 26 Jul 2021 11:46:15 +0200 Subject: fix(pyenv): fix for ignoring pyenv-win commands The previous fix ignored any pyenv command found in $PATH while on WSL, regardless of whether it was correctly set up or not. This change only ignores the pyenv command if it's proved to come from pyenv-win by looking at its full path. --- plugins/pyenv/pyenv.plugin.zsh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index fedde6342..813f64b42 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -1,11 +1,13 @@ # This plugin loads pyenv into the current shell and provides prompt info via # the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available. -# Load pyenv only if command not already available -if command -v pyenv &> /dev/null && [[ "$(uname -r)" != *icrosoft* ]]; then - FOUND_PYENV=1 -else +# Look for pyenv in $PATH and verify that it's not a part of pyenv-win in WSL +if ! command -v pyenv &>/dev/null; then + FOUND_PYENV=0 +elif [[ "${commands[pyenv]}" = */pyenv-win/* && "$(uname -r)" = *icrosoft* ]]; then FOUND_PYENV=0 +else + FOUND_PYENV=1 fi # Look for pyenv and try to load it (will only work on interactive shells) -- cgit v1.2.3-70-g09d2 From 9c34c359c4c1ebb1bd0211d40c3bca0c6aa2ca97 Mon Sep 17 00:00:00 2001 From: Aayush Kapoor Date: Fri, 6 Aug 2021 19:21:19 +0530 Subject: chore(ag): fix README (#10001) --- plugins/ag/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/ag/README.md b/plugins/ag/README.md index 6acc54067..1983aaa41 100644 --- a/plugins/ag/README.md +++ b/plugins/ag/README.md @@ -5,7 +5,7 @@ This plugin provides completion support for [`ag`](https://github.com/ggreer/the To use it, add ag to the plugins array in your zshrc file. ```zsh -plugins=(... aws) +plugins=(... ag) ``` ## INSTALLATION NOTES -- cgit v1.2.3-70-g09d2 From ab58594173c04f7fe2155a169d8906ef761ba0fc Mon Sep 17 00:00:00 2001 From: Max Eisner <4730112+max-ae@users.noreply.github.com> Date: Tue, 10 Aug 2021 16:31:49 +0200 Subject: feat(git): add `develop` branch name detection (#9881) --- plugins/git/README.md | 35 ++++++++++++++++++----------------- plugins/git/git.plugin.zsh | 19 ++++++++++++++++--- 2 files changed, 34 insertions(+), 20 deletions(-) (limited to 'plugins') diff --git a/plugins/git/README.md b/plugins/git/README.md index e00f4cf92..522257d2d 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -23,7 +23,7 @@ plugins=(... git) | gb | git branch | | gba | git branch -a | | gbd | git branch -d | -| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*($(git_main_branch)\|development\|develop\|devel\|dev)\s*$)" \| command xargs -n 1 git branch -d | +| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*($(git_main_branch)\|$(git_develop_branch))\s*$)" \| command xargs -n 1 git branch -d | | gbD | git branch -D | | gbl | git blame -b -w | | gbnm | git branch --no-merged | @@ -49,8 +49,8 @@ plugins=(... git) | gcl | git clone --recurse-submodules | | gclean | git clean -id | | gpristine | git reset --hard && git clean -dffx | -| gcm | git checkout $(git_main_branch) | -| gcd | git checkout develop | +| gcm | git checkout $(git_main_branch) | +| gcd | git checkout $(git_develop_branch) | | gcmsg | git commit -m | | gco | git checkout | | gcor | git checkout --recurse-submodules | @@ -88,7 +88,7 @@ plugins=(... git) | ghh | git help | | gignore | git update-index --assume-unchanged | | gignored | git ls-files -v \| grep "^[[:lower:]]" | -| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk | +| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk | | gk | gitk --all --branches | | gke | gitk --all $(git log -g --pretty=%h) | | gl | git pull | @@ -107,10 +107,10 @@ plugins=(... git) | gloga | git log --oneline --decorate --graph --all | | glp | git log --pretty=\ | | gm | git merge | -| gmom | git merge origin/$(git_main_branch) | +| gmom | git merge origin/$(git_main_branch) | | gmt | git mergetool --no-prompt | | gmtvim | git mergetool --no-prompt --tool=vimdiff | -| gmum | git merge upstream/$(git_main_branch) | +| gmum | git merge upstream/$(git_main_branch) | | gma | git merge --abort | | gp | git push | | gpd | git push --dry-run | @@ -125,10 +125,10 @@ plugins=(... git) | grb | git rebase | | grba | git rebase --abort | | grbc | git rebase --continue | -| grbd | git rebase develop | +| grbd | git rebase $(git_develop_branch) | | grbi | git rebase -i | -| grbm | git rebase $(git_main_branch) | -| grbo | git rebase --onto | +| grbm | git rebase $(git_main_branch) | +| grbo | git rebase --onto | | grbs | git rebase --skip | | grev | git revert | | grh | git reset | @@ -176,7 +176,7 @@ plugins=(... git) | gupv | git pull --rebase -v | | gupa | git pull --rebase --autostash | | gupav | git pull --rebase --autostash -v | -| glum | git pull upstream $(git_main_branch) | +| glum | git pull upstream $(git_main_branch) | | gwch | git whatchanged -p --abbrev-commit --pretty=medium | | gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" | | gam | git am | @@ -214,13 +214,14 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa ### Current -| Command | Description | -|:-----------------------|:-----------------------------------------------------------------------------| -| `grename ` | Rename `old` branch to `new`, including in origin remote | -| current_branch | Return the name of the current branch | -| git_current_user_name | Returns the `user.name` config value | -| git_current_user_email | Returns the `user.email` config value | -| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise | +| Command | Description | +|:-----------------------|:---------------------------------------------------------------------------------------------------------| +| `grename ` | Rename `old` branch to `new`, including in origin remote | +| current_branch | Return the name of the current branch | +| git_current_user_name | Returns the `user.name` config value | +| git_current_user_email | Returns the `user.email` config value | +| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise | +| git_develop_branch | Returns the name of the develop branch: `dev`, `devel`, `development` if they exist, `develop` otherwise | ### Work in Progress (WIP) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 2a7c7290d..3cd558692 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -42,6 +42,19 @@ function git_main_branch() { echo master } +# Check for develop and similarly named branches +function git_develop_branch() { + command git rev-parse --git-dir &>/dev/null || return + local branch + for branch in dev devel development; do + if command git show-ref -q --verify refs/heads/$branch; then + echo $branch + return + fi + done + echo develop +} + # # Aliases # (sorted alphabetically) @@ -60,7 +73,7 @@ alias gapt='git apply --3way' alias gb='git branch' alias gba='git branch -a' alias gbd='git branch -d' -alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs -n 1 git branch -d' alias gbD='git branch -D' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' @@ -88,7 +101,7 @@ alias gcl='git clone --recurse-submodules' alias gclean='git clean -id' alias gpristine='git reset --hard && git clean -dffx' alias gcm='git checkout $(git_main_branch)' -alias gcd='git checkout develop' +alias gcd='git checkout $(git_develop_branch)' alias gcmsg='git commit -m' alias gco='git checkout' alias gcor='git checkout --recurse-submodules' @@ -227,7 +240,7 @@ alias gra='git remote add' alias grb='git rebase' alias grba='git rebase --abort' alias grbc='git rebase --continue' -alias grbd='git rebase develop' +alias grbd='git rebase $(git_develop_branch)' alias grbi='git rebase -i' alias grbm='git rebase $(git_main_branch)' alias grbo='git rebase --onto' -- cgit v1.2.3-70-g09d2 From bca73e18584771fd6db770055dac25b5728764c3 Mon Sep 17 00:00:00 2001 From: Quentin Nerden Date: Tue, 10 Aug 2021 20:25:08 +0200 Subject: feat(plugins): add completion plugin for `invoke` (#7311) Co-authored-by: Quentin Nerden --- plugins/invoke/README.md | 10 ++++++++++ plugins/invoke/invoke.plugin.zsh | 5 +++++ 2 files changed, 15 insertions(+) create mode 100644 plugins/invoke/README.md create mode 100644 plugins/invoke/invoke.plugin.zsh (limited to 'plugins') diff --git a/plugins/invoke/README.md b/plugins/invoke/README.md new file mode 100644 index 000000000..3f4b88078 --- /dev/null +++ b/plugins/invoke/README.md @@ -0,0 +1,10 @@ +# Invoke plugin + +This plugin adds completion for [invoke](https://github.com/pyinvoke/invoke). + +To use it, add `invoke` to the plugins array in your `~/.zshrc` file: + +```zsh +plugins=(... invoke) +``` + diff --git a/plugins/invoke/invoke.plugin.zsh b/plugins/invoke/invoke.plugin.zsh new file mode 100644 index 000000000..8c807de02 --- /dev/null +++ b/plugins/invoke/invoke.plugin.zsh @@ -0,0 +1,5 @@ +# Autocompletion for invoke. +# +if [ $commands[invoke] ]; then + source <(invoke --print-completion-script=zsh) +fi -- cgit v1.2.3-70-g09d2 From b79fba7b0d38aa61afaeeaaa7fab6992dbfb6db3 Mon Sep 17 00:00:00 2001 From: Gregor Trefs Date: Tue, 10 Aug 2021 21:02:06 +0200 Subject: feat(plugins): `octozen` shows an Octocat zen quote on startup (#5959) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc Cornellà --- plugins/octozen/README.md | 12 ++++++++++++ plugins/octozen/octozen.plugin.zsh | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 plugins/octozen/README.md create mode 100644 plugins/octozen/octozen.plugin.zsh (limited to 'plugins') diff --git a/plugins/octozen/README.md b/plugins/octozen/README.md new file mode 100644 index 000000000..2051248ca --- /dev/null +++ b/plugins/octozen/README.md @@ -0,0 +1,12 @@ +# Octozen plugin + +Displays a zen quote from GitHub's Octocat on start up. + +To use it, add `octozen` to the plugins array in your zshrc file: + +```zsh +plugins=(... octozen) +``` + +It defines a `display_octozen` function that fetches a GitHub Octocat zen quote. +NOTE: Internet connection is required (will time out if not fetched in 2 seconds). diff --git a/plugins/octozen/octozen.plugin.zsh b/plugins/octozen/octozen.plugin.zsh new file mode 100644 index 000000000..71ee550a5 --- /dev/null +++ b/plugins/octozen/octozen.plugin.zsh @@ -0,0 +1,11 @@ +# octozen plugin + +# Displays a zen quote from octocat +function display_octozen() { + curl -m 2 -fsL "https://api.github.com/octocat" + add-zsh-hook -d precmd display_octozen +} + +# Display the octocat on the first precmd, after the whole starting process has finished +autoload -Uz add-zsh-hook +add-zsh-hook precmd display_octozen -- cgit v1.2.3-70-g09d2 From 502b07c9b2829733f43ca76b7cd077b310f0f77f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 13 Aug 2021 12:38:22 +0200 Subject: refactor(fedora)!: remove deprecated `fedora` plugin BREAKING CHANGE: the `fedora` plugin has been removed. Use the `dnf` plugin instead. --- plugins/fedora/README.md | 1 - plugins/fedora/fedora.plugin.zsh | 3 --- 2 files changed, 4 deletions(-) delete mode 100644 plugins/fedora/README.md delete mode 100644 plugins/fedora/fedora.plugin.zsh (limited to 'plugins') diff --git a/plugins/fedora/README.md b/plugins/fedora/README.md deleted file mode 100644 index 85d8d7dea..000000000 --- a/plugins/fedora/README.md +++ /dev/null @@ -1 +0,0 @@ -The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dnf) instead. diff --git a/plugins/fedora/fedora.plugin.zsh b/plugins/fedora/fedora.plugin.zsh deleted file mode 100644 index 226506c05..000000000 --- a/plugins/fedora/fedora.plugin.zsh +++ /dev/null @@ -1,3 +0,0 @@ -print -P "%F{yellow}The 'fedora' plugin is deprecated. Use the '%Udnf%u' plugin instead.%f" - -source "$ZSH/plugins/dnf/dnf.plugin.zsh" -- cgit v1.2.3-70-g09d2 From e1f0d826f1f0d362eb377ef4a8124062ec63c3e9 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 13 Aug 2021 12:40:20 +0200 Subject: refactor(go)!: remove deprecated `go` plugin BREAKING CHANGE: the `go` plugin has been removed. Use the `golang` plugin instead. --- plugins/go/README.md | 1 - plugins/go/go.plugin.zsh | 3 --- 2 files changed, 4 deletions(-) delete mode 100644 plugins/go/README.md delete mode 100644 plugins/go/go.plugin.zsh (limited to 'plugins') diff --git a/plugins/go/README.md b/plugins/go/README.md deleted file mode 100644 index bf43b9feb..000000000 --- a/plugins/go/README.md +++ /dev/null @@ -1 +0,0 @@ -The go plugin is deprecated. Use the [golang plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/golang) instead. diff --git a/plugins/go/go.plugin.zsh b/plugins/go/go.plugin.zsh deleted file mode 100644 index da7c87cfd..000000000 --- a/plugins/go/go.plugin.zsh +++ /dev/null @@ -1,3 +0,0 @@ -print -P "%F{yellow}The 'go' plugin is deprecated. Use the '%Ugolang%u' plugin instead.%f" - -source "$ZSH/plugins/golang/golang.plugin.zsh" -- cgit v1.2.3-70-g09d2 From af6c7f3d6782cf0a34e4e68f661df526d35795be Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 13 Aug 2021 12:42:56 +0200 Subject: refactor(cloudapp)!: remove deprecated `cloudapp` plugin BREAKING CHANGE: the `cloudapp` plugin has been removed due to removed API. --- plugins/cloudapp/README.md | 26 -------------------------- plugins/cloudapp/cloudapp.plugin.zsh | 4 ---- 2 files changed, 30 deletions(-) delete mode 100644 plugins/cloudapp/README.md delete mode 100644 plugins/cloudapp/cloudapp.plugin.zsh (limited to 'plugins') diff --git a/plugins/cloudapp/README.md b/plugins/cloudapp/README.md deleted file mode 100644 index ef304edc2..000000000 --- a/plugins/cloudapp/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# CloudApp plugin - -## The CloudApp API is deprecated, so the plugin will be removed shortly - -[CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line. - -To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file: - -```zsh -plugins=(... cloudapp) -``` - -## Requirements - -1. [Aaron Russell's `cloudapp_api` gem](https://github.com/aaronrussell/cloudapp_api#installation) - -2. That you set your CloudApp credentials in `~/.cloudapp` as a simple text file like below: - ``` - email - password - ``` - -## Usage - -- `cloudapp `: uploads `` to your CloudApp account, and if you're using - macOS, copies the URL to your clipboard. diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh deleted file mode 100644 index a4d92a080..000000000 --- a/plugins/cloudapp/cloudapp.plugin.zsh +++ /dev/null @@ -1,4 +0,0 @@ -print -Pn "%F{yellow}" -print "[oh-my-zsh] The CloudApp API no longer works, so the cloudapp plugin will" -print "[oh-my-zsh] be removed shortly. Please remove it from your plugins list." -print -Pn "%f" -- cgit v1.2.3-70-g09d2 From 6dc937ff685fcbc43056dbd7fb05ba01c56dfd1a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 4 Aug 2021 15:49:11 +0200 Subject: feat(extract): add suport for .cab files via `cabextract` --- plugins/extract/README.md | 1 + plugins/extract/_extract | 2 +- plugins/extract/extract.plugin.zsh | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/extract/README.md b/plugins/extract/README.md index f2e6ad1d1..1dd8e19c0 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -21,6 +21,7 @@ plugins=(... extract) | `apk` | Android app file | | `aar` | Android library file | | `bz2` | Bzip2 file | +| `cab` | Microsoft cabinet archive | | `deb` | Debian package | | `ear` | Enterprise Application aRchive | | `gz` | Gzip file | diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 267c4d4e1..31a7facbe 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -3,5 +3,5 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ - "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ + "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ && return 0 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index e390e2dcc..601272cac 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -55,7 +55,7 @@ extract() { (*.lz4) lz4 -d "$1" ;; (*.lzma) unlzma "$1" ;; (*.z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;; + (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d "$extract_dir" ;; (*.rar) unrar x -ad "$1" ;; (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;; (*.7z) 7za x "$1" ;; @@ -69,6 +69,7 @@ extract() { cd .. ;; (*.zst) unzstd "$1" ;; + (*.cab) cabextract -d "$extract_dir" "$1" ;; (*) echo "extract: '$1' cannot be extracted" >&2 success=1 -- cgit v1.2.3-70-g09d2 From 59a9b453d348baad4ff7b7cb2e1f205d615200e6 Mon Sep 17 00:00:00 2001 From: Alexander Kapshuna Date: Mon, 24 Jun 2019 00:54:28 +0300 Subject: fix(extract): support unpacking deb file from different directory --- plugins/extract/extract.plugin.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 601272cac..e63b9494f 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -60,13 +60,13 @@ extract() { (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;; (*.7z) 7za x "$1" ;; (*.deb) - mkdir -p "$extract_dir/control" - mkdir -p "$extract_dir/data" - cd "$extract_dir"; ar vx "../${1}" > /dev/null - cd control; tar xzvf ../control.tar.gz - cd ../data; extract ../data.tar.* - cd ..; rm *.tar.* debian-binary - cd .. + local pwd="$PWD" file="${1:A}" + mkdir -p "$extract_dir/control" "$extract_dir/data" + builtin cd -q "$extract_dir"; ar vx "$file" > /dev/null + builtin cd -q control; extract ../control.tar.* + builtin cd -q ../data; extract ../data.tar.* + builtin cd -q ..; command rm *.tar.* debian-binary + builtin cd -q "$pwd" ;; (*.zst) unzstd "$1" ;; (*.cab) cabextract -d "$extract_dir" "$1" ;; -- cgit v1.2.3-70-g09d2 From 0b506fea0c9aeb450db6fdaba572041fd900c05b Mon Sep 17 00:00:00 2001 From: Xeonacid Date: Wed, 9 Jun 2021 19:29:04 +0800 Subject: feat(extract): add cpio support --- plugins/extract/README.md | 1 + plugins/extract/_extract | 2 +- plugins/extract/extract.plugin.zsh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/extract/README.md b/plugins/extract/README.md index 1dd8e19c0..44f0b05a1 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -22,6 +22,7 @@ plugins=(... extract) | `aar` | Android library file | | `bz2` | Bzip2 file | | `cab` | Microsoft cabinet archive | +| `cpio` | Cpio archive | | `deb` | Debian package | | `ear` | Enterprise Application aRchive | | `gz` | Gzip file | diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 31a7facbe..27b099c9e 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -3,5 +3,5 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ - "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ + "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ && return 0 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index e63b9494f..ac181fa78 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -70,6 +70,7 @@ extract() { ;; (*.zst) unzstd "$1" ;; (*.cab) cabextract -d "$extract_dir" "$1" ;; + (*.cpio) cpio -idmvF "$1" ;; (*) echo "extract: '$1' cannot be extracted" >&2 success=1 -- cgit v1.2.3-70-g09d2 From a2f1ef69b570b43bbdd0fa29bddb860293b7278b Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 14 Aug 2021 21:57:56 +0200 Subject: fix(extract): correctly extract rpm files on other directories --- plugins/extract/extract.plugin.zsh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index ac181fa78..12a1ec948 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -20,6 +20,7 @@ extract() { shift fi + local pwd="$PWD" while (( $# > 0 )); do if [[ ! -f "$1" ]]; then echo "extract: '$1' is not a valid file" >&2 @@ -29,6 +30,7 @@ extract() { success=0 extract_dir="${1:t:r}" + local full_path="${1:A}" case "${1:l}" in (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;; (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; @@ -57,17 +59,16 @@ extract() { (*.z) uncompress "$1" ;; (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d "$extract_dir" ;; (*.rar) unrar x -ad "$1" ;; - (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;; + (*.rpm) + command mkdir -p "$extract_dir" && builtin cd -q "$extract_dir" \ + && rpm2cpio "$full_path" | cpio --quiet -id ;; (*.7z) 7za x "$1" ;; (*.deb) - local pwd="$PWD" file="${1:A}" - mkdir -p "$extract_dir/control" "$extract_dir/data" - builtin cd -q "$extract_dir"; ar vx "$file" > /dev/null + command mkdir -p "$extract_dir/control" "$extract_dir/data" + builtin cd -q "$extract_dir"; ar vx "$full_path" > /dev/null builtin cd -q control; extract ../control.tar.* builtin cd -q ../data; extract ../data.tar.* - builtin cd -q ..; command rm *.tar.* debian-binary - builtin cd -q "$pwd" - ;; + builtin cd -q ..; command rm *.tar.* debian-binary ;; (*.zst) unzstd "$1" ;; (*.cab) cabextract -d "$extract_dir" "$1" ;; (*.cpio) cpio -idmvF "$1" ;; @@ -77,8 +78,11 @@ extract() { ;; esac - (( success = $success > 0 ? $success : $? )) - (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" + (( success = success > 0 ? success : $? )) + (( success == 0 && remove_archive == 0 )) && rm "$full_path" shift + + # Go back to original working directory in case we ran cd previously + builtin cd -q "$pwd" done } -- cgit v1.2.3-70-g09d2 From 10a00085d027a969c7ef27e52085ca1fa7f5668c Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 14 Aug 2021 22:05:48 +0200 Subject: fix(extract): don't push entries to dirstack when extracting rpm and deb files --- plugins/extract/extract.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 12a1ec948..a257f6bc3 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -1,6 +1,8 @@ alias x=extract extract() { + setopt localoptions noautopushd + local remove_archive local success local extract_dir -- cgit v1.2.3-70-g09d2 From 0b32e4b25fa7f3215964281a8af4e3ff2bf4cd68 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 14 Aug 2021 22:03:41 +0200 Subject: style(extract): adopt main code style guide and refactor variables --- plugins/extract/extract.plugin.zsh | 153 ++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 79 deletions(-) (limited to 'plugins') diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index a257f6bc3..1112dd52f 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -1,90 +1,85 @@ alias x=extract extract() { - setopt localoptions noautopushd + setopt localoptions noautopushd - local remove_archive - local success - local extract_dir + if (( $# == 0 )); then + cat >&2 <<'EOF' +Usage: extract [-option] [file ...] - if (( $# == 0 )); then - cat <<-'EOF' >&2 - Usage: extract [-option] [file ...] +Options: + -r, --remove Remove archive after unpacking. +EOF + fi - Options: - -r, --remove Remove archive after unpacking. - EOF - fi + local remove_archive=1 + if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then + remove_archive=0 + shift + fi - remove_archive=1 - if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then - remove_archive=0 - shift - fi + local pwd="$PWD" + while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + echo "extract: '$1' is not a valid file" >&2 + shift + continue + fi - local pwd="$PWD" - while (( $# > 0 )); do - if [[ ! -f "$1" ]]; then - echo "extract: '$1' is not a valid file" >&2 - shift - continue - fi + local success=0 + local extract_dir="${1:t:r}" + local file="$1" full_path="${1:A}" + case "${file:l}" in + (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$file" | tar xv } || tar zxvf "$file" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$file" ;; + (*.tar.xz|*.txz) + tar --xz --help &> /dev/null \ + && tar --xz -xvf "$file" \ + || xzcat "$file" | tar xvf - ;; + (*.tar.zma|*.tlz) + tar --lzma --help &> /dev/null \ + && tar --lzma -xvf "$file" \ + || lzcat "$file" | tar xvf - ;; + (*.tar.zst|*.tzst) + tar --zstd --help &> /dev/null \ + && tar --zstd -xvf "$file" \ + || zstdcat "$file" | tar xvf - ;; + (*.tar) tar xvf "$file" ;; + (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$file" ;; + (*.tar.lz4) lz4 -c -d "$file" | tar xvf - ;; + (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$file" ;; + (*.gz) (( $+commands[pigz] )) && pigz -dk "$file" || gunzip -k "$file" ;; + (*.bz2) bunzip2 "$file" ;; + (*.xz) unxz "$file" ;; + (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$file" ;; + (*.lz4) lz4 -d "$file" ;; + (*.lzma) unlzma "$file" ;; + (*.z) uncompress "$file" ;; + (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$file" -d "$extract_dir" ;; + (*.rar) unrar x -ad "$file" ;; + (*.rpm) + command mkdir -p "$extract_dir" && builtin cd -q "$extract_dir" \ + && rpm2cpio "$full_path" | cpio --quiet -id ;; + (*.7z) 7za x "$file" ;; + (*.deb) + command mkdir -p "$extract_dir/control" "$extract_dir/data" + builtin cd -q "$extract_dir"; ar vx "$full_path" > /dev/null + builtin cd -q control; extract ../control.tar.* + builtin cd -q ../data; extract ../data.tar.* + builtin cd -q ..; command rm *.tar.* debian-binary ;; + (*.zst) unzstd "$file" ;; + (*.cab) cabextract -d "$extract_dir" "$file" ;; + (*.cpio) cpio -idmvF "$file" ;; + (*) + echo "extract: '$file' cannot be extracted" >&2 + success=1 ;; + esac - success=0 - extract_dir="${1:t:r}" - local full_path="${1:A}" - case "${1:l}" in - (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;; - (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; - (*.tar.xz|*.txz) - tar --xz --help &> /dev/null \ - && tar --xz -xvf "$1" \ - || xzcat "$1" | tar xvf - ;; - (*.tar.zma|*.tlz) - tar --lzma --help &> /dev/null \ - && tar --lzma -xvf "$1" \ - || lzcat "$1" | tar xvf - ;; - (*.tar.zst|*.tzst) - tar --zstd --help &> /dev/null \ - && tar --zstd -xvf "$1" \ - || zstdcat "$1" | tar xvf - ;; - (*.tar) tar xvf "$1" ;; - (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;; - (*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;; - (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;; - (*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;; - (*.bz2) bunzip2 "$1" ;; - (*.xz) unxz "$1" ;; - (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;; - (*.lz4) lz4 -d "$1" ;; - (*.lzma) unlzma "$1" ;; - (*.z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d "$extract_dir" ;; - (*.rar) unrar x -ad "$1" ;; - (*.rpm) - command mkdir -p "$extract_dir" && builtin cd -q "$extract_dir" \ - && rpm2cpio "$full_path" | cpio --quiet -id ;; - (*.7z) 7za x "$1" ;; - (*.deb) - command mkdir -p "$extract_dir/control" "$extract_dir/data" - builtin cd -q "$extract_dir"; ar vx "$full_path" > /dev/null - builtin cd -q control; extract ../control.tar.* - builtin cd -q ../data; extract ../data.tar.* - builtin cd -q ..; command rm *.tar.* debian-binary ;; - (*.zst) unzstd "$1" ;; - (*.cab) cabextract -d "$extract_dir" "$1" ;; - (*.cpio) cpio -idmvF "$1" ;; - (*) - echo "extract: '$1' cannot be extracted" >&2 - success=1 - ;; - esac + (( success = success > 0 ? success : $? )) + (( success == 0 && remove_archive == 0 )) && rm "$full_path" + shift - (( success = success > 0 ? success : $? )) - (( success == 0 && remove_archive == 0 )) && rm "$full_path" - shift - - # Go back to original working directory in case we ran cd previously - builtin cd -q "$pwd" - done + # Go back to original working directory in case we ran cd previously + builtin cd -q "$pwd" + done } -- cgit v1.2.3-70-g09d2 From 11e22ed0b5c1aebd6e990ea7a885bdf03ab6555a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 14 Aug 2021 22:54:07 +0200 Subject: docs(dirhistory): document keyboard shortcut conflict with Windows Terminal Related: https://github.com/ohmyzsh/ohmyzsh/issues/8505#issuecomment-886241162 --- plugins/dirhistory/README.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins') diff --git a/plugins/dirhistory/README.md b/plugins/dirhistory/README.md index 223650727..602fc8284 100644 --- a/plugins/dirhistory/README.md +++ b/plugins/dirhistory/README.md @@ -17,6 +17,9 @@ plugins=(... dirhistory) | alt + up | Move into the parent directory | | alt + down | Move into the first child directory by alphabetical order | +NOTE: some terminals might override the ALT+Arrows key bindings (Windows Terminal, for example). +If these don't work check your terminal settings and change them to a different keyboard shortcut. + ## Usage This plugin allows you to navigate the history of previous current-working-directories using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. MAC users may alternately use OPT-LEFT and OPT-RIGHT. -- cgit v1.2.3-70-g09d2