Unverified Commit 0232ac4b authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into master

parents afb02876 ebc700be
......@@ -24,10 +24,10 @@
# Keywords: prompt directory truncate shrink collapse fish
#
# Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx>
# License: WTFPL <http://sam.zoy.org/wtfpl>
# License: WTFPL <http://www.wtfpl.net>
#
# Ref: http://www.zsh.org/mla/workers/2009/msg00415.html
# http://www.zsh.org/mla/workers/2009/msg00419.html
# Ref: https://www.zsh.org/mla/workers/2009/msg00415.html
# https://www.zsh.org/mla/workers/2009/msg00419.html
shrink_path () {
setopt localoptions
......@@ -88,19 +88,18 @@ shrink_path () {
if (( named )) {
for part in ${(k)nameddirs}; {
[[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~$part}
[[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/#${nameddirs[$part]}/\~$part}
}
}
(( tilde )) && dir=${dir/$HOME/\~}
(( tilde )) && dir=${dir/#$HOME/\~}
tree=(${(s:/:)dir})
(
unfunction chpwd 2> /dev/null
if [[ $tree[1] == \~* ]] {
cd ${~tree[1]}
cd -q ${~tree[1]}
result=$tree[1]
shift tree
} else {
cd /
cd -q /
}
for dir in $tree; {
if (( lastfull && $#tree == 1 )) {
......@@ -117,7 +116,7 @@ shrink_path () {
(( short )) && break
done
result+="/$part"
cd $dir
cd -q $dir
shift tree
}
echo ${result:-/}
......
......@@ -18,8 +18,8 @@ Adjust your .zshrc file and add spring to plugins=(...)
## Reference
* Spring Boot: http://projects.spring.io/spring-boot/
* Spring Boot CLI: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli
* Spring Boot: https://spring.io/projects/spring-boot
* Spring Boot CLI: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli
Maintainer : linux_china ([@linux_china](https://twitter.com/linux_china))
# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail>
# Created by the blogger at the URL below...I don't know where to find his/her name
# Original found at http://www.shellperson.net/sprunge-pastebin-script/
# Original found at https://www.shellperson.net/sprunge-pastebin-script/
usage() {
description | fmt -s >&2
......
......@@ -11,6 +11,8 @@ plugins=(... ssh-agent)
## Instructions
**IMPORTANT: put these settings _before_ the line that sources oh-my-zsh**
To enable **agent forwarding support** add the following to your zshrc file:
```zsh
......@@ -33,6 +35,6 @@ zstyle :omz:plugins:ssh-agent lifetime 4h
## Credits
Based on code from Joseph M. Reagle: http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
Based on code from Joseph M. Reagle: https://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
Agent-forwarding support based on ideas from Florent Thoumie and Jonas Pfenniger
......@@ -2,20 +2,51 @@ typeset _agent_forwarding _ssh_env_cache
function _start_agent() {
local lifetime
local -a identities
# start ssh-agent and setup environment
zstyle -s :omz:plugins:ssh-agent lifetime lifetime
# start ssh-agent and setup environment
echo Starting ssh-agent...
ssh-agent -s ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! $_ssh_env_cache
chmod 600 $_ssh_env_cache
. $_ssh_env_cache > /dev/null
}
# load identies
function _add_identities() {
local id line sig
local -a identities loaded_sigs loaded_ids not_loaded
zstyle -a :omz:plugins:ssh-agent identities identities
echo starting ssh-agent...
ssh-add $HOME/.ssh/${^identities}
# check for .ssh folder presence
if [[ ! -d $HOME/.ssh ]]; then
return
fi
# add default keys if no identities were set up via zstyle
# this is to mimic the call to ssh-add with no identities
if [[ ${#identities} -eq 0 ]]; then
# key list found on `ssh-add` man page's DESCRIPTION section
for id in id_rsa id_dsa id_ecdsa id_ed25519 identity; do
# check if file exists
[[ -f "$HOME/.ssh/$id" ]] && identities+=$id
done
fi
# get list of loaded identities' signatures and filenames
for line in ${(f)"$(ssh-add -l)"}; do
loaded_sigs+=${${(z)line}[2]}
loaded_ids+=${${(z)line}[3]}
done
# add identities if not already loaded
for id in $identities; do
# check for filename match, otherwise try for signature match
if [[ ${loaded_ids[(I)$HOME/.ssh/$id]} -le 0 ]]; then
sig="$(ssh-keygen -lf "$HOME/.ssh/$id" | awk '{print $2}')"
[[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+="$HOME/.ssh/$id"
fi
done
[[ -n "$not_loaded" ]] && ssh-add ${^not_loaded}
}
# Get the filename to store/lookup the environment from
......@@ -30,13 +61,20 @@ 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
_start_agent
fi
_add_identities
# tidy up after ourselves
unset _agent_forwarding _ssh_env_cache
unfunction _start_agent
unfunction _start_agent _add_identities
# Stack
This plugin provides completion for [Stack](https://haskellstack.org).
To use it add stack to the plugins array in your zshrc file.
```bash
plugins=(... stack)
```
## sublime
# sublime
Plugin for Sublime Text, a cross platform text and code editor, available for Linux, Mac OS X, and Windows.
Plugin for [Sublime Text](https://www.sublimetext.com/), a cross platform text and code editor,
available for Linux, macOS, and Windows.
### Requirements
To use the plugin, add `sublime` to the plugins array of your zshrc file:
* [Sublime Text](http://www.sublimetext.com/)
```zsh
plugins=(... sublime)
```
### Usage
Sublime Text has to be installed to use the plugin.
* If `st` command is called without an argument, launch Sublime Text
## Usage
* If `st` is passed a directory, `cd` to it and open it in Sublime Text
The plugin defines several aliases, such as:
* If `st` is passed a file, open it in Sublime Text
- `st`: opens Sublime Text. If passed a file or directory, Sublime Text will open it.
* If `stt` command is called, it is equivalent to `st .`, opening the current folder in Sublime Text
- `stt`: open Sublime Text on the current directory.
* If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files.
- `sst`: if `sudo` is available, `sst` will open Sublime Text with root permissions, so that
you can modify any file or directory that you pass it. Useful to edit system files.
* If `stp` command is called, it find a `.sublime-project` file by traversing up the directory structure. If there is no `.sublime-project` file, but if the current folder is a Git repo, opens up the root directory of the repo. If the current folder is not a Git repo, then opens up the current directory.
There are also a few functions available:
* If `stn` command is called without an argument, create a stub `.sublime-project` file in the current working directory if one does not already exist
- `find_project` (or `stp` alias): if called, the function will search for a `.sublime-project` file
on the current directory or its parents, until it finds none.
* If `stn` is passed a directory, create a stub `.sublime-project` file in it
If there is no `.sublime-project` file but the current folder is in a Git repository, it will open
Sublime Text on the root directory of the repository.
If there is no Git repository, it will then open Sublime Text on the current directory.
- `create_project` (or `stn` alias): if called without an argument, create a stub `.sublime-project`
file in the current working directory, if one does not already exist. If passed a directory, create
a stub `.sublime-project` file in it.
if [[ "$OSTYPE" == linux* ]]; then
local _sublime_linux_paths > /dev/null 2>&1
_sublime_linux_paths=(
# Sublime Text aliases
alias st=subl
alias stt='subl .'
# Define sst only if sudo exists
(( $+commands[sudo] )) && alias sst='sudo subl'
alias stp=find_project
alias stn=create_project
# Search for the Sublime Text command if not found
(( $+commands[subl] )) || {
declare -a _sublime_paths
if [[ "$OSTYPE" == linux* ]]; then
if [[ "$(uname -r)" = *Microsoft* ]]; then
_sublime_paths=(
"$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe')"
"$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe')"
)
else
_sublime_paths=(
"$HOME/bin/sublime_text"
"/opt/sublime_text/sublime_text"
"/opt/sublime_text_3/sublime_text"
"/usr/bin/sublime_text"
"/usr/local/bin/sublime_text"
"/usr/bin/subl"
"/opt/sublime_text_3/sublime_text"
"/usr/bin/subl3"
)
for _sublime_path in $_sublime_linux_paths; do
if [[ -a $_sublime_path ]]; then
st_run() { $_sublime_path $@ >/dev/null 2>&1 &| }
st_run_sudo() {sudo $_sublime_path $@ >/dev/null 2>&1}
alias sst=st_run_sudo
alias st=st_run
break
fi
done
elif [[ "$OSTYPE" = darwin* ]]; then
local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
elif [[ "$OSTYPE" = darwin* ]]; then
_sublime_paths=(
"/usr/local/bin/subl"
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
......@@ -31,34 +41,30 @@ elif [[ "$OSTYPE" = darwin* ]]; then
"$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
)
for _sublime_path in $_sublime_darwin_paths; do
if [[ -a $_sublime_path ]]; then
subl () { "$_sublime_path" $* }
alias st=subl
break
elif [[ "$OSTYPE" = cygwin ]]; then
_sublime_paths=(
"$(cygpath "$ProgramW6432/Sublime Text 2")/subl.exe"
"$(cygpath "$ProgramW6432/Sublime Text 3")/subl.exe"
)
elif [[ "$OSTYPE" = msys ]]; then
_sublime_paths=(
"/c/Program Files/Sublime Text 2/subl.exe"
"/c/Program Files/Sublime Text 3/subl.exe"
)
fi
done
elif [[ "$OSTYPE" = 'cygwin' ]]; then
local _sublime_cygwin_paths > /dev/null 2>&1
_sublime_cygwin_paths=(
"$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe"
"$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe"
)
for _sublime_path in $_sublime_cygwin_paths; do
for _sublime_path in $_sublime_paths; do
if [[ -a $_sublime_path ]]; then
subl () { "$_sublime_path" $* }
alias st=subl
alias subl="'$_sublime_path'"
(( $+commands[sudo] )) && alias sst="sudo '$_sublime_path'"
break
fi
done
fi
alias stt='st .'
unset _sublime_paths _sublime_path
}
find_project()
{
function find_project() {
local PROJECT_ROOT="${PWD}"
local FINAL_DEST="."
......@@ -81,11 +87,10 @@ find_project()
fi
fi
st $FINAL_DEST
subl $FINAL_DEST
}
function create_project() {
local _target=$1
if [[ "${_target}" == "" ]]; then
......@@ -98,7 +103,6 @@ function create_project() {
local _sublime_project_file=$_target/$(basename $_target).sublime-project
if [[ ! -f $_sublime_project_file ]]; then
touch $_sublime_project_file
echo -e "{" >> $_sublime_project_file
......@@ -110,9 +114,5 @@ function create_project() {
echo -e "}" >> $_sublime_project_file
echo -e "New Sublime Text project created:\n\t${_sublime_project_file}"
fi
}
alias stp=find_project
alias stn=create_project
# sudo
Easily prefix your current or previous commands with `sudo` by pressing <kbd>esc</kbd> twice
## Enabling the plugin
1. Open your `.zshrc` file and add `sudo` in the plugins section:
```zsh
plugins=(
# all your enabled plugins
sudo
)
```
2. Reload the source file or restart your Terminal session:
```console
$ source ~/.zshrc
$
```
## Usage examples
### Current typed commands
Say you have typed a long command and forgot to add `sudo` in front:
```console
$ apt-get install build-essential
```
By pressing the <kbd>esc</kbd> key twice, you will have the same command with `sudo` prefixed without typing:
```console
$ sudo apt-get install build-essential
```
### Previous executed commands
Say you want to delete a system file and denied:
```console
$ rm some-system-file.txt
-su: some-system-file.txt: Permission denied
$
```
By pressing the <kbd>esc</kbd> key twice, you will have the same command with `sudo` prefixed without typing:
```console
$ rm some-system-file.txt
-su: some-system-file.txt: Permission denied
$ sudo rm some-system-file.txt
Password:
$
```
# suse
**Maintainer**: [r-darwish](https://github.com/r-darwish)
Alias for Zypper according to the official Zypper's alias
To use it add `suse` to the plugins array in you zshrc file.
```zsh
plugins=(... suse)
```
## Main commands
| Alias | Commands | Description |
| ---------------- | ----------------------------- | -------------------------------------------------------------- |
| z | `sudo zypper` | call zypper |
| 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 | `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
| Alias | Commands | Description |
| ----- | ----------------- | ------------------------------------------------------------------ |
| zin | `sudo zypper in` | install packages |
| zinr | `sudo zypper inr` | install newly added packages recommended by already installed ones |
| zrm | `sudo zypper rm` | remove packages |
| zsi | `sudo zypper si` | install source of a package |
| zve | `sudo zypper ve` | verify dependencies of installed packages |
## Updates commands
| Alias | Commands | Description |
| ------ | ------------------- | ---------------------- |
| zdup | `sudo zypper dup` | upgrade packages |
| 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 |
## Request commands
| Alias | Commands | Description |
| ------------- | -------------------------- | ---------------------------------------------------- |
| 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
| Alias | Commands | Description |
| ----- | ------------------- | ---------------------------------------- |
| zar | `sudo zypper ar` | add a repository |
| zcl | `sudo zypper clean` | clean cache |
| 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 |
| zrr | `sudo zypper rr` | remove repositories |
## Services commands
| Alias | Commands | Description |
| ----- | ------------------ | -------------------------------------------------------------- |
| zas | `sudo zypper as` | adds a service specified by URI to the system |
| 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 | `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 | `zypper ll` | list currently active package locks |
| zrl | `sudo zypper rl` | remove specified package lock |
#Alias for Zypper according to the official Zypper's alias
#Main commands
alias z='sudo zypper' #call zypper
alias zh='sudo zypper -h' #print help
alias zhse='sudo zypper -h se' #print help for the search command
alias zlicenses='sudo zypper licenses' #prints a report about licenses and EULAs of installed packages
alias zps='sudo zypper ps' #list process using deleted files
alias zshell='sudo zypper shell' #open a zypper shell session
alias zsource-download='sudo zypper source-download' #download source rpms for all installed packages
alias ztos='sudo zypper tos' #shows the ID string of the target operating system
alias zvcmp='sudo zypper vcmp' #tell whether version1 is older or newer than version2
alias z='sudo zypper'
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='zypper tos'
alias zvcmp='zypper vcmp'
#Packages commands
alias zin='sudo zypper in' #install packages
alias zinr='sudo zypper inr' #install newly added packages recommended by already installed ones
alias zrm='sudo zypper rm' #remove packages
alias zsi='sudo zypper si' #install source of a package
alias zve='sudo zypper ve' #verify dependencies of installed packages
alias zin='sudo zypper in'
alias zinr='sudo zypper inr'
alias zrm='sudo zypper rm'
alias zsi='sudo zypper si'
alias zve='sudo zypper ve'
#Updates commands
alias zdup='sudo zypper dup' #upgrade packages
alias zlp='sudo zypper lp' #list necessary patchs
alias zlu='sudo zypper lu' #list updates
alias zpchk='sudo zypper pchk' #check for patches
alias zup='sudo zypper up' #update packages
alias zpatch='sudo zypper patch' #install patches
alias zdup='sudo zypper dup'
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' #display info about packages
alias zpa='sudo zypper pa' #list packages
alias zpatch-info='sudo zypper patch-info' #display info about patches
alias zpattern-info='sudo zypper patch-info' #display info about patterns
alias zproduct-info='sudo zypper patch-info' #display info about products
alias zpch='sudo zypper pch' #list all patches
alias zpd='sudo zypper pd' #list products
alias zpt='sudo zypper pt' #list patterns
alias zse='sudo zypper se' #search for packages
alias zwp='sudo zypper wp' #list all packages providing the specified capability
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' #add a repository
alias zcl='sudo zypper clean' #clean cache
alias zlr='sudo zypper lr' #list repositories
alias zmr='sudo zypper mr' #modify repositories
alias znr='sudo zypper nr' #rename repositories (for the alias only)
alias zref='sudo zypper ref' #refresh repositories
alias zrr='sudo zypper rr' #remove repositories
alias zar='sudo zypper ar'
alias zcl='sudo zypper clean'
alias zlr='zypper lr'
alias zmr='sudo zypper mr'
alias znr='sudo zypper nr'
alias zref='sudo zypper ref'
alias zrr='sudo zypper rr'
#Services commands
alias zas='sudo zypper as' #adds a service specified by URI to the system
alias zms='sudo zypper ms' #modify properties of specified services
alias zrefs='sudo zypper refs' #refreshing a service mean executing the service's special task
alias zrs='sudo zypper rs' #remove specified repository index service from the system
alias zls='sudo zypper ls' #list services defined on the system
alias zas='sudo zypper as'
alias zms='sudo zypper ms'
alias zrefs='sudo zypper refs'
alias zrs='sudo zypper rs'
alias zls='zypper ls'
#Package Locks Management commands
alias zal='sudo zypper al' #add a package lock
alias zcl='sudo zypper cl' #Remove unused locks
alias zll='sudo zypper ll' #list currently active package locks
alias zrl='sudo zypper rl' #remove specified package lock
alias zal='sudo zypper al'
alias zcl='sudo zypper cl'
alias zll='zypper ll'
alias zrl='sudo zypper rl'
# svcat
This plugin provides completion for the [Kubernetes service catalog cli](https://github.com/kubernetes-incubator/service-catalog).
To use it, add `svcat` to the plugins array in your zshrc file.
```
plugins=(... svcat)
```
# Autocompletion for svcat.
#
if [ $commands[svcat] ]; then
source <(svcat completion zsh)
fi
# `svn` plugin
This plugin adds some utility functions to display additional information regarding your current
svn repository. See http://subversion.apache.org/ for the full svn documentation.
svn repository. See https://subversion.apache.org/ for the full svn documentation.
To use it, add `svn` to your plugins array:
......
......@@ -2,7 +2,7 @@
## Description
This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager).
This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.0.
To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`:
......
#compdef swift
local context state state_descr line
typeset -A opt_args
_swift() {
_arguments -C \
'(- :)--help[prints the synopsis and a list of the most commonly used commands]: :->arg' \
'(-): :->command' \
'(-)*:: :->arg' && return
case $state in
(command)
local tools
tools=(
'build:build sources into binary products'
'run:build and run an executable product'
'package:perform operations on Swift packages'
'test:build and run tests'
)
_alternative \
'tools:common:{_describe "tool" tools }' \
'compiler: :_swift_compiler' && _ret=0
;;
(arg)
case ${words[1]} in
(build)
_swift_build
;;
(run)
_swift_run
;;
(package)
_swift_package
;;
(test)
_swift_test
;;
(*)
_swift_compiler
;;
esac
;;
esac
}
_swift_dependency() {
local dependencies
dependencies=( $(swift package completion-tool list-dependencies) )
_describe '' dependencies
}
_swift_executable() {
local executables
executables=( $(swift package completion-tool list-executables) )
_describe '' executables
}
# Generates completions for swift build
#
# In the final compdef file, set the following file header:
#
# #compdef _swift_build
# local context state state_descr line
# typeset -A opt_args
_swift_build() {
arguments=(
"-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
"-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
"-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
"-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
"(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
"--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]' '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-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: "
"--show-bin-path[Print the binary output path]"
)
_arguments $arguments && return
}
# Generates completions for swift run
#
# In the final compdef file, set the following file header:
#
# #compdef _swift_run
# local context state state_descr line
# typeset -A opt_args
_swift_run() {
arguments=(
":The executable to run:_swift_executable"
"-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
"-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
"-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
"-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
"(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
"--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]' '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-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
}
# Generates completions for swift package
#
# In the final compdef file, set the following file header:
#
# #compdef _swift_package
# local context state state_descr line
# typeset -A opt_args
_swift_package() {
arguments=(
"-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
"-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
"-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
"-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
"(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
"--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]' '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-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'
)
_arguments $arguments && return
case $state in
(command)
local modes
modes=(
'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'
'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)'
'clean:Delete build artifacts'
'generate-xcodeproj:Generates an Xcode project'
'reset:Reset the complete cache/build directory'
'init:Initialize a new package'
)
_describe "mode" modes
;;
(arg)
case ${words[1]} in
(update)
_swift_package_update
;;
(describe)
_swift_package_describe
;;
(resolve)
_swift_package_resolve
;;
(tools-version)
_swift_package_tools-version
;;
(unedit)
_swift_package_unedit
;;
(show-dependencies)
_swift_package_show-dependencies
;;
(fetch)
_swift_package_fetch
;;
(dump-package)
_swift_package_dump-package
;;
(edit)
_swift_package_edit
;;
(config)
_swift_package_config
;;
(completion-tool)
_swift_package_completion-tool
;;
(clean)
_swift_package_clean
;;
(generate-xcodeproj)
_swift_package_generate-xcodeproj
;;
(reset)
_swift_package_reset
;;
(init)
_swift_package_init
;;
esac
;;
esac
}
_swift_package_update() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_describe() {
arguments=(
"--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}"
)
_arguments $arguments && return
}
_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=(
)
_arguments $arguments && return
}
_swift_package_dump-package() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_edit() {
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_config() {
arguments=(
'(-): :->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_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_config_set-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_config_get-mirror() {
arguments=(
"--package-url[The package dependency url]:The package dependency url: "
)
_arguments $arguments && return
}
_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_clean() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_generate-xcodeproj() {
arguments=(
"--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
"--enable-code-coverage[Enable code coverage in the generated project]"
"--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_reset() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_init() {
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]'}"
"--name[Provide custom package name]:Provide custom package name: "
)
_arguments $arguments && return
}
# Generates completions for swift test
#
# In the final compdef file, set the following file header:
#
# #compdef _swift_test
# local context state state_descr line
# typeset -A opt_args
_swift_test() {
arguments=(
"-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
"-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
"-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
"-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
"(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
"--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]' '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-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: <test-target>.<test-case> or <test-target>.<test-case>/<test>]:Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>: "
"--enable-code-coverage[Test with code coverage enabled]"
)
_arguments $arguments && return
}
_swift_compiler() {
}
_swift
# Symfony
This plugin provides completion for [Symfony](https://symfony.com/).
To use it add symfony to the plugins array in your zshrc file.
```bash
plugins=(... symfony)
```
# Symfony2
This plugin provides completion for [Symfony 2](https://symfony.com/), as well as aliases for frequent Symfony commands.
To use it add symfony2 to the plugins array in your zshrc file.
```bash
plugins=(... symfony2)
```
## Aliases
| Alias | Command | Description |
|---------------|------------------------------|-------------------------------|
| `sf` | php app/console | Start the symfony console |
| `sfcl` | sf cache:clear | Clear the cache |
| `sfsr` | sf server:run | Run the dev server |
| `sfcw` | sf cache:warmup | Use the Bundles warmer |
| `sfroute` | sf debug:router | Show the different routes |
| `sfcontainer` | sf debug:contaner | List the different services |
| `sfgb` | sf generate:bundle | Generate a bundle |
| `sfgc` | sf generate:controller | Generate a controller |
| `sfgcom` | sf generate:command | Generate a command |
| `sfge` | sf doctrine:generate:entity | Generate an entity |
| `sfsu` | sf doctrine:schema:update | Update the schema in Database |
| `sfdc` | sf doctrine:database:create | Create the Database |
| `sfdev` | sf --env=dev | Update environment to `dev` |
| `sfprod` | sf --env=prod | Update environment to `prod` |
......@@ -25,5 +25,10 @@ alias sfcw='sf cache:warmup'
alias sfroute='sf debug:router'
alias sfcontainer='sf debug:container'
alias sfgb='sf generate:bundle'
alias sfgc='sf generate:controller'
alias sfgcom='sf generate:command'
alias sfge='sf doctrine:generate:entity'
alias sfsu='sf doctrine:schema:update'
alias sfdc='sf doctrine:database:create'
alias sfdev='sf --env=dev'
alias sfprod='sf --env=prod'
# Systemadmin plugin
This plugin adds a series of aliases and functions which make a System Administrator's life easier.
To use it, add `systemadmin` to the plugins array in your zshrc file:
```zsh
plugins=(... systemadmin)
```
## Aliases
| Alias | Command | Description |
|---------|------------------------------------------------------------------------|--------------------------------------------------------------------|
| ping | `ping -c 5` | Sends only 5 ICMP Messages |
| clr | `clear; echo Currently logged in on $TTY, as $USER in directory $PWD.` | Clears the screen and prints the current user, TTY, and directory |
| path | `print -l $path` | Displays PATH with each entry on a separate line |
| mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output |
| psmem | `ps -e -orss=,args= \| sort -b -k1,1n` | Display the processes using the most memory |
| psmem10 | `ps -e -orss=,args= \| sort -b -k1,1n \| head -10` | Display the top 10 processes using the most memory |
| pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU |
| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -10` | Display the top 10 processes using the most CPU |
| hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history |
## Functions
| Function | Description |
|-------------|-----------------------------------------------------------------------------------------------------------------------|
| dls | List only directories in the current directory |
| psgrep | List all processes that match the pattern input after the command |
| killit | Kills any process that matches a regular expression passed to it |
| tree | List contents of directories in a tree-like format (if tree isn't installed) |
| sortcons | Sort connections by state |
| con80 | View all 80 Port Connections |
| sortconip | On the connected IP sorted by the number of connections |
| req20 | List the top 20 requests on port 80 |
| http20 | List the top 20 connections to port 80 based on tcpdump data |
| timewait20 | List the top 20 time_wait connections |
| syn20 | List the top 20 SYN connections |
| port_pro | Output all processes according to the port number |
| accessip10 | List the top 10 accesses to the ip address in the nginx/access.log file or another log file if specified |
| visitpage20 | List the top 20 most visited files or pages in the nginx/access.log file or another log file if specified |
| consume100 | List the 100 most time-consuming Page lists (more than 60 seconds) as well as the corresponding number of occurrences |
| webtraffic | List website traffic statistics in GB from tne nginx/access.log file or another log file if specified |
| c404 | List statistics on 404 connections in the nginx/access.log file or another log file if specified |
| httpstatus | List statistics based on http status in the nginx/access.log file or another log file if specified |
| d0 | Delete 0 byte files recursively in the current directory or another if specified |
| geteip | Gather information regarding an external IP address using [icanhazip.com](https://icanhazip.com) |
| getip | Determine the local IP Address with `ip addr` or `ifconfig` |
| clrz | Clear zombie processes |
| conssec | Show number of concurrent connections per second based on ngnix/access.log file or another log file if specified |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment