From 019e0d7c71429650de33b5fb48b066ee46f37199 Mon Sep 17 00:00:00 2001 From: Andre Figueiredo Date: Sun, 10 Jun 2018 12:55:47 -0400 Subject: fix(typo) (#6905) *trupd* for "trizen -Sy" fixed to *trupg* --- plugins/archlinux/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index c3521c523..0d1fdea3a 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -23,7 +23,7 @@ | trupd | trizen -Sy && sudo abs | Update and refresh the local package and ABS databases | | trupd | trizen -Sy && sudo aur | Update and refresh the local package and AUR databases | | trupd | trizen -Sy | Update and refresh the local package database | -| trupd | trizen -Syua | Sync with repositories before upgrading all packages (from AUR too) | +| trupg | trizen -Syua | Sync with repositories before upgrading all packages (from AUR too) | | trsu | trizen -Syua --no-confirm | Same as `trupg`, but without confirmation | | upgrade | trizen -Syu | Sync with repositories before upgrading packages | -- cgit v1.2.3-70-g09d2 From 0808c0f6efaaf988ea6530645394d97fef810f01 Mon Sep 17 00:00:00 2001 From: Matteo Giaccone Date: Tue, 12 Jun 2018 18:23:31 +0200 Subject: Remove default for git reset (#4993) The command will do the same as before, but now you can also specify a path. Example: grh branch-name grhh tag-name --- plugins/git/git.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 34598fb35..413d780e1 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -211,8 +211,8 @@ alias grbc='git rebase --continue' alias grbi='git rebase -i' alias grbm='git rebase master' alias grbs='git rebase --skip' -alias grh='git reset HEAD' -alias grhh='git reset HEAD --hard' +alias grh='git reset' +alias grhh='git reset --hard' alias grmv='git remote rename' alias grrm='git remote remove' alias grset='git remote set-url' -- cgit v1.2.3-70-g09d2 From 3dcf9fd662b2eb74dc84bd739ca66b8a5bf4f52b Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 12 Jun 2018 18:40:31 +0200 Subject: Delete python completion in favor of zsh's one --- plugins/python/_python | 54 -------------------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 plugins/python/_python (limited to 'plugins') diff --git a/plugins/python/_python b/plugins/python/_python deleted file mode 100644 index f517d4806..000000000 --- a/plugins/python/_python +++ /dev/null @@ -1,54 +0,0 @@ -#compdef python - -# Python 2.6 -# Python 3.0 - -local curcontext="$curcontext" state line expl -typeset -A opt_args - -local -a args - -if _pick_variant python3=Python\ 3 python2 --version; then - args=( - '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' - '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' - ) -else - args=( - '-Q+[division options]:division option:(old warn warnall new)' - '(-tt)-t[issue warnings about inconsistent tab usage]' - '(-t)-tt[issue errors about inconsistent tab usage]' - '-3[warn about Python 3.x incompatibilities]' - ) -fi - -_arguments -C -s -S "$args[@]" \ - "-B[don't write .py\[co\] files on import]" \ - '(1 -)-c+[program passed in as string (terminates option list)]:python command:' \ - '-d[debug output from parser]' \ - '-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \ - '(1 * -)-h[display help information]' \ - '-i[inspect interactively after running script]' \ - '(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \ - '-O[optimize generated bytecode slightly]' \ - '-OO[remove doc-strings in addition to the -O optimizations]' \ - "-s[don't add user site directory to sys.path]" \ - "-S[don't imply 'import site' on initialization]" \ - '-u[unbuffered binary stdout and stderr]' \ - '-v[verbose (trace import statements)]' \ - '(1 * -)'{-V,--version}'[display version information]' \ - '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \ - '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \ - '(-)1:script file:_files -g "*.py(|c|o)(-.)"' \ - '*::script argument: _normal' && return - -if [[ "$state" = modules ]]; then - local -a modules - modules=( - ${${=${(f)"$(_call_program modules $words[1] -c \ - 'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)} - ) - _wanted modules expl module compadd -a modules && return -fi - -return 1 -- cgit v1.2.3-70-g09d2 From 321200d708027b56e95525cba3d4a6bb3d86983e Mon Sep 17 00:00:00 2001 From: Peter Butkovic Date: Tue, 12 Jun 2018 19:19:59 +0200 Subject: added tmuxinator aliases (#3147) --- plugins/tmuxinator/tmuxinator.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/tmuxinator/tmuxinator.plugin.zsh (limited to 'plugins') diff --git a/plugins/tmuxinator/tmuxinator.plugin.zsh b/plugins/tmuxinator/tmuxinator.plugin.zsh new file mode 100644 index 000000000..166fa9881 --- /dev/null +++ b/plugins/tmuxinator/tmuxinator.plugin.zsh @@ -0,0 +1,5 @@ +# aliases +alias txs='tmuxinator start' +alias txo='tmuxinator open' +alias txn='tmuxinator new' +alias txl='tmuxinator list' -- cgit v1.2.3-70-g09d2 From 7a9bab1d77e2c22c331ce98a7245d0ba5d348353 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 12 Jun 2018 19:20:10 +0200 Subject: Update tmuxinator completion to 03c8babb --- plugins/tmuxinator/_tmuxinator | 55 ++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 37 deletions(-) (limited to 'plugins') diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator index 551267ed2..37032f8d8 100644 --- a/plugins/tmuxinator/_tmuxinator +++ b/plugins/tmuxinator/_tmuxinator @@ -1,40 +1,21 @@ -#compdef tmuxinator mux -#autoload +_tmuxinator() { + local commands projects + commands=(${(f)"$(tmuxinator commands zsh)"}) + projects=(${(f)"$(tmuxinator completions start)"}) -local curcontext="$curcontext" state line ret=1 -local -a _configs - -_arguments -C \ - '1: :->cmds' \ - '2:: :->args' && ret=0 - -_configs=(${$(echo ~/.tmuxinator/*.yml):r:t}) - -case $state in - cmds) - _values "tmuxinator command" \ - "new[create a new project file and open it in your editor]" \ - "start[start a tmux session using project's tmuxinator config]" \ - "open[create a new project file and open it in your editor]" \ - "copy[copy source_project project file to a new project called new_project]" \ - "delete[deletes the project called project_name]" \ - "debug[output the shell commands generated by a projet]" \ - "implode[deletes all existing projects!]" \ - "list[list all existing projects]" \ - "doctor[look for problems in your configuration]" \ - "help[shows this help document]" \ - "version[shows tmuxinator version number]" \ - $_configs - ret=0 - ;; - args) - case $line[1] in - start|open|copy|delete|debug) - [[ -n "$_configs" ]] && _values 'configs' $_configs - ret=0 - ;; + if (( CURRENT == 2 )); then + _describe -t commands "tmuxinator subcommands" commands + _describe -t projects "tmuxinator projects" projects + elif (( CURRENT == 3)); then + case $words[2] in + copy|debug|delete|open|start) + _arguments '*:projects:($projects)' + ;; esac - ;; -esac + fi + + return +} -return ret +compdef _tmuxinator tmuxinator mux +alias mux="tmuxinator" -- cgit v1.2.3-70-g09d2 From be5bff2e86872c00536191265aa9fdef225af100 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 12 Jun 2018 19:54:47 +0200 Subject: Allow FreeBSD to correctly detect number of CPUs Use the same scheme as Darwin - sysctl instead of nproc, which doesn't exist in FreeBSD Closes #2545 Co-authored-by: Daniel Bye --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 6b10b78d1..ea199d09a 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -57,7 +57,7 @@ bundle_install() { if _bundler-installed && _within-bundled-project; then local bundler_version=`bundle version | cut -d' ' -f3` if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then - if [[ "$OSTYPE" = darwin* ]] + if [[ "$OSTYPE" = (darwin|freebsd)* ]] then local cores_num="$(sysctl -n hw.ncpu)" else -- cgit v1.2.3-70-g09d2 From 09fbc163663cd814488cb4be474f034525a8cca0 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 12 Jun 2018 20:45:38 +0200 Subject: Refactor lein plugin (#6914) * Add upstream lein completion (cee9029d) * Delete lein.plugin.zsh --- plugins/lein/_lein | 69 ++++++++++++++++++++++++++++++++++++++++++++ plugins/lein/lein.plugin.zsh | 43 --------------------------- 2 files changed, 69 insertions(+), 43 deletions(-) create mode 100644 plugins/lein/_lein delete mode 100644 plugins/lein/lein.plugin.zsh (limited to 'plugins') diff --git a/plugins/lein/_lein b/plugins/lein/_lein new file mode 100644 index 000000000..9d022e968 --- /dev/null +++ b/plugins/lein/_lein @@ -0,0 +1,69 @@ +#compdef lein + +# Lein ZSH completion function +# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions) +# and rename it _lein + +_lein() { + if (( CURRENT > 2 )); then + # shift words so _arguments doesn't have to be concerned with second command + (( CURRENT-- )) + shift words + # use _call_function here in case it doesn't exist + _call_function 1 _lein_${words[1]} + else + _values "lein command" \ + "change[Rewrite project.clj by applying a function.]" \ + "check[Check syntax and warn on reflection.]" \ + "classpath[Print the classpath of the current project.]" \ + "clean[Remove all files from project's target-path.]" \ + "compile[Compile Clojure source into .class files.]" \ + "deploy[Build and deploy jar to remote repository.]" \ + "deps[Download all dependencies.]" \ + "do[Higher-order task to perform other tasks in succession.]" \ + "help[Display a list of tasks or help for a given task.]" \ + "install[Install the current project to the local repository.]" \ + "jar[Package up all the project's files into a jar file.]" \ + "javac[Compile Java source files.]" \ + "new[Generate project scaffolding based on a template.]" \ + "plugin[DEPRECATED. Please use the :user profile instead.]" \ + "pom[Write a pom.xml file to disk for Maven interoperability.]" \ + "release[Perform :release-tasks.]" \ + "repl[Start a repl session either with the current project or standalone.]" \ + "retest[Run only the test namespaces which failed last time around.]" \ + "run[Run a -main function with optional command-line arguments.]" \ + "search[Search remote maven repositories for matching jars.]" \ + "show-profiles[List all available profiles or display one if given an argument.]" \ + "test[Run the project's tests.]" \ + "trampoline[Run a task without nesting the project's JVM inside Leiningen's.]" \ + "uberjar[Package up the project files and dependencies into a jar file.]" \ + "update-in[Perform arbitrary transformations on your project map.]" \ + "upgrade[Upgrade Leiningen to specified version or latest stable.]" \ + "vcs[Interact with the version control system.]" \ + "version[Print version for Leiningen and the current JVM.]" \ + "with-profile[Apply the given task with the profile(s) specified.]" + fi +} + +_lein_plugin() { + _values "lein plugin commands" \ + "install[Download, package, and install plugin jarfile into ~/.lein/plugins]" \ + "uninstall[Delete the plugin jarfile: \[GROUP/\]ARTIFACT-ID VERSION]" +} + + +_lein_namespaces() { + if [ -f "./project.clj" -a -d "$1" ]; then + _values "lein valid namespaces" \ + $(find "$1" -type f -name "*.clj" -exec awk '/^\(ns */ {gsub("\\)", "", $2); print $2}' '{}' '+') + fi +} + + +_lein_run() { + _lein_namespaces "src/" +} + +_lein_test() { + _lein_namespaces "test/" +} diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh deleted file mode 100644 index f4e50b447..000000000 --- a/plugins/lein/lein.plugin.zsh +++ /dev/null @@ -1,43 +0,0 @@ -function _lein_commands() { - local ret=1 state - _arguments ':subcommand:->subcommand' && ret=0 - - case $state in - subcommand) - subcommands=( - "classpath:print the classpath of the current project" - "clean:remove compiled files and dependencies from project" - "compile:ahead-of-time compile the project" - "deploy:build jar and deploy to remote repository" - "deps:download and install all dependencies" - "help:display a list of tasks or help for a given task" - "install:install the project and its dependencies in your local repository" - "int:enter an interactive task shell" - "interactive:enter an interactive task shell" - "jack-in:jack in to a clojure slime session from emacs." - "jar:create a jar file containing the compiled .class files" - "javac:compile java source files" - "new:create a new project skeleton" - "plugin:manage user-level plugins" - "pom:write a pom.xml file to disk for maven interop" - "repl:start a repl session either with the current project or standalone" - "retest:run only the test namespaces which failed last time around" - "run:run the project's -main function" - "search:search remote maven repositories for matching jars" - "swank:launch swank server for Emacs to connect" - "test:run the project's tests" - "test!:run a project's tests after cleaning and fetching dependencies" - "trampoline:run a task without nesting the project's JVM inside Leiningen's." - "uberjar:Create a jar including the contents of each of deps" - "upgrade:upgrade leiningen to the latest stable release" - "version:print leiningen's version" - ) - _describe -t subcommands 'leiningen subcommands' subcommands && ret=0 - ;; - *) _files - esac - - return ret -} - -compdef _lein_commands lein -- cgit v1.2.3-70-g09d2 From 5efa5138bf4ab168b1ca197dfdeef0e4c3ade271 Mon Sep 17 00:00:00 2001 From: Parham Alvani Date: Thu, 14 Jun 2018 23:02:15 +0430 Subject: silence mode of curl (#6898) Uses silence mode of curl for better autocomplete. Co-authored-by: Dominik Rimpf --- plugins/gitignore/gitignore.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh index f242169e4..15e38d3b7 100644 --- a/plugins/gitignore/gitignore.plugin.zsh +++ b/plugins/gitignore/gitignore.plugin.zsh @@ -1,7 +1,7 @@ function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} } _gitignoreio_get_command_list() { - curl -fL https://www.gitignore.io/api/list | tr "," "\n" + curl -sfL https://www.gitignore.io/api/list | tr "," "\n" } _gitignoreio () { -- cgit v1.2.3-70-g09d2 From 4105faf620cd324712568ca9b6c3665979adc698 Mon Sep 17 00:00:00 2001 From: Edwin de Jong Date: Fri, 15 Jun 2018 21:04:25 +0200 Subject: Update sbt to add publish-local to commands (#3112) --- plugins/sbt/_sbt | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/sbt/_sbt b/plugins/sbt/_sbt index 91372aa72..a601c9b97 100644 --- a/plugins/sbt/_sbt +++ b/plugins/sbt/_sbt @@ -17,6 +17,7 @@ _sbt_commands=( 'package-src:produce a source artifact, such as a jar containing sources' 'publish:publish artifacts to a repository' 'publish-local:publish artifacts to the local repository' + 'publish-m2:publish artifacts to the local Maven 2 repository' 'run:run a main class' 'run-main:run the main class selected by the first argument' 'test:execute all tests' -- cgit v1.2.3-70-g09d2 From 2647a8ccfd8beebda0d5362fd3ec610dda8d6441 Mon Sep 17 00:00:00 2001 From: Yann VR Date: Fri, 15 Jun 2018 20:40:31 +0100 Subject: Meteor-1-2 arguments update (#4538) Fixes #4280 Fixes #4321 --- plugins/meteor/_meteor | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'plugins') diff --git a/plugins/meteor/_meteor b/plugins/meteor/_meteor index cd7fc304f..69ac7a1b7 100644 --- a/plugins/meteor/_meteor +++ b/plugins/meteor/_meteor @@ -13,19 +13,36 @@ _meteor_installed_packages() { local -a _1st_arguments _1st_arguments=( - 'run:[Default] Run this project in local development mode' - 'create:Create a new project' - 'update:Upgrade this project to the latest version of Meteor' - 'add:Add a package to this project' - 'remove:Remove a package from this project' - 'list:List available packages' - 'help:Display Meteor help' - 'bundle:Pack this project up into a tarball' - 'mongo:Connect to the Mongo database for the specified site' - 'deploy:Deploy this project to Meteor' - 'logs:Show logs for specified site' - 'reset:Reset the project state. Erases the local database.' - 'test-packages:Test one or more packages' + "run: [default] Run this project in local development mode." + "debug: Run the project, but suspend the server process for debugging." + "create: Create a new project." + "update: Upgrade this project's dependencies to their latest versions." + "add: Add a package to this project." + "remove: Remove a package from this project." + "list: List the packages explicitly used by your project." + "add-platform: Add a platform to this project." + "remove-platform: Remove a platform from this project." + "list-platforms: List the platforms added to your project." + "build: Build this project for all platforms." + "lint: Build this project and run the linters printing all errors and warnings." + "shell: Launch a Node REPL for interactively evaluating server-side code." + "mongo: Connect to the Mongo database for the specified site." + "reset: Reset the project state. Erases the local database." + "deploy: Deploy this project to Meteor." + "logs: Show logs for specified site." + "authorized: View or change authorized users and organizations for a site." + "claim: Claim a site deployed with an old Meteor version." + "login: Log in to your Meteor developer account." + "logout: Log out of your Meteor developer account." + "whoami: Prints the username of your Meteor developer account." + "test-packages: Test one or more packages." + "admin: Administrative commands." + "list-sites: List sites for which you are authorized." + "publish-release: Publish a new meteor release to the package server." + "publish: Publish a new version of a package to the package server." + "publish-for-arch: Builds an already-published package for a new platform." + "search: Search through the package server database." + "show: Show detailed information about a release or package." ) local expl -- cgit v1.2.3-70-g09d2 From 125dd32361df63626ff7a3ff2ebc3416d2e3be55 Mon Sep 17 00:00:00 2001 From: Adnan Y Date: Fri, 10 Apr 2015 16:12:03 -0700 Subject: meteor: completion updated with more commands --- plugins/meteor/_meteor | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/meteor/_meteor b/plugins/meteor/_meteor index 69ac7a1b7..48b9fa4c1 100644 --- a/plugins/meteor/_meteor +++ b/plugins/meteor/_meteor @@ -43,6 +43,8 @@ _1st_arguments=( "publish-for-arch: Builds an already-published package for a new platform." "search: Search through the package server database." "show: Show detailed information about a release or package." + "install-sdk:Installs SDKs for a platform." + "configure-android:Run the Android configuration tool from Meteor’s ADK environment." ) local expl -- cgit v1.2.3-70-g09d2 From ef1e89b44b1a969d1ad08bf788a860be0c6f0379 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 15 Jun 2018 23:05:01 +0200 Subject: meteor: fix formatting and reorganise --- plugins/meteor/_meteor | 64 +++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'plugins') diff --git a/plugins/meteor/_meteor b/plugins/meteor/_meteor index 48b9fa4c1..6a15c4bc2 100644 --- a/plugins/meteor/_meteor +++ b/plugins/meteor/_meteor @@ -13,38 +13,38 @@ _meteor_installed_packages() { local -a _1st_arguments _1st_arguments=( - "run: [default] Run this project in local development mode." - "debug: Run the project, but suspend the server process for debugging." - "create: Create a new project." - "update: Upgrade this project's dependencies to their latest versions." - "add: Add a package to this project." - "remove: Remove a package from this project." - "list: List the packages explicitly used by your project." - "add-platform: Add a platform to this project." - "remove-platform: Remove a platform from this project." - "list-platforms: List the platforms added to your project." - "build: Build this project for all platforms." - "lint: Build this project and run the linters printing all errors and warnings." - "shell: Launch a Node REPL for interactively evaluating server-side code." - "mongo: Connect to the Mongo database for the specified site." - "reset: Reset the project state. Erases the local database." - "deploy: Deploy this project to Meteor." - "logs: Show logs for specified site." - "authorized: View or change authorized users and organizations for a site." - "claim: Claim a site deployed with an old Meteor version." - "login: Log in to your Meteor developer account." - "logout: Log out of your Meteor developer account." - "whoami: Prints the username of your Meteor developer account." - "test-packages: Test one or more packages." - "admin: Administrative commands." - "list-sites: List sites for which you are authorized." - "publish-release: Publish a new meteor release to the package server." - "publish: Publish a new version of a package to the package server." - "publish-for-arch: Builds an already-published package for a new platform." - "search: Search through the package server database." - "show: Show detailed information about a release or package." + "add-platform:Add a platform to this project." + "add:Add a package to this project." + "admin:Administrative commands." + "authorized:View or change authorized users and organizations for a site." + "build:Build this project for all platforms." + "claim:Claim a site deployed with an old Meteor version." + "configure-android:Run the Android configuration tool from Meteor's ADK environment." + "create:Create a new project." + "debug:Run the project, but suspend the server process for debugging." + "deploy:Deploy this project to Meteor." "install-sdk:Installs SDKs for a platform." - "configure-android:Run the Android configuration tool from Meteor’s ADK environment." + "lint:Build this project and run the linters printing all errors and warnings." + "list-platforms:List the platforms added to your project." + "list-sites:List sites for which you are authorized." + "list:List the packages explicitly used by your project." + "login:Log in to your Meteor developer account." + "logout:Log out of your Meteor developer account." + "logs:Show logs for specified site." + "mongo:Connect to the Mongo database for the specified site." + "publish-for-arch:Builds an already-published package for a new platform." + "publish-release:Publish a new meteor release to the package server." + "publish:Publish a new version of a package to the package server." + "remove-platform:Remove a platform from this project." + "remove:Remove a package from this project." + "reset:Reset the project state. Erases the local database." + "run:[default] Run this project in local development mode." + "search:Search through the package server database." + "shell:Launch a Node REPL for interactively evaluating server-side code." + "show:Show detailed information about a release or package." + "test-packages:Test one or more packages." + "update:Upgrade this project's dependencies to their latest versions." + "whoami:Prints the username of your Meteor developer account." ) local expl @@ -64,4 +64,4 @@ case "$words[2]" in add) _meteor_all_packages _wanted packages expl 'all packages' compadd -a packages ;; -esac \ No newline at end of file +esac -- cgit v1.2.3-70-g09d2 From f258bcba8d93065ade5ea4000afa5e60e84aae76 Mon Sep 17 00:00:00 2001 From: Przemysław Włodek Date: Sun, 17 Jun 2018 00:03:14 +0200 Subject: Fix yarn alias that conflicts with yeoman cli (#6453) Yeoman cli alias is 'yo' so 'yarn outdated' can't be aliased to 'yo'. See: http://yeoman.io/ --- plugins/yarn/yarn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 5fa512377..939820edb 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -4,7 +4,7 @@ alias y="yarn " alias ya="yarn add" alias ycc="yarn cache clean" alias yh="yarn help" -alias yo="yarn outdated" +alias yout="yarn outdated" alias yui="yarn upgrade-interactive" _yarn () -- cgit v1.2.3-70-g09d2 From c99844d84891076dceb5638bd6f4ad1599358cea Mon Sep 17 00:00:00 2001 From: kang Date: Sun, 17 Jun 2018 06:07:03 +0800 Subject: adb: fix `adb -s` device completion (#6489) --- plugins/adb/_adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/adb/_adb b/plugins/adb/_adb index 8cbf6593c..e3c20d751 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -48,8 +48,8 @@ _arguments \ case "$state" in specify_device) - _values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ - {printf "%s[%s] ",$1,$6 }') + _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \ + {sub(/ +/," ",$0);gsub(":","\\:",$1); printf "%s[%s] ",$1, $NF}'):-""} return ;; esac -- cgit v1.2.3-70-g09d2 From 48e2c828ef3d60750d157f388830d639c9b2e0bc Mon Sep 17 00:00:00 2001 From: Henry Bley-Vroman Date: Mon, 18 Jun 2018 15:04:42 -0400 Subject: Thefuck: homebrew install documentation and thefuck repo link (#5940) * Thefuck: homebrew install documentation and thefuck repo link * thefuck: reformat error message --- plugins/thefuck/thefuck.plugin.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/thefuck/thefuck.plugin.zsh b/plugins/thefuck/thefuck.plugin.zsh index 765e2b9a5..ac88e67de 100644 --- a/plugins/thefuck/thefuck.plugin.zsh +++ b/plugins/thefuck/thefuck.plugin.zsh @@ -1,6 +1,7 @@ if [[ -z $commands[thefuck] ]]; then - echo 'thefuck is not installed, you should "pip install thefuck" first' - return -1 + echo 'thefuck is not installed, you should "pip install thefuck" or "brew install thefuck" first.' + echo 'See https://github.com/nvbn/thefuck#installation' + return 1 fi # Register alias -- cgit v1.2.3-70-g09d2 From 0d80e9b4ee4925da24f5c2ef9082f6660d983113 Mon Sep 17 00:00:00 2001 From: Elton Chen-Yu Ho Date: Tue, 19 Jun 2018 04:12:07 +0800 Subject: Fix zshrc alias when $EDITOR uses parameters (#6146) According to #5003 if one exports EDITOR with parameters, say: `export EDITOR='subl -w'` running command: `zshrc` will result in: `zsh: command not found: subl -w` This can be fixed by updating common-aliases.plugin.zsh line 16 with: `alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file` Fixes #5003 --- plugins/common-aliases/common-aliases.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 742798f27..6a7daf845 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -13,7 +13,7 @@ alias lS='ls -1FSsh' alias lart='ls -1Fcart' alias lrt='ls -1Fcrt' -alias zshrc='$EDITOR ~/.zshrc' # Quick access to the ~/.zshrc file +alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file alias grep='grep --color' alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' -- cgit v1.2.3-70-g09d2 From 6af58f492f8c5219e27f74cf6378e92834d1b3e5 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 18 Jun 2018 22:47:51 +0200 Subject: common-aliases: delete unexistant command `display_info` doesn't exist in any known platform Fixes #5208 --- plugins/common-aliases/common-aliases.plugin.zsh | 2 -- 1 file changed, 2 deletions(-) (limited to 'plugins') diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 6a7daf845..785a09c63 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -44,8 +44,6 @@ alias p='ps -f' alias sortnr='sort -n -r' alias unexport='unset' -alias whereami=display_info - alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' -- cgit v1.2.3-70-g09d2 From a0b8eab5f0cd339082c1fe33d7bcfc34e38918b5 Mon Sep 17 00:00:00 2001 From: doofin <8177dph@gmail.com> Date: Tue, 19 Jun 2018 23:38:10 +0800 Subject: Update sbt.plugin.zsh (#6930) --- plugins/sbt/sbt.plugin.zsh | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh index 15acfec4f..8fabf0add 100644 --- a/plugins/sbt/sbt.plugin.zsh +++ b/plugins/sbt/sbt.plugin.zsh @@ -7,6 +7,7 @@ # aliases - mnemonic: prefix is 'sb' alias sbc='sbt compile' +alias sbcc='sbt clean compile' alias sbco='sbt console' alias sbcq='sbt console-quick' alias sbcl='sbt clean' -- cgit v1.2.3-70-g09d2 From 6c1dab232033b79534d4583a4d6f40340bdf334c Mon Sep 17 00:00:00 2001 From: Ruben Di Battista Date: Wed, 20 Jun 2018 23:27:38 +0200 Subject: Fix autojump sourcing on OSX with Macports (#4801) * Fix autojump sourcing on OSX with Macports The last version of autojump available on Macports does not have anymore different shell scripts (.sh, .zsh, .bash ...) to be sourced but just one autojump.sh that takes care of that located at /opt/local/etc/profile.d/autojump.sh fix # 4625 * Fix bug with macports autojump on OSX. --- plugins/autojump/autojump.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index 7339fad9e..c0af67631 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -15,8 +15,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed . /etc/profile.d/autojump.sh elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation . /usr/local/share/autojump/autojump.zsh - elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports - . /opt/local/etc/profile.d/autojump.zsh + elif [ -f /opt/local/etc/profile.d/autojump.sh ]; then # mac os x with ports + . /opt/local/etc/profile.d/autojump.sh elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew . `brew --prefix`/etc/autojump.sh fi -- cgit v1.2.3-70-g09d2 From 547a6ce260362b06e86a9c366dc29984c0954124 Mon Sep 17 00:00:00 2001 From: Jeremy Jones Date: Sat, 23 Jun 2018 23:52:53 -0500 Subject: fix path completion issue with go run subcommand (#6929) --- plugins/golang/golang.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh index d9d450690..d5c78ce6c 100644 --- a/plugins/golang/golang.plugin.zsh +++ b/plugins/golang/golang.plugin.zsh @@ -135,7 +135,7 @@ __go_tool_complete() { run) _arguments -s -w : \ ${build_flags[@]} \ - '*:file:_path_files -g "*.go"' + '*:file:_files -g "*.go"' ;; tool) if (( CURRENT == 3 )); then -- cgit v1.2.3-70-g09d2 From 787c6899d4db04b3e6cef9a02c6a2ff3d896ece3 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 29 Jun 2018 17:50:32 +0200 Subject: rand-quote: update URL Fixes #6949 --- plugins/rand-quote/rand-quote.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/rand-quote/rand-quote.plugin.zsh b/plugins/rand-quote/rand-quote.plugin.zsh index 8f345d9aa..a64e9b4ed 100644 --- a/plugins/rand-quote/rand-quote.plugin.zsh +++ b/plugins/rand-quote/rand-quote.plugin.zsh @@ -1,4 +1,4 @@ -# Get a random quote fron the site http://www.quotationspage.com/random.php3 +# Get a random quote fron the site http://www.quotationspage.com/random.php # Created by Eduardo San Martin Morote aka Posva # http://posva.github.io # Sun Jun 09 10:59:36 CEST 2013 @@ -13,7 +13,7 @@ END_COLOR="\e[m" if [[ -x `which curl` ]]; then function quote() { - Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ") + Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ") TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g') W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g') if [ "$W" -a "$TXT" ]; then -- cgit v1.2.3-70-g09d2 From 1e255a1a8d19f713482c7f2caa639733e8f86b39 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 29 Jun 2018 17:55:55 +0200 Subject: rand-quote: add README --- plugins/rand-quote/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 plugins/rand-quote/README.md (limited to 'plugins') diff --git a/plugins/rand-quote/README.md b/plugins/rand-quote/README.md new file mode 100644 index 000000000..c387aaa22 --- /dev/null +++ b/plugins/rand-quote/README.md @@ -0,0 +1,15 @@ +# rand-quote plugin + +Displays a random quote taken from [quotationspage.com](http://www.quotationspage.com/random.php) + +Created by [Eduardo San Martin Morote, aka Posva](https://posva.github.io) + +## Usage + +Add the plugin to the plugins array in your zshrc file and restart zsh: + +```zsh +plugins=(... rand-quote) +``` + +Then, run `quote` to get a new random quote. -- cgit v1.2.3-70-g09d2 From 76bfa7dd2a5422569c48ceb5429fb31adf1f23c2 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 29 Jun 2018 18:16:10 +0200 Subject: rand-quote: refactor rand-quote function - Make function variables local - Use prompt color sequences - Use guard clause to check for curl - Improved syntax --- plugins/rand-quote/rand-quote.plugin.zsh | 36 +++++++++++--------------------- 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'plugins') diff --git a/plugins/rand-quote/rand-quote.plugin.zsh b/plugins/rand-quote/rand-quote.plugin.zsh index a64e9b4ed..371b997d3 100644 --- a/plugins/rand-quote/rand-quote.plugin.zsh +++ b/plugins/rand-quote/rand-quote.plugin.zsh @@ -1,26 +1,14 @@ -# Get a random quote fron the site http://www.quotationspage.com/random.php -# Created by Eduardo San Martin Morote aka Posva -# http://posva.github.io -# Sun Jun 09 10:59:36 CEST 2013 -# Don't remove this header, thank you -# Usage: quote - -WHO_COLOR="\e[0;33m" -TEXT_COLOR="\e[0;35m" -COLON_COLOR="\e[0;35m" -END_COLOR="\e[m" - -if [[ -x `which curl` ]]; then - function quote() - { - Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ") - TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g') - W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g') - if [ "$W" -a "$TXT" ]; then - echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}“${TXT}”${END_COLOR}" - fi - } - #quote -else +if ! (( $+commands[curl] )); then echo "rand-quote plugin needs curl to work" >&2 + return fi + +function quote { + emulate -L zsh + Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ") + + TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g') + WHO=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g') + + [[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”" +} -- cgit v1.2.3-70-g09d2 From 0639582f73be6aec42d856a242ad1783eb05f973 Mon Sep 17 00:00:00 2001 From: Sascha Rudolph Date: Fri, 29 Jun 2018 18:22:46 +0200 Subject: 6098 - add support for apt in debian plugin (#6122) Signed-off-by: Sascha Rudolph --- plugins/debian/debian.plugin.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 19966b6ac..42690e53e 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -5,9 +5,12 @@ # # Debian-related zsh aliases and functions for zsh -# Use aptitude if installed, or apt-get if not. +# Use apt or aptitude if installed, fallback is apt-get # You can just set apt_pref='apt-get' to override it. -if [[ -e $( which -p aptitude 2>&1 ) ]]; then +if [[ -e $( which -p apt 2>&1 ) ]]; then + apt_pref='apt' + apt_upgr='upgrade' +elif [[ -e $( which -p aptitude 2>&1 ) ]]; then apt_pref='aptitude' apt_upgr='safe-upgrade' else -- cgit v1.2.3-70-g09d2 From b6ca933a02ed780c8ed776e74b141e45a5389f98 Mon Sep 17 00:00:00 2001 From: Michal Juriš Date: Sat, 30 Jun 2018 22:25:53 +0200 Subject: Add alias for 'git rebase develop' (#6006) --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 413d780e1..04ff22164 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -208,6 +208,7 @@ alias gra='git remote add' alias grb='git rebase' alias grba='git rebase --abort' alias grbc='git rebase --continue' +alias grbd='git rebase develop' alias grbi='git rebase -i' alias grbm='git rebase master' alias grbs='git rebase --skip' -- cgit v1.2.3-70-g09d2 From b09890a3e42b82810c6a2c79b3cf427fbf136a65 Mon Sep 17 00:00:00 2001 From: Justin Aiken <60tonangel@gmail.com> Date: Sat, 30 Jun 2018 14:45:20 -0600 Subject: Added more levels of zeus compeletion (#2058) --- plugins/zeus/_zeus | 110 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 87 insertions(+), 23 deletions(-) (limited to 'plugins') diff --git a/plugins/zeus/_zeus b/plugins/zeus/_zeus index 5a13bd9ec..78f0c545e 100644 --- a/plugins/zeus/_zeus +++ b/plugins/zeus/_zeus @@ -2,33 +2,97 @@ #autoload # in order to make this work, you will need to have the gem zeus installed - -# zeus zsh completion, based on adb completion +# zeus zsh completion local -a _1st_arguments -_1st_arguments=( -'console:Lets you interact with your Rails application from the command line. (alias = c)' -'cucumber:Runs cucumber.' -'dbconsole:Figures out which database you are using and drops you into whichever command line interface.' -'destroy:Figures out what generate did, and undoes it. (alias = d)' -'generate:Uses templates to create a whole lot of things. (alias = g)' -'rake:Execute rake tasks.' -'runner:Runs Ruby code in the context of Rails non-interactively. (alias = r)' -'server:Launches a small web server named WEBrick which comes bundled with Ruby. (alias = s)' -'start:Preloads the zeus environment' -'test:Runs RSpec tests. (alias = rspec, testrb)' -'version:Shows the version number.' -) +if [[ -e .zeus.sock ]]; then + _1st_arguments=( + 'console:Lets you interact with your Rails application from the command line. (alias = c)' + 'cucumber:Runs cucumber.' + 'dbconsole:Figures out which database you are using and drops you into whichever command line interface.' + 'destroy:Figures out what generate did, and undoes it. (alias = d)' + 'generate:Uses templates to create a whole lot of things. (alias = g)' + 'rake:Execute rake tasks.' + 'runner:Runs Ruby code in the context of Rails non-interactively. (alias = r)' + 'server:Launches a small web server named WEBrick which comes bundled with Ruby. (alias = s)' + 'test:Runs RSpec tests. (alias = rspec, testrb)' + 'version:Shows the version number.' + ) +else + _1st_arguments=( + 'start:Preloads the zeus environment' + 'init:Generate a zeus.json file' + ) +fi + +_rails_generate_arguments() { + generate_arguments=( + controller + generator + helper + integration_test + mailer + migration + model + observer + performance_test + plugin + resource + scaffold + scaffold_controller + session_migration + stylesheets + ) +} + +_rake_does_task_list_need_generating () { + if [ ! -f .rake_tasks ]; then return 0; + else + accurate=$(stat -f%m .rake_tasks) + changed=$(stat -f%m Rakefile) + return $(expr $accurate '>=' $changed) + fi +} + +_zrake () +{ + local expl + declare -a tasks + + if [ -f Rakefile ]; then + if _rake_does_task_list_need_generating; then + echo "\nGenerating .rake_tasks..." > /dev/stderr + rake --silent --tasks | cut -d " " -f 2 > .rake_tasks + fi + tasks=(`cat .rake_tasks`) + _wanted tasks expl 'rake' compadd $tasks + fi +} local expl -local -a pkgs installed_pkgs +local curcontext="$curcontext" state line +typeset -A opt_args -_arguments \ - '*:: :->subcmds' && return 0 +_arguments -C \ + ':command:->command' \ + '*::options:->options' -if (( CURRENT == 1 )); then - _describe -t commands "zeus subcommand" _1st_arguments - return -fi -_files +case $state in + (command) + _describe -t commands "zeus subcommand" _1st_arguments + return + ;; + + (options) + case $line[1] in + (rake) + _zrake + ;; + (generate|g|destroy|d) + _rails_generate_arguments + _wanted generate_arguments expl 'all generate' compadd -a generate_arguments + ;; + esac + ;; +esac -- cgit v1.2.3-70-g09d2 From 302270174d8173be35e8c1b464a0d9e731650c15 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Sun, 1 Jul 2018 18:20:34 +0200 Subject: Use existing ssh-agent when invoking a sudo shell (#3891) When invoking a shell as root using ```sudo -s```, the ssh-agent plugin starts a new agent although it already exists. The problem boils down to a check if ssh-agent is running using ```ps x```. If that is extended to ```ps ax``` for root, then the existing ssh-agent will still work. --- plugins/ssh-agent/ssh-agent.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 20f97c6f1..fe4946c6d 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -30,7 +30,12 @@ if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then elif [[ -f "$_ssh_env_cache" ]]; then # Source SSH settings, if applicable . $_ssh_env_cache > /dev/null - ps x | grep ssh-agent | grep -q $SSH_AGENT_PID || { + if [[ $USER == "root" ]]; then + FILTER="ax" + else + FILTER="x" + fi + ps $FILTER | grep ssh-agent | grep -q $SSH_AGENT_PID || { _start_agent } else -- cgit v1.2.3-70-g09d2 From 4aaafc0fe811f5be85b8c7b3e5db61d030a2d857 Mon Sep 17 00:00:00 2001 From: Hosmel Quintana Date: Sun, 1 Jul 2018 11:39:44 -0600 Subject: Add Homestead plugin (#3712) --- plugins/homestead/homestead.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/homestead/homestead.plugin.zsh (limited to 'plugins') diff --git a/plugins/homestead/homestead.plugin.zsh b/plugins/homestead/homestead.plugin.zsh new file mode 100644 index 000000000..cdbc564e4 --- /dev/null +++ b/plugins/homestead/homestead.plugin.zsh @@ -0,0 +1,10 @@ +# Homestead basic command completion +_homestead_get_command_list () { + homestead --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }' +} + +_homestead () { + compadd `_homestead_get_command_list` +} + +compdef _homestead homestead -- cgit v1.2.3-70-g09d2 From 2de926aa109181907def20c21f28d8a5e32b9d85 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sun, 1 Jul 2018 20:00:09 +0200 Subject: add ufw completion script (#3835) --- plugins/ufw/_ufw | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 plugins/ufw/_ufw (limited to 'plugins') diff --git a/plugins/ufw/_ufw b/plugins/ufw/_ufw new file mode 100644 index 000000000..08f871f35 --- /dev/null +++ b/plugins/ufw/_ufw @@ -0,0 +1,117 @@ +#compdef ufw +#autoload + +typeset -A opt_args + +function _ufw_delete_rules { + if ufw status &> /dev/null ; then + ufw status numbered \ + | perl -n -e'/\[ +(\d+)\] +([^ ].+)/ && print "\"$1\[$2\]\" "' + fi +} + +function _ufw_app_profiles { + grep -rhoP "(?<=\[)[^\]]+" /etc/ufw/applications.d/ \ + | awk '{ print "\""$0"\""}' \ + | tr '\n' ' ' +} + +local -a _1st_arguments +_1st_arguments=( + 'allow:add allow rule' + 'app:Application profile commands' + 'default:set default policy' + 'delete:delete RULE' + 'deny:add deny rule' + 'disable:disables the firewall' + 'enable:enables the firewall' + 'insert:insert RULE at NUM' + 'limit:add limit rule' + 'logging:set logging to LEVEL' + 'reject:add reject rule' + 'reload:reloads firewall' + 'reset:reset firewall' + 'show:show firewall report' + 'status:show firewall status' + 'version:display version information' +) + +local context state line curcontext="$curcontext" + +_arguments -C \ + '(--dry-run)--dry-run[dry run]' \ + '1:: :->cmds' \ + '2:: :->subcmds' \ + '3:: :->subsubcmds' \ +&& return 0 + +echo "DEBUG: $(date)| $state | $line[1] | $line| $word[1]| $word| $CURRENT|" >> log.log + +local rules + +case "$state" in + (cmds) + _describe -t commands "ufw commands" _1st_arguments + return 0 + ;; + (subcmds) + case "$line[1]" in + (app) + _values 'app' \ + 'list[list application profiles]' \ + 'info[show information on PROFILE]' \ + 'update[update PROFILE]' \ + 'default[set default application policy]' \ + && ret=0 + ;; + (status) + _values 'status' \ + 'numbered[show firewall status as numbered list of RULES]' \ + 'verbose[show verbose firewall status]' \ + && ret=0 + ;; + (logging) + _values 'logging' \ + 'on' 'off' 'low' 'medium' 'high' 'full' \ + && ret=0 + ;; + (default) + _values 'default' \ + 'allow' 'deny' 'reject' \ + && ret=0 + ;; + (show) + _values 'show' \ + 'raw' 'builtins' 'before-rules' 'user-rules' 'after-rules' 'logging-rules' 'listening' 'added' \ + && ret=0 + ;; + (delete) + rules="$(_ufw_delete_rules)" + if [[ -n "$rules" ]] ; then + _values 'delete' \ + ${(Q)${(z)"$(_ufw_delete_rules)"}} \ + && ret=0 + fi + ;; + esac + ;; + (subsubcmds) + case "$line[1]" in + (app) + case "$line[2]" in + (info|update) + _values 'profiles' \ + ${(Q)${(z)"$(_ufw_app_profiles)"}} \ + && ret=0 + ;; + esac + ;; + (default) + _values 'default-direction' \ + 'incoming' 'outgoing' \ + && ret=0 + ;; + esac +esac + +return -- cgit v1.2.3-70-g09d2 From 78e7ec2186201a941f47d2f1f7a986bae3828e59 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Sun, 1 Jul 2018 23:43:49 +0530 Subject: Add magic-enter plugin (#4082) * Added magic-enter plugin To bind commonly used tasks to the enter key * Allow the magic-enter commands to be modified by the user --- plugins/magic-enter/Readme.md | 14 ++++++++++++++ plugins/magic-enter/magic-enter.plugin.zsh | 24 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 plugins/magic-enter/Readme.md create mode 100644 plugins/magic-enter/magic-enter.plugin.zsh (limited to 'plugins') diff --git a/plugins/magic-enter/Readme.md b/plugins/magic-enter/Readme.md new file mode 100644 index 000000000..b401ab415 --- /dev/null +++ b/plugins/magic-enter/Readme.md @@ -0,0 +1,14 @@ +## Magic Enter + +**Maintainer:** [@dufferzafar](https://github.com/dufferzafar) + +Makes your enter key magical, by binding commonly used commands to it. + +You can set the commands to be run in your .zshrc, before the line containing plugins! + +```bash +MAGIC_ENTER_GIT_COMMAND='git status -u .' +MAGIC_ENTER_OTHER_COMMAND='ls -lh .' + +plugins=(magic-enter) +``` diff --git a/plugins/magic-enter/magic-enter.plugin.zsh b/plugins/magic-enter/magic-enter.plugin.zsh new file mode 100644 index 000000000..8e1859678 --- /dev/null +++ b/plugins/magic-enter/magic-enter.plugin.zsh @@ -0,0 +1,24 @@ +# Bind quick stuff to enter! +# +# Pressing enter in a git directory runs `git status` +# in other directories `ls` +magic-enter () { + + # If commands are not already set, use the defaults + [ -z "$MAGIC_ENTER_GIT_COMMAND" ] && MAGIC_ENTER_GIT_COMMAND="git status -u ." + [ -z "$MAGIC_ENTER_OTHER_COMMAND" ] && MAGIC_ENTER_OTHER_COMMAND="ls -lh ." + + if [[ -z $BUFFER ]]; then + echo "" + if git rev-parse --is-inside-work-tree &>/dev/null; then + eval "$MAGIC_ENTER_GIT_COMMAND" + else + eval "$MAGIC_ENTER_OTHER_COMMAND" + fi + zle redisplay + else + zle accept-line + fi +} +zle -N magic-enter +bindkey "^M" magic-enter -- cgit v1.2.3-70-g09d2 From 29a2394c8f88efe04a61460a9a171228c39b1de0 Mon Sep 17 00:00:00 2001 From: Alberto Re Date: Sun, 1 Jul 2018 20:16:08 +0200 Subject: Adds `vagrant_prompt_info` function to your shell (#4081) --- plugins/vagrant-prompt/README.md | 6 ++++ plugins/vagrant-prompt/vagrant-prompt.plugin.zsh | 38 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 plugins/vagrant-prompt/README.md create mode 100644 plugins/vagrant-prompt/vagrant-prompt.plugin.zsh (limited to 'plugins') diff --git a/plugins/vagrant-prompt/README.md b/plugins/vagrant-prompt/README.md new file mode 100644 index 000000000..c5bc55d17 --- /dev/null +++ b/plugins/vagrant-prompt/README.md @@ -0,0 +1,6 @@ +This plugin prompts the status of the Vagrant VMs. It supports single-host and +multi-host configurations as well. + +Look inside the source for documentation about custom variables. + +Alberto Re diff --git a/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh b/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh new file mode 100644 index 000000000..28bf31f91 --- /dev/null +++ b/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh @@ -0,0 +1,38 @@ +# vim:ft=zsh ts=2 sw=2 sts=2 +# +# To display Vagrant infos on your prompt add the vagrant_prompt_info to the +# $PROMPT variable in your theme. Example: +# +# PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(vagrant_prompt_info)$(svn_prompt_info)$(git_prompt_info)%(!.#.$) ' +# +# `vagrant_prompt_info` makes use of some custom variables. This is an example +# definition: +# +# ZSH_THEME_VAGRANT_PROMPT_PREFIX="%{$fg_bold[blue]%}[" +# ZSH_THEME_VAGRANT_PROMPT_SUFFIX="%{$fg_bold[blue]%}]%{$reset_color%} " +# ZSH_THEME_VAGRANT_PROMPT_RUNNING="%{$fg_no_bold[green]%}●" +# ZSH_THEME_VAGRANT_PROMPT_POWEROFF="%{$fg_no_bold[red]%}●" +# ZSH_THEME_VAGRANT_PROMPT_SUSPENDED="%{$fg_no_bold[yellow]%}●" +# ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED="%{$fg_no_bold[white]%}○" + +function vagrant_prompt_info() { + test -d .vagrant && test -f Vagrantfile + if [[ "$?" == "0" ]]; then + statuses=$(vagrant status 2> /dev/null | grep -P "\w+\s+[\w\s]+\s\(\w+\)") + statuses=("${(f)statuses}") + printf '%s' $ZSH_THEME_VAGRANT_PROMPT_PREFIX + for vm_details in $statuses; do + vm_state=$(echo $vm_details | grep -o -E "saved|poweroff|not created|running") + if [[ "$vm_state" == "running" ]]; then + printf '%s' $ZSH_THEME_VAGRANT_PROMPT_RUNNING + elif [[ "$vm_state" == "saved" ]]; then + printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUSPENDED + elif [[ "$vm_state" == "not created" ]]; then + printf '%s' $ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED + elif [[ "$vm_state" == "poweroff" ]]; then + printf '%s' $ZSH_THEME_VAGRANT_PROMPT_POWEROFF + fi + done + printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUFFIX + fi +} -- cgit v1.2.3-70-g09d2 From 27321265258ce4e0b0c0b1bdb90eb5e72b9b1c29 Mon Sep 17 00:00:00 2001 From: miguelpuyol Date: Sun, 1 Jul 2018 20:42:29 +0200 Subject: Add Spring Boot Run command (#4460) --- plugins/mvn/mvn.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index ee6fe2770..d422ba5c7 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -59,11 +59,13 @@ 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 mvndt='mvn dependency:tree' alias mvns='mvn site' alias mvnsrc='mvn dependency:sources' alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' + function listMavenCompletions { reply=( # common lifecycle -- cgit v1.2.3-70-g09d2 From c7d8ad1e7511749f584adae37f0ff1ccd0922ec6 Mon Sep 17 00:00:00 2001 From: meehow Date: Sun, 1 Jul 2018 20:45:15 +0200 Subject: sudo added to nmap commands which require sudo (#4476) --- plugins/nmap/nmap.plugin.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/nmap/nmap.plugin.zsh b/plugins/nmap/nmap.plugin.zsh index d09f2c615..82c275f23 100644 --- a/plugins/nmap/nmap.plugin.zsh +++ b/plugins/nmap/nmap.plugin.zsh @@ -17,16 +17,16 @@ alias nmap_open_ports="nmap --open" alias nmap_list_interfaces="nmap --iflist" -alias nmap_slow="nmap -sS -v -T1" -alias nmap_fin="nmap -sF -v" -alias nmap_full="nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v" -alias nmap_check_for_firewall="nmap -sA -p1-65535 -v -T4" +alias nmap_slow="sudo nmap -sS -v -T1" +alias nmap_fin="sudo nmap -sF -v" +alias nmap_full="sudo nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v" +alias nmap_check_for_firewall="sudo nmap -sA -p1-65535 -v -T4" alias nmap_ping_through_firewall="nmap -PS -PA" alias nmap_fast="nmap -F -T5 --version-light --top-ports 300" -alias nmap_detect_versions="nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn" +alias nmap_detect_versions="sudo nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn" alias nmap_check_for_vulns="nmap --script=vulscan" -alias nmap_full_udp="nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 " -alias nmap_traceroute="nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute " +alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 " +alias nmap_traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute " alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all " alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy " -- cgit v1.2.3-70-g09d2 From 27b9aed87f2c05e0c7e18716741ec3381e27f889 Mon Sep 17 00:00:00 2001 From: Pierre Barbier de Reuille Date: Sun, 1 Jul 2018 20:48:53 +0200 Subject: Added "-n name" option to vim-interaction plugin (#4522) --- plugins/vim-interaction/vim-interaction.plugin.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/vim-interaction/vim-interaction.plugin.zsh b/plugins/vim-interaction/vim-interaction.plugin.zsh index b774be342..010f998d3 100644 --- a/plugins/vim-interaction/vim-interaction.plugin.zsh +++ b/plugins/vim-interaction/vim-interaction.plugin.zsh @@ -8,10 +8,11 @@ function callvim { if [[ $# == 0 ]]; then cat <" fi cmd="$before$files$after" - gvim --remote-send "$cmd" + gvim --servername "$name" --remote-send "$cmd" if typeset -f postCallVim > /dev/null; then postCallVim fi -- cgit v1.2.3-70-g09d2 From ac0d71467be9de2e399ef99ae58d7780e1d2ff4c Mon Sep 17 00:00:00 2001 From: 当轩 Date: Mon, 2 Jul 2018 05:07:35 +0800 Subject: add plugin:percol (#4582) * add plugin:percol * fix format * check percol * fix empty history in gnome terminal --- plugins/percol/README.md | 23 +++++++++++++++++++++++ plugins/percol/percol.plugin.zsh | 22 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 plugins/percol/README.md create mode 100644 plugins/percol/percol.plugin.zsh (limited to 'plugins') diff --git a/plugins/percol/README.md b/plugins/percol/README.md new file mode 100644 index 000000000..97cca6876 --- /dev/null +++ b/plugins/percol/README.md @@ -0,0 +1,23 @@ +## percol + +Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) + +### Preview +![Preview](http://t1.qpic.cn/mblogpic/eb1c8f9d2b9f62d19fa8/2000.jpg) + +### Requirements + +```shell +pip install percol +``` + +And [jump](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement. + +### Usage + +For default + +- `^-r` bind to `percol_select_history`.You can use it to grep your history with percol. + +- `^-b` bind to `percol_select_marks`.You can use it to grep your bookmarks with percol. + diff --git a/plugins/percol/percol.plugin.zsh b/plugins/percol/percol.plugin.zsh new file mode 100644 index 000000000..c6adf4e1e --- /dev/null +++ b/plugins/percol/percol.plugin.zsh @@ -0,0 +1,22 @@ +if which percol &> /dev/null; then + function percol_select_history() { + local tac + which gtac &> /dev/null && tac="gtac" || { which tac &> /dev/null && tac="tac" || { tac="tail -r" } } + BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER") + CURSOR=$#BUFFER + zle -R -c + } + + zle -N percol_select_history + bindkey '^R' percol_select_history + + if which marks &> /dev/null; then + function percol_select_marks() { + BUFFER=$(marks | percol --query "$LBUFFER" | awk '{print $3}') + CURSOR=$#BUFFER # move cursor + zle -R -c # refresh + } + zle -N percol_select_marks + bindkey '^B' percol_select_marks + fi +fi -- cgit v1.2.3-70-g09d2 From 5c0911c184b012797ef4d0ed2a79d67b6b0976e3 Mon Sep 17 00:00:00 2001 From: Maciej Sypień Date: Sun, 1 Jul 2018 23:12:14 +0200 Subject: update nvm completions with v0.29.0 (#4701) --- plugins/nvm/_nvm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/nvm/_nvm b/plugins/nvm/_nvm index 1414dcbb1..1eec48b0a 100644 --- a/plugins/nvm/_nvm +++ b/plugins/nvm/_nvm @@ -6,16 +6,23 @@ local -a _1st_arguments _1st_arguments=( 'help:show help' - 'install:download and install a version' + '--version:print out the latest released version of nvm' + 'install:download and install a version in ' 'uninstall:uninstall a version' - 'use:modify PATH to use version' - 'run:run version with given arguments' + 'use:modify PATH to use . Uses .nvmrc if available' + 'exec:run on . Uses .nvmrc if available' + 'run:run `node` on with as arguments. Uses .nvmrc if available' + 'current:list installed versions' 'ls:list installed versions or versions matching a given description' + 'version:resolve the given description to a single local version' + 'version-remote:resolve the given description to a single remote version' 'ls-remote:list remote versions available for install' - 'deactivate:undo effects of NVM on current shell' + 'deactivate:undo effects of `nvm` on current shell' 'alias:show or set aliases' 'unalias:deletes an alias' - 'copy-packages:install global NPM packages to current version' + 'reinstall-packages:reinstall global `npm` packages contained in to current version' + 'unload:unload `nvm` from shell' + 'which:display path to installed node version. Uses .nvmrc if available' ) _arguments -C '*:: :->subcmds' && return 0 @@ -23,4 +30,4 @@ _arguments -C '*:: :->subcmds' && return 0 if (( CURRENT == 1 )); then _describe -t commands "nvm subcommand" _1st_arguments return -fi \ No newline at end of file +fi -- cgit v1.2.3-70-g09d2 From af085542bdc0e835093ed2b86f90251bc1f3d719 Mon Sep 17 00:00:00 2001 From: Alexandre Nicastro Date: Sun, 1 Jul 2018 18:21:20 -0300 Subject: Stop error "permission denied: /npm_completion" (#6340) Fixes #5874 Related: https://github.com/lukechilds/zsh-nvm/issues/23 https://github.com/zsh-users/antigen/issues/586 --- plugins/npm/npm.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 43af35ddb..f62174a4f 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -1,5 +1,5 @@ (( $+commands[npm] )) && { - __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion" + __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion" if [[ ! -f $__NPM_COMPLETION_FILE ]]; then npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null -- cgit v1.2.3-70-g09d2 From 9711d8f7316339b21c1043c74020c944eda7a2f5 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 2 Jul 2018 17:04:09 +0200 Subject: Rename kube-ps1.zsh to kube-ps1.plugin.zsh --- plugins/kube-ps1/kube-ps1.plugin.zsh | 123 +++++++++++++++++++++++++++++++++++ plugins/kube-ps1/kube-ps1.zsh | 123 ----------------------------------- 2 files changed, 123 insertions(+), 123 deletions(-) create mode 100644 plugins/kube-ps1/kube-ps1.plugin.zsh delete mode 100644 plugins/kube-ps1/kube-ps1.zsh (limited to 'plugins') diff --git a/plugins/kube-ps1/kube-ps1.plugin.zsh b/plugins/kube-ps1/kube-ps1.plugin.zsh new file mode 100644 index 000000000..e1cb4339d --- /dev/null +++ b/plugins/kube-ps1/kube-ps1.plugin.zsh @@ -0,0 +1,123 @@ +#!/bin/zsh + +# Kubernetes prompt helper for bash/zsh +# Displays current context and namespace + +# Copyright 2017 Jon Mosco +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Debug +[[ -n $DEBUG ]] && set -x + +setopt PROMPT_SUBST +add-zsh-hook precmd _kube_ps1_load +zmodload zsh/stat + +# Default values for the prompt +# Override these values in ~/.zshrc or ~/.bashrc +KUBE_PS1_DEFAULT="${KUBE_PS1_DEFAULT:=true}" +KUBE_PS1_PREFIX="(" +KUBE_PS1_DEFAULT_LABEL="${KUBE_PS1_DEFAULT_LABEL:="⎈ "}" +KUBE_PS1_DEFAULT_LABEL_IMG="${KUBE_PS1_DEFAULT_LABEL_IMG:=false}" +KUBE_PS1_SEPERATOR="|" +KUBE_PS1_PLATFORM="${KUBE_PS1_PLATFORM:="kubectl"}" +KUBE_PS1_DIVIDER=":" +KUBE_PS1_SUFFIX=")" +KUBE_PS1_UNAME=$(uname) +KUBE_PS1_LAST_TIME=0 + +kube_ps1_label () { + + [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == false ]] && return + + if [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == true ]]; then + local KUBE_LABEL="☸️ " + fi + + KUBE_PS1_DEFAULT_LABEL="${KUBE_LABEL}" + +} + +_kube_ps1_split() { + type setopt >/dev/null 2>&1 && setopt SH_WORD_SPLIT + local IFS=$1 + echo $2 +} + +_kube_ps1_file_newer_than() { + + local mtime + local file=$1 + local check_time=$2 + mtime=$(stat +mtime "${file}") + + [ "${mtime}" -gt "${check_time}" ] + +} + +_kube_ps1_load() { + # kubectl will read the environment variable $KUBECONFIG + # otherwise set it to ~/.kube/config + KUBECONFIG="${KUBECONFIG:=$HOME/.kube/config}" + + for conf in $(_kube_ps1_split : "${KUBECONFIG}"); do + # TODO: check existence of $conf + if _kube_ps1_file_newer_than "${conf}" "${KUBE_PS1_LAST_TIME}"; then + _kube_ps1_get_context_ns + return + fi + done +} + +_kube_ps1_get_context_ns() { + + # Set the command time + KUBE_PS1_LAST_TIME=$(date +%s) + + if [[ "${KUBE_PS1_DEFAULT}" == true ]]; then + local KUBE_BINARY="${KUBE_PS1_PLATFORM}" + elif [[ "${KUBE_PS1_DEFAULT}" == false ]] && [[ "${KUBE_PS1_PLATFORM}" == "kubectl" ]];then + local KUBE_BINARY="kubectl" + elif [[ "${KUBE_PS1_PLATFORM}" == "oc" ]]; then + local KUBE_BINARY="oc" + fi + + KUBE_PS1_CONTEXT="$(${KUBE_BINARY} config current-context)" + KUBE_PS1_NAMESPACE="$(${KUBE_BINARY} config view --minify --output 'jsonpath={..namespace}')" + # Set namespace to default if it is not defined + KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-default}" + +} + +# source our symbol +kube_ps1_label + +# Build our prompt +kube_ps1 () { + local reset_color="%f" + local blue="%F{blue}" + local red="%F{red}" + local cyan="%F{cyan}" + + KUBE_PS1="${reset_color}$KUBE_PS1_PREFIX" + KUBE_PS1+="${blue}$KUBE_PS1_DEFAULT_LABEL" + KUBE_PS1+="${reset_color}$KUBE_PS1_SEPERATOR" + KUBE_PS1+="${red}$KUBE_PS1_CONTEXT${reset_color}" + KUBE_PS1+="$KUBE_PS1_DIVIDER" + KUBE_PS1+="${cyan}$KUBE_PS1_NAMESPACE${reset_color}" + KUBE_PS1+="$KUBE_PS1_SUFFIX" + + echo "${KUBE_PS1}" + +} diff --git a/plugins/kube-ps1/kube-ps1.zsh b/plugins/kube-ps1/kube-ps1.zsh deleted file mode 100644 index e1cb4339d..000000000 --- a/plugins/kube-ps1/kube-ps1.zsh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/zsh - -# Kubernetes prompt helper for bash/zsh -# Displays current context and namespace - -# Copyright 2017 Jon Mosco -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Debug -[[ -n $DEBUG ]] && set -x - -setopt PROMPT_SUBST -add-zsh-hook precmd _kube_ps1_load -zmodload zsh/stat - -# Default values for the prompt -# Override these values in ~/.zshrc or ~/.bashrc -KUBE_PS1_DEFAULT="${KUBE_PS1_DEFAULT:=true}" -KUBE_PS1_PREFIX="(" -KUBE_PS1_DEFAULT_LABEL="${KUBE_PS1_DEFAULT_LABEL:="⎈ "}" -KUBE_PS1_DEFAULT_LABEL_IMG="${KUBE_PS1_DEFAULT_LABEL_IMG:=false}" -KUBE_PS1_SEPERATOR="|" -KUBE_PS1_PLATFORM="${KUBE_PS1_PLATFORM:="kubectl"}" -KUBE_PS1_DIVIDER=":" -KUBE_PS1_SUFFIX=")" -KUBE_PS1_UNAME=$(uname) -KUBE_PS1_LAST_TIME=0 - -kube_ps1_label () { - - [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == false ]] && return - - if [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == true ]]; then - local KUBE_LABEL="☸️ " - fi - - KUBE_PS1_DEFAULT_LABEL="${KUBE_LABEL}" - -} - -_kube_ps1_split() { - type setopt >/dev/null 2>&1 && setopt SH_WORD_SPLIT - local IFS=$1 - echo $2 -} - -_kube_ps1_file_newer_than() { - - local mtime - local file=$1 - local check_time=$2 - mtime=$(stat +mtime "${file}") - - [ "${mtime}" -gt "${check_time}" ] - -} - -_kube_ps1_load() { - # kubectl will read the environment variable $KUBECONFIG - # otherwise set it to ~/.kube/config - KUBECONFIG="${KUBECONFIG:=$HOME/.kube/config}" - - for conf in $(_kube_ps1_split : "${KUBECONFIG}"); do - # TODO: check existence of $conf - if _kube_ps1_file_newer_than "${conf}" "${KUBE_PS1_LAST_TIME}"; then - _kube_ps1_get_context_ns - return - fi - done -} - -_kube_ps1_get_context_ns() { - - # Set the command time - KUBE_PS1_LAST_TIME=$(date +%s) - - if [[ "${KUBE_PS1_DEFAULT}" == true ]]; then - local KUBE_BINARY="${KUBE_PS1_PLATFORM}" - elif [[ "${KUBE_PS1_DEFAULT}" == false ]] && [[ "${KUBE_PS1_PLATFORM}" == "kubectl" ]];then - local KUBE_BINARY="kubectl" - elif [[ "${KUBE_PS1_PLATFORM}" == "oc" ]]; then - local KUBE_BINARY="oc" - fi - - KUBE_PS1_CONTEXT="$(${KUBE_BINARY} config current-context)" - KUBE_PS1_NAMESPACE="$(${KUBE_BINARY} config view --minify --output 'jsonpath={..namespace}')" - # Set namespace to default if it is not defined - KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-default}" - -} - -# source our symbol -kube_ps1_label - -# Build our prompt -kube_ps1 () { - local reset_color="%f" - local blue="%F{blue}" - local red="%F{red}" - local cyan="%F{cyan}" - - KUBE_PS1="${reset_color}$KUBE_PS1_PREFIX" - KUBE_PS1+="${blue}$KUBE_PS1_DEFAULT_LABEL" - KUBE_PS1+="${reset_color}$KUBE_PS1_SEPERATOR" - KUBE_PS1+="${red}$KUBE_PS1_CONTEXT${reset_color}" - KUBE_PS1+="$KUBE_PS1_DIVIDER" - KUBE_PS1+="${cyan}$KUBE_PS1_NAMESPACE${reset_color}" - KUBE_PS1+="$KUBE_PS1_SUFFIX" - - echo "${KUBE_PS1}" - -} -- cgit v1.2.3-70-g09d2 From da8745eb9abe5565519218c1b732548de0b66b75 Mon Sep 17 00:00:00 2001 From: Roman Sedov Date: Tue, 3 Jul 2018 18:45:42 +0300 Subject: convenient vscode plugin for oh-my-zsh (#6903) --- plugins/vscode/README.md | 38 ++++++++++++++++++++++++++++++++++++++ plugins/vscode/vscode.plugin.zsh | 19 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 plugins/vscode/README.md create mode 100644 plugins/vscode/vscode.plugin.zsh (limited to 'plugins') diff --git a/plugins/vscode/README.md b/plugins/vscode/README.md new file mode 100644 index 000000000..ef1fdea30 --- /dev/null +++ b/plugins/vscode/README.md @@ -0,0 +1,38 @@ +# VS code + +This plugin makes interaction between the command line and the code editor easier. + +To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`: + +```zsh +plugins=(... vscode) +``` + +## Common aliases + +| Alias | Command | Description | +| ----------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- | +| vsc | code . | Open the current folder in VS code | +| vsca `dir` | code --add `dir` | Add folder(s) to the last active window | +| vscd `file` `file` | code --diff `file` `file` | Compare two files with each other. | +| vscg `file:line[:char]` | code --goto `file:line[:char]` | Open a file at the path on the specified line and character position. | +| vscn | code --new-window | Force to open a new window. | +| vscr | code --reuse-window | Force to open a file or folder in the last active window. | +| vscw | code --wait | Wait for the files to be closed before returning. | +| vscu `dir` | code --user-data-dir `dir` | Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code. | + +## Extensions aliases + +| Alias | Command | Description | +| ----------------------- | ---------------------------------------------------------------- | --------------------------------- | +| vsce `dir` | code --extensions-dir `dir` | Set the root path for extensions. | +| vscie `id or vsix-path` | code --install-extension `extension-id> or Date: Tue, 3 Jul 2018 11:46:33 -0400 Subject: Spelling fix (#6963) --- plugins/kubectl/kubectl.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index c4e30dacd..f91475b6c 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -10,7 +10,7 @@ if (( $+commands[kubectl] )); then unset __KUBECTL_COMPLETION_FILE fi -# This command is used ALOT both below and in daily life +# This command is used a LOT both below and in daily life alias k=kubectl # Apply a YML file -- cgit v1.2.3-70-g09d2 From b0052c7958db673bcf9d7a14103599c11e2b0513 Mon Sep 17 00:00:00 2001 From: Matthieu PETIOT Date: Wed, 4 Jul 2018 12:48:46 +0200 Subject: Add argument to set644 and set755 perms alias. (#6959) This can avoid big mistakes as this I just made. I thought I could give it an argument. So, now, it is possible. --- plugins/perms/README.md | 6 +++--- plugins/perms/perms.plugin.zsh | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/perms/README.md b/plugins/perms/README.md index 873c21d42..324b3f3cc 100644 --- a/plugins/perms/README.md +++ b/plugins/perms/README.md @@ -4,6 +4,6 @@ Plugin to handle some unix filesystem permissions quickly ### Usage -* `set755` recursively sets all directories located within the current working directory and sub directories to octal 755. -* `set644` recursively sets all files located within the current working directory and sub directories to octal 644. -* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases. \ No newline at end of file +* `set755` recursively sets all given directories (default to .) to octal 755. +* `set644` recursively sets all given files (default to .) to octal 644. +* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases. diff --git a/plugins/perms/perms.plugin.zsh b/plugins/perms/perms.plugin.zsh index 7cdebab7f..1a7472c1c 100644 --- a/plugins/perms/perms.plugin.zsh +++ b/plugins/perms/perms.plugin.zsh @@ -6,10 +6,14 @@ ### Aliases # Set all files' permissions to 644 recursively in a directory -alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644' +set644() { + find "${@:-.}" -type f ! -perm 644 -print0 | xargs -0 chmod 644 +} # Set all directories' permissions to 755 recursively in a directory -alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755' +set755() { + find "${@:-.}" -type d ! -perm 755 -print0 | xargs -0 chmod 755 +} ### Functions -- cgit v1.2.3-70-g09d2 From d232e6866c08a7b192d31c435ad2e00ccc48e03a Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Mon, 9 Jul 2018 19:27:02 +0200 Subject: ufw: remove debug print (#6976) --- plugins/ufw/_ufw | 2 -- 1 file changed, 2 deletions(-) (limited to 'plugins') diff --git a/plugins/ufw/_ufw b/plugins/ufw/_ufw index 08f871f35..f5ad03377 100644 --- a/plugins/ufw/_ufw +++ b/plugins/ufw/_ufw @@ -45,8 +45,6 @@ _arguments -C \ '3:: :->subsubcmds' \ && return 0 -echo "DEBUG: $(date)| $state | $line[1] | $line| $word[1]| $word| $CURRENT|" >> log.log - local rules case "$state" in -- cgit v1.2.3-70-g09d2 From be342b1bc8306cc24c2bb6145ceae78839a3008f Mon Sep 17 00:00:00 2001 From: Azat S Date: Tue, 10 Jul 2018 14:41:20 +0300 Subject: Yarn upgrade-interactive (#5796) * Add Yarn upgrade-ineractive CLI command * Remove dots at the end of completions --- plugins/yarn/yarn.plugin.zsh | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'plugins') diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 939820edb..eee811b16 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -28,24 +28,30 @@ _yarn () _production=('(--production)--production[Do not install project devDependencies]') + _upgrade=( + '(--exact)--exact[Install exact version]' + '(--tilde)--tilde[Install most recent release with the same minor version]' + ) + _1st_arguments=( 'help:Display help information about yarn' \ - 'init:Initialize for the development of a package.' \ - 'add:Add a package to use in your current package.' \ - 'install:Install all the dependencies listed within package.json in the local node_modules folder.' \ - 'publish:Publish a package to a package manager.' \ - 'remove:Remove a package that will no longer be used in your current package.' \ - 'cache:Clear the local cache. It will be populated again the next time yarn or yarn install is run.' \ - 'clean:Frees up space by removing unnecessary files and folders from dependencies.' \ - 'check:Verifies that versions of the package dependencies in the current project’s package.json matches that of yarn’s lock file.' \ - 'ls:List all installed packages.' \ - 'global:Makes binaries available to use on your operating system.' \ - 'info: [] - fetch information about a package and return it in a tree format.' \ - 'outdated:Checks for outdated package dependencies.' \ - 'run:Runs a defined package script.' \ - 'self-update:Updates Yarn to the latest version.' \ - 'upgrade:Upgrades packages to their latest version based on the specified range.' \ - 'why: - Show information about why a package is installed.' + 'init:Initialize for the development of a package' \ + 'add:Add a package to use in your current package' \ + 'install:Install all the dependencies listed within package.json in the local node_modules folder' \ + 'publish:Publish a package to a package manager' \ + 'remove:Remove a package that will no longer be used in your current package' \ + 'cache:Clear the local cache. It will be populated again the next time yarn or yarn install is run' \ + 'clean:Frees up space by removing unnecessary files and folders from dependencies' \ + 'check:Verifies that versions of the package dependencies in the current project’s package.json matches that of yarn’s lock file' \ + 'ls:List all installed packages' \ + 'global:Makes binaries available to use on your operating system' \ + 'info: [] - fetch information about a package and return it in a tree format' \ + 'outdated:Checks for outdated package dependencies' \ + 'run:Runs a defined package script' \ + 'self-update:Updates Yarn to the latest version' \ + 'upgrade:Upgrades packages to their latest version based on the specified range' \ + 'upgrade-interactive:Selectively upgrades specific packages in a simple way' \ + 'why: - Show information about why a package is installed' ) _arguments \ '*:: :->subcmds' && return 0 @@ -78,6 +84,10 @@ _yarn () _arguments \ $_dopts ;; + upgrade-interactive) + _arguments \ + $_upgrade + ;; *) _arguments \ ;; -- cgit v1.2.3-70-g09d2 From 7cb5fa8aea3d325fee08e3c1708abd12cdea1c1c Mon Sep 17 00:00:00 2001 From: Arthur <192247+arteezy@users.noreply.github.com> Date: Wed, 11 Jul 2018 03:31:47 +0600 Subject: Fix dotenv plugin accepted file format and clarify README (#6093) * Fix dotenv plugin accepted file format * clarify README and add disclaimer section --- plugins/dotenv/README.md | 19 +++++++++++++++---- plugins/dotenv/dotenv.plugin.zsh | 8 +++++++- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/dotenv/README.md b/plugins/dotenv/README.md index ade09fbb2..e0e75571f 100644 --- a/plugins/dotenv/README.md +++ b/plugins/dotenv/README.md @@ -2,19 +2,19 @@ Automatically load your project ENV variables from `.env` file when you `cd` into project root directory. -Storing configuration in the environment is one of the tenets of a [twelve-factor app](http://www.12factor.net). Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables. +Storing configuration in the environment is one of the tenets of a [twelve-factor app](http://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables. ## Installation Just add the plugin to your `.zshrc`: ```sh -plugins=(git man dotenv) +plugins=(... dotenv) ``` ## Usage -Create `.env` file inside your project directory and put your local ENV variables there. +Create `.env` file inside your project root directory and put your ENV variables there. For example: ```sh @@ -30,5 +30,16 @@ SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f MONGO_URI=mongodb://127.0.0.1:27017 PORT=3001 ``` +You can even mix both formats, although it's probably a bad idea. -**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it supposed to be local only. +## Version Control + +**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only. + +## Disclaimer + +This plugin only sources the `.env` file. Nothing less, nothing more. It doesn't do any checks. It's designed to be the fastest and simplest option. You're responsible for the `.env` file content. You can put some code (or weird symbols) there, but do it on your own risk. `dotenv` is the basic tool, yet it does the job. + +If you need more advanced and feature-rich ENV management, check out these awesome projects: +* [direnv](https://github.com/direnv/direnv) +* [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv) diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh index 9dd784229..fa47c4c68 100644 --- a/plugins/dotenv/dotenv.plugin.zsh +++ b/plugins/dotenv/dotenv.plugin.zsh @@ -2,7 +2,13 @@ source_env() { if [[ -f .env ]]; then - source .env + if [[ -o a ]]; then + source .env + else + set -a + source .env + set +a + fi fi } -- cgit v1.2.3-70-g09d2