From fbc878cb66cbe0067998034c2d2e383b2742c0de Mon Sep 17 00:00:00 2001 From: Rob Freiburger Date: Sat, 18 Feb 2017 04:31:36 -0600 Subject: Adds option to disable auto update prompt I noticed this option was missing from the template. When I followed the directions in README to enable it, I put it below line 59 without noticing it wouldn't have any effect by then. Prevent others from making a rookie mistake like mine. --- templates/zshrc.zsh-template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index af42e5b9f..93bbf36aa 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -19,6 +19,9 @@ ZSH_THEME="robbyrussell" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true" +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + # Uncomment the following line to change how often to auto-update (in days). # export UPDATE_ZSH_DAYS=13 -- cgit v1.2.3-70-g09d2 From 132bffcbe164bc3b60208215ddea5bd405605f2b Mon Sep 17 00:00:00 2001 From: Zopanix Date: Mon, 26 Mar 2018 21:04:27 -0400 Subject: Added a myissues option This will allow the user to directly open the my open issues page. This will make it easier for the user to open his open issues in jira. --- plugins/jira/jira.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 052481a60..e03bda90e 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -44,6 +44,9 @@ function jira() { open_command "${jira_url}/secure/CreateIssue!default.jspa" elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then _jira_query $@ + elif [[ "$action" == "myissues" ]]; then + echo "Opening my issues" + open_command "${jira_url}/issues/?filter=-1" elif [[ "$action" == "dashboard" ]]; then echo "Opening dashboard" if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then -- cgit v1.2.3-70-g09d2 From afb028763cf40fc339e49011b2cba124dc108fcb Mon Sep 17 00:00:00 2001 From: Zopanix Date: Tue, 27 Mar 2018 09:16:43 -0400 Subject: MOdified README to reflect changes for myissues command --- plugins/jira/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/jira/README.md b/plugins/jira/README.md index a934ae68c..091dccb97 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -21,6 +21,7 @@ jira new # opens a new issue jira dashboard # opens your JIRA dashboard jira reported [username] # queries for issues reported by a user jira assigned [username] # queries for issues assigned to a user +jira myissues # queries for you own issues jira branch # opens an existing issue matching the current branch name jira ABC-123 # opens an existing issue jira ABC-123 m # opens an existing issue for adding a comment -- cgit v1.2.3-70-g09d2 From b0a149076fc39ff2707279c2246744378643c0d5 Mon Sep 17 00:00:00 2001 From: Ben Klein Date: Sat, 16 Jun 2018 20:35:41 -0400 Subject: Allow arguments to `d` to be passed to dirs Replace the alias with a function. Call `dirs` if arguments are given to `d`. --- lib/directories.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/directories.zsh b/lib/directories.zsh index 14064b86f..355c442d2 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -21,7 +21,14 @@ alias 9='cd -9' alias md='mkdir -p' alias rd=rmdir -alias d='dirs -v | head -10' +function d () { + if [[ -n $1 ]]; then + dirs "$@" + else + dirs -v | head -10 + fi +} +compdef _dirs d # List directory contents alias lsa='ls -lah' -- cgit v1.2.3-70-g09d2 From d326cc5c411ac17f1a2befa1e717d221b2bbbf35 Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Sat, 7 Jan 2017 20:32:56 +1100 Subject: target name completion --- plugins/cargo/_cargo | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 54e709ca0..3eb3acb96 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -31,7 +31,7 @@ case $state in '--no-default-features[do not build the default features]' \ '--no-run[compile but do not run]' \ '(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \ - '--target=[target triple]' \ + '--target=[target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--color=:colorization option:(auto always never)' \ @@ -48,7 +48,7 @@ case $state in '--no-default-features[do not build the default features]' \ '(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \ '--release=[build in release mode]' \ - '--target=[target triple]' \ + '--target=[target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--color=:colorization option:(auto always never)' \ @@ -61,7 +61,7 @@ case $state in '(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[whether or not to clean release artifacts]' \ - '--target=[target triple(default:all)]' \ + '--target=[target triple(default:all)]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '--color=:colorization option:(auto always never)' \ ;; @@ -79,7 +79,7 @@ case $state in '(-p, --package)'{-p,--package}'=[package to document]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[build artifacts in release mode, with optimizations]' \ - '--target=[build for the target triple]' \ + '--target=[build for the target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '--color=:colorization option:(auto always never)' \ ;; @@ -276,7 +276,7 @@ case $state in '--profile=[profile to build the selected target for]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[build artifacts in release mode, with optimizations]' \ - '--target=[target triple which compiles will be for]' \ + '--target=[target triple which compiles will be for]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ "${command_scope_spec[@]}" \ ;; @@ -294,7 +294,7 @@ case $state in '(-p, --package)'{-p,--package}'=[package to document]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[build artifacts in release mode, with optimizations]' \ - '--target=[build for the target triple]' \ + '--target=[build for the target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ "${command_scope_spec[@]}" \ ;; @@ -323,7 +323,7 @@ case $state in '(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[build artifacts in release mode, with optimizations]' \ - '--target=[target triple]' \ + '--target=[target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '--color=:colorization option:(auto always never)' \ '1: :_test_names' \ @@ -484,6 +484,37 @@ _benchmark_names() _get_names_from_array "bench" } +#Gets the target names from config files +_get_targets() +{ + local CURRENT_PATH + if [[ $(uname -o) = "Cygwin" && -f "$PWD"/Cargo.toml ]]; then + CURRENT_PATH=$PWD + else + CURRENT_PATH=$(_locate_manifest) + fi + if [[ -z "$CURRENT_PATH" ]]; then + return 1 + fi + local -a TARGETS + local -a FIND_PATHS=( "/" ) + local -a FLINES + local FIND_PATH FLINE + while [[ "$CURRENT_PATH" != "/" ]]; do + FIND_PATHS+=( "$CURRENT_PATH" ) + CURRENT_PATH=$(dirname $CURRENT_PATH) + done + for FIND_PATH in ${FIND_PATHS[@]}; do + if [[ -f "$FIND_PATH"/.cargo/config ]]; then + FLINES=( `grep "$FIND_PATH"/.cargo/config -e "^\[target\."` ) + for FLINE in ${FLINES[@]}; do + TARGETS+=(`sed 's/^\[target\.\(.*\)\]$/\1/' <<< $FLINE`) + done + fi + done + _describe 'target' TARGETS +} + # These flags are mutally exclusive specifiers for the scope of a command; as # they are used in multiple places without change, they are expanded into the # appropriate command's `_arguments` where appropriate. -- cgit v1.2.3-70-g09d2 From da30a1d6d2709d768c68de122d6d0ab96c5a9a90 Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Sat, 7 Jan 2017 20:48:11 +1100 Subject: add description for --color --- plugins/cargo/_cargo | 54 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 3eb3acb96..99eac2bdb 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -34,7 +34,7 @@ case $state in '--target=[target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; build) @@ -51,7 +51,7 @@ case $state in '--target=[target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; clean) @@ -63,7 +63,7 @@ case $state in '--release[whether or not to clean release artifacts]' \ '--target=[target triple(default:all)]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; doc) @@ -81,7 +81,7 @@ case $state in '--release[build artifacts in release mode, with optimizations]' \ '--target=[build for the target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; fetch) @@ -90,7 +90,7 @@ case $state in '--manifest-path=[path to manifest]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; generate-lockfile) @@ -99,7 +99,7 @@ case $state in '--manifest-path=[path to manifest]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; git-checkout) @@ -109,7 +109,7 @@ case $state in '--reference=[REF]' \ '--url=[URL]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; help) @@ -126,14 +126,14 @@ case $state in '--name=[set the resulting package name]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; install) _arguments \ '--bin=[only install the specified binary]' \ '--branch=[branch to use when installing from git]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ '--debug[build in debug mode instead of release mode]' \ '--example[install the specified example instead of binaries]' \ '--features=[space separated feature list]' \ @@ -163,7 +163,7 @@ case $state in '--host=[Host to set the token for]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; metadata) @@ -177,7 +177,7 @@ case $state in '--features=[space separated feature list]' \ '--all-features[enable all available features]' \ '--format-version=[format version(default: 1)]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; new) @@ -188,7 +188,7 @@ case $state in '--name=[set the resulting package name]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; owner) @@ -201,7 +201,7 @@ case $state in '(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \ '--token[API token to use when authenticating]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; package) @@ -213,7 +213,7 @@ case $state in '--no-verify[do not build to verify contents]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; pkgid) @@ -222,7 +222,7 @@ case $state in '--manifest-path=[path to manifest]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; publish) @@ -234,7 +234,7 @@ case $state in '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--token[token to use when uploading]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; read-manifest) @@ -242,7 +242,7 @@ case $state in '(-h, --help)'{-h,--help}'[show help message]' \ '--manifest-path=[path to manifest]: :_files -/' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; run) @@ -259,13 +259,13 @@ case $state in '--release=[build in release mode]' \ '--target=[target triple]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ '*: :_normal' \ ;; rustc) _arguments \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ '--features=[features to compile for the package]' \ '--all-features[enable all available features]' \ '(-h, --help)'{-h,--help}'[show help message]' \ @@ -283,7 +283,7 @@ case $state in rustdoc) _arguments \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ '--features=[space-separated list of features to also build]' \ '--all-features[enable all available features]' \ '(-h, --help)'{-h,--help}'[show help message]' \ @@ -301,7 +301,7 @@ case $state in search) _arguments \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ '(-h, --help)'{-h,--help}'[show help message]' \ '--host=[host of a registry to search in]' \ '--limit=[limit the number of results]' \ @@ -325,14 +325,14 @@ case $state in '--release[build artifacts in release mode, with optimizations]' \ '--target=[target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ '1: :_test_names' \ ;; uninstall) _arguments \ '--bin=[only uninstall the binary NAME]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ '(-h, --help)'{-h,--help}'[show help message]' \ '(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \ '--root=[directory to uninstall packages from]' \ @@ -348,7 +348,7 @@ case $state in '--precise=[update single dependency to PRECISE]: :' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; verify-project) @@ -357,14 +357,14 @@ case $state in '--manifest-path=[path to manifest]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; version) _arguments \ '(-h, --help)'{-h,--help}'[show help message]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ ;; yank) @@ -375,7 +375,7 @@ case $state in '--token[API token to use when authenticating]' \ '--undo[undo a yank, putting a version back into the index]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ + '--color=[coloring]:colorization option:(auto always never)' \ '--vers[yank version]' \ ;; esac -- cgit v1.2.3-70-g09d2 From b9533ccac2846d74693158eef1759d198231a79b Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Sat, 7 Jan 2017 20:54:48 +1100 Subject: complete --message-format --- plugins/cargo/_cargo | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 99eac2bdb..7ed95c0ce 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -34,6 +34,7 @@ case $state in '--target=[target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--message-format=[error format]:format option:(human json)' \ '--color=[coloring]:colorization option:(auto always never)' \ ;; @@ -51,6 +52,7 @@ case $state in '--target=[target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--message-format=[error format]:format option:(human json)' \ '--color=[coloring]:colorization option:(auto always never)' \ ;; @@ -259,12 +261,14 @@ case $state in '--release=[build in release mode]' \ '--target=[target triple]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--message-format=[error format]:format option:(human json)' \ '--color=[coloring]:colorization option:(auto always never)' \ '*: :_normal' \ ;; rustc) _arguments \ + '--message-format=[error format]:format option:(human json)' \ '--color=[coloring]:colorization option:(auto always never)' \ '--features=[features to compile for the package]' \ '--all-features[enable all available features]' \ @@ -283,6 +287,7 @@ case $state in rustdoc) _arguments \ + '--message-format=[error format]:format option:(human json)' \ '--color=[coloring]:colorization option:(auto always never)' \ '--features=[space-separated list of features to also build]' \ '--all-features[enable all available features]' \ @@ -325,6 +330,7 @@ case $state in '--release[build artifacts in release mode, with optimizations]' \ '--target=[target triple]: :_get_targets' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--message-format=[error format]:format option:(human json)' \ '--color=[coloring]:colorization option:(auto always never)' \ '1: :_test_names' \ ;; -- cgit v1.2.3-70-g09d2 From 5423f7fa2ad255ec417fc3aea0c69077f0530ccb Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Tue, 24 Jan 2017 03:48:57 +1100 Subject: complete installed sub-commands --- plugins/cargo/_cargo | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 7ed95c0ce..e26fbfeba 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -390,6 +390,7 @@ esac } _cargo_cmds(){ +local IFS=$'\n' local -a commands;commands=( 'bench:execute all benchmarks of a local package' 'build:compile the current project' @@ -420,6 +421,7 @@ local -a commands;commands=( 'verify-project:check Cargo.toml' 'version:show version information' 'yank:remove pushed file from index' +$( cargo --list | sed -n '1!p' | tr -d ' ' | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed -r "s/(.*)/echo \"\1:$\(cargo help \1 | head -n 1\)\"/" | sh ) ) _describe 'command' commands -- cgit v1.2.3-70-g09d2 From 5d0b90a7ef8fde6d8c53a5d88b5599af6b5da75e Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Mon, 26 Jun 2017 12:47:27 +1000 Subject: redir debug output to std --- plugins/cargo/_cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index e26fbfeba..7d6ca9fc5 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -421,7 +421,7 @@ local -a commands;commands=( 'verify-project:check Cargo.toml' 'version:show version information' 'yank:remove pushed file from index' -$( cargo --list | sed -n '1!p' | tr -d ' ' | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed -r "s/(.*)/echo \"\1:$\(cargo help \1 | head -n 1\)\"/" | sh ) +$( cargo --list | sed -n '1!p' | tr -d ' ' | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed -r "s/(.*)/echo \"\1:$\(cargo help \1 2>&1 | head -n 1\)\"/" | sh ) ) _describe 'command' commands -- cgit v1.2.3-70-g09d2 From 440d8ef344686b699c918edc7c878a362b3a5038 Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Mon, 26 Jun 2017 12:56:16 +1000 Subject: fix escaping --- plugins/cargo/_cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 7d6ca9fc5..01089dff4 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -421,7 +421,7 @@ local -a commands;commands=( 'verify-project:check Cargo.toml' 'version:show version information' 'yank:remove pushed file from index' -$( cargo --list | sed -n '1!p' | tr -d ' ' | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed -r "s/(.*)/echo \"\1:$\(cargo help \1 2>&1 | head -n 1\)\"/" | sh ) +$( cargo --list | sed -n '1!p' | tr -d ' ' | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed -r "s/(.*)/echo \"\1:$\(cargo help \1 2>\&1 | head -n 1\)\"/" | sh ) ) _describe 'command' commands -- cgit v1.2.3-70-g09d2 From 1e161e839f5b544955096b30b01841307b4e4d2f Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Mon, 24 Sep 2018 18:02:03 +1000 Subject: fix subcommands completion --- plugins/cargo/_cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 01089dff4..7d7d9b2d8 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -421,7 +421,7 @@ local -a commands;commands=( 'verify-project:check Cargo.toml' 'version:show version information' 'yank:remove pushed file from index' -$( cargo --list | sed -n '1!p' | tr -d ' ' | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed -r "s/(.*)/echo \"\1:$\(cargo help \1 2>\&1 | head -n 1\)\"/" | sh ) +$( cargo --list | sed -n '1!p' | tr -s ' ' | cut -d ' ' -f 2 | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed -r "s/(.*)/echo \"\1:$\(cargo help \1 2>\&1 | head -n 1\)\"/" | sh ) ) _describe 'command' commands -- cgit v1.2.3-70-g09d2 From 23688fc7ab925111fdb0db07670b6b641e380ec9 Mon Sep 17 00:00:00 2001 From: Iulian Onofrei <6d0847b9@opayq.com> Date: Sat, 29 Sep 2018 17:01:41 +0300 Subject: Add option to color any help command This allows you to use `colored git log --help` for example, to get colored output. --- plugins/colored-man-pages/colored-man-pages.plugin.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index 1bea536e0..ac6a94654 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -16,7 +16,7 @@ EOF fi fi -function man() { +function colored() { env \ LESS_TERMCAP_mb=$(printf "\e[1;31m") \ LESS_TERMCAP_md=$(printf "\e[1;31m") \ @@ -28,5 +28,9 @@ function man() { PAGER="${commands[less]:-$PAGER}" \ _NROFF_U=1 \ PATH="$HOME/bin:$PATH" \ - man "$@" + "$@" +} + +function man() { + colored man "$@" } -- cgit v1.2.3-70-g09d2 From 1a4052b0451121556fceca63ee96255cca0ca94c Mon Sep 17 00:00:00 2001 From: Pasan Date: Sat, 20 Oct 2018 08:55:19 +0530 Subject: Added README.md to lighthouse plugin --- plugins/lighthouse/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 plugins/lighthouse/README.md diff --git a/plugins/lighthouse/README.md b/plugins/lighthouse/README.md new file mode 100644 index 000000000..0dd0003f1 --- /dev/null +++ b/plugins/lighthouse/README.md @@ -0,0 +1,15 @@ +# Lighthouse plugin + +This plugin issue lighthouse tickets. + +To use it, add `lighthouse` to the plugins array in your zshrc file: + +```zsh +plugins=(... lighthouse) +``` + +## Aliases + +| Alias | Command | Description | +|-------|----------------------------------------|------------------------------------------------------| +| lho | `open_lighthouse_ticket` | Opening lighthouse ticket | \ No newline at end of file -- cgit v1.2.3-70-g09d2 From cf07fe2c6f0ea1561e21189feb12592a21d10306 Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Wed, 28 Nov 2018 14:50:45 +1100 Subject: -r is not available for bsd sed --- plugins/cargo/_cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 7d7d9b2d8..a8c58ecc5 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -421,7 +421,7 @@ local -a commands;commands=( 'verify-project:check Cargo.toml' 'version:show version information' 'yank:remove pushed file from index' -$( cargo --list | sed -n '1!p' | tr -s ' ' | cut -d ' ' -f 2 | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed -r "s/(.*)/echo \"\1:$\(cargo help \1 2>\&1 | head -n 1\)\"/" | sh ) +$( cargo --list | sed -n '1!p' | tr -s ' ' | cut -d ' ' -f 2 | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed "s/\(.*\)/echo \"\1:$\(cargo help \1 2>\&1 | head -n 1\)\"/" | sh ) ) _describe 'command' commands -- cgit v1.2.3-70-g09d2 From 308b046875f745abb87b3ef9f0382029fe37b452 Mon Sep 17 00:00:00 2001 From: Gianluca Recchia Date: Sun, 30 Dec 2018 03:10:49 +0100 Subject: Use stash 'push' or 'save' depending on Git version A utility function now parses the output of git --version and set the alias for git stash to 'git stash push' iff the current version of Git is greater than 2.13; it falls back to 'git stash save' otherwise. --- plugins/git/git.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 2251bae2e..17e4d4b9d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -33,6 +33,11 @@ function work_in_progress() { fi } +function _omz_git_stash_command() { + [[ `git --version 2>/dev/null` =~ '^git version ([[:digit:]]+.[[:digit:]]+)' && "$match[1]" >= '2.13' ]] \ + && echo push || echo save +} + # # Aliases # (sorted alphabetically) @@ -238,7 +243,7 @@ alias gsps='git show --pretty=short --show-signature' alias gsr='git svn rebase' alias gss='git status -s' alias gst='git status' -alias gsta='git stash save' +alias gsta="git stash $(_omz_git_stash_command)" alias gstaa='git stash apply' alias gstc='git stash clear' alias gstd='git stash drop' -- cgit v1.2.3-70-g09d2 From 237c83aae0e1092eb47f17758d046306c9051243 Mon Sep 17 00:00:00 2001 From: Lukas Aldersley Date: Fri, 15 Feb 2019 19:22:27 +0100 Subject: Update LICENSE.txt --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 7af38f217..4d465b1c3 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2009-2018 Robby Russell and contributors +Copyright (c) 2009-2019 Robby Russell and contributors See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors Permission is hereby granted, free of charge, to any person obtaining a copy -- cgit v1.2.3-70-g09d2 From df002539f8c12cab9a4ca236be56fa19982fd6cb Mon Sep 17 00:00:00 2001 From: nslqqq Date: Mon, 9 Sep 2013 07:35:57 -0700 Subject: mvn: enable completion for maven colorizer --- plugins/mvn/mvn.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index f367fecce..4f3d40ec9 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -288,5 +288,6 @@ function listMavenCompletions { } compctl -K listMavenCompletions mvn +compctl -K listMavenCompletions mvn-color compctl -K listMavenCompletions mvn-or-mvnw -- cgit v1.2.3-70-g09d2 From e056aee79447bb0f61e33a8901f3a9bfef2d06b9 Mon Sep 17 00:00:00 2001 From: Neil Green Date: Mon, 13 Feb 2017 12:17:06 +0000 Subject: mvn: enable completion for mvnw --- plugins/mvn/mvn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 4f3d40ec9..d846508d3 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -287,7 +287,7 @@ function listMavenCompletions { ); } -compctl -K listMavenCompletions mvn +compctl -K listMavenCompletions mvn mvnw compctl -K listMavenCompletions mvn-color compctl -K listMavenCompletions mvn-or-mvnw -- cgit v1.2.3-70-g09d2 From 35539fd6e4519eaa9110f160aae7a403478263d2 Mon Sep 17 00:00:00 2001 From: Wajdi Al-Hawari Date: Thu, 17 Sep 2015 13:46:28 -0400 Subject: mvn: add initialize support in mvn completion --- plugins/mvn/mvn.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index d846508d3..ad0ae0ca0 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -53,6 +53,7 @@ mvn-color() { alias mvn="mvn-or-mvnw" # aliases +alias mvncini='mvn clean initialize' alias mvncie='mvn clean install eclipse:eclipse' alias mvnci='mvn clean install' alias mvncist='mvn clean install -DskipTests' @@ -81,7 +82,7 @@ alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' function listMavenCompletions { reply=( # common lifecycle - clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site + clean initialize process-resources compile process-test-resources test-compile test integration-test package verify install deploy site # common plugins deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt -- cgit v1.2.3-70-g09d2 From 4d4a2fac584e199cc9f15f0431173f376cb674bd Mon Sep 17 00:00:00 2001 From: Alexey Merezhin Date: Fri, 22 Sep 2017 16:19:59 +0200 Subject: mvn: add mvncp alias to 'mvn clean package' --- plugins/mvn/mvn.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index ad0ae0ca0..53136db9c 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -56,6 +56,7 @@ alias mvn="mvn-or-mvnw" alias mvncini='mvn clean initialize' alias mvncie='mvn clean install eclipse:eclipse' alias mvnci='mvn clean install' +alias mvncp='mvn clean package' alias mvncist='mvn clean install -DskipTests' alias mvncisto='mvn clean install -DskipTests --offline' alias mvne='mvn eclipse:eclipse' -- cgit v1.2.3-70-g09d2 From 0dbe7ecedc7631668fdad8ca23d9f19e91b4d0d2 Mon Sep 17 00:00:00 2001 From: sparsick Date: Tue, 31 Jan 2017 10:10:53 +0100 Subject: mvn: add alias to 'mvn clean deploy' --- plugins/mvn/README.md | 1 + plugins/mvn/mvn.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index 986ac84a4..be6bd6db3 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -19,6 +19,7 @@ plugins=(... mvn) | `mvne` | `mvn eclipse:eclipse` | | `mvncv` | `mvn clean verify` | | `mvnd` | `mvn deploy` | +| `mvncd` | `mvn clean deploy` | | `mvnp` | `mvn package` | | `mvnc` | `mvn clean` | | `mvncom` | `mvn compile` | diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 53136db9c..9baf66464 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -63,6 +63,7 @@ alias mvne='mvn eclipse:eclipse' alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvncv='mvn clean verify' alias mvnd='mvn deploy' +alias mvncd='mvn clean deploy' alias mvnp='mvn package' alias mvnc='mvn clean' alias mvncom='mvn compile' -- cgit v1.2.3-70-g09d2 From 7ebd80fc7df544e112480cb9a7ea9d564cbdc160 Mon Sep 17 00:00:00 2001 From: Laurent Vaills Date: Thu, 15 Oct 2015 09:04:32 +0200 Subject: mvn: add mvncvst alias --- plugins/mvn/mvn.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 9baf66464..edcd10a17 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -62,6 +62,7 @@ alias mvncisto='mvn clean install -DskipTests --offline' alias mvne='mvn eclipse:eclipse' alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvncv='mvn clean verify' +alias mvncvst='mvn clean verify -DskipTests' alias mvnd='mvn deploy' alias mvncd='mvn clean deploy' alias mvnp='mvn package' -- cgit v1.2.3-70-g09d2 From 283dcab64ffac23e40c80f7fa8bb2e8d06548c50 Mon Sep 17 00:00:00 2001 From: Bryan Banz Date: Wed, 22 Oct 2014 12:07:31 -0500 Subject: mvn: colorize [DEBUG] statements in mvn-color --- plugins/mvn/mvn.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index edcd10a17..f4c46bfa1 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -35,7 +35,9 @@ mvn-color() { ( # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations unset LANG - LC_CTYPE=C mvn "$@" | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + LC_CTYPE=C mvn "$@" | sed \ + -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_RED}${BOLD}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ -- cgit v1.2.3-70-g09d2 From 0a5e69b87eef354e96d8995b786082de7f67c082 Mon Sep 17 00:00:00 2001 From: Bryan Banz Date: Wed, 22 Oct 2014 12:09:53 -0500 Subject: mvn: add alias to run maven from a project's subdirectory --- plugins/mvn/mvn.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index f4c46bfa1..7dd3c98dd 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -54,6 +54,9 @@ mvn-color() { # either use orignal mvn oder the mvn wrapper alias mvn="mvn-or-mvnw" +# Run mvn against the pom found in a project's root directory (assumes a git repo) +alias 'mvn!'='mvn -f $(git rev-parse --show-toplevel 2>/dev/null || echo ".")/pom.xml' + # aliases alias mvncini='mvn clean initialize' alias mvncie='mvn clean install eclipse:eclipse' -- cgit v1.2.3-70-g09d2 From 9afaa0c40625a8fa03531efeac6e364d15810e95 Mon Sep 17 00:00:00 2001 From: Bryan Banz Date: Wed, 22 Oct 2014 12:15:29 -0500 Subject: mvn: add integration-test options to mvn autocomplete --- plugins/mvn/mvn.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 7dd3c98dd..28d49d73b 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -90,7 +90,10 @@ alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' function listMavenCompletions { reply=( # common lifecycle - clean initialize process-resources compile process-test-resources test-compile test integration-test package verify install deploy site + clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site + + # integration testing + pre-integration-test integration-test # common plugins deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt -- cgit v1.2.3-70-g09d2 From 5b569149f33a2eadd29f303a3e2f09d9e3c67c2e Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 17 Feb 2019 17:34:31 +0100 Subject: mvn: fix formatting --- plugins/mvn/mvn.plugin.zsh | 440 ++++++++++++++++++++++----------------------- 1 file changed, 218 insertions(+), 222 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 28d49d73b..a6cd4edd1 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -22,34 +22,31 @@ RESET_FORMATTING=$(tput sgr0) # if found an executable ./mvnw file execute it otherwise execute orignal mvn mvn-or-mvnw() { - if [ -x ./mvnw ] ; then - echo "executing mvnw instead of mvn" - ./mvnw "$@"; + if [ -x ./mvnw ]; then + echo "executing mvnw instead of mvn" + ./mvnw "$@" else - mvn "$@"; + mvn "$@" fi } # Wrapper function for Maven's mvn command. mvn-color() { - ( - # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations - unset LANG - LC_CTYPE=C mvn "$@" | sed \ - -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_RED}${BOLD}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ - -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" - - # Make sure formatting is reset - echo -ne "${RESET_FORMATTING}" - ) -} + ( + # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations + unset LANG + LC_CTYPE=C mvn "$@" | sed \ + -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_RED}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ + -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ + -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" -# Override the mvn command with the colorized one. -#alias mvn="mvn-color" + # Make sure formatting is reset + echo -ne "${RESET_FORMATTING}" + ) +} # either use orignal mvn oder the mvn wrapper alias mvn="mvn-or-mvnw" @@ -77,7 +74,7 @@ alias mvnct='mvn clean test' alias mvnt='mvn test' alias mvnag='mvn archetype:generate' alias mvn-updates='mvn versions:display-dependency-updates' -alias mvntc7='mvn tomcat7:run' +alias mvntc7='mvn tomcat7:run' alias mvntc='mvn tomcat:run' alias mvnjetty='mvn jetty:run' alias mvnboot='mvn spring-boot:run' @@ -87,219 +84,218 @@ alias mvnsrc='mvn dependency:sources' alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' -function listMavenCompletions { - reply=( - # common lifecycle - clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site +function listMavenCompletions { + reply=( + # common lifecycle + clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site - # integration testing - pre-integration-test integration-test + # integration testing + pre-integration-test integration-test - # common plugins - deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt + # common plugins + deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt - # deploy - deploy:deploy-file - # failsafe - failsafe:integration-test failsafe:verify - # install - install:install-file install:help - # site - site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site - # surefire - surefire:test + # deploy + deploy:deploy-file + # failsafe + failsafe:integration-test failsafe:verify + # install + install:install-file install:help + # site + site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site + # surefire + surefire:test - # checkstyle - checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate - # javadoc - javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle - # jxr - jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate - # pmd - pmd:pmd pmd:cpd pmd:check pmd:cpd-check + # checkstyle + checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate + # javadoc + javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle + # jxr + jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate + # pmd + pmd:pmd pmd:cpd pmd:check pmd:cpd-check - # ant - ant:ant ant:clean - # antrun - antrun:run - # archetype - archetype:generate archetype:create-from-project archetype:crawl - # assembly - assembly:single assembly:assembly - # dependency - dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies - # enforcer - enforcer:enforce enforcer:display-info - # gpg - gpg:sign gpg:sign-and-deploy-file - # help - help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system - # release - release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions - # jgitflow - jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number - # repository - repository:bundle-create repository:bundle-pack - # source - source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork + # ant + ant:ant ant:clean + # antrun + antrun:run + # archetype + archetype:generate archetype:create-from-project archetype:crawl + # assembly + assembly:single assembly:assembly + # dependency + dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies + # enforcer + enforcer:enforce enforcer:display-info + # gpg + gpg:sign gpg:sign-and-deploy-file + # help + help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system + # release + release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions + # jgitflow + jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number + # repository + repository:bundle-create repository:bundle-pack + # source + source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork - # eclipse - eclipse:clean eclipse:eclipse - # idea - idea:clean idea:idea + # eclipse + eclipse:clean eclipse:eclipse + # idea + idea:clean idea:idea - # jetty - jetty:run jetty:run-exploded - # cargo - cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help - # jboss - jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy - # tomcat - tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy - # tomcat6 - tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy - # tomcat7 - tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy - # tomee - tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy - # spring-boot - spring-boot:run spring-boot:repackage - # exec - exec:exec exec:java - # versions - versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert - # scm - scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate - # buildnumber - buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset + # jetty + jetty:run jetty:run-exploded + # cargo + cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help + # jboss + jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy + # tomcat + tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy + # tomcat6 + tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy + # tomcat7 + tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy + # tomee + tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy + # spring-boot + spring-boot:run spring-boot:repackage + # exec + exec:exec exec:java + # versions + versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert + # scm + scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate + # buildnumber + buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset - # war - war:war war:exploded war:inplace war:manifest - # ear - ear:ear ear:generate-application-xml - # ejb - ejb:ejb - # android - android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices - # nexus - nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download - # repository - repository:bundle-create repository:bundle-pack repository:help + # war + war:war war:exploded war:inplace war:manifest + # ear + ear:ear ear:generate-application-xml + # ejb + ejb:ejb + # android + android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices + # nexus + nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download + # repository + repository:bundle-create repository:bundle-pack repository:help - # sonar - sonar:sonar - # license - license:format license:check - # hibernate3 - hibernate3:hbm2ddl hibernate3:help - # liquibase - liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback - # flyway - flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate - # gwt - gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test - # asciidoctor - asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip - # compiler - compiler:compile compiler:testCompile - # resources - resources:resources resources:testResources resources:copy-resources - # verifier - verifier:verify - # jar - jar:jar jar:test-jar - # rar - rar:rar - # acr - acr:acr - # shade - shade:shade - # changelog - changelog:changelog changelog:dev-activity changelog:file-activity - # changes - changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report - # doap - doap:generate - # docck - docck:check - # jdeps - jdeps:jdkinternals jdeps:test-jdkinternals - # linkcheck - linkcheck:linkcheck - # project-info-reports - project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary - # surefire-report - surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only - # invoker - invoker:install invoker:integration-test invoker:verify invoker:run - # jarsigner - jarsigner:sign jarsigner:verify - # patch - patch:apply - # pdf - pdf:pdf - # plugin - plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo - # remote-resources - remote-resources:bundle remote-resources:process - # scm-publish - scm-publish:help scm-publish:publish-scm scm-publish:scmpublish - # stage - stage:copy - # toolchain - toolchain:toolchain - - # options - "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" + # sonar + sonar:sonar + # license + license:format license:check + # hibernate3 + hibernate3:hbm2ddl hibernate3:help + # liquibase + liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback + # flyway + flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate + # gwt + gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test + # asciidoctor + asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip + # compiler + compiler:compile compiler:testCompile + # resources + resources:resources resources:testResources resources:copy-resources + # verifier + verifier:verify + # jar + jar:jar jar:test-jar + # rar + rar:rar + # acr + acr:acr + # shade + shade:shade + # changelog + changelog:changelog changelog:dev-activity changelog:file-activity + # changes + changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report + # doap + doap:generate + # docck + docck:check + # jdeps + jdeps:jdkinternals jdeps:test-jdkinternals + # linkcheck + linkcheck:linkcheck + # project-info-reports + project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary + # surefire-report + surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only + # invoker + invoker:install invoker:integration-test invoker:verify invoker:run + # jarsigner + jarsigner:sign jarsigner:verify + # patch + patch:apply + # pdf + pdf:pdf + # plugin + plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo + # remote-resources + remote-resources:bundle remote-resources:process + # scm-publish + scm-publish:help scm-publish:publish-scm scm-publish:scmpublish + # stage + stage:copy + # toolchain + toolchain:toolchain - # arguments - -am --also-make - -amd --also-make-dependents-am - -B --batch-mode - -b --builder - -C --strict-checksums - -c --lax-checksums - -cpu --check-plugin-updates - -D --define - -e --errors - -emp --encrypt-master-password - -ep --encrypt-password - -f --file - -fae --fail-at-end - -ff --fail-fast - -fn --fail-never - -gs --global-settings - -gt --global-toolchains - -h --help - -l --log-file - -llr --legacy-local-repository - -N --non-recursive - -npr --no-plugin-registry - -npu --no-plugin-updates - -nsu --no-snapshot-updates - -o --offline - -P --activate-profiles - -pl --projects - -q --quiet - -rf --resume-from - -s --settings - -t --toolchains - -T --threads - -U --update-snapshots - -up --update-plugins - -v --version - -V --show-version - -X --debug + # options + "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" - cli:execute cli:execute-phase - archetype:generate generate-sources - cobertura:cobertura - -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) - -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) - ); + # arguments + -am --also-make + -amd --also-make-dependents-am + -B --batch-mode + -b --builder + -C --strict-checksums + -c --lax-checksums + -cpu --check-plugin-updates + -D --define + -e --errors + -emp --encrypt-master-password + -ep --encrypt-password + -f --file + -fae --fail-at-end + -ff --fail-fast + -fn --fail-never + -gs --global-settings + -gt --global-toolchains + -h --help + -l --log-file + -llr --legacy-local-repository + -N --non-recursive + -npr --no-plugin-registry + -npu --no-plugin-updates + -nsu --no-snapshot-updates + -o --offline + -P --activate-profiles + -pl --projects + -q --quiet + -rf --resume-from + -s --settings + -t --toolchains + -T --threads + -U --update-snapshots + -up --update-plugins + -v --version + -V --show-version + -X --debug + + cli:execute cli:execute-phase + archetype:generate generate-sources + cobertura:cobertura + -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) + -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) + ) } compctl -K listMavenCompletions mvn mvnw compctl -K listMavenCompletions mvn-color compctl -K listMavenCompletions mvn-or-mvnw - -- cgit v1.2.3-70-g09d2 From b767976586a4be87a8e57bbe7feddab9fda097b6 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 17 Feb 2019 17:35:57 +0100 Subject: mvn: use echoti instead of tput Avoids forking to tput and some systems don't have tput --- plugins/mvn/mvn.plugin.zsh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index a6cd4edd1..b557c23e8 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,24 +1,24 @@ # mvn-color based on https://gist.github.com/1027800 -BOLD=$(tput bold) -UNDERLINE_ON=$(tput smul) -UNDERLINE_OFF=$(tput rmul) -TEXT_BLACK=$(tput setaf 0) -TEXT_RED=$(tput setaf 1) -TEXT_GREEN=$(tput setaf 2) -TEXT_YELLOW=$(tput setaf 3) -TEXT_BLUE=$(tput setaf 4) -TEXT_MAGENTA=$(tput setaf 5) -TEXT_CYAN=$(tput setaf 6) -TEXT_WHITE=$(tput setaf 7) -BACKGROUND_BLACK=$(tput setab 0) -BACKGROUND_RED=$(tput setab 1) -BACKGROUND_GREEN=$(tput setab 2) -BACKGROUND_YELLOW=$(tput setab 3) -BACKGROUND_BLUE=$(tput setab 4) -BACKGROUND_MAGENTA=$(tput setab 5) -BACKGROUND_CYAN=$(tput setab 6) -BACKGROUND_WHITE=$(tput setab 7) -RESET_FORMATTING=$(tput sgr0) +BOLD=$(echoti bold) +UNDERLINE_ON=$(echoti smul) +UNDERLINE_OFF=$(echoti rmul) +TEXT_BLACK=$(echoti setaf 0) +TEXT_RED=$(echoti setaf 1) +TEXT_GREEN=$(echoti setaf 2) +TEXT_YELLOW=$(echoti setaf 3) +TEXT_BLUE=$(echoti setaf 4) +TEXT_MAGENTA=$(echoti setaf 5) +TEXT_CYAN=$(echoti setaf 6) +TEXT_WHITE=$(echoti setaf 7) +BACKGROUND_BLACK=$(echoti setab 0) +BACKGROUND_RED=$(echoti setab 1) +BACKGROUND_GREEN=$(echoti setab 2) +BACKGROUND_YELLOW=$(echoti setab 3) +BACKGROUND_BLUE=$(echoti setab 4) +BACKGROUND_MAGENTA=$(echoti setab 5) +BACKGROUND_CYAN=$(echoti setab 6) +BACKGROUND_WHITE=$(echoti setab 7) +RESET_FORMATTING=$(echoti sgr0) # if found an executable ./mvnw file execute it otherwise execute orignal mvn mvn-or-mvnw() { -- cgit v1.2.3-70-g09d2 From c636e0933a63c85b3c6cef251e1c91d4a8bdb83d Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 17 Feb 2019 18:28:24 +0100 Subject: mvn: avoid mvn-or-mvnw function calling itself when mvn is aliased to it --- plugins/mvn/mvn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index b557c23e8..1bc678b74 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -26,7 +26,7 @@ mvn-or-mvnw() { echo "executing mvnw instead of mvn" ./mvnw "$@" else - mvn "$@" + command mvn "$@" fi } -- cgit v1.2.3-70-g09d2 From 006b88209872f5f26c57fbb8c0e5d17d5e1ddd9d Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 17 Feb 2019 18:30:38 +0100 Subject: mvn: clean up mvn-color function --- plugins/mvn/mvn.plugin.zsh | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 1bc678b74..7e31da46a 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,25 +1,3 @@ -# mvn-color based on https://gist.github.com/1027800 -BOLD=$(echoti bold) -UNDERLINE_ON=$(echoti smul) -UNDERLINE_OFF=$(echoti rmul) -TEXT_BLACK=$(echoti setaf 0) -TEXT_RED=$(echoti setaf 1) -TEXT_GREEN=$(echoti setaf 2) -TEXT_YELLOW=$(echoti setaf 3) -TEXT_BLUE=$(echoti setaf 4) -TEXT_MAGENTA=$(echoti setaf 5) -TEXT_CYAN=$(echoti setaf 6) -TEXT_WHITE=$(echoti setaf 7) -BACKGROUND_BLACK=$(echoti setab 0) -BACKGROUND_RED=$(echoti setab 1) -BACKGROUND_GREEN=$(echoti setab 2) -BACKGROUND_YELLOW=$(echoti setab 3) -BACKGROUND_BLUE=$(echoti setab 4) -BACKGROUND_MAGENTA=$(echoti setab 5) -BACKGROUND_CYAN=$(echoti setab 6) -BACKGROUND_WHITE=$(echoti setab 7) -RESET_FORMATTING=$(echoti sgr0) - # if found an executable ./mvnw file execute it otherwise execute orignal mvn mvn-or-mvnw() { if [ -x ./mvnw ]; then @@ -31,13 +9,21 @@ mvn-or-mvnw() { } # Wrapper function for Maven's mvn command. +# based on https://gist.github.com/1027800 mvn-color() { + local BOLD=$(echoti bold) + local TEXT_RED=$(echoti setaf 1) + local TEXT_GREEN=$(echoti setaf 2) + local TEXT_YELLOW=$(echoti setaf 3) + local TEXT_BLUE=$(echoti setaf 4) + local TEXT_WHITE=$(echoti setaf 7) + local RESET_FORMATTING=$(echoti sgr0) ( # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations unset LANG LC_CTYPE=C mvn "$@" | sed \ -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_RED}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_WHITE}${BOLD}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ -- cgit v1.2.3-70-g09d2 From d0a0421e10e222f76c30cdaa04fed2f4911a5272 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 17 Feb 2019 18:50:46 +0100 Subject: mvn: sort aliases and improve comments and README --- plugins/mvn/README.md | 45 ++++++++++++++++++++++++++++++++------------- plugins/mvn/mvn.plugin.zsh | 43 +++++++++++++++++++++---------------------- 2 files changed, 53 insertions(+), 35 deletions(-) diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index be6bd6db3..3f08c56d8 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -10,26 +10,45 @@ plugins=(... mvn) ## Aliases +The plugin aliases mvn to a either calls `mvnw` ([Maven Wrapper](https://github.com/takari/maven-wrapper)) +if it's found, or the mvn command otherwise. + | Alias | Command | |:---------------------|:------------------------------------------------| -| `mvncie` | `mvn clean install eclipse:eclipse` | +| `mvn!` | `mvn -f /pom.xml` | +| `mvnag` | `mvn archetype:generate` | +| `mvnboot` | `mvn spring-boot:run` | +| `mvnc` | `mvn clean` | +| `mvncd` | `mvn clean deploy` | +| `mvnce` | `mvn clean eclipse:clean eclipse:eclipse` | | `mvnci` | `mvn clean install` | +| `mvncie` | `mvn clean install eclipse:eclipse` | +| `mvncini` | `mvn clean initialize` | | `mvncist` | `mvn clean install -DskipTests` | | `mvncisto` | `mvn clean install -DskipTests --offline` | -| `mvne` | `mvn eclipse:eclipse` | -| `mvncv` | `mvn clean verify` | -| `mvnd` | `mvn deploy` | -| `mvncd` | `mvn clean deploy` | -| `mvnp` | `mvn package` | -| `mvnc` | `mvn clean` | | `mvncom` | `mvn compile` | +| `mvncp` | `mvn clean package` | | `mvnct` | `mvn clean test` | -| `mvnt` | `mvn test` | -| `mvnag` | `mvn archetype:generate` | -| `mvn-updates` | `mvn versions:display-dependency-updates` | -| `mvntc7` | `mvn tomcat7:run` | -| `mvnjetty` | `mvn jetty:run` | +| `mvncv` | `mvn clean verify` | +| `mvncvst` | `mvn clean verify -DskipTests` | +| `mvnd` | `mvn deploy` | +| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` | | `mvndt` | `mvn dependency:tree` | +| `mvne` | `mvn eclipse:eclipse` | +| `mvnjetty` | `mvn jetty:run` | +| `mvnp` | `mvn package` | | `mvns` | `mvn site` | | `mvnsrc` | `mvn dependency:sources` | -| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` | +| `mvnt` | `mvn test` | +| `mvntc` | `mvn tomcat:run` | +| `mvntc7` | `mvn tomcat7:run` | +| `mvn-updates` | `mvn versions:display-dependency-updates` | + +## mvn-color + +It's a function that wraps the mvn command to colorize it's output. Since Maven 3.5.0 +the mvn command adds colored output, so this function will be soon removed from the +plugin. + +It also has a bug where it won't print when mvn prompts for user input, _e.g._ when +using `archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052). diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 7e31da46a..66ea548ad 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,4 +1,4 @@ -# if found an executable ./mvnw file execute it otherwise execute orignal mvn +# Calls ./mvnw if found, otherwise execute the original mvn mvn-or-mvnw() { if [ -x ./mvnw ]; then echo "executing mvnw instead of mvn" @@ -8,8 +8,7 @@ mvn-or-mvnw() { fi } -# Wrapper function for Maven's mvn command. -# based on https://gist.github.com/1027800 +# Wrapper function for Maven's mvn command. Based on https://gist.github.com/1027800 mvn-color() { local BOLD=$(echoti bold) local TEXT_RED=$(echoti setaf 1) @@ -34,40 +33,40 @@ mvn-color() { ) } -# either use orignal mvn oder the mvn wrapper +# either use orignal mvn or the mvn wrapper alias mvn="mvn-or-mvnw" # Run mvn against the pom found in a project's root directory (assumes a git repo) alias 'mvn!'='mvn -f $(git rev-parse --show-toplevel 2>/dev/null || echo ".")/pom.xml' # aliases -alias mvncini='mvn clean initialize' -alias mvncie='mvn clean install eclipse:eclipse' +alias mvnag='mvn archetype:generate' +alias mvnboot='mvn spring-boot:run' +alias mvnc='mvn clean' +alias mvncd='mvn clean deploy' +alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvnci='mvn clean install' -alias mvncp='mvn clean package' +alias mvncie='mvn clean install eclipse:eclipse' +alias mvncini='mvn clean initialize' alias mvncist='mvn clean install -DskipTests' alias mvncisto='mvn clean install -DskipTests --offline' -alias mvne='mvn eclipse:eclipse' -alias mvnce='mvn clean eclipse:clean eclipse:eclipse' +alias mvncom='mvn compile' +alias mvncp='mvn clean package' +alias mvnct='mvn clean test' alias mvncv='mvn clean verify' alias mvncvst='mvn clean verify -DskipTests' alias mvnd='mvn deploy' -alias mvncd='mvn clean deploy' -alias mvnp='mvn package' -alias mvnc='mvn clean' -alias mvncom='mvn compile' -alias mvnct='mvn clean test' -alias mvnt='mvn test' -alias mvnag='mvn archetype:generate' -alias mvn-updates='mvn versions:display-dependency-updates' -alias mvntc7='mvn tomcat7:run' -alias mvntc='mvn tomcat:run' -alias mvnjetty='mvn jetty:run' -alias mvnboot='mvn spring-boot:run' +alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' alias mvndt='mvn dependency:tree' +alias mvne='mvn eclipse:eclipse' +alias mvnjetty='mvn jetty:run' +alias mvnp='mvn package' alias mvns='mvn site' alias mvnsrc='mvn dependency:sources' -alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' +alias mvnt='mvn test' +alias mvntc='mvn tomcat:run' +alias mvntc7='mvn tomcat7:run' +alias mvn-updates='mvn versions:display-dependency-updates' function listMavenCompletions { -- cgit v1.2.3-70-g09d2 From fff756069f678ceda0b7c760b843c09bbc2bc72d Mon Sep 17 00:00:00 2001 From: kubamarchwicki Date: Sun, 1 Jun 2014 21:01:01 +0200 Subject: mvn: add dynamic profile support to mvn completion * Maven profiles for current pom.xml file * Maven profiles for pom hierarchy * Ommiting comments in profiles --- plugins/mvn/mvn.plugin.zsh | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 66ea548ad..71bba454c 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -68,8 +68,66 @@ alias mvntc='mvn tomcat:run' alias mvntc7='mvn tomcat7:run' alias mvn-updates='mvn versions:display-dependency-updates' +#realpath replacement for iOS - not always present +function _realpath { + if [[ -f "$1" ]] + then + # file *must* exist + if cd "$(echo "${1%/*}")" &>/dev/null + then + # file *may* not be local + # exception is ./file.ext + # try 'cd .; cd -;' *works!* + local tmppwd="$PWD" + cd - &>/dev/null + else + # file *must* be local + local tmppwd="$PWD" + fi + else + # file *cannot* exist + return 1 # failure + fi + + # reassemble realpath + echo "$tmppwd"/"${1##*/}" + return 1 #success +} + +function __pom_hierarchy { + local file=`_realpath "pom.xml"` + POM_HIERARCHY+=("~/.m2/settings.xml") + POM_HIERARCHY+=("$file") + while [ -n "$file" ] && grep -q "" $file; do + ##look for a new relativePath for parent pom.xml + local new_file=`grep -e ".*" $file | sed 's/.*//' | sed 's/<\/relativePath>.*//g'` + + ## is present but not defined. Asume ../pom.xml + if [ -z "$new_file" ]; then + new_file="../pom.xml" + fi + + ## if file exists continue else break + new_pom=`_realpath "${file%/*}/$new_file"` + if [ -n "$new_pom" ]; then + file=$new_pom + else + break + fi + POM_HIERARCHY+=("$file") + done +} function listMavenCompletions { + POM_HIERARCHY=() + __pom_hierarchy + + profiles=() + #current pom profiles + for item in ${POM_HIERARCHY[*]}; do + profiles=($profiles `[ -e $item ] && cat $item | sed 's///' | sed '//d' | grep -e "" -A 1 | grep -e ".*" | sed 's?.*\(.*\)<\/id>.*?-P\1?'`) + done + reply=( # common lifecycle clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site @@ -278,7 +336,12 @@ function listMavenCompletions { cobertura:cobertura -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) + + $profiles ) + + unset POM_HIERARCHY + unset profiles } compctl -K listMavenCompletions mvn mvnw -- cgit v1.2.3-70-g09d2 From f4b2e460c77b79f99831cd048eb0004059c96370 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 17 Feb 2019 20:28:32 +0100 Subject: mvn: fix and cleanup dynamic profiles logic --- plugins/mvn/mvn.plugin.zsh | 78 ++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 51 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 71bba454c..01aef814d 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -68,64 +68,43 @@ alias mvntc='mvn tomcat:run' alias mvntc7='mvn tomcat7:run' alias mvn-updates='mvn versions:display-dependency-updates' -#realpath replacement for iOS - not always present -function _realpath { - if [[ -f "$1" ]] - then - # file *must* exist - if cd "$(echo "${1%/*}")" &>/dev/null - then - # file *may* not be local - # exception is ./file.ext - # try 'cd .; cd -;' *works!* - local tmppwd="$PWD" - cd - &>/dev/null - else - # file *must* be local - local tmppwd="$PWD" - fi - else - # file *cannot* exist - return 1 # failure - fi - # reassemble realpath - echo "$tmppwd"/"${1##*/}" - return 1 #success -} +function listMavenCompletions { + local file new_file + local -a profiles POM_FILES + + # Root POM + POM_FILES=(~/.m2/settings.xml) -function __pom_hierarchy { - local file=`_realpath "pom.xml"` - POM_HIERARCHY+=("~/.m2/settings.xml") - POM_HIERARCHY+=("$file") - while [ -n "$file" ] && grep -q "" $file; do - ##look for a new relativePath for parent pom.xml - local new_file=`grep -e ".*" $file | sed 's/.*//' | sed 's/<\/relativePath>.*//g'` + # POM in the current directory + if [[ -f pom.xml ]]; then + local file=pom.xml + POM_FILES+=("${file:A}") + fi - ## is present but not defined. Asume ../pom.xml - if [ -z "$new_file" ]; then + # Look for POM files in parent directories + while [[ -n "$file" ]] && grep -q "" "$file"; do + # look for a new relativePath for parent pom.xml + new_file=$(grep -e ".*" "$file" | sed -e 's/.*\(.*\)<\/relativePath>.*/\1/') + + # if is present but not defined, assume ../pom.xml + if [[ -z "$new_file" ]]; then new_file="../pom.xml" fi - ## if file exists continue else break - new_pom=`_realpath "${file%/*}/$new_file"` - if [ -n "$new_pom" ]; then - file=$new_pom - else + # if file doesn't exist break + file="${file:h}/${new_file}" + if ! [[ -e "$file" ]]; then break fi - POM_HIERARCHY+=("$file") - done -} -function listMavenCompletions { - POM_HIERARCHY=() - __pom_hierarchy + POM_FILES+=("${file:A}") + done - profiles=() - #current pom profiles - for item in ${POM_HIERARCHY[*]}; do - profiles=($profiles `[ -e $item ] && cat $item | sed 's///' | sed '//d' | grep -e "" -A 1 | grep -e ".*" | sed 's?.*\(.*\)<\/id>.*?-P\1?'`) + # Get profiles from found files + for file in $POM_FILES; do + [[ -e $file ]] || continue + profiles+=($(sed 's///' "$file" | sed '//d' | grep -e "" -A 1 | grep -e ".*" | sed 's?.*\(.*\)<\/id>.*?-P\1?')) done reply=( @@ -339,9 +318,6 @@ function listMavenCompletions { $profiles ) - - unset POM_HIERARCHY - unset profiles } compctl -K listMavenCompletions mvn mvnw -- cgit v1.2.3-70-g09d2 From 0e647904ffdd19c697e1c6ab602f65377cb186fe Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 17 Feb 2019 20:48:13 +0100 Subject: mvn: update documentation --- plugins/mvn/README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index 3f08c56d8..88f5be8ba 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -1,7 +1,7 @@ -## Introduction +# mvn plugin -The [mvn plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) provides many -[useful aliases](#aliases) as well as completion for the `mvn` command. +The mvn plugin provides many [useful aliases](#aliases) as well as completion for +the [Apache Maven](https://maven.apache.org/) command (`mvn`). Enable it by adding `mvn` to the plugins array in your zshrc file: ```zsh @@ -10,7 +10,7 @@ plugins=(... mvn) ## Aliases -The plugin aliases mvn to a either calls `mvnw` ([Maven Wrapper](https://github.com/takari/maven-wrapper)) +The plugin aliases mvn to a function that calls `mvnw` (the [Maven Wrapper](https://github.com/takari/maven-wrapper)) if it's found, or the mvn command otherwise. | Alias | Command | @@ -46,9 +46,13 @@ if it's found, or the mvn command otherwise. ## mvn-color -It's a function that wraps the mvn command to colorize it's output. Since Maven 3.5.0 -the mvn command adds colored output, so this function will be soon removed from the -plugin. +It's a function that wraps the mvn command to colorize it's output. You can use it in place +of the `mvn` command. For example: instead of `mvn test`, use `mvn-color test`. -It also has a bug where it won't print when mvn prompts for user input, _e.g._ when -using `archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052). +Since [Maven 3.5.0](https://maven.apache.org/docs/3.5.0/release-notes.html) the mvn command +has colored output, so this function will be soon removed from the plugin. + +### Known bugs + +It has a bug where it will swallow mvn prompts for user input, _e.g._ when using +`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052). -- cgit v1.2.3-70-g09d2 From dfd1b4f8dfe977016bfe0ecd0fc360a526252827 Mon Sep 17 00:00:00 2001 From: Muhannad Fakhouri Date: Sun, 17 Feb 2019 23:10:17 +0100 Subject: adb: improve `adb -s` completion to show helpful info (#7532) Currently it shows for example the following: DEVICE_ID -- transport_id:2 which doesn't really ease device selection. I've adapted the awk script to print device name with it's model name, see the example below: DEVICE_ID -- Pixel_3(blueline) --- plugins/adb/_adb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/adb/_adb b/plugins/adb/_adb index e3c20d751..78c457746 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -49,7 +49,12 @@ _arguments \ case "$state" in specify_device) _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \ - {sub(/ +/," ",$0);gsub(":","\\:",$1); printf "%s[%s] ",$1, $NF}'):-""} + {sub(/ +/," ",$0); \ + gsub(":","\\:",$1); \ + for(i=1;i<=NF;i++) { + if($i ~ /model:/) { split($i,m,":") } \ + else if($i ~ /product:/) { split($i,p,":") } } \ + printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""} return ;; esac @@ -59,4 +64,4 @@ if (( CURRENT == 1 )); then return fi -_files \ No newline at end of file +_files -- cgit v1.2.3-70-g09d2 From ca1123a044e7e09dd8376868b372c541aedcd82d Mon Sep 17 00:00:00 2001 From: Thomas Hutterer Date: Wed, 20 Feb 2019 16:59:57 +0100 Subject: Fix "hurt sme" typo Just found this typo while browsing through the `plugins` folder ... and it "hurt sme" :hurtrealbad: --- plugins/fancy-ctrl-z/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/fancy-ctrl-z/README.md b/plugins/fancy-ctrl-z/README.md index a7670fa2c..f1b1dfa5c 100644 --- a/plugins/fancy-ctrl-z/README.md +++ b/plugins/fancy-ctrl-z/README.md @@ -1,10 +1,10 @@ # Use Ctrl-Z to switch back to Vim -I frequently need to execute random command in my shell. To achieve it I pause +I frequently need to execute random commands in my shell. To achieve it I pause Vim by pressing Ctrl-z, type command and press fg to switch back to Vim. -The fg part really hurt sme. I just wanted to hit Ctrl-z once again to get back +The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back to Vim. I could not find a solution, so I developed one on my own that -works wonderfully with ZSH +works wonderfully with ZSH. Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/ -- cgit v1.2.3-70-g09d2 From 243c46b7cd85c3578bbba8501fae62befc25f378 Mon Sep 17 00:00:00 2001 From: Deepankumar Date: Sat, 23 Feb 2019 09:00:05 +0100 Subject: fixed aplay conflict --- plugins/ansible/README.md | 3 +-- plugins/ansible/ansible.plugin.zsh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/ansible/README.md b/plugins/ansible/README.md index 38bc13775..e0e6a19bb 100644 --- a/plugins/ansible/README.md +++ b/plugins/ansible/README.md @@ -19,9 +19,8 @@ plugins=(... ansible) | `a` | command `ansible` | | `aconf` | command `ansible-config` | | `acon` | command `ansible-console` | -| `aconn` | command `ansible-connection` | | `ainv` | command `ansible-inventory` | -| `aplay` | command `ansible-playbook` | +| `aplaybook` | command `ansible-playbook` | | `ainv` | command `ansible-inventory` | | `adoc` | command `ansible-doc` | | `agal` | command `ansible-galaxy` | diff --git a/plugins/ansible/ansible.plugin.zsh b/plugins/ansible/ansible.plugin.zsh index 0e7aff528..f68ff23a5 100644 --- a/plugins/ansible/ansible.plugin.zsh +++ b/plugins/ansible/ansible.plugin.zsh @@ -18,10 +18,9 @@ function ansible-role-init(){ alias a='ansible ' alias aconf='ansible-config ' alias acon='ansible-console ' -alias aconn='ansible-connection ' alias aver='ansible-version' alias arinit='ansible-role-init' -alias aplay='ansible-playbook ' +alias aplaybook='ansible-playbook ' alias ainv='ansible-inventory ' alias adoc='ansible-doc ' alias agal='ansible-galaxy ' -- cgit v1.2.3-70-g09d2 From 25d0a10cda82edfa6cf5e1611e018a714ecbfb3e Mon Sep 17 00:00:00 2001 From: akinnane Date: Mon, 25 Feb 2019 13:37:41 +0000 Subject: Revert "Fix emacs client terminal" (#7597) Reverts robbyrussell/oh-my-zsh#5714 --- plugins/emacs/emacs.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index 934c8d673..db0ab13af 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -16,7 +16,7 @@ if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then # set EDITOR if not already defined. export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}" - alias emacs="$EMACS_PLUGIN_LAUNCHER -t" + alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" alias e=emacs # open terminal emacsclient alias te="$EMACS_PLUGIN_LAUNCHER -nw" -- cgit v1.2.3-70-g09d2 From 4cdffcd4858c7818e5325c03909d75e41995eeae Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 Feb 2019 21:30:00 +0100 Subject: init: cut down on the number of compaudit calls --- oh-my-zsh.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index d7c68d35c..4f6bfd5a5 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -69,14 +69,12 @@ fi if [[ $ZSH_DISABLE_COMPFIX != true ]]; then # If completion insecurities exist, warn the user - if ! compaudit &>/dev/null; then - handle_completion_insecurities - fi + handle_completion_insecurities # Load only from secure directories - compinit -i -d "${ZSH_COMPDUMP}" + compinit -i -C -d "${ZSH_COMPDUMP}" else # If the user wants it, load from all found directories - compinit -u -d "${ZSH_COMPDUMP}" + compinit -u -C -d "${ZSH_COMPDUMP}" fi # Load all of the plugins that were defined in ~/.zshrc -- cgit v1.2.3-70-g09d2 From 55575b88f9e47d88fab02c26fc69e4af48af1cd9 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 Feb 2019 23:20:47 +0100 Subject: lib: optimize default and env_default --- lib/functions.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 4ef8920f6..9f8736bd7 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -79,7 +79,7 @@ function try_alias_value() { # 0 if the variable exists, 3 if it was set # function default() { - test `typeset +m "$1"` && return 0 + (( $+parameters[$1] )) && return 0 typeset -g "$1"="$2" && return 3 } @@ -93,8 +93,8 @@ function default() { # 0 if the env variable exists, 3 if it was set # function env_default() { - env | grep -q "^$1=" && return 0 - export "$1=$2" && return 3 + (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0 + export "$1=$2" && return 3 } -- cgit v1.2.3-70-g09d2 From f319aa845dfa6b202e31dacf49ec8c2b2d5d17c2 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 25 Feb 2019 19:22:07 -0600 Subject: Updating Oh My Zsh shop URLs (#7619) * Updating Oh My Zsh shop URLs Linking directly to the Oh My Zsh inventory vs the top-level store with non-OMZ items. * Updating link to Oh My Zsh products in the install script * Updating link to Oh My Zsh shop products in the upgrade script * Getting rid of 't-' in shirts for now --- README.md | 2 +- tools/install.sh | 2 +- tools/upgrade.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b3651a99c..d6c77a147 100644 --- a/README.md +++ b/README.md @@ -238,7 +238,7 @@ We're on the social media. ## Merchandise -We have [stickers](https://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](https://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town! +We have [stickers, shirts, and coffee mugs available](https://shop.planetargon.com/collections/oh-my-zsh?utm_source=github) for you to show off your love of Oh My Zsh. Again, you will become the talk of the town! ## License diff --git a/tools/install.sh b/tools/install.sh index 2fb87cdaf..e2b33f640 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -105,7 +105,7 @@ main() { echo '' echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' echo '' - echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.' + echo 'p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh.' echo '' printf "${NORMAL}" env zsh -l diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 25b2de27a..d234c7f88 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -33,7 +33,7 @@ then printf '%s\n' ' /____/ ' printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version." printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh" - printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/" + printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh" else printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?' fi -- cgit v1.2.3-70-g09d2 From 934615480e8a008deda1a5330d8fbd47815b7cf4 Mon Sep 17 00:00:00 2001 From: Alec Ge Date: Tue, 26 Feb 2019 15:13:27 -0500 Subject: docs: fixed themes link for readme (#7620) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d6c77a147..511e6aeff 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Most plugins (should! we're working on this) include a __README__, which documen ### Themes -We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out! +We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out! #### Selecting a Theme -- cgit v1.2.3-70-g09d2 From 52afbf77f63844abd719e565a15af2c34075de7f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 3 Mar 2019 20:32:59 +0100 Subject: per-directory-history: update to latest version (0e090e8) --- plugins/per-directory-history/per-directory-history.zsh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh index 53ad963e7..41de2f91d 100644 --- a/plugins/per-directory-history/per-directory-history.zsh +++ b/plugins/per-directory-history/per-directory-history.zsh @@ -26,7 +26,7 @@ # # [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html # [2]: http://dieter.plaetinck.be/per_directory_bash -# [3]: https://www.zsh.org/mla/users/1997/msg00226.html +# [3]: http://www.zsh.org/mla/users/1997/msg00226.html # ################################################################################ # @@ -109,8 +109,13 @@ function _per-directory-history-change-directory() { } function _per-directory-history-addhistory() { - print -Sr -- "${1%%$'\n'}" - fc -p $_per_directory_history_directory + # respect hist_ignore_space + if [[ -o hist_ignore_space ]] && [[ "$1" == \ * ]]; then + true + else + print -Sr -- "${1%%$'\n'}" + fc -p $_per_directory_history_directory + fi } -- cgit v1.2.3-70-g09d2 From e3e0dd599ea4ed3e4d89ed4cadbe049a25013700 Mon Sep 17 00:00:00 2001 From: Rahil Wazir Date: Sun, 10 Mar 2019 21:36:21 +0500 Subject: fix typo (#7643) Extra t in `wp theme updatet` --- plugins/wp-cli/wp-cli.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/wp-cli/wp-cli.plugin.zsh b/plugins/wp-cli/wp-cli.plugin.zsh index 45fac0761..97bed406e 100644 --- a/plugins/wp-cli/wp-cli.plugin.zsh +++ b/plugins/wp-cli/wp-cli.plugin.zsh @@ -109,7 +109,7 @@ alias wptm='wp theme mod' alias wptp='wp theme path' alias wpts='wp theme search' alias wptst='wp theme status' -alias wptu='wp theme updatet' +alias wptu='wp theme update' # Transient -- cgit v1.2.3-70-g09d2 From 275e5b13498e04173f703538bff32fc2c801b4d3 Mon Sep 17 00:00:00 2001 From: Ulrich Schreiner Date: Sun, 10 Mar 2019 17:36:51 +0100 Subject: allow kubectl commands against all namespaces (#7637) * allow kubectl commands against all namespaces * enhance the readme too --- plugins/kubectl/README.md | 1 + plugins/kubectl/kubectl.plugin.zsh | 3 +++ 2 files changed, 4 insertions(+) diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md index b30f90548..3343f0195 100644 --- a/plugins/kubectl/README.md +++ b/plugins/kubectl/README.md @@ -14,6 +14,7 @@ plugins=(... kubectl) | Alias | Command | Description | |:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------| | k | `kubectl` | The kubectl command | +| kca | `kubectl --all-namespaces` | The kubectl command targeting all namespaces | | kaf | `kubectl apply -f` | Apply a YML file | | keti | `kubectl exec -ti` | Drop into an interactive terminal on a container | | | | **Manage configuration quickly to switch contexts between local, dev and staging** | diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index d388d6543..ab7a1a0a4 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -13,6 +13,9 @@ fi # This command is used a LOT both below and in daily life alias k=kubectl +# Execute a kubectl command against all namespaces +alias kca='f(){ kubectl "$@" --all-namespaces; unset -f f; }; f' + # Apply a YML file alias kaf='kubectl apply -f' -- cgit v1.2.3-70-g09d2 From 9509fd6a9193e32e5c2d460786253ba0e98fd741 Mon Sep 17 00:00:00 2001 From: Tieme van Veen Date: Sun, 10 Mar 2019 17:38:06 +0100 Subject: Add git reset to origin alias to git plugin (#7630) --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 12400ede4..4277ac664 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -220,6 +220,7 @@ alias grbm='git rebase master' alias grbs='git rebase --skip' alias grh='git reset' alias grhh='git reset --hard' +alias groh='git reset origin/$(git_current_branch) --hard' alias grm='git rm' alias grmc='git rm --cached' alias grmv='git remote rename' -- cgit v1.2.3-70-g09d2 From 779ff24c2d0091ebbddae938d12b3f117123fc29 Mon Sep 17 00:00:00 2001 From: SomeDer <48731521+SomeDer@users.noreply.github.com> Date: Thu, 21 Mar 2019 19:25:41 +0000 Subject: init: notify user if plugin isn't found (#7679) --- oh-my-zsh.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 4f6bfd5a5..fbb10dd82 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -83,6 +83,8 @@ for plugin ($plugins); do source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH/plugins/$plugin/$plugin.plugin.zsh + else + echo "Warning: plugin $plugin not found" fi done -- cgit v1.2.3-70-g09d2 From de2395c678228a5bc6b22711d2bc1b17797d639d Mon Sep 17 00:00:00 2001 From: Konstantin Gizdov Date: Thu, 21 Mar 2019 21:35:00 +0200 Subject: compfix: fix check for empty string (#7674) --- lib/compfix.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compfix.zsh b/lib/compfix.zsh index 68decc1ed..b09b283f2 100644 --- a/lib/compfix.zsh +++ b/lib/compfix.zsh @@ -18,7 +18,7 @@ function handle_completion_insecurities() { insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} ) # If no such directories exist, get us out of here. - (( ! ${#insecure_dirs} )) && return + [[ -z "${insecure_dirs}" ]] && return # List ownership and permissions of all insecure directories. print "[oh-my-zsh] Insecure completion-dependent directories detected:" -- cgit v1.2.3-70-g09d2 From 8aa8405ea25f768a9bfb9a54d9a0dc05efb4efad Mon Sep 17 00:00:00 2001 From: Jeremy Armstrong Date: Thu, 21 Mar 2019 14:41:55 -0500 Subject: termsupport: add support for tmux* $TERM values (#7622) --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 87d55ee89..aa14f3f07 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -21,7 +21,7 @@ function title { print -Pn "\e]2;$2:q\a" # set window name print -Pn "\e]1;$1:q\a" # set tab name ;; - screen*) + screen*|tmux*) print -Pn "\ek$1:q\e\\" # set screen hardstatus ;; *) -- cgit v1.2.3-70-g09d2 From 1e11a3c112f47ee87f432a5410755239ff43b0bb Mon Sep 17 00:00:00 2001 From: Avi ד Date: Fri, 22 Mar 2019 14:37:08 -0400 Subject: init: fix erroneous plugin not found warning (#7686) Co-authored-by: Se De --- oh-my-zsh.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index fbb10dd82..e080257c1 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -44,6 +44,7 @@ is_plugin() { test -f $base_dir/plugins/$name/$name.plugin.zsh \ || test -f $base_dir/plugins/$name/_$name } + # Add all defined plugins to fpath. This must be done # before running compinit. for plugin ($plugins); do @@ -51,6 +52,8 @@ for plugin ($plugins); do fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) elif is_plugin $ZSH $plugin; then fpath=($ZSH/plugins/$plugin $fpath) + else + echo "Warning: plugin $plugin not found" fi done @@ -83,8 +86,6 @@ for plugin ($plugins); do source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH/plugins/$plugin/$plugin.plugin.zsh - else - echo "Warning: plugin $plugin not found" fi done -- cgit v1.2.3-70-g09d2 From 2b68600d50f2e75ab22583e8cb49fc8ee9a9675f Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Fri, 22 Mar 2019 20:32:29 +0100 Subject: suse: remove sudo from some zypper aliases (#7678) Closes #5564 --- plugins/suse/README.md | 40 ++++++++++++++++++++-------------------- plugins/suse/suse.plugin.zsh | 40 ++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/plugins/suse/README.md b/plugins/suse/README.md index 0e8a7f7ba..b9b069574 100644 --- a/plugins/suse/README.md +++ b/plugins/suse/README.md @@ -15,14 +15,14 @@ plugins=(... suse) | Alias | Commands | Description | | ---------------- | ----------------------------- | -------------------------------------------------------------- | | z | `sudo zypper` | call zypper | -| zh | `sudo zypper -h` | print help | -| zhse | `sudo zypper -h se` | print help for the search command | -| zlicenses | `sudo zypper licenses` | prints a report about licenses and EULAs of installed packages | +| zh | `zypper -h` | print help | +| zhse | `zypper -h se` | print help for the search command | +| zlicenses | `zypper licenses` | prints a report about licenses and EULAs of installed packages | | zps | `sudo zypper ps` | list process using deleted files | | zshell | `sudo zypper shell` | open a zypper shell session | | zsource-download | `sudo zypper source-download` | download source rpms for all installed packages | -| ztos | `sudo zypper tos` | shows the ID string of the target operating system | -| zvcmp | `sudo zypper vcmp` | tell whether version1 is older or newer than version2 | +| ztos | `zypper tos` | shows the ID string of the target operating system | +| zvcmp | `zypper vcmp` | tell whether version1 is older or newer than version2 | ## Packages commands @@ -39,8 +39,8 @@ plugins=(... suse) | Alias | Commands | Description | | ------ | ------------------- | ---------------------- | | zdup | `sudo zypper dup` | upgrade packages | -| zlp | `sudo zypper lp` | list necessary patches | -| zlu | `sudo zypper lu` | list updates | +| zlp | `zypper lp` | list necessary patches | +| zlu | `zypper lu` | list updates | | zpchk | `sudo zypper pchk` | check for patches | | zup | `sudo zypper up` | update packages | | zpatch | `sudo zypper patch` | install patches | @@ -49,16 +49,16 @@ plugins=(... suse) | Alias | Commands | Description | | ------------- | -------------------------- | ---------------------------------------------------- | -| zif | `sudo zypper if` | display info about packages | -| zpa | `sudo zypper pa` | list packages | -| zpatch-info | `sudo zypper patch-info` | display info about patches | -| zpattern-info | `sudo zypper pattern-info` | display info about patterns | -| zproduct-info | `sudo zypper product-info` | display info about products | -| zpch | `sudo zypper pch` | list all patches | -| zpd | `sudo zypper pd` | list products | -| zpt | `sudo zypper pt` | list patterns | -| zse | `sudo zypper se` | search for packages | -| zwp | `sudo zypper wp` | list all packages providing the specified capability | +| zif | `zypper if` | display info about packages | +| zpa | `zypper pa` | list packages | +| zpatch-info | `zypper patch-info` | display info about patches | +| zpattern-info | `zypper pattern-info` | display info about patterns | +| zproduct-info | `zypper product-info` | display info about products | +| zpch | `zypper pch` | list all patches | +| zpd | `zypper pd` | list products | +| zpt | `zypper pt` | list patterns | +| zse | `zypper se` | search for packages | +| zwp | `zypper wp` | list all packages providing the specified capability | ## Repositories commands @@ -66,7 +66,7 @@ plugins=(... suse) | ----- | ------------------- | ---------------------------------------- | | zar | `sudo zypper ar` | add a repository | | zcl | `sudo zypper clean` | clean cache | -| zlr | `sudo zypper lr` | list repositories | +| zlr | `zypper lr` | list repositories | | zmr | `sudo zypper mr` | modify repositories | | znr | `sudo zypper nr` | rename repositories (for the alias only) | | zref | `sudo zypper ref` | refresh repositories | @@ -79,12 +79,12 @@ plugins=(... suse) | zms | `sudo zypper ms` | modify properties of specified services | | zrefs | `sudo zypper refs` | refreshing a service mean executing the service's special task | | zrs | `sudo zypper rs` | remove specified repository index service from the system | -| zls | `sudo zypper ls` | list services defined on the system | +| zls | `zypper ls` | list services defined on the system | ## Package Locks Management commands | Alias | Commands | Description | | ----- | ---------------- | ----------------------------------- | | zal | `sudo zypper al` | add a package lock | | zcl | `sudo zypper cl` | remove unused locks | -| zll | `sudo zypper ll` | list currently active package locks | +| zll | `zypper ll` | list currently active package locks | | zrl | `sudo zypper rl` | remove specified package lock | diff --git a/plugins/suse/suse.plugin.zsh b/plugins/suse/suse.plugin.zsh index 60f7042eb..dcfeccb03 100644 --- a/plugins/suse/suse.plugin.zsh +++ b/plugins/suse/suse.plugin.zsh @@ -1,13 +1,13 @@ #Main commands alias z='sudo zypper' -alias zh='sudo zypper -h' -alias zhse='sudo zypper -h se' -alias zlicenses='sudo zypper licenses' +alias zh='zypper -h' +alias zhse='zypper -h se' +alias zlicenses='zypper licenses' alias zps='sudo zypper ps' alias zshell='sudo zypper shell' alias zsource-download='sudo zypper source-download' -alias ztos='sudo zypper tos' -alias zvcmp='sudo zypper vcmp' +alias ztos='zypper tos' +alias zvcmp='zypper vcmp' #Packages commands alias zin='sudo zypper in' @@ -18,28 +18,28 @@ alias zve='sudo zypper ve' #Updates commands alias zdup='sudo zypper dup' -alias zlp='sudo zypper lp' -alias zlu='sudo zypper lu' +alias zlp='zypper lp' +alias zlu='zypper lu' alias zpchk='sudo zypper pchk' alias zup='sudo zypper up' alias zpatch='sudo zypper patch' #Request commands -alias zif='sudo zypper if' -alias zpa='sudo zypper pa' -alias zpatch-info='sudo zypper patch-info' -alias zpattern-info='sudo zypper pattern-info' -alias zproduct-info='sudo zypper product-info' -alias zpch='sudo zypper pch' -alias zpd='sudo zypper pd' -alias zpt='sudo zypper pt' -alias zse='sudo zypper se' -alias zwp='sudo zypper wp' +alias zif='zypper if' +alias zpa='zypper pa' +alias zpatch-info='zypper patch-info' +alias zpattern-info='zypper pattern-info' +alias zproduct-info='zypper product-info' +alias zpch='zypper pch' +alias zpd='zypper pd' +alias zpt='zypper pt' +alias zse='zypper se' +alias zwp='zypper wp' #Repositories commands alias zar='sudo zypper ar' alias zcl='sudo zypper clean' -alias zlr='sudo zypper lr' +alias zlr='zypper lr' alias zmr='sudo zypper mr' alias znr='sudo zypper nr' alias zref='sudo zypper ref' @@ -50,10 +50,10 @@ alias zas='sudo zypper as' alias zms='sudo zypper ms' alias zrefs='sudo zypper refs' alias zrs='sudo zypper rs' -alias zls='sudo zypper ls' +alias zls='zypper ls' #Package Locks Management commands alias zal='sudo zypper al' alias zcl='sudo zypper cl' -alias zll='sudo zypper ll' +alias zll='zypper ll' alias zrl='sudo zypper rl' -- cgit v1.2.3-70-g09d2 From 6fe4ac024a0373a847b3a4c1b59e9509d5832c25 Mon Sep 17 00:00:00 2001 From: Zixu Wang Date: Sat, 23 Mar 2019 08:57:46 -0700 Subject: web-search: update alias for stackoverflow (#7660) Changed from `stack` because it conflicts with Haskell Tool Stack Fixes #7659 --- plugins/web-search/README.md | 1 + plugins/web-search/web-search.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/web-search/README.md b/plugins/web-search/README.md index d790d944d..5b09b8980 100644 --- a/plugins/web-search/README.md +++ b/plugins/web-search/README.md @@ -37,6 +37,7 @@ Available search contexts are: | `ecosia` | `https://www.ecosia.org/search?q=` | | `goodreads` | `https://www.goodreads.com/search?q=` | | `qwant` | `https://www.qwant.com/?q=` | +| `stackoverflow` | `https://stackoverflow.com/search?q=` | Also there are aliases for bang-searching DuckDuckGo: diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index 18cc0614a..9a70d7bc6 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -52,7 +52,7 @@ alias baidu='web_search baidu' alias ecosia='web_search ecosia' alias goodreads='web_search goodreads' alias qwant='web_search qwant' -alias stack='web_search stackoverflow' +alias stackoverflow='web_search stackoverflow' #add your own !bang searches here alias wiki='web_search duckduckgo \!w' -- cgit v1.2.3-70-g09d2 From 9975b16297e3c5619bdb88cc8f029a90ee80bb27 Mon Sep 17 00:00:00 2001 From: Peter Theill Date: Sat, 23 Mar 2019 17:03:45 +0100 Subject: web-search: add Givero (supports good causes) as search engine (#7581) Adds "givero" as a keyword for searching Givero, a relative new search engine donating revenue to good causes around the world. --- plugins/web-search/README.md | 1 + plugins/web-search/web-search.plugin.zsh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/plugins/web-search/README.md b/plugins/web-search/README.md index 5b09b8980..d04042506 100644 --- a/plugins/web-search/README.md +++ b/plugins/web-search/README.md @@ -37,6 +37,7 @@ Available search contexts are: | `ecosia` | `https://www.ecosia.org/search?q=` | | `goodreads` | `https://www.goodreads.com/search?q=` | | `qwant` | `https://www.qwant.com/?q=` | +| `givero` | `https://www.givero.com/search?q=` | | `stackoverflow` | `https://stackoverflow.com/search?q=` | Also there are aliases for bang-searching DuckDuckGo: diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index 9a70d7bc6..5b76eeae2 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -17,6 +17,7 @@ function web_search() { ecosia "https://www.ecosia.org/search?q=" goodreads "https://www.goodreads.com/search?q=" qwant "https://www.qwant.com/?q=" + givero "https://www.givero.com/search?q=" stackoverflow "https://stackoverflow.com/search?q=" ) @@ -52,6 +53,7 @@ alias baidu='web_search baidu' alias ecosia='web_search ecosia' alias goodreads='web_search goodreads' alias qwant='web_search qwant' +alias givero='web_search givero' alias stackoverflow='web_search stackoverflow' #add your own !bang searches here -- cgit v1.2.3-70-g09d2 From f03aa42cbb2ef401f723557bbd2be5c72b1cba21 Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 23 Mar 2019 12:49:15 -0400 Subject: react-native: add iPad and Apple TV simulator aliases (#7603) --- plugins/react-native/README.md | 67 +++++++++++++++++----------- plugins/react-native/react-native.plugin.zsh | 17 +++++++ 2 files changed, 59 insertions(+), 25 deletions(-) diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md index d1fce0fc2..0cfaa36b4 100644 --- a/plugins/react-native/README.md +++ b/plugins/react-native/README.md @@ -11,28 +11,45 @@ plugins=(... react-native) ## Aliases -| Alias | React Native command | -| :------------ | :------------------------------------------------- | -| **rn** | `react-native` | -| **rns** | `react-native start` | -| **rnlink** | `react-native link` | -| _App testing_ | -| **rnand** | `react-native run-android` | -| **rnios** | `react-native run-ios` | -| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` | -| **rnios5** | `react-native run-ios --simulator "iPhone 5"` | -| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` | -| **rnios6** | `react-native run-ios --simulator "iPhone 6"` | -| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` | -| **rnios7** | `react-native run-ios --simulator "iPhone7"` | -| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` | -| **rnios8** | `react-native run-ios --simulator "iPhone 8"` | -| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` | -| **rniosse** | `react-native run-ios --simulator "iPhone SE"` | -| **rniosx** | `react-native run-ios --simulator "iPhone X"` | -| **rniosxs** | `react-native run-ios --simulator "iPhone XS"` | -| **rniosxsm** | `react-native run-ios --simulator "iPhone XS Max"` | -| **rniosxr** | `react-native run-ios --simulator "iPhone XR"` | -| _Logging_ | -| **rnland** | `react-native log-android` | -| **rnlios** | `react-native log-ios` | +| Alias | React Native command | +| :------------ | :------------------------------------------------- | +| **rn** | `react-native` | +| **rns** | `react-native start` | +| **rnlink** | `react-native link` | +| _App testing_ | +| **rnand** | `react-native run-android` | +| **rnios** | `react-native run-ios` | +| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` | +| **rnios5** | `react-native run-ios --simulator "iPhone 5"` | +| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` | +| **rnios6** | `react-native run-ios --simulator "iPhone 6"` | +| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` | +| **rnios7** | `react-native run-ios --simulator "iPhone7"` | +| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` | +| **rnios8** | `react-native run-ios --simulator "iPhone 8"` | +| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` | +| **rniosse** | `react-native run-ios --simulator "iPhone SE"` | +| **rniosx** | `react-native run-ios --simulator "iPhone X"` | +| **rniosxs** | `react-native run-ios --simulator "iPhone XS"` | +| **rniosxsm** | `react-native run-ios --simulator "iPhone XS Max"` | +| **rniosxr** | `react-native run-ios --simulator "iPhone XR"` | +| _iPads_ | | +| **rnipad2** | `react-native run-ios --simulator "iPad 2"` | +| **rnipadr** | `react-native run-ios --simulator "iPad Retina"` | +| **rnipada** | 'react-native run-ios --simulator "iPad Air"' | +| **rnipada2** | 'react-native run-ios --simulator "iPad Air 2"' | +| **rnipad5** | 'react-native run-ios --simulator "iPad (5th generation)"' | +| **rnipad9** | 'react-native run-ios --simulator "iPad Pro (9.7-inch)"' | +| **rnipad12** | 'react-native run-ios --simulator "iPad Pro (12.9-inch)"' | +| **rnipad122** | 'react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"' | +| **rnipad10** | 'react-native run-ios --simulator "iPad Pro (10.5-inch)"' | +| **rnipad6** | 'react-native run-ios --simulator "iPad Pro (6th generation)"' | +| **rnipad11** | 'react-native run-ios --simulator "iPad Pro (11-inch)"' | +| **rnipad123** | 'react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"' | +| _Apple TVs_ | | +| **rnatv** | `react-native run-ios --simulator "Apple TV"` | +| **rnatv4k** | `react-native run-ios --simulator "Apple TV 4K"` | +| **rnatv4k1080**| `react-native run-ios --simulator "Apple TV 4K (at 1080p)"` | +| _Logging_ | +| **rnland** | `react-native log-android` | +| **rnlios** | `react-native log-ios` | diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh index 220aa2dce..a4092a694 100644 --- a/plugins/react-native/react-native.plugin.zsh +++ b/plugins/react-native/react-native.plugin.zsh @@ -19,5 +19,22 @@ alias rniosxs='react-native run-ios --simulator "iPhone XS"' alias rniosxsm='react-native run-ios --simulator "iPhone XS Max"' alias rniosxr='react-native run-ios --simulator "iPhone XR"' +alias rnipad2='react-native run-ios --simulator "iPad 2"' +alias rnipadr='react-native run-ios --simulator "iPad Retina"' +alias rnipada='react-native run-ios --simulator "iPad Air"' +alias rnipada2='react-native run-ios --simulator "iPad Air 2"' +alias rnipad5='react-native run-ios --simulator "iPad (5th generation)"' +alias rnipad9='react-native run-ios --simulator "iPad Pro (9.7-inch)"' +alias rnipad12='react-native run-ios --simulator "iPad Pro (12.9-inch)"' +alias rnipad122='react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"' +alias rnipad10='react-native run-ios --simulator "iPad Pro (10.5-inch)"' +alias rnipad6='react-native run-ios --simulator "iPad Pro (6th generation)"' +alias rnipad11='react-native run-ios --simulator "iPad Pro (11-inch)"' +alias rnipad123='react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"' + +alias rnatv='react-native run-ios --simulator "Apple TV"' +alias rnatv4k='react-native run-ios --simulator "Apple TV 4K"' +alias rnatv4k1080='react-native run-ios --simulator "Apple TV 4K (at 1080p)"' + alias rnland='react-native log-android' alias rnlios='react-native log-ios' -- cgit v1.2.3-70-g09d2 From 83d11394321398b99911089901b905574807ccfb Mon Sep 17 00:00:00 2001 From: Rob Lugton Date: Sun, 24 Mar 2019 05:20:28 +1100 Subject: agnoster: show AWS_PROFILE in prompt (#6621) --- themes/agnoster.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 0edb773aa..3c30a9e11 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -224,11 +224,25 @@ prompt_status() { [[ -n "$symbols" ]] && prompt_segment black default "$symbols" } +#AWS Profile: +# - display current AWS_PROFILE name +# - displays yellow on red if profile name contains 'production' or +# ends in '-prod' +# - displays black on green otherwise +prompt_aws() { + [[ -z "$AWS_PROFILE" ]] && return + case "$AWS_PROFILE" in + *-prod|*production*) prompt_segment red yellow "AWS: $AWS_PROFILE" ;; + *) prompt_segment green black "AWS: $AWS_PROFILE" ;; + esac +} + ## Main prompt build_prompt() { RETVAL=$? prompt_status prompt_virtualenv + prompt_aws prompt_context prompt_dir prompt_git -- cgit v1.2.3-70-g09d2 From 1a2d930bca7966c44f1551ea2f0b8d7aecc80e56 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 23 Mar 2019 19:52:31 +0100 Subject: aws: refactor completion sourcing logic (#7364) * Clean up Homebrew detection and add comments. Also changed some if flags. * Detect aws cli completion file from RPM --- plugins/aws/aws.plugin.zsh | 56 ++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index af27e669a..9cb69dd09 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -1,32 +1,9 @@ -_homebrew-installed() { - type brew &> /dev/null - _xit=$? - if [ $_xit -eq 0 ];then - # ok , we have brew installed - # speculatively we check default brew prefix - if [ -h /usr/local/opt/awscli ];then - _brew_prefix="/usr/local/opt/awscli" - else - # ok , it is not default prefix - # this call to brew is expensive ( about 400 ms ), so at least let's make it only once - _brew_prefix=$(brew --prefix awscli) - fi - return 0 - else - return $_xit - fi -} - -_awscli-homebrew-installed() { - [ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null -} - function agp { echo $AWS_PROFILE } function asp { - local rprompt=${RPROMPT//} + local rprompt=${RPROMPT//} export AWS_DEFAULT_PROFILE=$1 export AWS_PROFILE=$1 @@ -39,11 +16,32 @@ function aws_profiles { } compctl -K aws_profiles asp -if which aws_zsh_completer.sh &>/dev/null; then - _aws_zsh_completer_path=$(which aws_zsh_completer.sh 2>/dev/null) -elif _homebrew-installed && _awscli-homebrew-installed; then + +# Load awscli completions + +_awscli-homebrew-installed() { + # check if Homebrew is installed + (( $+commands[brew] )) || return 1 + + # speculatively check default brew prefix + if [ -h /usr/local/opt/awscli ]; then + _brew_prefix=/usr/local/opt/awscli + else + # ok, it is not in the default prefix + # this call to brew is expensive (about 400 ms), so at least let's make it only once + _brew_prefix=$(brew --prefix awscli) + fi +} + +# get aws_zsh_completer.sh location from $PATH +_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]" + +# otherwise check if installed via Homebrew +if [[ -z $_aws_zsh_completer_path ]] && _awscli-homebrew-installed; then _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh +else + _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh fi -[ -n "$_aws_zsh_completer_path" ] && [ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path -unset _aws_zsh_completer_path +[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path +unset _aws_zsh_completer_path _brew_prefix -- cgit v1.2.3-70-g09d2 From 729c2f796d4945dfa2bcff144fea84afe5c4b0cb Mon Sep 17 00:00:00 2001 From: "Cristian Măgherușan-Stanciu @magheru_san" Date: Sat, 23 Mar 2019 22:08:35 +0100 Subject: otp: added a plugin for oathtool one-time passwords (#3862) --- plugins/otp/otp.plugin.zsh | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 plugins/otp/otp.plugin.zsh diff --git a/plugins/otp/otp.plugin.zsh b/plugins/otp/otp.plugin.zsh new file mode 100644 index 000000000..4bce34fd3 --- /dev/null +++ b/plugins/otp/otp.plugin.zsh @@ -0,0 +1,54 @@ +export OTP_HOME=~/.otp +mkdir -p $OTP_HOME + +function ot () { + if ! command -v oathtool > /dev/null 2>&1; then + echo "Note: you need to install oathtool or oath-toolkit, depending on your OS or distribution." + return 1 + fi + + if ! command -v gpg > /dev/null 2>&1; then + echo "Note: you need to install gpg and create an ID using 'gpg --gen-key', unless you have one already." + return 1 + fi + + if [[ `uname` == 'Darwin' ]] then # MacOS X + 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 + echo "usage: otpw " + return 1 + elif [ ! -f $OTP_HOME/$1.otp.asc ]; then + echo "missing profile $1, you might need to create it first using otp_add_device" + return 1 + else + totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc) + oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD` + if [[ $COPY_CMD == 'true' ]] then + echo "Note: you might consider installing xsel for clipboard integration" + fi + fi +} + +function otp_add_device () { + if [[ "x$1" == "x" ]] then + echo "usage: otp_add " + return 1 + else + echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D" + + rm -f $OTP_HOME/$1.otp.asc + gpg --armor --encrypt --output $OTP_HOME/$1.otp.asc /dev/stdin + fi +} + +function otp_devices () { + reply=($(find $OTP_HOME -name \*.otp.asc | xargs basename -s .otp.asc)) +} + +compctl -K otp_devices ot -- cgit v1.2.3-70-g09d2 From a055930cf862c74159218d0acfd09b64f1e09ed5 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 24 Mar 2019 11:27:25 +0100 Subject: Fix README --- plugins/lighthouse/README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/plugins/lighthouse/README.md b/plugins/lighthouse/README.md index 0dd0003f1..0db29b4e5 100644 --- a/plugins/lighthouse/README.md +++ b/plugins/lighthouse/README.md @@ -1,6 +1,6 @@ # Lighthouse plugin -This plugin issue lighthouse tickets. +This plugin adds commands to manage [Lighthouse](https://lighthouseapp.com/). To use it, add `lighthouse` to the plugins array in your zshrc file: @@ -8,8 +8,19 @@ To use it, add `lighthouse` to the plugins array in your zshrc file: plugins=(... lighthouse) ``` -## Aliases +## Commands -| Alias | Command | Description | -|-------|----------------------------------------|------------------------------------------------------| -| lho | `open_lighthouse_ticket` | Opening lighthouse ticket | \ No newline at end of file +* `open_lighthouse_ticket ` (alias: `lho`): + + Opens the URL to the issue passed as an argument. To use it, add a `.lighthouse-url` + file in your directory with the URL to the individual project. + + Example: + ```zsh + $ cat .lighthouse-url + https://rails.lighthouseapp.com/projects/8994 + + $ lho 23 + Opening ticket #23 + # The browser goes to https://rails.lighthouseapp.com/projects/8994/tickets/23 + ``` -- cgit v1.2.3-70-g09d2 From e4189b9a963a323b5e4e2a5a440e69a01f18479f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 24 Mar 2019 11:29:35 +0100 Subject: Clean up lighthouse plugin --- plugins/lighthouse/lighthouse.plugin.zsh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/lighthouse/lighthouse.plugin.zsh b/plugins/lighthouse/lighthouse.plugin.zsh index 4a47b6010..3fca2bf4f 100644 --- a/plugins/lighthouse/lighthouse.plugin.zsh +++ b/plugins/lighthouse/lighthouse.plugin.zsh @@ -1,16 +1,12 @@ -# To use: add a .lighthouse file into your directory with the URL to the -# individual project. For example: -# https://rails.lighthouseapp.com/projects/8994 -# Example usage: https://screencast.com/t/ZDgwNDUwNT open_lighthouse_ticket () { if [ ! -f .lighthouse-url ]; then echo "There is no .lighthouse-url file in the current directory..." - return 0; - else - lighthouse_url=$(cat .lighthouse-url); - echo "Opening ticket #$1"; - open_command "$lighthouse_url/tickets/$1"; + return 0 fi + + lighthouse_url=$(cat .lighthouse-url) + echo "Opening ticket #$1" + open_command "$lighthouse_url/tickets/$1" } alias lho='open_lighthouse_ticket' -- cgit v1.2.3-70-g09d2 From 5ff21efad72117377c7b6cabd850d6b2b01ee31a Mon Sep 17 00:00:00 2001 From: shellbye Date: Mon, 25 Mar 2019 00:25:26 +0800 Subject: Add pygmalion-virtualenv theme (#5139) --- themes/pygmalion-virtualenv.zsh-theme | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 themes/pygmalion-virtualenv.zsh-theme diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme new file mode 100644 index 000000000..ea28e125a --- /dev/null +++ b/themes/pygmalion-virtualenv.zsh-theme @@ -0,0 +1,50 @@ +# Yay! High voltage and arrows! + + +function _virtualenv_prompt_info { + if [[ -n "$(whence virtualenv_prompt_info)" ]]; then + if [ -n "$(whence pyenv_prompt_info)" ]; then + if [ "$1" = "inline" ]; then + ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX=%{$fg[blue]%}"::%{$fg[red]%}" + ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="" + virtualenv_prompt_info + fi + [ "$(pyenv_prompt_info)" = "${PYENV_PROMPT_DEFAULT_VERSION}" ] && virtualenv_prompt_info + else + virtualenv_prompt_info + fi + fi +} + +prompt_setup_pygmalion(){ + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " + ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + base_prompt='$(_virtualenv_prompt_info)%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' + post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} ' + + base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") + post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") + + precmd_functions+=(prompt_pygmalion_precmd) +} + +prompt_pygmalion_precmd(){ + local gitinfo=$(git_prompt_info) + local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g") + local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local prompt_length=${#exp_nocolor} + + local nl="" + + if [[ $prompt_length -gt 40 ]]; then + nl=$'\n%{\r%}'; + fi + PROMPT="$base_prompt$gitinfo$nl$post_prompt" +} + +prompt_setup_pygmalion + + -- cgit v1.2.3-70-g09d2 From 532a784b806375370022605d8be17c1116553572 Mon Sep 17 00:00:00 2001 From: David Kane Date: Sun, 24 Mar 2019 18:37:07 +0000 Subject: aws: refactor AWS plugin (#7615) * Update the AWS plugin to support disabling RPROMT display: Use a $SHOW_AWS_PROMPT option. * Refactoring aws plugin: Exposing customizable aws_prompt_info function to be used in themes. * Set aws prompt prefix and suffix to original values and fix README Co-authored-by: "Vassilis S. Moustakas" --- plugins/aws/README.md | 25 +++++++++++++++++++------ plugins/aws/aws.plugin.zsh | 20 +++++++++++++++++--- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/plugins/aws/README.md b/plugins/aws/README.md index 8a45199b8..57ab1e5ac 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -1,8 +1,7 @@ # aws This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html) -and a few utilities to manage AWS profiles: a function to change profiles with autocompletion support -and a function to get the current AWS profile. The current AWS profile is also displayed in `RPROMPT`. +and a few utilities to manage AWS profiles and display them in the prompt. To use it, add `aws` to the plugins array in your zshrc file. @@ -12,9 +11,23 @@ plugins=(... aws) ## Plugin commands -* `asp `: Sets `AWS_PROFILE` and `AWS_DEFAULT_PROFILE` (legacy) to ``. -It also adds it to your RPROMPT. +* `asp []`: Sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to ``. + Run `asp` without arguments to clear the profile. -* `agp`: Gets the current value of `AWS_PROFILE`. +* `agp`: Gets the current value of `$AWS_PROFILE`. -* `aws_profiles`: Lists the available profiles in the file referenced in `AWS_CONFIG_FILE` (default: ~/.aws/config). Used to provide completion for the `asp` function. +* `aws_profiles`: Lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`). + Used to provide completion for the `asp` function. + +## Plugin options + +* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT. + +## Theme + +The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays +the current `$AWS_PROFILE`. It uses two variables to control how that is shown: + +- ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to ``. diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 9cb69dd09..2fb351812 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -1,14 +1,16 @@ +# AWS profile selection + function agp { echo $AWS_PROFILE } function asp { - local rprompt=${RPROMPT//} - export AWS_DEFAULT_PROFILE=$1 export AWS_PROFILE=$1 - export RPROMPT="$rprompt" + if [[ -z "$1" ]]; then + echo AWS profile cleared. + fi } function aws_profiles { @@ -17,6 +19,18 @@ function aws_profiles { compctl -K aws_profiles asp +# AWS prompt + +function aws_prompt_info() { + [[ -z $AWS_PROFILE ]] && return + echo "${ZSH_THEME_AWS_PREFIX:=}" +} + +if [ "$SHOW_AWS_PROMPT" != false ]; then + export RPROMPT='$(aws_prompt_info)'"$RPROMPT" +fi + + # Load awscli completions _awscli-homebrew-installed() { -- cgit v1.2.3-70-g09d2 From 8cbdd79517d710e5bab6ce7aca0754b37462f2ee Mon Sep 17 00:00:00 2001 From: Logan Lindquist Date: Sun, 24 Mar 2019 13:46:27 -0500 Subject: aws: set AWS_EB_PROFILE for the EB CLI (#7388) Added AWS_EB_PROFILE environment variable to the AWS Plugin. The EB CLI uses this variable instead of the primary AWS_PROFILE variable to keep track of what profile it is using. https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-configuration.html --- plugins/aws/README.md | 1 + plugins/aws/aws.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/aws/README.md b/plugins/aws/README.md index 57ab1e5ac..45e6de937 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -12,6 +12,7 @@ plugins=(... aws) ## Plugin commands * `asp []`: Sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to ``. + It also sets `$AWS_EB_PROFILE` to `` for the Elastic Beanstalk CLI. Run `asp` without arguments to clear the profile. * `agp`: Gets the current value of `$AWS_PROFILE`. diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 2fb351812..944557e14 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -7,6 +7,7 @@ function agp { function asp { export AWS_DEFAULT_PROFILE=$1 export AWS_PROFILE=$1 + export AWS_EB_PROFILE=$1 if [[ -z "$1" ]]; then echo AWS profile cleared. -- cgit v1.2.3-70-g09d2 From 4f4985fddc632a1d9745aec94ce95bea10006f97 Mon Sep 17 00:00:00 2001 From: Cristian Măgherușan-Stanciu Date: Wed, 30 Jul 2014 14:59:00 +0200 Subject: aws: added an alias for changing the AWS access key set on a profile --- plugins/aws/aws.plugin.zsh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 944557e14..7005af2d6 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -14,10 +14,25 @@ function asp { fi } +function aws_change_access_key { + if [[ "x$1" == "x" ]] then + echo "usage: $0 " + return 1 + else + echo "Insert the credentials when asked." + asp $1 + aws iam create-access-key + aws configure --profile $1 + echo "You can now safely delete the old access key running 'aws iam delete-access-key --access-key-id ID'" + echo "Your current keys are:" + aws iam list-access-keys + fi +} + function aws_profiles { reply=($(grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/')) } -compctl -K aws_profiles asp +compctl -K aws_profiles asp aws_change_access_key # AWS prompt -- cgit v1.2.3-70-g09d2 From 5f893dcd209fdad920a1450355acbd4c10faabf2 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 23 Mar 2019 20:56:55 +0100 Subject: aws: clean up aws_change_access_key function --- plugins/aws/aws.plugin.zsh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 7005af2d6..6de329bb8 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -15,18 +15,19 @@ function asp { } function aws_change_access_key { - if [[ "x$1" == "x" ]] then - echo "usage: $0 " + if [[ -z "$1" ]] then + echo "usage: $0 " return 1 - else - echo "Insert the credentials when asked." - asp $1 - aws iam create-access-key - aws configure --profile $1 - echo "You can now safely delete the old access key running 'aws iam delete-access-key --access-key-id ID'" - echo "Your current keys are:" - aws iam list-access-keys fi + + echo Insert the credentials when asked. + asp "$1" + aws iam create-access-key + aws configure --profile "$1" + + echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\` + echo Your current keys are: + aws iam list-access-keys } function aws_profiles { -- cgit v1.2.3-70-g09d2 From 6d143d42ea2e16610855e5b1e912b2962d44d9ab Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 24 Mar 2019 19:54:56 +0100 Subject: aws: document aws_change_access_key and fix README --- plugins/aws/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/aws/README.md b/plugins/aws/README.md index 45e6de937..a52024128 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -11,13 +11,15 @@ plugins=(... aws) ## Plugin commands -* `asp []`: Sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to ``. +* `asp []`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to ``. It also sets `$AWS_EB_PROFILE` to `` for the Elastic Beanstalk CLI. Run `asp` without arguments to clear the profile. -* `agp`: Gets the current value of `$AWS_PROFILE`. +* `agp`: gets the current value of `$AWS_PROFILE`. -* `aws_profiles`: Lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`). +* `aws_change_access_key`: changes the AWS access key of a profile. + +* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`). Used to provide completion for the `asp` function. ## Plugin options -- cgit v1.2.3-70-g09d2 From c56fa996e7cb1500dca97723d525e4c97af33c75 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 Mar 2019 10:12:43 +0100 Subject: rake-fast: remove brackets from completion entries Fixes #5653 --- plugins/rake-fast/rake-fast.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh index ca80d86e1..19dab154b 100644 --- a/plugins/rake-fast/rake-fast.plugin.zsh +++ b/plugins/rake-fast/rake-fast.plugin.zsh @@ -20,7 +20,7 @@ _tasks_changed () { } _rake_generate () { - rake --silent --tasks | cut -d " " -f 2 > .rake_tasks + rake --silent --tasks | cut -d " " -f 2 | sed 's/\[.*\]//g' > .rake_tasks } _rake () { -- cgit v1.2.3-70-g09d2 From e59cc94805ebe76b0eb57de0b84e403583ebd4db Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 Mar 2019 17:05:50 +0100 Subject: themes: fix prompt verbosity on window resize %_ is a prompt expansion sequence that expands to the status of the parser. This means that on window resize, the status of the execution of the window resize hook (TRAPWINCH) would be displayed while reloading the prompt line. This looked like cmdand cursh$ or then$ depending on the body of the TRAPWINCH function. Fixes #7262 --- themes/dst.zsh-theme | 2 +- themes/gentoo.zsh-theme | 2 +- themes/tjkirch.zsh-theme | 2 +- themes/tjkirch_mod.zsh-theme | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/dst.zsh-theme b/themes/dst.zsh-theme index 3e2539d57..6b2f8767d 100644 --- a/themes/dst.zsh-theme +++ b/themes/dst.zsh-theme @@ -11,6 +11,6 @@ function prompt_char { PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%} ) %{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) -%_ $(prompt_char) ' +$(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/themes/gentoo.zsh-theme b/themes/gentoo.zsh-theme index ee205d248..5f2427c7a 100644 --- a/themes/gentoo.zsh-theme +++ b/themes/gentoo.zsh-theme @@ -2,7 +2,7 @@ function prompt_char { if [ $UID -eq 0 ]; then echo "#"; else echo $; fi } -PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} ' +PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)$(prompt_char)%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX="(" ZSH_THEME_GIT_PROMPT_SUFFIX=") " diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme index 446cde724..c51609860 100644 --- a/themes/tjkirch.zsh-theme +++ b/themes/tjkirch.zsh-theme @@ -10,6 +10,6 @@ function prompt_char { PROMPT='%(?, ,%{$fg[red]%}FAIL: $?%{$reset_color%} ) %{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) -%_$(prompt_char) ' +$(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/themes/tjkirch_mod.zsh-theme b/themes/tjkirch_mod.zsh-theme index 1b206a7e1..2dd060ea1 100644 --- a/themes/tjkirch_mod.zsh-theme +++ b/themes/tjkirch_mod.zsh-theme @@ -8,6 +8,6 @@ function prompt_char { } PROMPT='%(?,,%{$fg[red]%}FAIL: $?%{$reset_color%} -)%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) %_$(prompt_char) ' +)%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) $(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' -- cgit v1.2.3-70-g09d2 From f6a9a0a49855666f3311a2db040b9b27969da2bc Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 Mar 2019 18:46:18 +0100 Subject: git: fix grt on path with spaces Fixes #7682 --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 4277ac664..6fc9b078b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -226,7 +226,7 @@ alias grmc='git rm --cached' alias grmv='git remote rename' alias grrm='git remote remove' alias grset='git remote set-url' -alias grt='cd $(git rev-parse --show-toplevel || echo ".")' +alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' alias gru='git reset --' alias grup='git remote update' alias grv='git remote -v' -- cgit v1.2.3-70-g09d2 From 647537f15bb31f8a50699db239e9a98343d5d280 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 27 Sep 2018 18:26:48 +0200 Subject: Added a new plugin which adds completion for fd (fd-find) Based on the existing "cargo" plugin. --- plugins/fd/README.md | 13 ++++++++ plugins/fd/_fd | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 plugins/fd/README.md create mode 100644 plugins/fd/_fd diff --git a/plugins/fd/README.md b/plugins/fd/README.md new file mode 100644 index 000000000..aabd624b8 --- /dev/null +++ b/plugins/fd/README.md @@ -0,0 +1,13 @@ +# fd + +This plugin adds completion for the file search tool [`fd`](https://github.com/sharkdp/fd), also known as `fd-find`. + +To use it, add `fd` to the plugins array in your zshrc file: + +```zsh +plugins=(... fd) +``` + +Completion is taken from the fd release [`7.3.0`](https://github.com/sharkdp/fd/releases/tag/v7.3.0). + +Updated on Febrary 13th, 2019. diff --git a/plugins/fd/_fd b/plugins/fd/_fd new file mode 100644 index 000000000..7d65c7856 --- /dev/null +++ b/plugins/fd/_fd @@ -0,0 +1,83 @@ +#compdef fd + +autoload -U is-at-least + +_fd() { + typeset -A opt_args + typeset -a _arguments_options + local ret=1 + + if is-at-least 5.2; then + _arguments_options=(-s -S -C) + else + _arguments_options=(-s -C) + fi + + local context curcontext="$curcontext" state line + _arguments "${_arguments_options[@]}" \ +'-d+[Set maximum search depth (default: none)]' \ +'--max-depth=[Set maximum search depth (default: none)]' \ +'--maxdepth=[See --max-depth]' \ +'*-t+[Filter by type: file (f), directory (d), symlink (l), +executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \ +'*--type=[Filter by type: file (f), directory (d), symlink (l), +executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \ +'*-e+[Filter by file extension]' \ +'*--extension=[Filter by file extension]' \ +'-x+[Execute a command for each search result]' \ +'--exec=[Execute a command for each search result]' \ +'(-x --exec)-X+[Execute a command with all search results at once]' \ +'(-x --exec)--exec-batch=[Execute a command with all search results at once]' \ +'*-E+[Exclude entries that match the given glob pattern]' \ +'*--exclude=[Exclude entries that match the given glob pattern]' \ +'*--ignore-file=[Add a custom ignore-file in .gitignore format]' \ +'-c+[When to use colors: never, *auto*, always]: :(never auto always)' \ +'--color=[When to use colors: never, *auto*, always]: :(never auto always)' \ +'-j+[Set number of threads to use for searching & executing]' \ +'--threads=[Set number of threads to use for searching & executing]' \ +'*-S+[Limit results based on the size of files.]' \ +'*--size=[Limit results based on the size of files.]' \ +'--max-buffer-time=[the time (in ms) to buffer, before streaming to the console]' \ +'--changed-within=[Filter by file modification time (newer than)]' \ +'--changed-before=[Filter by file modification time (older than)]' \ +'*--search-path=[(hidden)]' \ +'-H[Search hidden files and directories]' \ +'--hidden[Search hidden files and directories]' \ +'-I[Do not respect .(git|fd)ignore files]' \ +'--no-ignore[Do not respect .(git|fd)ignore files]' \ +'--no-ignore-vcs[Do not respect .gitignore files]' \ +'*-u[Alias for no-ignore and/or hidden]' \ +'-s[Case-sensitive search (default: smart case)]' \ +'--case-sensitive[Case-sensitive search (default: smart case)]' \ +'-i[Case-insensitive search (default: smart case)]' \ +'--ignore-case[Case-insensitive search (default: smart case)]' \ +'-F[Treat the pattern as a literal string]' \ +'--fixed-strings[Treat the pattern as a literal string]' \ +'-a[Show absolute instead of relative paths]' \ +'--absolute-path[Show absolute instead of relative paths]' \ +'-L[Follow symbolic links]' \ +'--follow[Follow symbolic links]' \ +'-p[Search full path (default: file-/dirname only)]' \ +'--full-path[Search full path (default: file-/dirname only)]' \ +'-0[Separate results by the null character]' \ +'--print0[Separate results by the null character]' \ +'--show-errors[Enable display of filesystem errors]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::pattern -- the search pattern, a regular expression (optional):_files' \ +'::path -- the root directory for the filesystem search (optional):_files' \ +&& ret=0 + +} + +(( $+functions[_fd_commands] )) || +_fd_commands() { + local commands; commands=( + + ) + _describe -t commands 'fd commands' commands "$@" +} + +_fd "$@" -- cgit v1.2.3-70-g09d2 From 9538eae3d732f6c1e59136f0fb2dce7f98a129a1 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 27 Sep 2018 18:27:51 +0200 Subject: Added a new plugin which adds completion for ripgrep (rg) Based on the existing "cargo" plugin. --- plugins/ripgrep/README.md | 13 ++ plugins/ripgrep/_ripgrep | 433 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 446 insertions(+) create mode 100644 plugins/ripgrep/README.md create mode 100644 plugins/ripgrep/_ripgrep diff --git a/plugins/ripgrep/README.md b/plugins/ripgrep/README.md new file mode 100644 index 000000000..794b105ee --- /dev/null +++ b/plugins/ripgrep/README.md @@ -0,0 +1,13 @@ +# ripgrep + +This plugin adds completion for the text search tool [`ripgrep`](https://github.com/BurntSushi/ripgrep), also known as `rg`. + +To use it, add `ripgrep` to the plugins array in your zshrc file: + +```zsh +plugins=(... ripgrep) +``` + +Completion is taken from the ripgrep release [`0.10.0`](https://github.com/BurntSushi/ripgrep/releases/tag/0.10.0). + +Updated on September 27th, 2018. diff --git a/plugins/ripgrep/_ripgrep b/plugins/ripgrep/_ripgrep new file mode 100644 index 000000000..53f135dde --- /dev/null +++ b/plugins/ripgrep/_ripgrep @@ -0,0 +1,433 @@ +#compdef rg + +## +# zsh completion function for ripgrep +# +# Originally based on code from the zsh-users project — see copyright notice +# below. + +_rg() { + local curcontext=$curcontext no='!' descr ret=1 + local -a context line state state_descr args tmp suf + local -A opt_args + + # ripgrep has many options which negate the effect of a more common one — for + # example, `--no-column` to negate `--column`, and `--messages` to negate + # `--no-messages`. There are so many of these, and they're so infrequently + # used, that some users will probably find it irritating if they're completed + # indiscriminately, so let's not do that unless either the current prefix + # matches one of those negation options or the user has the `complete-all` + # style set. Note that this prefix check has to be updated manually to account + # for all of the potential negation options listed below! + if + # We also want to list all of these options during testing + [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] || + # (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode) + [[ $PREFIX$SUFFIX == --[imnp]* ]] || + zstyle -t ":complete:$curcontext:*" complete-all + then + no= + fi + + # We make heavy use of argument groups here to prevent the option specs from + # growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip + # them out below if necessary. This makes the exclusions inaccurate on those + # older versions, but oh well — it's not that big a deal + args=( + + '(exclusive)' # Misc. fully exclusive options + '(: * -)'{-h,--help}'[display help information]' + '(: * -)'{-V,--version}'[display version information]' + + + '(buffered)' # buffering options + '--line-buffered[force line buffering]' + $no"--no-line-buffered[don't force line buffering]" + '--block-buffered[force block buffering]' + $no"--no-block-buffered[don't force block buffering]" + + + '(case)' # Case-sensitivity options + {-i,--ignore-case}'[search case-insensitively]' + {-s,--case-sensitive}'[search case-sensitively]' + {-S,--smart-case}'[search case-insensitively if pattern is all lowercase]' + + + '(context-a)' # Context (after) options + '(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines' + + + '(context-b)' # Context (before) options + '(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines' + + + '(context-c)' # Context (combined) options + '(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines' + + + '(column)' # Column options + '--column[show column numbers for matches]' + $no"--no-column[don't show column numbers for matches]" + + + '(count)' # Counting options + {-c,--count}'[only show count of matching lines for each file]' + '--count-matches[only show count of individual matches for each file]' + + + '(encoding)' # Encoding options + {-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings' + $no'--no-encoding[use default text encoding]' + + + file # File-input options + '(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files' + + + '(file-match)' # Files with/without match options + '(stats)'{-l,--files-with-matches}'[only show names of files with matches]' + '(stats)--files-without-match[only show names of files without matches]' + + + '(file-name)' # File-name options + {-H,--with-filename}'[show file name for matches]' + "--no-filename[don't show file name for matches]" + + + '(file-system)' # File system options + "--one-file-system[don't descend into directories on other file systems]" + $no'--no-one-file-system[descend into directories on other file systems]' + + + '(fixed)' # Fixed-string options + {-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]' + $no"--no-fixed-strings[don't treat pattern as literal string]" + + + '(follow)' # Symlink-following options + {-L,--follow}'[follow symlinks]' + $no"--no-follow[don't follow symlinks]" + + + glob # File-glob options + '*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob' + '*--iglob=[include/exclude files matching specified case-insensitive glob]:glob' + + + '(heading)' # Heading options + '(pretty-vimgrep)--heading[show matches grouped by file name]' + "(pretty-vimgrep)--no-heading[don't show matches grouped by file name]" + + + '(hidden)' # Hidden-file options + '--hidden[search hidden files and directories]' + $no"--no-hidden[don't search hidden files and directories]" + + + '(ignore)' # Ignore-file options + "(--no-ignore-global --no-ignore-parent --no-ignore-vcs)--no-ignore[don't respect ignore files]" + $no'(--ignore-global --ignore-parent --ignore-vcs)--ignore[respect ignore files]' + + + '(ignore-global)' # Global ignore-file options + "--no-ignore-global[don't respect global ignore files]" + $no'--ignore-global[respect global ignore files]' + + + '(ignore-parent)' # Parent ignore-file options + "--no-ignore-parent[don't respect ignore files in parent directories]" + $no'--ignore-parent[respect ignore files in parent directories]' + + + '(ignore-vcs)' # VCS ignore-file options + "--no-ignore-vcs[don't respect version control ignore files]" + $no'--ignore-vcs[respect version control ignore files]' + + + '(json)' # JSON options + '--json[output results in JSON Lines format]' + $no"--no-json[don't output results in JSON Lines format]" + + + '(line-number)' # Line-number options + {-n,--line-number}'[show line numbers for matches]' + {-N,--no-line-number}"[don't show line numbers for matches]" + + + '(line-terminator)' # Line-terminator options + '--crlf[use CRLF as line terminator]' + $no"--no-crlf[don't use CRLF as line terminator]" + '(text)--null-data[use NUL as line terminator]' + + + '(max-depth)' # Directory-depth options + '--max-depth=[specify max number of directories to descend]:number of directories' + '!--maxdepth=:number of directories' + + + '(messages)' # Error-message options + '(--no-ignore-messages)--no-messages[suppress some error messages]' + $no"--messages[don't suppress error messages affected by --no-messages]" + + + '(messages-ignore)' # Ignore-error message options + "--no-ignore-messages[don't show ignore-file parse error messages]" + $no'--ignore-messages[show ignore-file parse error messages]' + + + '(mmap)' # mmap options + '--mmap[search using memory maps when possible]' + "--no-mmap[don't search using memory maps]" + + + '(multiline)' # Multiline options + {-U,--multiline}'[permit matching across multiple lines]' + $no'(multiline-dotall)--no-multiline[restrict matches to at most one line each]' + + + '(multiline-dotall)' # Multiline DOTALL options + '(--no-multiline)--multiline-dotall[allow "." to match newline (with -U)]' + $no"(--no-multiline)--no-multiline-dotall[don't allow \".\" to match newline (with -U)]" + + + '(only)' # Only-match options + {-o,--only-matching}'[show only matching part of each line]' + + + '(passthru)' # Pass-through options + '(--vimgrep)--passthru[show both matching and non-matching lines]' + '!(--vimgrep)--passthrough' + + + '(pcre2)' # PCRE2 options + {-P,--pcre2}'[enable matching with PCRE2]' + $no'(pcre2-unicode)--no-pcre2[disable matching with PCRE2]' + + + '(pcre2-unicode)' # PCRE2 Unicode options + $no'(--no-pcre2 --no-pcre2-unicode)--pcre2-unicode[enable PCRE2 Unicode mode (with -P)]' + '(--no-pcre2 --pcre2-unicode)--no-pcre2-unicode[disable PCRE2 Unicode mode (with -P)]' + + + '(pre)' # Preprocessing options + '(-z --search-zip)--pre=[specify preprocessor utility]:preprocessor utility:_command_names -e' + $no'--no-pre[disable preprocessor utility]' + + + pre-glob # Preprocessing glob options + '*--pre-glob[include/exclude files for preprocessing with --pre]' + + + '(pretty-vimgrep)' # Pretty/vimgrep display options + '(heading)'{-p,--pretty}'[alias for --color=always --heading -n]' + '(heading passthru)--vimgrep[show results in vim-compatible format]' + + + regexp # Explicit pattern options + '(1 file)*'{-e+,--regexp=}'[specify pattern]:pattern' + + + '(replace)' # Replacement options + {-r+,--replace=}'[specify string used to replace matches]:replace string' + + + '(sort)' # File-sorting options + '(threads)--sort=[sort results in ascending order (disables parallelism)]:sort method:(( + none\:"no sorting" + path\:"sort by file path" + modified\:"sort by last modified time" + accessed\:"sort by last accessed time" + created\:"sort by creation time" + ))' + '(threads)--sortr=[sort results in descending order (disables parallelism)]:sort method:(( + none\:"no sorting" + path\:"sort by file path" + modified\:"sort by last modified time" + accessed\:"sort by last accessed time" + created\:"sort by creation time" + ))' + '!(threads)--sort-files[sort results by file path (disables parallelism)]' + + + '(stats)' # Statistics options + '(--files file-match)--stats[show search statistics]' + $no"--no-stats[don't show search statistics]" + + + '(text)' # Binary-search options + {-a,--text}'[search binary files as if they were text]' + $no"(--null-data)--no-text[don't search binary files as if they were text]" + + + '(threads)' # Thread-count options + '(sort)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads' + + + '(trim)' # Trim options + '--trim[trim any ASCII whitespace prefix from each line]' + $no"--no-trim[don't trim ASCII whitespace prefix from each line]" + + + type # Type options + '*'{-t+,--type=}'[only search files matching specified type]: :_rg_types' + '*--type-add=[add new glob for specified file type]: :->typespec' + '*--type-clear=[clear globs previously defined for specified file type]: :_rg_types' + # This should actually be exclusive with everything but other type options + '(: *)--type-list[show all supported file types and their associated globs]' + '*'{-T+,--type-not=}"[don't search files matching specified file type]: :_rg_types" + + + '(word-line)' # Whole-word/line match options + {-w,--word-regexp}'[only show matches surrounded by word boundaries]' + {-x,--line-regexp}'[only show matches surrounded by line boundaries]' + + + '(zip)' # Compression options + '(--pre)'{-z,--search-zip}'[search in compressed files]' + $no"--no-search-zip[don't search in compressed files]" + + + misc # Other options — no need to separate these at the moment + '(-b --byte-offset)'{-b,--byte-offset}'[show 0-based byte offset for each matching line]' + '--color=[specify when to use colors in output]:when:(( + never\:"never use colors" + auto\:"use colors or not based on stdout, TERM, etc." + always\:"always use colors" + ansi\:"always use ANSI colors (even on Windows)" + ))' + '*--colors=[specify color and style settings]: :->colorspec' + '--context-separator=[specify string used to separate non-continuous context lines in output]:separator' + '--debug[show debug messages]' + '--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size (bytes)' + "(1 stats)--files[show each file that would be searched (but don't search)]" + '*--ignore-file=[specify additional ignore file]:ignore file:_files' + '(-v --invert-match)'{-v,--invert-match}'[invert matching]' + '(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes' + '(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches' + '--max-filesize=[specify size above which files should be ignored]:file size (bytes)' + "--no-config[don't load configuration files]" + '(-0 --null)'{-0,--null}'[print NUL byte after file names]' + '--path-separator=[specify path separator to use when printing file names]:separator' + '(-q --quiet)'{-q,--quiet}'[suppress normal output]' + '--regex-size-limit=[specify upper size limit of compiled regex]:regex size (bytes)' + '*'{-u,--unrestricted}'[reduce level of "smart" searching]' + + + operand # Operands + '(--files --type-list file regexp)1: :_guard "^-*" pattern' + '(--type-list)*: :_files' + ) + + # This is used with test_complete.sh to verify that there are no options + # listed in the help output that aren't also defined here + [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] && { + print -rl - $args + return 0 + } + + # Strip out argument groups where unsupported (see above) + [[ $ZSH_VERSION == (4|5.<0-3>)(.*)# ]] && + args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} ) + + _arguments -C -s -S : $args && ret=0 + + case $state in + colorspec) + if [[ ${IPREFIX#--*=}$PREFIX == [^:]# ]]; then + suf=( -qS: ) + tmp=( + 'column:specify coloring for column numbers' + 'line:specify coloring for line numbers' + 'match:specify coloring for match text' + 'path:specify coloring for file names' + ) + descr='color/style type' + elif [[ ${IPREFIX#--*=}$PREFIX == (column|line|match|path):[^:]# ]]; then + suf=( -qS: ) + tmp=( + 'none:clear color/style for type' + 'bg:specify background color' + 'fg:specify foreground color' + 'style:specify text style' + ) + descr='color/style attribute' + elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:(bg|fg):[^:]# ]]; then + tmp=( black blue green red cyan magenta yellow white ) + descr='color name or r,g,b' + elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:style:[^:]# ]]; then + tmp=( {,no}bold {,no}intense {,no}underline ) + descr='style name' + else + _message -e colorspec 'no more arguments' + fi + + (( $#tmp )) && { + compset -P '*:' + _describe -t colorspec $descr tmp $suf && ret=0 + } + ;; + + typespec) + if compset -P '[^:]##:include:'; then + _sequence -s , _rg_types && ret=0 + # @todo This bit in particular could be better, but it's a little + # complex, and attempting to solve it seems to run us up against a crash + # bug — zsh # 40362 + elif compset -P '[^:]##:'; then + _message 'glob or include directive' && ret=1 + elif [[ ! -prefix *:* ]]; then + _rg_types -qS : && ret=0 + fi + ;; + esac + + return ret +} + +# Complete encodings +_rg_encodings() { + local -a expl + local -aU _encodings + + # This is impossible to read, but these encodings rarely if ever change, so it + # probably doesn't matter. They are derived from the list given here: + # https://encoding.spec.whatwg.org/#concept-encoding-get + _encodings=( + {{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean} + logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian} + 866 ibm{819,866} csibm866 + big5{,-hkscs} {cn-,cs}big5 x-x-big5 + cp{819,866,125{0..8}} x-cp125{0..8} + csiso2022{jp,kr} csiso8859{6,8}{e,i} + csisolatin{{1..6},9} csisolatin{arabic,cyrillic,greek,hebrew} + ecma-{114,118} asmo-708 elot_928 sun_eu_greek + euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese + {,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312 + iso-2022-{cn,cn-ext,jp,kr} + iso8859{,-}{{1..11},13,14,15} + iso-8859-{{1..11},{6,8}-{e,i},13,14,15,16} iso_8859-{{1..9},15} + iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989 + iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157} + koi{,8,8-r,8-ru,8-u,8_r} cskoi8r + ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987 + latin{1..6} l{{1..6},9} + shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932 + utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8 + windows-{31j,874,949,125{0..8}} dos-874 tis-620 ansi_x3.4-1968 + x-user-defined auto + ) + + _wanted encodings expl encoding compadd -a "$@" - _encodings +} + +# Complete file types +_rg_types() { + local -a expl + local -aU _types + + _types=( ${(@)${(f)"$( _call_program types rg --type-list )"}%%:*} ) + + _wanted types expl 'file type' compadd -a "$@" - _types +} + +_rg "$@" + + +# ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for ripgrep +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * arcizan +# * MaskRay +# +# ------------------------------------------------------------------------------ + +# Local Variables: +# mode: shell-script +# coding: utf-8-unix +# indent-tabs-mode: nil +# sh-indentation: 2 +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et -- cgit v1.2.3-70-g09d2 From d79415b17d1c730b87bcbf76e691e344c9cb4694 Mon Sep 17 00:00:00 2001 From: SomeDer <48731521+SomeDer@users.noreply.github.com> Date: Mon, 25 Mar 2019 21:19:46 +0000 Subject: command-not-found: add support for NixOS (#7701) --- plugins/command-not-found/README.md | 1 + plugins/command-not-found/command-not-found.plugin.zsh | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/plugins/command-not-found/README.md b/plugins/command-not-found/README.md index df62d1f07..1cf4ba66e 100644 --- a/plugins/command-not-found/README.md +++ b/plugins/command-not-found/README.md @@ -27,5 +27,6 @@ It works out of the box with the command-not-found packages for: - [Arch Linux](https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found) - [macOS (Homebrew)](https://github.com/Homebrew/homebrew-command-not-found) - [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound) +- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found) You can add support for other platforms by submitting a Pull Request. diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index ba1262de6..dd1186e44 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -31,3 +31,10 @@ if type brew &> /dev/null; then eval "$(brew command-not-found-init)"; fi fi + +# NixOS command-not-found support +if [ -x /run/current-system/sw/bin/command-not-found ]; then + command_not_found_handler () { + /run/current-system/sw/bin/command-not-found $@ + } +fi -- cgit v1.2.3-70-g09d2 From ae7d0bcdb9d22a2de4150f2f00a5c0a26b857c48 Mon Sep 17 00:00:00 2001 From: Andrey Skurlatov Date: Tue, 26 Mar 2019 00:36:46 +0300 Subject: golang: mod and list commands completion (#7665) Also, add `gom` alias to `go mod`. --- plugins/golang/golang.plugin.zsh | 79 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh index 8284ab83c..47b10988e 100644 --- a/plugins/golang/golang.plugin.zsh +++ b/plugins/golang/golang.plugin.zsh @@ -28,6 +28,7 @@ __go_tool_complete() { 'help[display help]' 'install[compile and install packages and dependencies]' 'list[list packages]' + 'mod[modules maintenance]' 'run[compile and run Go program]' 'test[test packages]' 'tool[run specified go tool]' @@ -83,7 +84,7 @@ __go_tool_complete() { "-x[print remove commands as it executes them]" \ "*:importpaths:__go_packages" ;; - fix|fmt|list|vet) + fix|fmt|vet) _alternative ':importpaths:__go_packages' ':files:_path_files -g "*.go"' ;; install) @@ -124,6 +125,81 @@ __go_tool_complete() { "-memprofilerate[set heap profiling rate]:number" \ "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }" ;; + list) + _arguments -s -w : \ + "-f[alternative format for the list]:format" \ + "-json[print data in json format]" \ + "-compiled[set CompiledGoFiles to the Go source files presented to the compiler]" \ + "-deps[iterate over not just the named packages but also all their dependencies]" \ + "-e[change the handling of erroneous packages]" \ + "-export[set the Export field to the name of a file containing up-to-date export information for the given package]" \ + "-find[identify the named packages but not resolve their dependencies]" \ + "-test[report not only the named packages but also their test binaries]" \ + "-m[list modules instead of packages]" \ + "-u[adds information about available upgrades]" \ + "-versions[set the Module's Versions field to a list of all known versions of that module]:number" \ + "*:importpaths:__go_packages" + ;; + mod) + typeset -a mod_commands + mod_commands+=( + 'download[download modules to local cache]' + 'edit[edit go.mod from tools or scripts]' + 'graph[print module requirement graph]' + 'init[initialize new module in current directory]' + 'tidy[add missing and remove unused modules]' + 'vendor[make vendored copy of dependencies]' + 'verify[verify dependencies have expected content]' + 'why[explain why packages or modules are needed]' + ) + if (( CURRENT == 3 )); then + _values 'go mod commands' ${mod_commands[@]} "help[display help]" + return + fi + case ${words[3]} in + help) + _values 'go mod commands' ${mod_commands[@]} + ;; + download) + _arguments -s -w : \ + "-json[print a sequence of JSON objects standard output]" \ + "*:flags" + ;; + edit) + _arguments -s -w : \ + "-fmt[reformat the go.mod file]" \ + "-module[change the module's path]" \ + "-replace[=old{@v}=new{@v} add a replacement of the given module path and version pair]:name" \ + "-dropreplace[=old{@v}=new{@v} drop a replacement of the given module path and version pair]:name" \ + "-go[={version} set the expected Go language version]:number" \ + "-print[print the final go.mod in its text format]" \ + "-json[print the final go.mod file in JSON format]" \ + "*:flags" + ;; + graph) + ;; + init) + ;; + tidy) + _arguments -s -w : \ + "-v[print information about removed modules]" \ + "*:flags" + ;; + vendor) + _arguments -s -w : \ + "-v[print the names of vendored]" \ + "*:flags" + ;; + verify) + ;; + why) + _arguments -s -w : \ + "-m[treats the arguments as a list of modules and finds a path to any package in each of the modules]" \ + "-vendor[exclude tests of dependencies]" \ + "*:importpaths:__go_packages" + ;; + esac + ;; help) _values "${commands[@]}" \ 'environment[show Go environment variables available]' \ @@ -189,6 +265,7 @@ alias gofa='go fmt ./...' alias gog='go get' alias goi='go install' alias gol='go list' +alias gom='go mod' alias gop='cd $GOPATH' alias gopb='cd $GOPATH/bin' alias gops='cd $GOPATH/src' -- cgit v1.2.3-70-g09d2 From a441f64d090d30856a1f56a10820b219ffc10e18 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 Mar 2019 22:40:50 +0100 Subject: Update _cargo completion to 0.34.0 version --- plugins/cargo/_cargo | 193 ++++++++++++++++++++++++++------------------------- 1 file changed, 99 insertions(+), 94 deletions(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index a8c58ecc5..395c517cd 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -1,23 +1,37 @@ #compdef cargo -typeset -A opt_args autoload -U regexp-replace +zstyle -T ':completion:*:*:cargo:*' tag-order && \ + zstyle ':completion:*:*:cargo:*' tag-order 'common-commands' + _cargo() { +local context state state_descr line +typeset -A opt_args +# leading items in parentheses are an exclusion list for the arguments following that arg +# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions +# - => exclude all other options +# 1 => exclude positional arg 1 +# * => exclude all other args +# +blah => exclude +blah _arguments \ '(- 1 *)'{-h,--help}'[show help message]' \ + '(- 1 *)--list[list installed commands]' \ '(- 1 *)'{-V,--version}'[show version information]' \ - '(- 1 *)'--list'[list installed commands]' \ - '(- 1 *)'--explain'[Run `rustc --explain CODE`]' \ - '(- 1 *)'{-v,--verbose}'[use verbose output]' \ - '(- 1 *)'--color'[colorization option]' \ - '(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \ - '(- 1 *)'--locked'[Require Cargo.lock is up to date]' \ - '1: :_cargo_cmds' \ + {-v,--verbose}'[use verbose output]' \ + --color'[colorization option]' \ + '(+beta +nightly)+stable[use the stable toolchain]' \ + '(+stable +nightly)+beta[use the beta toolchain]' \ + '(+stable +beta)+nightly[use the nightly toolchain]' \ + '1: :->command' \ '*:: :->args' case $state in + command) + _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds' + ;; + args) case $words[1] in bench) @@ -31,11 +45,10 @@ case $state in '--no-default-features[do not build the default features]' \ '--no-run[compile but do not run]' \ '(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \ - '--target=[target triple]: :_get_targets' \ + '--target=[target triple]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--message-format=[error format]:format option:(human json)' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; build) @@ -49,11 +62,27 @@ case $state in '--no-default-features[do not build the default features]' \ '(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \ '--release=[build in release mode]' \ - '--target=[target triple]: :_get_targets' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + check) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + "${command_scope_spec[@]}" \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-default-features[do not check the default features]' \ + '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \ + '--release=[check in release mode]' \ + '--target=[target triple]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--message-format=[error format]:format option:(human json)' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; clean) @@ -63,9 +92,9 @@ case $state in '(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[whether or not to clean release artifacts]' \ - '--target=[target triple(default:all)]: :_get_targets' \ + '--target=[target triple(default:all)]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; doc) @@ -81,9 +110,9 @@ case $state in '(-p, --package)'{-p,--package}'=[package to document]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[build artifacts in release mode, with optimizations]' \ - '--target=[build for the target triple]: :_get_targets' \ + '--target=[build for the target triple]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; fetch) @@ -92,7 +121,7 @@ case $state in '--manifest-path=[path to manifest]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; generate-lockfile) @@ -101,17 +130,17 @@ case $state in '--manifest-path=[path to manifest]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; git-checkout) _arguments \ '(-h, --help)'{-h,--help}'[show help message]' \ - 'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--reference=[REF]' \ '--url=[URL]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; help) @@ -128,14 +157,14 @@ case $state in '--name=[set the resulting package name]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; install) _arguments \ '--bin=[only install the specified binary]' \ '--branch=[branch to use when installing from git]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ '--debug[build in debug mode instead of release mode]' \ '--example[install the specified example instead of binaries]' \ '--features=[space separated feature list]' \ @@ -144,10 +173,10 @@ case $state in '(-h, --help)'{-h,--help}'[show help message]' \ '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ '--no-default-features[do not build the default features]' \ - '--path=[local filesystem path to crate to install]' \ + '--path=[local filesystem path to crate to install]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--rev=[specific commit to use when installing from git]' \ - '--root=[directory to install packages into]' \ + '--root=[directory to install packages into]: :_files -/' \ '--tag=[tag to use when installing from git]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '--vers=[version to install from crates.io]' \ @@ -165,7 +194,7 @@ case $state in '--host=[Host to set the token for]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; metadata) @@ -179,7 +208,7 @@ case $state in '--features=[space separated feature list]' \ '--all-features[enable all available features]' \ '--format-version=[format version(default: 1)]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; new) @@ -190,7 +219,7 @@ case $state in '--name=[set the resulting package name]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; owner) @@ -203,7 +232,7 @@ case $state in '(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \ '--token[API token to use when authenticating]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; package) @@ -215,7 +244,7 @@ case $state in '--no-verify[do not build to verify contents]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; pkgid) @@ -224,7 +253,7 @@ case $state in '--manifest-path=[path to manifest]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; publish) @@ -236,7 +265,7 @@ case $state in '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--token[token to use when uploading]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; read-manifest) @@ -244,7 +273,7 @@ case $state in '(-h, --help)'{-h,--help}'[show help message]' \ '--manifest-path=[path to manifest]: :_files -/' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; run) @@ -261,52 +290,49 @@ case $state in '--release=[build in release mode]' \ '--target=[target triple]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--message-format=[error format]:format option:(human json)' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ '*: :_normal' \ ;; rustc) _arguments \ - '--message-format=[error format]:format option:(human json)' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ '--features=[features to compile for the package]' \ '--all-features[enable all available features]' \ '(-h, --help)'{-h,--help}'[show help message]' \ '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ - '--manifest-path=[path to the manifest to fetch dependencies for]' \ + '--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \ '--no-default-features[do not compile default features for the package]' \ '(-p, --package)'{-p,--package}'=[profile to compile for]' \ '--profile=[profile to build the selected target for]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[build artifacts in release mode, with optimizations]' \ - '--target=[target triple which compiles will be for]: :_get_targets' \ + '--target=[target triple which compiles will be for]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ "${command_scope_spec[@]}" \ ;; rustdoc) _arguments \ - '--message-format=[error format]:format option:(human json)' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ '--features=[space-separated list of features to also build]' \ '--all-features[enable all available features]' \ '(-h, --help)'{-h,--help}'[show help message]' \ '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ - '--manifest-path=[path to the manifest to document]' \ + '--manifest-path=[path to the manifest to document]: :_files -/' \ '--no-default-features[do not build the `default` feature]' \ '--open[open the docs in a browser after the operation]' \ '(-p, --package)'{-p,--package}'=[package to document]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[build artifacts in release mode, with optimizations]' \ - '--target=[build for the target triple]: :_get_targets' \ + '--target=[build for the target triple]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ "${command_scope_spec[@]}" \ ;; search) _arguments \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ '(-h, --help)'{-h,--help}'[show help message]' \ '--host=[host of a registry to search in]' \ '--limit=[limit the number of results]' \ @@ -328,20 +354,28 @@ case $state in '(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--release[build artifacts in release mode, with optimizations]' \ - '--target=[target triple]: :_get_targets' \ + '--target=[target triple]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--message-format=[error format]:format option:(human json)' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ '1: :_test_names' \ + '(--doc --bin --example --test --bench)--lib[only test library]' \ + '(--lib --bin --example --test --bench)--doc[only test documentation]' \ + '(--lib --doc --example --test --bench)--bin=[binary name]' \ + '(--lib --doc --bin --test --bench)--example=[example name]' \ + '(--lib --doc --bin --example --bench)--test=[test name]' \ + '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ + '--message-format:error format:(human json short)' \ + '--frozen[require lock and cache up to date]' \ + '--locked[require lock up to date]' ;; uninstall) _arguments \ '--bin=[only uninstall the binary NAME]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ '(-h, --help)'{-h,--help}'[show help message]' \ '(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \ - '--root=[directory to uninstall packages from]' \ + '--root=[directory to uninstall packages from]: :_files -/' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ ;; @@ -354,7 +388,7 @@ case $state in '--precise=[update single dependency to PRECISE]: :' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; verify-project) @@ -363,14 +397,14 @@ case $state in '--manifest-path=[path to manifest]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; version) _arguments \ '(-h, --help)'{-h,--help}'[show help message]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ ;; yank) @@ -381,7 +415,7 @@ case $state in '--token[API token to use when authenticating]' \ '--undo[undo a yank, putting a version back into the index]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=[coloring]:colorization option:(auto always never)' \ + '--color=:colorization option:(auto always never)' \ '--vers[yank version]' \ ;; esac @@ -390,22 +424,22 @@ esac } _cargo_cmds(){ -local IFS=$'\n' local -a commands;commands=( 'bench:execute all benchmarks of a local package' -'build:compile the current project' +'build:compile the current package' +'check:check the current package without compiling' 'clean:remove generated artifacts' 'doc:build package documentation' 'fetch:fetch package dependencies' 'generate-lockfile:create lockfile' 'git-checkout:git checkout' 'help:get help for commands' -'init:create new project in current directory' +'init:create new package in current directory' 'install:install a Rust binary' 'locate-project:print "Cargo.toml" location' 'login:login to remote server' -'metadata:the metadata for a project in json' -'new:create a new project' +'metadata:the metadata for a package in json' +'new:create a new package' 'owner:manage the owners of a crate on the registry' 'package:assemble local package into a distributable tarball' 'pkgid:print a fully qualified package specification' @@ -421,10 +455,13 @@ local -a commands;commands=( 'verify-project:check Cargo.toml' 'version:show version information' 'yank:remove pushed file from index' -$( cargo --list | sed -n '1!p' | tr -s ' ' | cut -d ' ' -f 2 | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed "s/\(.*\)/echo \"\1:$\(cargo help \1 2>\&1 | head -n 1\)\"/" | sh ) ) -_describe 'command' commands +_describe -t common-commands 'common commands' commands +} +_cargo_all_cmds(){ +local -a commands;commands=($(cargo --list)) +_describe -t all-commands 'all commands' commands } @@ -492,38 +529,7 @@ _benchmark_names() _get_names_from_array "bench" } -#Gets the target names from config files -_get_targets() -{ - local CURRENT_PATH - if [[ $(uname -o) = "Cygwin" && -f "$PWD"/Cargo.toml ]]; then - CURRENT_PATH=$PWD - else - CURRENT_PATH=$(_locate_manifest) - fi - if [[ -z "$CURRENT_PATH" ]]; then - return 1 - fi - local -a TARGETS - local -a FIND_PATHS=( "/" ) - local -a FLINES - local FIND_PATH FLINE - while [[ "$CURRENT_PATH" != "/" ]]; do - FIND_PATHS+=( "$CURRENT_PATH" ) - CURRENT_PATH=$(dirname $CURRENT_PATH) - done - for FIND_PATH in ${FIND_PATHS[@]}; do - if [[ -f "$FIND_PATH"/.cargo/config ]]; then - FLINES=( `grep "$FIND_PATH"/.cargo/config -e "^\[target\."` ) - for FLINE in ${FLINES[@]}; do - TARGETS+=(`sed 's/^\[target\.\(.*\)\]$/\1/' <<< $FLINE`) - done - fi - done - _describe 'target' TARGETS -} - -# These flags are mutally exclusive specifiers for the scope of a command; as +# These flags are mutually exclusive specifiers for the scope of a command; as # they are used in multiple places without change, they are expanded into the # appropriate command's `_arguments` where appropriate. set command_scope_spec @@ -535,5 +541,4 @@ command_scope_spec=( '(--bench --bin --example --lib)--test=[test name]' ) - _cargo -- cgit v1.2.3-70-g09d2 From 61a7bc2d4aa1012ca46d4a4bc8d0e7c20af675b7 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 Mar 2019 22:42:38 +0100 Subject: Update README --- plugins/cargo/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/cargo/README.md b/plugins/cargo/README.md index 5fa688d21..31bae4efe 100644 --- a/plugins/cargo/README.md +++ b/plugins/cargo/README.md @@ -1,6 +1,6 @@ # cargo -This plugin adds completion for the Rust build tool [`cargo`](https://github.com/rust-lang/cargo). +This plugin adds completion for the Rust build tool [`Cargo`](https://github.com/rust-lang/cargo). To use it, add `cargo` to the plugins array in your zshrc file: @@ -8,4 +8,4 @@ To use it, add `cargo` to the plugins array in your zshrc file: plugins=(... cargo) ``` -Updated on October 4th, 2016. +Updated on March 3rd, 2019, from [Cargo 0.34.0](https://github.com/rust-lang/cargo/releases/tag/0.34.0). -- cgit v1.2.3-70-g09d2 From b7b40b0b68c791d57d91c7f4e17ed681d01d5c75 Mon Sep 17 00:00:00 2001 From: Jakub Łuczyński Date: Tue, 26 Mar 2019 14:44:58 +0100 Subject: fd: fix fd-find completions for debian (#7704) In debian package, fd executable is renamed to fdfind. --- plugins/fd/_fd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fd/_fd b/plugins/fd/_fd index 7d65c7856..7a4c38753 100644 --- a/plugins/fd/_fd +++ b/plugins/fd/_fd @@ -1,4 +1,4 @@ -#compdef fd +#compdef fd fdfind autoload -U is-at-least -- cgit v1.2.3-70-g09d2 From 7fe353ccb64017abb4de43b7e947115b8ec58871 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 Mar 2019 16:55:28 +0100 Subject: ubuntu: clean up plugin and README --- plugins/ubuntu/README.md | 68 ++++++++++++++++------------- plugins/ubuntu/ubuntu.plugin.zsh | 93 +++++++++++++--------------------------- 2 files changed, 68 insertions(+), 93 deletions(-) diff --git a/plugins/ubuntu/README.md b/plugins/ubuntu/README.md index caa6a90b4..fd03f6afe 100644 --- a/plugins/ubuntu/README.md +++ b/plugins/ubuntu/README.md @@ -2,7 +2,7 @@ This plugin adds completions and aliases for [Ubuntu](https://www.ubuntu.com/). -To use it, add `ubuntu` to the plugins array in your zshrc file: +To use it, add `ubuntu` to the plugins array in your zshrc file: ```zsh plugins=(... ubuntu) @@ -10,34 +10,34 @@ plugins=(... ubuntu) ## Aliases -Commands that use `$APT` will use apt if installed or defer to apt-get otherwise. - -| Alias | Command | Description | -|---------|------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------| -| acs | `apt-cache search` | Search the apt-cache with the specified criteria | -| acp | `apt-cache policy` | Display the package source priorities | -| afs | `apt-file search --regexp` | Perform a regular expression apt-file search | -| afu | `sudo apt-file update` | Generates or updates the apt-file package database | -| ag | `sudo $APT` | Run apt-get with sudo | -| aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded | -| agb | `sudo $APT build-dep ` | Installs/Removes packages to satisfy the dependencies of a specified build pkg | -| agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files | -| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation | -| agi | `sudo $APT install ` | Install the specified package | -| agli | `apt list --installed` | List the installed packages | -| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts | -| agp | `sudo $APT purge ` | Remove a package including any configuration files | -| agr | `sudo $APT remove ` | Remove a package | -| ags | `$APT source ` | Fetch the source for the specified package | -| agu | `sudo $APT update` | Update package list | -| agud | `sudo $APT update && sudo $APT dist-upgrade` | Update packages list and perform a distribution upgrade | -| agug | `sudo $APT upgrade` | Upgrade available packages | -| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed | -| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages | -| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages | -| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` |Remove ALL kernel images and headers EXCEPT the one in use | -| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package | -| ppap | `sudo ppa-purge ` | Remove the specified PPA | +Commands that use `$APT` will use `apt` if installed or defer to `apt-get` otherwise. + +| Alias | Command | Description | +|---------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------| +| acs | `apt-cache search` | Search the apt-cache with the specified criteria | +| acp | `apt-cache policy` | Display the package source priorities | +| afs | `apt-file search --regexp` | Perform a regular expression apt-file search | +| afu | `sudo apt-file update` | Generates or updates the apt-file package database | +| ag | `sudo $APT` | Run apt-get with sudo | +| aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded | +| agb | `sudo $APT build-dep ` | Installs/Removes packages to satisfy the dependencies of a specified build pkg | +| agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files | +| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation | +| agi | `sudo $APT install ` | Install the specified package | +| agli | `apt list --installed` | List the installed packages | +| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts | +| agp | `sudo $APT purge ` | Remove a package including any configuration files | +| agr | `sudo $APT remove ` | Remove a package | +| ags | `$APT source ` | Fetch the source for the specified package | +| agu | `sudo $APT update` | Update package list | +| agud | `sudo $APT update && sudo $APT dist-upgrade` | Update packages list and perform a distribution upgrade | +| agug | `sudo $APT upgrade` | Upgrade available packages | +| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed | +| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages | +| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages | +| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` |Remove ALL kernel images and headers EXCEPT the one in use | +| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package | +| ppap | `sudo ppa-purge ` | Remove the specified PPA | ## Functions @@ -47,6 +47,14 @@ Commands that use `$APT` will use apt if installed or defer to apt-get otherwise | aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package | | apt-history | `apt-history ` | Prints the Apt history of the specified action | | apt-list-packages | `apt-list-packages` | List packages by size | -| kerndeb | `kerndeb` | Kernel-package building shortcut | +| kerndeb | `kerndeb` | Kernel-package building shortcut | +## Authors: +- [@AlexBio](https://github.com/AlexBio) +- [@dbb](https://github.com/dbb) +- [@Mappleconfusers](https://github.com/Mappleconfusers) +- [@trinaldi](https://github.com/trinaldi) +- [Nicolas Jonas](https://nextgenthemes.com) +- [@loctauxphilippe](https://github.com/loctauxphilippe) +- [@HaraldNordgren](https://github.com/HaraldNordgren) diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index 198f06743..6481fa371 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -1,76 +1,43 @@ -# Authors: -# https://github.com/AlexBio -# https://github.com/dbb -# https://github.com/Mappleconfusers -# https://github.com/trinaldi -# Nicolas Jonas nextgenthemes.com -# https://github.com/loctauxphilippe -# https://github.com/HaraldNordgren -# -# Debian, Ubuntu and friends related zsh aliases and functions for zsh - (( $+commands[apt] )) && APT=apt || APT=apt-get alias acs='apt-cache search' -compdef _acs acs='apt-cache search' alias afs='apt-file search --regexp' -compdef _afs afs='apt-file search --regexp' # These are apt/apt-get only -alias ags="$APT source" # asrc -compdef _ags ags="$APT source" +alias ags="$APT source" -alias acp='apt-cache policy' # app -compdef _acp acp='apt-cache policy' +alias acp='apt-cache policy' #List all installed packages alias agli='apt list --installed' -compdef _agli agli='apt list --installed' # superuser operations ###################################################### # List available updates only alias aglu='sudo apt-get -u upgrade --assume-no' -compdef _aglu aglu='sudo apt-get -u upgrade --assume-no' alias afu='sudo apt-file update' -compdef _afu afu='sudo apt-file update' alias ppap='sudo ppa-purge' -compdef _ppap ppap='sudo ppa-purge' - -alias ag="sudo $APT" # age - but without sudo -alias aga="sudo $APT autoclean" # aac -alias agb="sudo $APT build-dep" # abd -alias agc="sudo $APT clean" # adc -alias agd="sudo $APT dselect-upgrade" # ads -alias agi="sudo $APT install" # ai -alias agp="sudo $APT purge" # ap -alias agr="sudo $APT remove" # ar -alias agu="sudo $APT update" # ad -alias agud="sudo $APT update && sudo $APT dist-upgrade" #adu -alias agug="sudo $APT upgrade" # ag -alias aguu="sudo $APT update && sudo $APT upgrade" #adg + +alias ag="sudo $APT" +alias aga="sudo $APT autoclean" +alias agb="sudo $APT build-dep" +alias agc="sudo $APT clean" +alias agd="sudo $APT dselect-upgrade" +alias agi="sudo $APT install" +alias agp="sudo $APT purge" +alias agr="sudo $APT remove" +alias agu="sudo $APT update" +alias agud="sudo $APT update && sudo $APT dist-upgrade" +alias agug="sudo $APT upgrade" +alias aguu="sudo $APT update && sudo $APT upgrade" alias agar="sudo $APT autoremove" -compdef _ag ag="sudo $APT" -compdef _aga aga="sudo $APT autoclean" -compdef _agb agb="sudo $APT build-dep" -compdef _agc agc="sudo $APT clean" -compdef _agd agd="sudo $APT dselect-upgrade" -compdef _agi agi="sudo $APT install" -compdef _agp agp="sudo $APT purge" -compdef _agr agr="sudo $APT remove" -compdef _agu agu="sudo $APT update" -compdef _agud agud="sudo $APT update && sudo $APT dist-upgrade" -compdef _agug agug="sudo $APT upgrade" -compdef _aguu aguu="sudo $APT update && sudo $APT upgrade" -compdef _agar agar="sudo $APT autoremove" # Remove ALL kernel images and headers EXCEPT the one in use -alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ - ?not(~n`uname -r`))' +alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))' # Misc. ##################################################################### # print all installed packages @@ -89,11 +56,11 @@ aar() { else read "PACKAGE?Type in the package name to install/upgrade with this ppa [${1##*/}]: " fi - + if [ -z "$PACKAGE" ]; then PACKAGE=${1##*/} fi - + sudo apt-add-repository $1 && sudo $APT update sudo $APT install $PACKAGE } @@ -136,22 +103,22 @@ apt-history () { # Kernel-package building shortcut kerndeb () { - # temporarily unset MAKEFLAGS ( '-j3' will fail ) - MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) - print '$MAKEFLAGS set to '"'$MAKEFLAGS'" - appendage='-custom' # this shows up in $ (uname -r ) - revision=$(date +"%Y%m%d") # this shows up in the .deb file name + # temporarily unset MAKEFLAGS ( '-j3' will fail ) + MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) + print '$MAKEFLAGS set to '"'$MAKEFLAGS'" + appendage='-custom' # this shows up in $(uname -r) + revision=$(date +"%Y%m%d") # this shows up in the .deb file name - make-kpkg clean + make-kpkg clean - time fakeroot make-kpkg --append-to-version "$appendage" --revision \ - "$revision" kernel_image kernel_headers + time fakeroot make-kpkg --append-to-version "$appendage" --revision \ + "$revision" kernel_image kernel_headers } # List packages by size function apt-list-packages { - dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \ - grep -v deinstall | \ - sort -n | \ - awk '{print $1" "$2}' + dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \ + grep -v deinstall | \ + sort -n | \ + awk '{print $1" "$2}' } -- cgit v1.2.3-70-g09d2 From 7d27843e892e0906e70b7392c20ddde149636553 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 Mar 2019 16:56:52 +0100 Subject: ubuntu: rename ag to age to avoid conflict with The Silver Searcher Fixes #3866 --- plugins/ubuntu/README.md | 2 +- plugins/ubuntu/ubuntu.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/ubuntu/README.md b/plugins/ubuntu/README.md index fd03f6afe..f72182f5c 100644 --- a/plugins/ubuntu/README.md +++ b/plugins/ubuntu/README.md @@ -14,11 +14,11 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other | Alias | Command | Description | |---------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------| +| age | `sudo $APT` | Run apt-get with sudo | | acs | `apt-cache search` | Search the apt-cache with the specified criteria | | acp | `apt-cache policy` | Display the package source priorities | | afs | `apt-file search --regexp` | Perform a regular expression apt-file search | | afu | `sudo apt-file update` | Generates or updates the apt-file package database | -| ag | `sudo $APT` | Run apt-get with sudo | | aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded | | agb | `sudo $APT build-dep ` | Installs/Removes packages to satisfy the dependencies of a specified build pkg | | agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files | diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index 6481fa371..d589096c3 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -21,7 +21,7 @@ alias afu='sudo apt-file update' alias ppap='sudo ppa-purge' -alias ag="sudo $APT" +alias age="sudo $APT" alias aga="sudo $APT autoclean" alias agb="sudo $APT build-dep" alias agc="sudo $APT clean" -- cgit v1.2.3-70-g09d2 From 15f29aacc2b6d30a767e72e7b751fa39f929a0ae Mon Sep 17 00:00:00 2001 From: Janek <27jf@web.de> Date: Fri, 29 Mar 2019 22:16:29 +0100 Subject: gradle: also support settings files (#7014) --- plugins/gradle/gradle.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 8df62c2e2..8d578e27b 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -156,7 +156,7 @@ _gradle_parse_and_extract_tasks () { # Discover the gradle tasks by running "gradle tasks --all" ############################################################################ _gradle_tasks () { - if [[ -f build.gradle || -f build.gradle.kts ]]; then + if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache @@ -166,7 +166,7 @@ _gradle_tasks () { } _gradlew_tasks () { - if [[ -f build.gradle || -f build.gradle.kts ]]; then + if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache -- cgit v1.2.3-70-g09d2 From a43cef34043dae63d73cd40b7e887a43e7b93680 Mon Sep 17 00:00:00 2001 From: Oleg Smelov Date: Fri, 29 Mar 2019 23:17:19 +0200 Subject: pyenv: detect pyenv from Homebrew faster (#7670) --- plugins/pyenv/pyenv.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index dbc7da472..4e92b8017 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -4,7 +4,7 @@ FOUND_PYENV=$+commands[pyenv] if [[ $FOUND_PYENV -ne 1 ]]; then - pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv") + 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" -- cgit v1.2.3-70-g09d2 From f1799de0c92357cfafd501c3f74375d197a1708c Mon Sep 17 00:00:00 2001 From: "Lucas A. Rodrigues" Date: Fri, 29 Mar 2019 18:39:52 -0300 Subject: Add drush plugin (#4490) --- plugins/drush/README.md | 83 ++++++++++++++++++++++++++++++++ plugins/drush/drush.complete.sh | 50 +++++++++++++++++++ plugins/drush/drush.plugin.zsh | 104 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 237 insertions(+) create mode 100644 plugins/drush/README.md create mode 100644 plugins/drush/drush.complete.sh create mode 100644 plugins/drush/drush.plugin.zsh diff --git a/plugins/drush/README.md b/plugins/drush/README.md new file mode 100644 index 000000000..df7b82bdd --- /dev/null +++ b/plugins/drush/README.md @@ -0,0 +1,83 @@ +# Drush + +## Description +This plugin offers aliases and functions to make the work with drush easier and more productive. + +To enable it, add the `drush` to your `plugins` array in `~/.zshrc`: + +``` +plugins=(... drush) +``` + +## Aliases +| Alias | Description | Command | +|-------|-----------------------------------------------------------------------|-----------------------------| +| dr | Display drush help | drush | +| drca | Clear all drupal caches. | drush cc all | +| drcb | Clear block cache. | drush cc block | +| drcg | Clear registry cache. | drush cc registry | +| drcj | Clear css-js cache. | drush cc css-js | +| drcm | Clear menu cache. | drush cc menu | +| drcml | Clear module-list cache. | drush cc module-list | +| drcr | Run all cron hooks in all active modules for specified site. | drush core-cron | +| drct | Clear theme-registry cache. | drush cc theme-registry | +| drcv | Clear views cache. (Make sure that the views module is enabled) | drush cc views | +| drdmp | Backup database in a new dump.sql file | drush drush sql-dump --ordered-dump --result-file=dump.sql| +| drf | Display features status | drush features | +| drfr | Revert a feature module on your site. | drush features-revert -y | +| drfu | Update a feature module on your site. | drush features-update -y | +| drfra | Revert all enabled feature module on your site. | drush features-revert-all | +| drif | Flush all derived images. | drush image-flush --all | +| drpm | Show a list of available modules. | drush pm-list --type=module | +| drst | Provides a birds-eye view of the current Drupal installation, if any. | drush core-status | +| drup | Apply any database updates required (as with running update.php). | drush updatedb | +| drups | List any pending database updates. | drush updatedb-status | +| drv | Show drush version. | drush version | +| drvd | Delete a variable. | drush variable-del | +| drvg | Get a list of some or all site variables and values. | drush variable-get | +| drvs | Set a variable. | drush variable-set | + +## Functions + +### dren +Download and enable one or more extensions (modules or themes). +Must be invoked with one or more parameters. e.g.: +`dren devel` or `dren devel module_filter views` + +### drf +Edit drushrc, site alias, and Drupal settings.php files. +Can be invoked with one or without parameters. e.g.: +`drf 1` + +### dris +Disable one or more extensions (modules or themes) +Must be invoked with one or more parameters. e.g.: +`dris devel` or `dris devel module_filter views` + +### drpu +Uninstall one or more modules. +Must be invoked with one or more parameters. e.g.: +`drpu devel` or `drpu devel module_filter views` + +### drnew +Creates a brand new drupal website. +Note: As soon as the installation is complete, drush will print a username and a random password into the terminal: +``` +Installation complete. User name: admin User password: cf7t8yqNEm +``` + +## Additional features + +### Autocomplete +The [completion script for drush](https://github.com/drush-ops/drush/blob/8.0.1/drush.complete.sh) comes enabled with this plugin. +So, it is possible to type a command: +``` +drush sql +``` + +And as soon as the tab key is pressed, the script will display the available commands: +``` +drush sql +sqlc sql-conf sql-create sql-dump sql-query sql-sanitize +sql-cli sql-connect sql-drop sqlq sqlsan sql-sync +``` diff --git a/plugins/drush/drush.complete.sh b/plugins/drush/drush.complete.sh new file mode 100644 index 000000000..38b882ec3 --- /dev/null +++ b/plugins/drush/drush.complete.sh @@ -0,0 +1,50 @@ +# BASH completion script for Drush. +# +# Place this in your /etc/bash_completion.d/ directory or source it from your +# ~/.bash_completion or ~/.bash_profile files. Alternatively, source +# examples/example.bashrc instead, as it will automatically find and source +# this file. +# +# If you're using ZSH instead of BASH, add the following to your ~/.zshrc file +# and source it. +# +# autoload bashcompinit +# bashcompinit +# source /path/to/your/drush.complete.sh + +# Ensure drush is available. +which drush > /dev/null || alias drush &> /dev/null || return + +__drush_ps1() { + f="${TMPDIR:-/tmp/}/drush-env-${USER}/drush-drupal-site-$$" + if [ -f $f ] + then + __DRUPAL_SITE=$(cat "$f") + else + __DRUPAL_SITE="$DRUPAL_SITE" + fi + + # Set DRUSH_PS1_SHOWCOLORHINTS to a non-empty value and define a + # __drush_ps1_colorize_alias() function for color hints in your Drush PS1 + # prompt. See example.prompt.sh for an example implementation. + if [ -n "${__DRUPAL_SITE-}" ] && [ -n "${DRUSH_PS1_SHOWCOLORHINTS-}" ]; then + __drush_ps1_colorize_alias + fi + + [[ -n "$__DRUPAL_SITE" ]] && printf "${1:- (%s)}" "$__DRUPAL_SITE" +} + +# Completion function, uses the "drush complete" command to retrieve +# completions for a specific command line COMP_WORDS. +_drush_completion() { + # Set IFS to newline (locally), since we only use newline separators, and + # need to retain spaces (or not) after completions. + local IFS=$'\n' + # The '< /dev/null' is a work around for a bug in php libedit stdin handling. + # Note that libedit in place of libreadline in some distributions. See: + # https://bugs.launchpad.net/ubuntu/+source/php5/+bug/322214 + COMPREPLY=( $(drush --early=includes/complete.inc "${COMP_WORDS[@]}" < /dev/null 2> /dev/null) ) +} + +# Register our completion function. We include common short aliases for Drush. +complete -o bashdefault -o default -o nospace -F _drush_completion d dr drush drush5 drush6 drush7 drush8 drush.php diff --git a/plugins/drush/drush.plugin.zsh b/plugins/drush/drush.plugin.zsh new file mode 100644 index 000000000..8a20d79f2 --- /dev/null +++ b/plugins/drush/drush.plugin.zsh @@ -0,0 +1,104 @@ +# Drush support. + +function dren() { + drush en $@ -y +} + +function dris() { + drush pm-disable $@ -y +} + +function drpu() { + drush pm-uninstall $@ -y +} + +function drf() { + if [[ $1 == "" ]] then + drush core-config + else + drush core-config --choice=$1 + fi +} + +function drfi() { + if [[ $1 == "fields" ]]; then + drush field-info fields + elif [[ $1 == "types" ]]; then + drush field-info types + else + drush field-info + fi +} + +function drnew() { + + cd ~ + echo "Website's name: " + read WEBSITE_NAME + + HOST=http://$(hostname -i)/ + + if [[ $WEBSITE_NAME == "" ]] then + MINUTES=$(date +%M:%S) + WEBSITE_NAME="Drupal-$MINUTES" + echo "Your website will be named: $WEBSITE_NAME" + fi + + drush dl drupal --drupal-project-rename=$WEBSITE_NAME + + echo "Type your localhost directory: (Leave empty for /var/www/html/)" + read DIRECTORY + + if [[ $DIRECTORY == "" ]] then + DIRECTORY="/var/www/html/" + fi + + echo "Moving to $DIRECTORY$WEBSITE_NAME" + sudo mv $WEBSITE_NAME $DIRECTORY + cd $DIRECTORY$WEBSITE_NAME + + echo "Database's user: " + read DATABASE_USR + echo "Database's password: " + read -s DATABASE_PWD + echo "Database's name for your project: " + read DATABASE + + DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE" + drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME + + open_command $HOST$WEBSITE_NAME + echo "Done" + +} + +# Aliases, sorted alphabetically. +alias dr="drush" +alias drca="drush cc all" # Deprecated for Drush 8 +alias drcb="drush cc block" # Deprecated for Drush 8 +alias drcg="drush cc registry" # Deprecated for Drush 8 +alias drcj="drush cc css-js" +alias drcm="drush cc menu" +alias drcml="drush cc module-list" +alias drcr="drush core-cron" +alias drct="drush cc theme-registry" +alias drcv="drush cc views" +alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql" +alias drf="drush features" +alias drfr="drush features-revert -y" +alias drfu="drush features-update -y" +alias drfra="drush features-revert-all" +alias drif="drush image-flush --all" +alias drpm="drush pm-list --type=module" +alias drst="drush core-status" +alias drup="drush updatedb" +alias drups="drush updatedb-status" +alias drv="drush version" +alias drvd="drush variable-del" +alias drvg="drush variable-get" +alias drvs="drush variable-set" + +# Enable drush autocomplete support +autoload bashcompinit +bashcompinit +source $(dirname $0)/drush.complete.sh -- cgit v1.2.3-70-g09d2 From 0e0789fb7aedd1afd8ae07dfc9609f6a7f2e407f Mon Sep 17 00:00:00 2001 From: Jakub Chábek Date: Fri, 29 Mar 2019 22:56:59 +0100 Subject: git: delete branches in `gbda` only if there are any (#6079) It doesn't make sense to run `git branch -d $BRANCH` if the `$BRANCH` is empty. --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6fc9b078b..8eccc9cee 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -50,7 +50,7 @@ alias gap='git apply' 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*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -r -n 1 git branch -d' alias gbD='git branch -D' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' -- cgit v1.2.3-70-g09d2 From 4b82b8606442c5ff0235ea95d0fc11f151638dc3 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 29 Mar 2019 22:59:37 +0100 Subject: git: add `--no-gpg-sign` to gwip (#6031) --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 8eccc9cee..302377153 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -261,4 +261,4 @@ alias gupav='git pull --rebase --autostash -v' alias glum='git pull upstream master' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' -alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"' +alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"' -- cgit v1.2.3-70-g09d2 From 93cbc1614c9900f310a48de69447e035df84e1cb Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 31 Mar 2019 15:56:35 +0200 Subject: git: use interactive mode in gclean Fixes #7716 --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 302377153..8482c4d54 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -73,7 +73,7 @@ alias gcsm='git commit -s -m' alias gcb='git checkout -b' alias gcf='git config --list' alias gcl='git clone --recurse-submodules' -alias gclean='git clean -fd' +alias gclean='git clean -id' alias gpristine='git reset --hard && git clean -dfx' alias gcm='git checkout master' alias gcd='git checkout develop' -- cgit v1.2.3-70-g09d2 From 831fba4ee4bc28d1d0a3a3f94d5b4dcdfce04588 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 2 Apr 2019 19:05:52 +0200 Subject: Revert "git: delete branches in `gbda` only if there are any (#6079)" (#7724) This reverts commit 0e0789fb7aedd1afd8ae07dfc9609f6a7f2e407f. --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 8482c4d54..5bef95bd5 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -50,7 +50,7 @@ alias gap='git apply' 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*(master|develop|dev)\s*$)" | command xargs -r -n 1 git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\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' -- cgit v1.2.3-70-g09d2 From 3a6bf6bd26b809577d42cb606e05e9ea75373d5e Mon Sep 17 00:00:00 2001 From: Greg Date: Wed, 3 Apr 2019 12:20:16 +0100 Subject: init: more informative warning if plugin not found (#7727) --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index e080257c1..b1460b1d7 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -53,7 +53,7 @@ for plugin ($plugins); do elif is_plugin $ZSH $plugin; then fpath=($ZSH/plugins/$plugin $fpath) else - echo "Warning: plugin $plugin not found" + echo "[oh-my-zsh] plugin '$plugin' not found" fi done -- cgit v1.2.3-70-g09d2 From 4ddb2e384ab0840b1d8a6d4c95770ef8a6c25fcc Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 4 Apr 2019 09:45:00 -0700 Subject: Introducing a Code of Conduct based on the Contributor Covenant project. Adding links from the README and CONTRIBUTING pages to this, too, along with an email address for reporting abusive behavior to. Closes #7733 (#7734) --- CODE_OF_CONDUCT.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 4 ++- README.md | 6 ++++- 3 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..20ad1ccee --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ohmyzsh@planetargon.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ac263fd18..f575157c2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,10 @@ # CONTRIBUTING GUIDELINES -Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated. +Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged, and appreciated. It is also essential for the development of the project. +First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md). + These guidelines are an attempt at better addressing the huge amount of pending issues and pull requests. Please read them closely. diff --git a/README.md b/README.md index 511e6aeff..dd330d19e 100644 --- a/README.md +++ b/README.md @@ -213,12 +213,16 @@ Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy b If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration. -## Contributing +## How do I contribute to Oh My Zsh? + +Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md). I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can. +See [Contributing](CONTRIBUTING.md) for more details. + ### Do NOT send us themes We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page. -- cgit v1.2.3-70-g09d2 From 046d49f7827c994916a55d1531e70564682307af Mon Sep 17 00:00:00 2001 From: Asatur Meltonyan Date: Sun, 7 Apr 2019 16:17:22 +0400 Subject: git: add 'gtl' alias to list tags matching a pattern (#7629) 1. List the tags that match the pattern(s) passed through the argument. 2. Displays the first line of the annotation message along with the tag, or the line of the first commit message if the tag is not annotated. 3. Sorts and displays tags in descending order. --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 5bef95bd5..a4b6eb977 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -251,6 +251,7 @@ alias gsu='git submodule update' alias gts='git tag -s' alias gtv='git tag | sort -V' +alias gtl='gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl' alias gunignore='git update-index --no-assume-unchanged' alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' -- cgit v1.2.3-70-g09d2 From 3cfcf5e0aa71bddcf7ab45d3880f142654f22266 Mon Sep 17 00:00:00 2001 From: sheveko <28670374+sheveko@users.noreply.github.com> Date: Sun, 7 Apr 2019 20:21:54 +0200 Subject: git-prompt: run git status with LANG=C (#6087) As described in #6086 there will be an error when one set another language than English. --- plugins/git-prompt/gitstatus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py index a4d07cde6..5243af23c 100644 --- a/plugins/git-prompt/gitstatus.py +++ b/plugins/git-prompt/gitstatus.py @@ -30,7 +30,7 @@ def get_tagname_or_hash(): # `git status --porcelain --branch` can collect all information # branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind -po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE) +po = Popen(['git', 'status', '--porcelain', '--branch'], env={"LANG": "C"}, stdout=PIPE, stderr=PIPE) stdout, sterr = po.communicate() if po.returncode != 0: sys.exit(0) # Not a git repository -- cgit v1.2.3-70-g09d2 From a85ce89a3dc7fc63b4e8518a923f9c718561eb0b Mon Sep 17 00:00:00 2001 From: Kevin Kuhl <1747773+alph486@users.noreply.github.com> Date: Sun, 7 Apr 2019 13:31:28 -0500 Subject: refined: reset command exec time (#6117) Fixes #6116 --- themes/refined.zsh-theme | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme index 0e5681cc7..2a4188c9d 100644 --- a/themes/refined.zsh-theme +++ b/themes/refined.zsh-theme @@ -72,6 +72,7 @@ preexec() { precmd() { vcs_info # Get version control info before we start outputting stuff print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" + unset cmd_timestamp #Reset cmd exec time. } # Define prompts -- cgit v1.2.3-70-g09d2 From c23ab00990c8528a3334d178b9ec9135385cc99f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 7 Apr 2019 20:39:25 +0200 Subject: upgrade: fix lock-out on first upgrade check This early return made it so the lock wasn't removed, therefore locking out the upgrade script from ever entering the upgrade routine. Fixes #6138 Note: the logic needs some rework. --- tools/check_for_upgrade.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 05b31e8d4..c8dedcf77 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -34,7 +34,9 @@ if mkdir "$ZSH/log/update.lock" 2>/dev/null; then . ${ZSH_CACHE_DIR}/.zsh-update if [[ -z "$LAST_EPOCH" ]]; then - _update_zsh_update && return 0 + _update_zsh_update + rmdir $ZSH/log/update.lock # TODO: fix later + return 0 fi epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) -- cgit v1.2.3-70-g09d2 From 651856d4a3b37467cd26a5c5d8de52bd76a9be7f Mon Sep 17 00:00:00 2001 From: Roman Dzieciol Date: Sun, 7 Apr 2019 23:26:43 +0100 Subject: Update the swiftpm plugin autocompletion for Swift 5.0 --- plugins/swiftpm/README.md | 19 ++++ plugins/swiftpm/_swift | 235 ++++++++++++++++++++++++++++++++-------------- 2 files changed, 183 insertions(+), 71 deletions(-) diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md index 07ca25651..d9462fb7f 100644 --- a/plugins/swiftpm/README.md +++ b/plugins/swiftpm/README.md @@ -20,3 +20,22 @@ plugins=(... swiftpm) | `spx` | Generates an Xcode project | `swift package generate-xcodeproj` | | `sps` | Print the resolved dependency graph | `swift package show-dependencies` | | `spd` | Print parsed Package.swift as JSON | `swift package dump-package` | + +## Autocompletion + +The `_swift` file enables autocompletion for Swift Package Manager. Current version supports Swift 5.0 + + +### Updating the autocompletion for new version of Swift + +To update autocompletion to the Swift version present on your system: +``` +swift package completion-tool generate-zsh-script > ~/.oh-my-zsh/plugins/swiftpm/_swift +``` + +### Known issues + +If `swiftpm` is not added to your zsh plugins list, autocompletion will still be triggered but will result in errors: +``` +_values:compvalues:10: not enough arguments +``` diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift index bed6e13a7..1366b4d9c 100644 --- a/plugins/swiftpm/_swift +++ b/plugins/swiftpm/_swift @@ -72,16 +72,23 @@ _swift_build() { "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files" "(--chdir -C)"{--chdir,-C}"[]: :_files" "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files" - "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}" + "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}" "--disable-prefetching[]" "--skip-update[Skip updating dependencies from their remote during a resolution]" "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" "--version[]" "--destination[]: :_files" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]" + "--enable-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" "--build-tests[Build both source and test targets]" "--product[Build the specified product]:Build the specified product: " "--target[Build the specified target]:Build the specified target: " @@ -108,17 +115,26 @@ _swift_run() { "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files" "(--chdir -C)"{--chdir,-C}"[]: :_files" "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files" - "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}" + "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}" "--disable-prefetching[]" "--skip-update[Skip updating dependencies from their remote during a resolution]" "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" "--version[]" "--destination[]: :_files" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]" + "--enable-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" "--skip-build[Skip building the executable product]" + "--build-tests[Build both source and test targets]" + "--repl[Launch Swift REPL for the package]" ) _arguments $arguments && return } @@ -140,16 +156,23 @@ _swift_package() { "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files" "(--chdir -C)"{--chdir,-C}"[]: :_files" "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files" - "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}" + "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}" "--disable-prefetching[]" "--skip-update[Skip updating dependencies from their remote during a resolution]" "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" "--version[]" "--destination[]: :_files" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]" + "--enable-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" '(-): :->command' '(-)*:: :->arg' ) @@ -158,91 +181,124 @@ _swift_package() { (command) local modes modes=( - 'edit:Put a package in editable mode' - 'clean:Delete build artifacts' - 'init:Initialize a new package' - 'dump-package:Print parsed Package.swift as JSON' + 'update:Update package dependencies' 'describe:Describe the current package' + 'resolve:Resolve package dependencies' + 'tools-version:Manipulate tools version of the current package' 'unedit:Remove a package from editable mode' - 'update:Update package dependencies' + 'show-dependencies:Print the resolved dependency graph' + 'fetch:' + 'dump-package:Print parsed Package.swift as JSON' + 'edit:Put a package in editable mode' + 'config:Manipulate configuration of the package' 'completion-tool:Completion tool (for shell completions)' - 'tools-version:Manipulate tools version of the current package' - 'reset:Reset the complete cache/build directory' - 'resolve:Resolve package dependencies' + 'clean:Delete build artifacts' 'generate-xcodeproj:Generates an Xcode project' - 'fetch:' - 'show-dependencies:Print the resolved dependency graph' + 'reset:Reset the complete cache/build directory' + 'init:Initialize a new package' ) _describe "mode" modes ;; (arg) case ${words[1]} in - (edit) - _swift_package_edit - ;; - (clean) - _swift_package_clean - ;; - (init) - _swift_package_init - ;; - (dump-package) - _swift_package_dump-package + (update) + _swift_package_update ;; (describe) _swift_package_describe ;; + (resolve) + _swift_package_resolve + ;; + (tools-version) + _swift_package_tools-version + ;; (unedit) _swift_package_unedit ;; - (update) - _swift_package_update + (show-dependencies) + _swift_package_show-dependencies ;; - (completion-tool) - _swift_package_completion-tool + (fetch) + _swift_package_fetch ;; - (tools-version) - _swift_package_tools-version + (dump-package) + _swift_package_dump-package ;; - (reset) - _swift_package_reset + (edit) + _swift_package_edit ;; - (resolve) - _swift_package_resolve + (config) + _swift_package_config + ;; + (completion-tool) + _swift_package_completion-tool + ;; + (clean) + _swift_package_clean ;; (generate-xcodeproj) _swift_package_generate-xcodeproj ;; - (fetch) - _swift_package_fetch + (reset) + _swift_package_reset ;; - (show-dependencies) - _swift_package_show-dependencies + (init) + _swift_package_init ;; esac ;; esac } -_swift_package_edit() { +_swift_package_update() { arguments=( - ":The name of the package to edit:_swift_dependency" - "--revision[The revision to edit]:The revision to edit: " - "--branch[The branch to create]:The branch to create: " - "--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files" ) _arguments $arguments && return } -_swift_package_clean() { +_swift_package_describe() { arguments=( + "--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}" ) _arguments $arguments && return } -_swift_package_init() { +_swift_package_resolve() { + arguments=( + ":The name of the package to resolve:_swift_dependency" + "--version[The version to resolve at]:The version to resolve at: " + "--branch[The branch to resolve at]:The branch to resolve at: " + "--revision[The revision to resolve at]:The revision to resolve at: " + ) + _arguments $arguments && return +} + +_swift_package_tools-version() { + arguments=( + "--set[Set tools version of package to the given value]:Set tools version of package to the given value: " + "--set-current[Set tools version of package to the current tools version in use]" + ) + _arguments $arguments && return +} + +_swift_package_unedit() { + arguments=( + ":The name of the package to unedit:_swift_dependency" + "--force[Unedit the package even if it has uncommited and unpushed changes.]" + ) + _arguments $arguments && return +} + +_swift_package_show-dependencies() { + arguments=( + "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}" + ) + _arguments $arguments && return +} + +_swift_package_fetch() { arguments=( - "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}" ) _arguments $arguments && return } @@ -253,54 +309,80 @@ _swift_package_dump-package() { _arguments $arguments && return } -_swift_package_describe() { +_swift_package_edit() { arguments=( - "--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}" + ":The name of the package to edit:_swift_dependency" + "--revision[The revision to edit]:The revision to edit: " + "--branch[The branch to create]:The branch to create: " + "--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files" ) _arguments $arguments && return } -_swift_package_unedit() { +_swift_package_config() { arguments=( - ":The name of the package to unedit:_swift_dependency" - "--force[Unedit the package even if it has uncommited and unpushed changes.]" + '(-): :->command' + '(-)*:: :->arg' ) _arguments $arguments && return + case $state in + (command) + local modes + modes=( + 'unset-mirror:Remove an existing mirror' + 'set-mirror:Set a mirror for a dependency' + 'get-mirror:Print mirror configuration for the given package dependency' + ) + _describe "mode" modes + ;; + (arg) + case ${words[1]} in + (unset-mirror) + _swift_package_config_unset-mirror + ;; + (set-mirror) + _swift_package_config_set-mirror + ;; + (get-mirror) + _swift_package_config_get-mirror + ;; + esac + ;; + esac } -_swift_package_update() { +_swift_package_config_unset-mirror() { arguments=( + "--package-url[The package dependency url]:The package dependency url: " + "--mirror-url[The mirror url]:The mirror url: " ) _arguments $arguments && return } -_swift_package_completion-tool() { +_swift_package_config_set-mirror() { arguments=( - ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}" + "--package-url[The package dependency url]:The package dependency url: " + "--mirror-url[The mirror url]:The mirror url: " ) _arguments $arguments && return } -_swift_package_tools-version() { +_swift_package_config_get-mirror() { arguments=( - "--set[Set tools version of package to the given value]:Set tools version of package to the given value: " - "--set-current[Set tools version of package to the current tools version in use]" + "--package-url[The package dependency url]:The package dependency url: " ) _arguments $arguments && return } -_swift_package_reset() { +_swift_package_completion-tool() { arguments=( + ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}" ) _arguments $arguments && return } -_swift_package_resolve() { +_swift_package_clean() { arguments=( - ":The name of the package to resolve:_swift_dependency" - "--version[The version to resolve at]:The version to resolve at: " - "--branch[The branch to resolve at]:The branch to resolve at: " - "--revision[The revision to resolve at]:The revision to resolve at: " ) _arguments $arguments && return } @@ -312,19 +394,21 @@ _swift_package_generate-xcodeproj() { "--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files" "--legacy-scheme-generator[Use the legacy scheme generator]" "--watch[Watch for changes to the Package manifest to regenerate the Xcode project]" + "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]" ) _arguments $arguments && return } -_swift_package_fetch() { +_swift_package_reset() { arguments=( ) _arguments $arguments && return } -_swift_package_show-dependencies() { +_swift_package_init() { arguments=( - "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}" + "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}" + "--name[Provide custom package name]:Provide custom package name: " ) _arguments $arguments && return } @@ -346,23 +430,32 @@ _swift_test() { "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files" "(--chdir -C)"{--chdir,-C}"[]: :_files" "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files" - "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}" + "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}" "--disable-prefetching[]" "--skip-update[Skip updating dependencies from their remote during a resolution]" "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" "--version[]" "--destination[]: :_files" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]" + "--enable-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" "--skip-build[Skip building the test target]" "(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]" "--generate-linuxmain[Generate LinuxMain.swift entries for the package]" "--parallel[Run the tests in parallel.]" + "--num-workers[Number of tests to execute in parallel.]:Number of tests to execute in parallel.: " "(--specifier -s)"{--specifier,-s}"[]: : " "--xunit-output[]: :_files" "--filter[Run test cases matching regular expression, Format: . or ./]:Run test cases matching regular expression, Format: . or ./: " + "--enable-code-coverage[Test with code coverage enabled]" ) _arguments $arguments && return } -- cgit v1.2.3-70-g09d2 From 9981479900e3d3ff86bff0b3313c8e45891e880c Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 8 Apr 2019 17:34:59 +0200 Subject: zshrc: remove SSH_KEY_PATH comment Fixes #5741 --- templates/zshrc.zsh-template | 3 --- 1 file changed, 3 deletions(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index abd2c8812..bc892ff38 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -83,9 +83,6 @@ source $ZSH/oh-my-zsh.sh # Compilation flags # export ARCHFLAGS="-arch x86_64" -# ssh -# export SSH_KEY_PATH="~/.ssh/rsa_id" - # 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. -- cgit v1.2.3-70-g09d2 From 728c8e717435b31cb7db90168e1e7bd27b95e3f5 Mon Sep 17 00:00:00 2001 From: Sascha Bratton Date: Mon, 8 Apr 2019 11:58:27 -0400 Subject: nvm: load nvm script only if command doesn't already exist (#5454) Fixes #5453. --- plugins/nvm/nvm.plugin.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 9dde3a266..4bab8e9d7 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -1,5 +1,8 @@ # Set NVM_DIR if it isn't already defined [[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm" -# Load nvm if it exists -[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" +# Try to load nvm only if command not already available +if ! type "nvm" &> /dev/null; then + # Load nvm if it exists + [[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" +fi -- cgit v1.2.3-70-g09d2 From 8c95c2b6cb339379dda5e39a0eef795cab1dae7a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 8 Apr 2019 20:06:17 +0200 Subject: gitfast: update plugin (#7152) * Stop loading git plugin * Update completion and git-prompt to v2.10 * Update completion to v2.14 --- plugins/gitfast/_git | 11 +- plugins/gitfast/git-completion.bash | 913 ++++++++++++++++++++++++++++-------- plugins/gitfast/git-prompt.sh | 9 +- plugins/gitfast/gitfast.plugin.zsh | 7 +- 4 files changed, 747 insertions(+), 193 deletions(-) diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git index 6d1b4ecc7..78a6dbb3d 100644 --- a/plugins/gitfast/_git +++ b/plugins/gitfast/_git @@ -9,7 +9,7 @@ # # If your script is somewhere else, you can configure it on your ~/.zshrc: # -# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh +# zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh # # The recommended way to install this script is to copy to '~/.zsh/_git', and # then add the following to your ~/.zshrc file: @@ -67,6 +67,15 @@ __gitcomp () esac } +__gitcomp_direct () +{ + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -- ${=1} && _ret=0 +} + __gitcomp_nl () { emulate -L zsh diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index 8ce6b5c5f..d93441747 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -28,27 +28,55 @@ # completion style. For example '!f() { : git commit ; ... }; f' will # tell the completion to use commit completion. This also works with aliases # of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '". +# +# You can set the following environment variables to influence the behavior of +# the completion routines: +# +# GIT_COMPLETION_CHECKOUT_NO_GUESS +# +# When set to "1", do not include "DWIM" suggestions in git-checkout +# completion (e.g., completing "foo" when "origin/foo" exists). case "$COMP_WORDBREAKS" in *:*) : great ;; *) COMP_WORDBREAKS="$COMP_WORDBREAKS:" esac +# Discovers the path to the git repository taking any '--git-dir=' and +# '-C ' options into account and stores it in the $__git_repo_path +# variable. +__git_find_repo_path () +{ + if [ -n "$__git_repo_path" ]; then + # we already know where it is + return + fi + + if [ -n "${__git_C_args-}" ]; then + __git_repo_path="$(git "${__git_C_args[@]}" \ + ${__git_dir:+--git-dir="$__git_dir"} \ + rev-parse --absolute-git-dir 2>/dev/null)" + elif [ -n "${__git_dir-}" ]; then + test -d "$__git_dir" && + __git_repo_path="$__git_dir" + elif [ -n "${GIT_DIR-}" ]; then + test -d "${GIT_DIR-}" && + __git_repo_path="$GIT_DIR" + elif [ -d .git ]; then + __git_repo_path=.git + else + __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)" + fi +} + +# Deprecated: use __git_find_repo_path() and $__git_repo_path instead # __gitdir accepts 0 or 1 arguments (i.e., location) # returns location of .git repo __gitdir () { if [ -z "${1-}" ]; then - if [ -n "${__git_dir-}" ]; then - echo "$__git_dir" - elif [ -n "${GIT_DIR-}" ]; then - test -d "${GIT_DIR-}" || return 1 - echo "$GIT_DIR" - elif [ -d .git ]; then - echo .git - else - git rev-parse --git-dir 2>/dev/null - fi + __git_find_repo_path || return 1 + echo "$__git_repo_path" elif [ -d "$1/.git" ]; then echo "$1/.git" else @@ -56,6 +84,14 @@ __gitdir () fi } +# Runs git with all the options given as argument, respecting any +# '--git-dir=' and '-C ' options present on the command line +__git () +{ + git ${__git_C_args:+"${__git_C_args[@]}"} \ + ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null +} + # The following function is based on code from: # # bash_completion - programmable completion functions for bash 3.2+ @@ -185,6 +221,20 @@ _get_comp_words_by_ref () } fi +# Fills the COMPREPLY array with prefiltered words without any additional +# processing. +# Callers must take care of providing only words that match the current word +# to be completed and adding any prefix and/or suffix (trailing space!), if +# necessary. +# 1: List of newline-separated matching completion words, complete with +# prefix and suffix. +__gitcomp_direct () +{ + local IFS=$'\n' + + COMPREPLY=($1) +} + __gitcompappend () { local x i=${#COMPREPLY[@]} @@ -283,11 +333,11 @@ __gitcomp_file () __git_ls_files_helper () { if [ "$2" == "--committable" ]; then - git -C "$1" diff-index --name-only --relative HEAD + __git -C "$1" diff-index --name-only --relative HEAD else # NOTE: $2 is not quoted in order to support multiple options - git -C "$1" ls-files --exclude-standard $2 - fi 2>/dev/null + __git -C "$1" ls-files --exclude-standard $2 + fi } @@ -299,99 +349,195 @@ __git_ls_files_helper () # slash. __git_index_files () { - local dir="$(__gitdir)" root="${2-.}" file + local root="${2-.}" file - if [ -d "$dir" ]; then - __git_ls_files_helper "$root" "$1" | - while read -r file; do - case "$file" in - ?*/*) echo "${file%%/*}" ;; - *) echo "$file" ;; - esac - done | sort | uniq - fi + __git_ls_files_helper "$root" "$1" | + while read -r file; do + case "$file" in + ?*/*) echo "${file%%/*}" ;; + *) echo "$file" ;; + esac + done | sort | uniq } +# Lists branches from the local repository. +# 1: A prefix to be added to each listed branch (optional). +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). __git_heads () { - local dir="$(__gitdir)" - if [ -d "$dir" ]; then - git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ - refs/heads - return - fi + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + "refs/heads/$cur_*" "refs/heads/$cur_*/**" } +# Lists tags from the local repository. +# Accepts the same positional parameters as __git_heads() above. __git_tags () { - local dir="$(__gitdir)" - if [ -d "$dir" ]; then - git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ - refs/tags - return - fi + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + "refs/tags/$cur_*" "refs/tags/$cur_*/**" } -# __git_refs accepts 0, 1 (to pass to __gitdir), or 2 arguments -# presence of 2nd argument means use the guess heuristic employed -# by checkout for tracking branches +# Lists refs from the local (by default) or from a remote repository. +# It accepts 0, 1 or 2 arguments: +# 1: The remote to list refs from (optional; ignored, if set but empty). +# Can be the name of a configured remote, a path, or a URL. +# 2: In addition to local refs, list unique branches from refs/remotes/ for +# 'git checkout's tracking DWIMery (optional; ignored, if set but empty). +# 3: A prefix to be added to each listed ref (optional). +# 4: List only refs matching this word (optional; list all refs if unset or +# empty). +# 5: A suffix to be appended to each listed ref (optional; ignored, if set +# but empty). +# +# Use __git_complete_refs() instead. __git_refs () { - local i hash dir="$(__gitdir "${1-}")" track="${2-}" + local i hash dir track="${2-}" + local list_refs_from=path remote="${1-}" local format refs - if [ -d "$dir" ]; then - case "$cur" in + local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}" + local match="${4-}" + local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers + + __git_find_repo_path + dir="$__git_repo_path" + + if [ -z "$remote" ]; then + if [ -z "$dir" ]; then + return + fi + else + if __git_is_configured_remote "$remote"; then + # configured remote takes precedence over a + # local directory with the same name + list_refs_from=remote + elif [ -d "$remote/.git" ]; then + dir="$remote/.git" + elif [ -d "$remote" ]; then + dir="$remote" + else + list_refs_from=url + fi + fi + + if [ "$list_refs_from" = path ]; then + if [[ "$cur_" == ^* ]]; then + pfx="$pfx^" + fer_pfx="$fer_pfx^" + cur_=${cur_#^} + match=${match#^} + fi + case "$cur_" in refs|refs/*) format="refname" - refs="${cur%/*}" + refs=("$match*" "$match*/**") track="" ;; *) for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do - if [ -e "$dir/$i" ]; then echo $i; fi + case "$i" in + $match*) + if [ -e "$dir/$i" ]; then + echo "$pfx$i$sfx" + fi + ;; + esac done - format="refname:short" - refs="refs/tags refs/heads refs/remotes" + format="refname:strip=2" + refs=("refs/tags/$match*" "refs/tags/$match*/**" + "refs/heads/$match*" "refs/heads/$match*/**" + "refs/remotes/$match*" "refs/remotes/$match*/**") ;; esac - git --git-dir="$dir" for-each-ref --format="%($format)" \ - $refs + __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \ + "${refs[@]}" if [ -n "$track" ]; then # employ the heuristic used by git checkout # Try to find a remote branch that matches the completion word # but only output if the branch name is unique - local ref entry - git --git-dir="$dir" for-each-ref --shell --format="ref=%(refname:short)" \ - "refs/remotes/" | \ - while read -r entry; do - eval "$entry" - ref="${ref#*/}" - if [[ "$ref" == "$cur"* ]]; then - echo "$ref" - fi - done | sort | uniq -u + __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ + --sort="refname:strip=3" \ + "refs/remotes/*/$match*" "refs/remotes/*/$match*/**" | \ + uniq -u fi return fi - case "$cur" in + case "$cur_" in refs|refs/*) - git ls-remote "$dir" "$cur*" 2>/dev/null | \ + __git ls-remote "$remote" "$match*" | \ while read -r hash i; do case "$i" in *^{}) ;; - *) echo "$i" ;; + *) echo "$pfx$i$sfx" ;; esac done ;; *) - echo "HEAD" - git for-each-ref --format="%(refname:short)" -- \ - "refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##" + if [ "$list_refs_from" = remote ]; then + case "HEAD" in + $match*) echo "${pfx}HEAD$sfx" ;; + esac + __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ + "refs/remotes/$remote/$match*" \ + "refs/remotes/$remote/$match*/**" + else + local query_symref + case "HEAD" in + $match*) query_symref="HEAD" ;; + esac + __git ls-remote "$remote" $query_symref \ + "refs/tags/$match*" "refs/heads/$match*" \ + "refs/remotes/$match*" | + while read -r hash i; do + case "$i" in + *^{}) ;; + refs/*) echo "$pfx${i#refs/*/}$sfx" ;; + *) echo "$pfx$i$sfx" ;; # symbolic refs + esac + done + fi ;; esac } +# Completes refs, short and long, local and remote, symbolic and pseudo. +# +# Usage: __git_complete_refs [