Unverified Commit 8c95c523 authored by Kozlov Alexander's avatar Kozlov Alexander Committed by GitHub
Browse files

Merge branch 'master' into master

parents dd30cf10 3d8f2bda
# Sublime Text Aliases
() {
if [[ "$OSTYPE" == linux* ]]; then
local _sublime_linux_paths > /dev/null 2>&1
local _sublime_linux_paths
_sublime_linux_paths=(
"$HOME/bin/sublime_text"
"/opt/sublime_text/sublime_text"
......@@ -19,9 +23,8 @@ if [[ "$OSTYPE" == linux* ]]; then
break
fi
done
elif [[ "$OSTYPE" = darwin* ]]; then
local _sublime_darwin_paths > /dev/null 2>&1
local _sublime_darwin_paths
_sublime_darwin_paths=(
"/usr/local/bin/subl"
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
......@@ -38,9 +41,8 @@ elif [[ "$OSTYPE" = darwin* ]]; then
break
fi
done
elif [[ "$OSTYPE" = 'cygwin' ]]; then
local _sublime_cygwin_paths > /dev/null 2>&1
local _sublime_cygwin_paths
_sublime_cygwin_paths=(
"$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe"
"$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe"
......@@ -52,9 +54,10 @@ elif [[ "$OSTYPE" = 'cygwin' ]]; then
break
fi
done
fi
}
alias stt='st .'
find_project()
......@@ -84,4 +87,35 @@ find_project()
st $FINAL_DEST
}
function create_project() {
local _target=$1
if [[ "${_target}" == "" ]]; then
_target=$(pwd);
elif [[ ! -d ${_target} ]]; then
echo "${_target} is not a valid directory"
return 1
fi
local _sublime_project_file=$_target/$(basename $_target).sublime-project
if [[ ! -f $_sublime_project_file ]]; then
touch $_sublime_project_file
echo -e "{" >> $_sublime_project_file
echo -e "\t\"folders\":" >> $_sublime_project_file
echo -e "\t\t[{" >> $_sublime_project_file
echo -e "\t\t\t\"path\": \".\"," >> $_sublime_project_file
echo -e "\t\t\t\"file_exclude_patterns\": []" >> $_sublime_project_file
echo -e "\t\t}]" >> $_sublime_project_file
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 | `sudo zypper -h` | print help |
| zhse | `sudo zypper -h se` | print help for the search command |
| zlicenses | `sudo zypper licenses` | prints a report about licenses and EULAs of installed packages |
| zps | `sudo zypper ps` | list process using deleted files |
| zshell | `sudo zypper shell` | open a zypper shell session |
| zsource-download | `sudo zypper source-download` | download source rpms for all installed packages |
| ztos | `sudo zypper tos` | shows the ID string of the target operating system |
| zvcmp | `sudo zypper vcmp` | tell whether version1 is older or newer than version2 |
## 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 | `sudo zypper lp` | list necessary patches |
| zlu | `sudo 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 | `sudo zypper if` | display info about packages |
| zpa | `sudo zypper pa` | list packages |
| zpatch-info | `sudo zypper patch-info` | display info about patches |
| zpattern-info | `sudo zypper pattern-info` | display info about patterns |
| zproduct-info | `sudo zypper product-info` | display info about products |
| zpch | `sudo zypper pch` | list all patches |
| zpd | `sudo zypper pd` | list products |
| zpt | `sudo zypper pt` | list patterns |
| zse | `sudo zypper se` | search for packages |
| zwp | `sudo zypper wp` | list all packages providing the specified capability |
## Repositories commands
| Alias | Commands | Description |
| ----- | ------------------- | ---------------------------------------- |
| zar | `sudo zypper ar` | add a repository |
| zcl | `sudo zypper clean` | clean cache |
| zlr | `sudo 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 | `sudo zypper ls` | list services defined on the system |
## Package Locks Management commands
| Alias | Commands | Description |
| ----- | ---------------- | ----------------------------------- |
| zal | `sudo zypper al` | add a package lock |
| zcl | `sudo zypper cl` | remove unused locks |
| zll | `sudo zypper ll` | list currently active package locks |
| 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='sudo zypper -h'
alias zhse='sudo zypper -h se'
alias zlicenses='sudo zypper licenses'
alias zps='sudo zypper ps'
alias zshell='sudo zypper shell'
alias zsource-download='sudo zypper source-download'
alias ztos='sudo zypper tos'
alias zvcmp='sudo zypper vcmp'
#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='sudo zypper lp'
alias zlu='sudo 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='sudo zypper if'
alias zpa='sudo zypper pa'
alias zpatch-info='sudo zypper patch-info'
alias zpattern-info='sudo zypper pattern-info'
alias zproduct-info='sudo zypper product-info'
alias zpch='sudo zypper pch'
alias zpd='sudo zypper pd'
alias zpt='sudo zypper pt'
alias zse='sudo zypper se'
alias zwp='sudo zypper wp'
#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='sudo 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='sudo 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='sudo zypper ll'
alias zrl='sudo zypper rl'
# `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:
......
#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]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
"--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]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
"--skip-build[Skip building the executable product]"
)
_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]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
'(-): :->command'
'(-)*:: :->arg'
)
_arguments $arguments && return
case $state in
(command)
local modes
modes=(
'edit:Put a package in editable mode'
'clean:Delete build artifacts'
'init:Initialize a new package'
'dump-package:Print parsed Package.swift as JSON'
'describe:Describe the current package'
'unedit:Remove a package from editable mode'
'update:Update package dependencies'
'completion-tool:Completion tool (for shell completions)'
'tools-version:Manipulate tools version of the current package'
'reset:Reset the complete cache/build directory'
'resolve:Resolve package dependencies'
'generate-xcodeproj:Generates an Xcode project'
'fetch:'
'show-dependencies:Print the resolved dependency graph'
)
_describe "mode" modes
;;
(arg)
case ${words[1]} in
(edit)
_swift_package_edit
;;
(clean)
_swift_package_clean
;;
(init)
_swift_package_init
;;
(dump-package)
_swift_package_dump-package
;;
(describe)
_swift_package_describe
;;
(unedit)
_swift_package_unedit
;;
(update)
_swift_package_update
;;
(completion-tool)
_swift_package_completion-tool
;;
(tools-version)
_swift_package_tools-version
;;
(reset)
_swift_package_reset
;;
(resolve)
_swift_package_resolve
;;
(generate-xcodeproj)
_swift_package_generate-xcodeproj
;;
(fetch)
_swift_package_fetch
;;
(show-dependencies)
_swift_package_show-dependencies
;;
esac
;;
esac
}
_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_clean() {
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]'}"
)
_arguments $arguments && return
}
_swift_package_dump-package() {
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_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_update() {
arguments=(
)
_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_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_reset() {
arguments=(
)
_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_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]"
)
_arguments $arguments && return
}
_swift_package_fetch() {
arguments=(
)
_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
}
# 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]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
"--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.]"
"(--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>: "
)
_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 |
......@@ -3,7 +3,6 @@
# -----------
#
# This is one for the system administrator, operation and maintenance.
# Some of which come from http://justinlilly.com/dotfiles/zsh.html
#
# ------------------------------------------------------------------------------
# Authors
......@@ -13,14 +12,6 @@
#
# ------------------------------------------------------------------------------
function retval() {
if [[ -z $1 ]];then
echo '.'
else
echo $1
fi
}
function retlog() {
if [[ -z $1 ]];then
echo '/var/log/nginx/access.log'
......@@ -30,8 +21,8 @@ function retlog() {
}
alias ping='ping -c 5'
alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $PWD."'
alias path='echo -e ${PATH//:/\\n}'
alias clr='clear; echo Currently logged in on $TTY, as $USER in directory $PWD.'
alias path='print -l $path'
alias mkdir='mkdir -pv'
# get top process eating memory
alias psmem='ps -e -orss=,args= | sort -b -k1,1n'
......@@ -44,10 +35,10 @@ alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
# directory LS
dls () {
ls -l | grep "^d" | awk '{ print $9 }' | tr -d "/"
print -l *(/)
}
psgrep() {
ps aux | grep "$(retval $1)" | grep -v grep
ps aux | grep "${1:-.}" | grep -v grep
}
# Kills any process that matches a regexp passed to it
killit() {
......@@ -55,7 +46,7 @@ killit() {
}
# list contents of directories in a tree-like format
if [ -z "\${which tree}" ]; then
if ! (( $+commands[tree] )); then
tree () {
find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
}
......@@ -98,7 +89,7 @@ syn20() {
# Printing process according to the port number
port_pro() {
netstat -ntlp | grep "$(retval $1)" | awk '{print $7}' | cut -d/ -f1
netstat -ntlp | grep "${1:-.}" | awk '{print $7}' | cut -d/ -f1
}
# top10 of gain access to the ip address
......@@ -135,7 +126,7 @@ httpstatus() {
# Delete 0 byte file
d0() {
find "$(retval $1)" -type f -size 0 -exec rm -rf {} \;
find "${1:-.}" -type f -size 0 -exec rm -rf {} \;
}
# gather external ip address
......@@ -143,12 +134,12 @@ geteip() {
curl -s -S https://icanhazip.com
}
# determine local IP address
# determine local IP address(es)
getip() {
if (( ${+commands[ip]} )); then
ip addr | grep "inet " | grep -v '127.0.0.1' | awk '{print $2}'
ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1
else
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1
fi
}
......
# Systemd plugin
The systemd plugin provides many useful aliases for systemd.
To use it, add systemd to the plugins array of your zshrc file:
```
plugins=(... systemd)
```
## Aliases
| Alias | Command | Description |
|:-----------------------|:-----------------------------------|:-----------------------------------------------------------------|
| `sc-list-units` | `systemctl list-units` | List all units systemd has in memory |
| `sc-is-active` | `systemctl is-active` | Show whether a unit is active |
| `sc-status` | `systemctl status` | Show terse runtime status information about one or more units |
| `sc-show` | `systemctl show` | Show properties of units, jobs, or the manager itself |
| `sc-help` | `systemctl help` | Show man page of units |
| `sc-list-unit-files` | `systemctl list-unit-files` | List unit files installed on the system |
| `sc-is-enabled` | `systemctl is-enabled` | Checks whether any of the specified unit files are enabled |
| `sc-list-jobs` | `systemctl list-jobs` | List jobs that are in progress |
| `sc-show-environment` | `systemctl show-environment` | Dump the systemd manager environment block |
| `sc-cat` | `systemctl cat` | Show backing files of one or more units |
| `sc-list-timers` | `systemctl list-timers` | List timer units currently in memory |
| **Aliases with sudo** |
| `sc-start` | `sudo systemctl start` | Start Unit(s) |
| `sc-stop` | `sudo systemctl stop` | Stop Unit(s) |
| `sc-reload` | `sudo systemctl reload` | Reload Unit(s) |
| `sc-restart` | `sudo systemctl restart` | Restart Unit(s) |
| `sc-try-restart` | `sudo systemctl try-restart` | Restart Unit(s) |
| `sc-isolate` | `sudo systemctl isolate` | Start a unit and its dependencies and stop all others |
| `sc-kill` | `sudo systemctl kill` | Kill unit(s) |
| `sc-reset-failed` | `sudo systemctl reset-failed` | Reset the "failed" state of the specified units, |
| `sc-enable` | `sudo systemctl enable` | Enable unit(s) |
| `sc-disable` | `sudo systemctl disable` | Disable unit(s) |
| `sc-reenable` | `sudo systemctl reenable` | Reenable unit(s) |
| `sc-preset` | `sudo systemctl preset` | Reset the enable/disable status one or more unit files |
| `sc-mask` | `sudo systemctl mask` | Mask unit(s) |
| `sc-unmask` | `sudo systemctl unmask` | Unmask unit(s) |
| `sc-link` | `sudo systemctl link` | Link a unit file into the unit file search path |
| `sc-load` | `sudo systemctl load` | Load unit(s) |
| `sc-cancel` | `sudo systemctl cancel` | Cancel job(s) |
| `sc-set-environment` | `sudo systemctl set-environment` | Set one or more systemd manager environment variables |
| `sc-unset-environment` | `sudo systemctl unset-environment` | Unset one or more systemd manager environment variables |
| `sc-edit` | `sudo systemctl edit` | Edit a drop-in snippet or a whole replacement file with `--full` |
| `sc-enable-now` | `sudo systemctl enable --now` | Enable and start unit(s) |
| `sc-disable-now` | `sudo systemctl disable --now` | Disable and stop unit(s) |
| `sc-mask-now` | `sudo systemctl mask --now` | Mask and stop unit(s) |
### User aliases
You can use the above aliases as `--user` by using the prefix `scu` instead of `sc`.
For example: `scu-list-units` will be aliased to `systemctl --user list-units`.
......@@ -10,7 +10,13 @@ sudo_commands=(
for c in $user_commands; do; alias sc-$c="systemctl $c"; done
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
for c in $user_commands; do; alias scu-$c="systemctl --user $c"; done
for c in $sudo_commands; do; alias scu-$c="systemctl --user $c"; done
alias sc-enable-now="sc-enable --now"
alias sc-disable-now="sc-disable --now"
alias sc-mask-now="sc-mask --now"
alias scu-enable-now="scu-enable --now"
alias scu-disable-now="scu-disable --now"
alias scu-mask-now="scu-mask --now"
# taskwarrior
This plugin adds smart tab completion for [TaskWarrior](http://taskwarrior.org/).
This plugin adds smart tab completion for [TaskWarrior](https://taskwarrior.org/).
It uses the zsh tab completion script (`_task`) shipped with TaskWarrior for the
completion definitions.
......
......@@ -21,7 +21,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# http://www.opensource.org/licenses/mit-license.php
# https://www.opensource.org/licenses/mit-license.php
#
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
_task_projects=($(task _projects))
......
## atom
## Terraform oh-my-zsh plugin
Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently.
Current as of Terraform v0.11.7
### Requirements
* [Terraform](https://terraform.io/)
......@@ -13,7 +15,7 @@ Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely a
### Expanding ZSH prompt with current Terraform workspace name
If you want to get current Terraform workspace name in your ZSH prompt open
your .zsh-theme file and in a choosen place insert:
your .zsh-theme file and in a chosen place insert:
```
$FG[045]\
......
......@@ -3,90 +3,151 @@
local -a _terraform_cmds
_terraform_cmds=(
'apply:Builds or changes infrastructure'
'console:Interactive console for Terraform interpolations'
'destroy:Destroy Terraform-managed infrastructure'
'fmt:Rewrites config files to canonical format'
'get:Download and install modules for the configuration'
'graph:Create a visual graph of Terraform resources'
'init:Initializes Terraform configuration from a module'
'import:Import existing infrastructure into Terraform'
'init:Initialize a Terraform working directory'
'output:Read an output from a state file'
'plan:Generate and show an execution plan'
'pull:Refreshes the local state copy from the remote server'
'push:Uploads the local state to the remote server'
'providers:Prints a tree of the providers used in the configuration'
'push:Upload this Terraform module to Atlas to run'
'refresh:Update local state file against real resources'
'remote:Configures remote state management'
'show:Inspect Terraform state or plan'
'taint:Manually forcing a destroy and recreate on the next plan/apply'
'taint:Manually mark a resource for recreation'
'untaint:Manually unmark a resource as tainted'
'validate:Validates the Terraform files'
'version:Prints the Terraform version'
'workspace:Workspace management'
)
__apply() {
_arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-auto-approve[Skip interactive approval of plan before applying.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \
'-no-color[If specified, output will not contain any color.]' \
'-no-color[If specified, output wil be colorless.]' \
'-parallelism=[(10) Limit the number of parallel resource operations.]' \
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
'-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
__console() {
_arguments \
'-state=[(terraform.tfstate) Path to read state.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
__destroy() {
_arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-force[If set, then the destroy confirmation will not be shown.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \
'-no-color[If specified, output will not contain any color.]' \
'-auto-approve[Skip interactive approval before destroying.]' \
'-force[Deprecated: same as auto-approve.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will contain no color.]' \
'-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
'-target=[(resource) Instead of affecting "dependencies" will instead also destroy any resources that depend on the target(s) specified.]' \
'-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
__fmt() {
_arguments \
'-list=[(true) List files whose formatting differs (always false if using STDIN)]' \
'-write=[(true) Write result to source file instead of STDOUT (always false if using STDIN or -check)]' \
'-diff=[(false) Display diffs of formatting changes]' \
'-check=[(false) Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise.]'
}
__get() {
_arguments \
'-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]'
'-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]' \
'-no-color[If specified, output will contain no color.]'
}
__graph() {
_arguments \
'-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors.]' \
'-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \
'-verbose[Generate a verbose, "worst-case" graph, with all nodes for potential operations in place.]'
'-no-color[If specified, output will contain no color.]' \
'-type=[(plan) Type of graph to output. Can be: plan, plan-destroy, apply, validate, input, refresh.]'
}
__import() {
_arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-config=[(path) Path to a directory of Terraform configuration files to use to configure the provider. Defaults to pwd. If no config files are present, they must be provided via the input prompts or env vars.]' \
'-allow-missing-config[Allow import when no resource configuration block exists.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will contain no color.]' \
'-provider=[(provider) Specific provider to use for import. This is used for specifying aliases, such as "aws.eu". Defaults to the normal provider prefix of the resource being imported.]' \
'-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]' \
'-state-out=[(PATH) Path to the destination state file to write to. If this is not specified, the source state file will be used. This can be a new or existing path.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times. This is only useful with the "-config" flag.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
__init() {
_arguments \
'-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \
'-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \
'-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \
'-backend-config=[(path) Specifies the path to remote backend config file.]' \
'-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \
'-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]'
'-backend=[(true) Configure the backend for this configuration.]' \
'-backend-config=[This can be either a path to an HCL file with key/value assignments (same format as terraform.tfvars) or a 'key=value' format. This is merged with what is in the configuration file. This can be specified multiple times. The backend type must be in the configuration itself.]' \
'-force-copy[Suppress prompts about copying state data. This is equivalent to providing a "yes" to all confirmation prompts.]' \
'-from-module=[Copy the contents of the given module into the target directory before initialization.]' \
'-get=[(true) Download any modules for this configuration.]' \
'-get-plugins=[(true) Download any missing plugins for this configuration.]' \
'-input=[(true) Ask for input if necessary. If false, will error if input was required.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will contain no color.]' \
'-plugin-dir[Directory containing plugin binaries. This overrides all default search paths for plugins, and prevents the automatic installation of plugins. This flag can be used multiple times.]' \
'-reconfigure[Reconfigure the backend, ignoring any saved configuration.]' \
'-upgrade=[(false) If installing modules (-get) or plugins (-get-plugins), ignore previously-downloaded objects and install the latest version allowed within configured constraints.]' \
'-verify-plugins=[(true) Verify the authenticity and integrity of automatically downloaded plugins.]'
}
__output() {
_arguments \
'-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]' \
'-module=[(module_name) The module path which has needed output. By default this is the root path. Other modules can be specified by a period-separated list.]'
'-no-color[ If specified, output will contain no color.]' \
'-module=[(name) If specified, returns the outputs for a specific module]' \
'-json[If specified, machine readable output will be printed in JSON format]'
}
__plan() {
_arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with" .backup" extension. Set to "-" to disable backup.]' \
'-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \
'-detailed-exitcode[Return a detailed exit code when the command exits. When provided, this argument changes the exit codes and their meanings to provide more granular information about what the resulting plan contains]' \
'-destroy[() If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \
'-detailed-exitcode[() Return detailed exit codes when the command exits. This will change the meaning of exit codes to: 0 - Succeeded, diff is empty (no changes); 1 - Errored, 2 - Succeeded; there is a diff]' \
'-input=[(true) Ask for input for variables if not directly set.]' \
'-module-depth=[(n) Specifies the depth of modules to show in the output. This does not affect the plan itself, only the output shown. By default, this is zero. -1 will expand all.]' \
'-no-color[If specified, output will not contain any color.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-module-depth=[(n) Specifies the depth of modules to show in the output. This does not affect the plan itself, only the output shown. By default, this is -1, which will expand all.]' \
'-no-color[() If specified, output will contain no color.]' \
'-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \
'-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences.]' \
'-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
'-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]' \
}
__providers() {
_arguments \
}
__push() {
......@@ -105,6 +166,9 @@ __push() {
__refresh() {
_arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
......@@ -113,19 +177,6 @@ __refresh() {
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
}
__remote() {
_arguments \
'-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \
'-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \
'-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-disable[Disables remote state management and migrates the state to the -state path.]' \
'-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \
'-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' \
'-pull=[(true) Controls if the remote state is pulled before disabling. This defaults to true to ensure the latest state is cached before disabling.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]'
}
__show() {
_arguments \
'-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \
......@@ -136,12 +187,46 @@ __taint() {
_arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
'-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
}
__untaint() {
_arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
'-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
}
__validate() {
_arguments \
'-check-variables=[(true) If set to true (default), the command will check whether all required variables have been specified.]' \
'-no-color[If specified, output will not contain any color.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
}
__workspace() {
local -a __workspace_cmds
__workspace_cmds=(
'delete:Delete a workspace'
'list:List Workspaces'
'new:Create a new workspace'
'select:Select a workspace'
'show:Show the name of the current workspace'
)
_describe -t workspace "workspace commands" __workspace_cmds
}
_arguments '*:: :->command'
if (( CURRENT == 1 )); then
......@@ -153,26 +238,38 @@ local -a _command_args
case "$words[1]" in
apply)
__apply ;;
console)
__console;;
destroy)
__destroy ;;
fmt)
__fmt;;
get)
__get ;;
graph)
__graph ;;
import)
__import;;
init)
__init ;;
output)
__output ;;
plan)
__plan ;;
providers)
__providers ;;
push)
__push ;;
refresh)
__refresh ;;
remote)
__remote ;;
show)
__show ;;
taint)
__taint ;;
untaint)
__untaint ;;
validate)
__validate ;;
workspace)
test $CURRENT -lt 3 && __workspace ;;
esac
function tf_prompt_info() {
# dont show 'default' workspace in home dir
[[ "$PWD" == ~ ]] && return
# check if in terraform dir
if [ -d .terraform ]; then
workspace=$(terraform workspace show 2> /dev/null) || return
......
......@@ -4,7 +4,7 @@ Plugin for Textastic, a text and code editor for Mac OS X
### Requirements
* [Textastic](http://www.textasticapp.com/mac.html)
* [Textastic](https://www.textasticapp.com/mac.html)
### Usage
......
# TextMate plugin
The plugin adds a function for the [TextMate](https://macromates.com) editor.
To use it, add `textmate` to the plugins array of your zshrc file:
```
plugins=(... textmate)
```
## Function
The `tm` function provides the following options:
- No arguments: Run `mate` in the current directory.
- Argument that is a directory: Run `mate` in the given directory and cd to it.
- Other arguments: Pass all arguments to `mate`. This allows for easy opening of multiple files.
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