Unverified Commit 18ee5dff authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into clipboard

parents d81cd753 368198b7
......@@ -82,13 +82,15 @@ _swift_build() {
"(--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[]"
"--trace-resolver[]"
"(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
"--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--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: "
......@@ -125,13 +127,15 @@ _swift_run() {
"(--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[]"
"--trace-resolver[]"
"(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
"--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--skip-build[Skip building the executable product]"
"--build-tests[Build both source and test targets]"
"--repl[Launch Swift REPL for the package]"
......@@ -166,13 +170,15 @@ _swift_package() {
"(--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[]"
"--trace-resolver[]"
"(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
"--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
'(-): :->command'
'(-)*:: :->arg'
)
......@@ -181,49 +187,61 @@ _swift_package() {
(command)
local modes
modes=(
'update:Update package dependencies'
'completion-tool:Completion tool (for shell completions)'
'dump-package:Print parsed Package.swift as JSON'
'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'
'clean:Delete build artifacts'
'show-dependencies:Print the resolved dependency graph'
'init:Initialize a new package'
'unedit:Remove a package from editable mode'
'tools-version:Manipulate tools version of the current package'
'fetch:'
'dump-package:Print parsed Package.swift as JSON'
'resolve:Resolve package dependencies'
'reset:Reset the complete cache/build directory'
'generate-xcodeproj:Generates an Xcode project'
'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'
'update:Update package dependencies'
)
_describe "mode" modes
;;
(arg)
case ${words[1]} in
(update)
_swift_package_update
(completion-tool)
_swift_package_completion-tool
;;
(dump-package)
_swift_package_dump-package
;;
(describe)
_swift_package_describe
;;
(resolve)
_swift_package_resolve
(clean)
_swift_package_clean
;;
(tools-version)
_swift_package_tools-version
(show-dependencies)
_swift_package_show-dependencies
;;
(init)
_swift_package_init
;;
(unedit)
_swift_package_unedit
;;
(show-dependencies)
_swift_package_show-dependencies
(tools-version)
_swift_package_tools-version
;;
(fetch)
_swift_package_fetch
;;
(dump-package)
_swift_package_dump-package
(resolve)
_swift_package_resolve
;;
(reset)
_swift_package_reset
;;
(generate-xcodeproj)
_swift_package_generate-xcodeproj
;;
(edit)
_swift_package_edit
......@@ -231,27 +249,22 @@ _swift_package() {
(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
(update)
_swift_package_update
;;
esac
;;
esac
}
_swift_package_update() {
_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_dump-package() {
arguments=(
)
_arguments $arguments && return
......@@ -264,20 +277,23 @@ _swift_package_describe() {
_arguments $arguments && return
}
_swift_package_resolve() {
_swift_package_clean() {
arguments=(
":The name of the package to resolve:_swift_dependency"
"--version[The version to resolve at]:The version to resolve at: "
"--branch[The branch to resolve at]:The branch to resolve at: "
"--revision[The revision to resolve at]:The revision to resolve at: "
)
_arguments $arguments && return
}
_swift_package_tools-version() {
_swift_package_show-dependencies() {
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]"
"--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_init() {
arguments=(
"--type[empty|library|executable|system-module|manifest]: :{_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
}
......@@ -290,9 +306,10 @@ _swift_package_unedit() {
_arguments $arguments && return
}
_swift_package_show-dependencies() {
_swift_package_tools-version() {
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]'}"
"--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
}
......@@ -303,8 +320,30 @@ _swift_package_fetch() {
_arguments $arguments && return
}
_swift_package_dump-package() {
_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_reset() {
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
}
......@@ -330,8 +369,8 @@ _swift_package_config() {
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'
'set-mirror:Set a mirror for a dependency'
)
_describe "mode" modes
;;
......@@ -340,12 +379,12 @@ _swift_package_config() {
(unset-mirror)
_swift_package_config_unset-mirror
;;
(set-mirror)
_swift_package_config_set-mirror
;;
(get-mirror)
_swift_package_config_get-mirror
;;
(set-mirror)
_swift_package_config_set-mirror
;;
esac
;;
esac
......@@ -359,14 +398,6 @@ _swift_package_config_unset-mirror() {
_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: "
......@@ -374,41 +405,16 @@ _swift_package_config_get-mirror() {
_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() {
_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_init() {
_swift_package_update() {
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
}
......@@ -440,13 +446,15 @@ _swift_test() {
"(--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[]"
"--trace-resolver[]"
"(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
"--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--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]"
......
......@@ -28,8 +28,8 @@ alias mkdir='mkdir -pv'
alias psmem='ps -e -orss=,args= | sort -b -k1,1n'
alias psmem10='ps -e -orss=,args= | sort -b -k1,1n| head -10'
# get top process eating cpu if not work try excute : export LC_ALL='C'
alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr'
alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr | head -10'
alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr'
alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -10'
# top10 of the history
alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
......
......@@ -51,3 +51,44 @@ plugins=(... systemd)
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`.
### Unit Status Prompt
You can add a token to your prompt in a similar way to the gitfast plugin. To add the token
to your prompt, drop `$(systemd_prompt_info [unit]...)` into your prompt (more than one unit
may be specified).
The plugin will add the following to your prompt for each `$unit`.
```
<prefix><unit>:<active|notactive><suffix>
```
You can control these parts with the following variables:
- `<prefix>`: Set `$ZSH_THEME_SYSTEMD_PROMPT_PREFIX`.
- `<suffix>`: Set `$ZSH_THEME_SYSTEMD_PROMPT_SUFFIX`.
- `<unit>`: name passed as parameter to the function. If you want it to be in ALL CAPS,
you can set the variable `$ZSH_THEME_SYSTEMD_PROMPT_CAPS` to a non-empty string.
- `<active>`: shown if the systemd unit is active.
Set `$ZSH_THEME_SYSTEMD_PROMPT_ACTIVE`.
- `<notactive>`: shown if the systemd unit is *not* active.
Set `$ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE`.
For example, if your prompt contains `PROMPT='$(systemd_prompt_info dhcpd httpd)'` and you set the following variables:
```
ZSH_THEME_SYSTEMD_PROMPT_PREFIX="["
ZSH_THEME_SYSTEMD_PROMPT_SUFFIX="]"
ZSH_THEME_SYSTEMD_PROMPT_ACTIVE="+"
ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE="X"
ZSH_THEME_SYSTEMD_PROMPT_CAPS=1
```
If `dhcpd` is running, and `httpd` is not, then your prompt will look like this:
```
[DHCPD: +][HTTPD: X]
```
user_commands=(
list-units is-active status show help list-unit-files
is-enabled list-jobs show-environment cat list-timers)
cat
get-default
help
is-active
is-enabled
is-failed
is-system-running
list-dependencies
list-jobs
list-sockets
list-timers
list-unit-files
list-units
show
show-environment
status)
sudo_commands=(
start stop reload restart try-restart isolate kill
reset-failed enable disable reenable preset mask unmask
link load cancel set-environment unset-environment
edit)
add-requires
add-wants
cancel
daemon-reexec
daemon-reload
default
disable
edit
emergency
enable
halt
hibernate
hybrid-sleep
import-environment
isolate
kexec
kill
link
list-machines
load
mask
poweroff
preset
preset-all
reboot
reenable
reload
reload-or-restart
reset-failed
rescue
restart
revert
set-default
set-environment
set-property
start
stop
suspend
switch-root
try-reload-or-restart
try-restart
unmask
unset-environment)
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
......@@ -20,3 +73,18 @@ 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"
function systemd_prompt_info {
local unit
for unit in $@; do
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_PREFIX"
[[ -n "$ZSH_THEME_SYSTEMD_PROMPT_CAPS" ]] && echo "${(U)unit}:" || echo "$unit:"
if systemctl is-active $unit &>/dev/null; then
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_ACTIVE"
else
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE"
fi
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_SUFFIX"
done
}
# This file is intentionally empty.
#
# The terminalapp plugin is deprecated and may be removed in a future release.
# Its functionality has been folded in to the core lib/termsupport.zsh, which
# is loaded for all users. You can remove terminalapp from your $plugins list
# once all your systems are updated to the current version of Oh My Zsh.
# Terminitor plugin
This plugin adds completions for the [Terminitor](https://github.com/achiurizo/terminitor) development workflow setup tool.
To use it, add `terminitor` to the plugins array in your zshrc file:
```zsh
plugins=(... terminitor)
```
#compdef terraform
local -a _terraform_cmds
local -a _terraform_cmds opt_args
_terraform_cmds=(
'apply:Builds or changes infrastructure'
'console:Interactive console for Terraform interpolations'
......@@ -16,13 +16,21 @@ _terraform_cmds=(
'push:Upload this Terraform module to Atlas to run'
'refresh:Update local state file against real resources'
'show:Inspect Terraform state or plan'
'state:Advanced state management'
'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'
'0.12upgrade:Rewrites pre-0.12 module source code for v0.12'
)
__012upgrade() {
_arguments \
'-yes[Skip the initial introduction messages and interactive confirmation. This can be used to run this command in batch from a script.]' \
'-force[ Override the heuristic that attempts to detect if a configuration is already written for v0.12 or later. Some of the transformations made by this command are not idempotent, so re-running against the same module may change the meanings expressions in the module.]'
}
__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.]' \
......@@ -35,7 +43,7 @@ __apply() {
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-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) Resource 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.]:target:__statelist' \
'-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.]'
}
......@@ -59,7 +67,7 @@ __destroy() {
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-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) Resource 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.]:target:__statelist' \
'-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.]'
}
......@@ -140,7 +148,7 @@ __plan() {
'-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) Resource 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.]:target:__statelist' \
'-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.]' \
}
......@@ -172,7 +180,7 @@ __refresh() {
'-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.]' \
'-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) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
'-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.]'
}
......@@ -183,6 +191,70 @@ __show() {
'-no-color[If specified, output will not contain any color.]'
}
__state() {
local -a __state_cmds
__state_cmds=(
'list:List resources in the state'
'mv:Move an item in the state'
'pull:Pull current state and output to stdout'
'push:Update remote state from a local state file'
'rm:Remove instances from the state'
'show:Show a resource in the state'
)
_describe -t state "state commands" __state_cmds
}
__state_list() {
_arguments \
'-state=[(path) 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.]' \
'-id=[(id) Filters the results to include only instances whose resource types have an attribute named id whose value equals the given id string.]' \
"*:address:__statelist"
}
__state_mv() {
_arguments \
"-dry-run[If set, prints out what would've been moved but doesn't actually move anything.]" \
"-backup=[(path) Path where Terraform should write the backup for the original state. This can't be disabled. If not set, Terraform will write it to the same path as the statefile with a \".backup\" extension.]:file:_files" \
"-backup-out=[(path) Path where Terraform should write the backup for the destination state. This can't be disabled. If not set, Terraform will write it to the same path as the destination state file with a backup extension. This only needs to be specified if -state-out is set to a different path than -state.]:file:_files" \
"-lock=[(true|false) Lock the state files when locking is supported.]:lock:(true false)" \
"-lock-timeout=[(seconds) Duration to retry a state lock.]" \
'-state=[(path) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:file:_files' \
"-state-out=[(path) Path to the destination state file to write to. If this isn't specified, the source state file will be used. This can be a new or existing path.]:file:_files" \
"::" \
":source:__statelist" \
":destination: "
}
__state_push() {
_arguments \
"-force[Write the state even if lineages don't match or the remote serial is higher.]" \
'-lock=[(true|false) Lock the state file when locking is supported.]:lock:(true false)' \
"-lock-timeout=[(seconds) Duration to retry a state lock.]" \
"::" \
":destination:_files"
}
__state_rm() {
_arguments \
"-dry-run[If set, prints out what would've been removed but doesn't actually remove anything.]" \
"-backup=[(path) Path where Terraform should write the backup for the original state.]:file:_files" \
"-lock=[(true|false) Lock the state files when locking is supported.]:lock:(true false)" \
"-lock-timeout=[(seconds) Duration to retry a state lock.]" \
'-state=[(path) Path to the state file to update. Defaults to the current workspace state.]:file:_files' \
"*:address:__statelist"
}
__state_show() {
_arguments \
'-state=[(path) 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.]' \
"*:address:__statelist"
}
__statelist() {
compadd $(terraform state list $opt_args[-state])
}
__taint() {
_arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
......@@ -192,7 +264,8 @@ __taint() {
'-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.]'
'-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]' \
"*:address:__statelist"
}
__untaint() {
......@@ -236,6 +309,8 @@ fi
local -a _command_args
case "$words[1]" in
0.12upgrade)
__012upgrade ;;
apply)
__apply ;;
console)
......@@ -264,6 +339,14 @@ case "$words[1]" in
__refresh ;;
show)
__show ;;
state)
test $CURRENT -lt 3 && __state
[[ $words[2] = "list" ]] && __state_list
[[ $words[2] = "mv" ]] && __state_mv
[[ $words[2] = "push" ]] && __state_push
[[ $words[2] = "rm" ]] && __state_rm
[[ $words[2] = "show" ]] && __state_show
;;
taint)
__taint ;;
untaint)
......
......@@ -6,4 +6,4 @@
Press `ESC` twice to correct previous console command.
## Notes
`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/sudo) plugin.
`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo) plugin.
......@@ -15,4 +15,6 @@ fuck-command-line() {
}
zle -N fuck-command-line
# Defined shortcut keys: [Esc] [Esc]
bindkey "\e\e" fuck-command-line
bindkey -M emacs '\e\e' fuck-command-line
bindkey -M vicmd '\e\e' fuck-command-line
bindkey -M viins '\e\e' fuck-command-line
#compdef theme
_arguments "1: :($(lstheme | tr "\n" " "))"
function theme
{
if [ -z "$1" ] || [ "$1" = "random" ]; then
themes=($ZSH/themes/*zsh-theme)
N=${#themes[@]}
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else
if [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]
then
function theme {
: ${1:=random} # Use random theme if none provided
if [[ -f "$ZSH_CUSTOM/$1.zsh-theme" ]]; then
source "$ZSH_CUSTOM/$1.zsh-theme"
elif [[ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]]; then
source "$ZSH_CUSTOM/themes/$1.zsh-theme"
else
elif [[ -f "$ZSH/themes/$1.zsh-theme" ]]; then
source "$ZSH/themes/$1.zsh-theme"
else
echo "$0: Theme '$1' not found"
return 1
fi
fi
}
function lstheme
{
function _theme {
_arguments "1: :($(lstheme))"
}
compdef _theme theme
function lstheme {
# Resources:
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Modifiers
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers
print -l {$ZSH,$ZSH_CUSTOM}/themes/*.zsh-theme(N:t:r)
print "$ZSH_CUSTOM"/*.zsh-theme(N:t:r) {"$ZSH_CUSTOM","$ZSH"}/themes/*.zsh-theme(N:t:r)
}
# Thor plugin
This plugin adds completion for [Thor](http://whatisthor.com/),
a ruby toolkit for building powerful command-line interfaces.
To use it, add `thor` to the plugins array in your zshrc file:
```zsh
plugins=(... thor)
```
......@@ -25,5 +25,6 @@ __timer_display_timer_precmd() {
fi
}
preexec_functions+=(__timer_save_time_preexec)
precmd_functions+=(__timer_display_timer_precmd)
autoload -U add-zsh-hook
add-zsh-hook preexec __timer_save_time_preexec
add-zsh-hook precmd __timer_display_timer_precmd
# tmux-cssh plugin
This plugin adds autocompletion for [`tmux-cssh`](https://github.com/zinic/tmux-cssh/).
To use it, add `tmux-cssh` to the plugins array in your zshrc file:
```zsh
plugins=(... tmux-cssh)
```
First upstream repo, now disappeared: https://github.com/dennishafemann/tmux-cssh.
......@@ -5,16 +5,16 @@
# Author: Manfred Touron (@moul)
_arguments \
'(-h --help)'{-h,--help}'[This help.]' \
'(-u --user)'{-u,--user}'[User to use.]' \
'(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \
'(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \
'(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \
'(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \
'(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \
'(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \
'(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \
'(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \
'(-h --help)'{-h,--help}'[This help.]' \
'(-u --user)'{-u,--user}'[User to use.]' \
'(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \
'(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \
'(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \
'(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \
'(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \
'(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \
'(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \
'(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \
':hosts:_hosts' \
'*:: :->subcmds' \
&& return 0
......
# tmux
This plugin provides aliases for [tmux](http://tmux.github.io/), the terminal multiplexer.
This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer.
To use it add `tmux` to the plugins array in your zshrc file.
```zsh
......@@ -37,3 +37,5 @@ The plugin also supports the following -
| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) |
| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` |
| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) |
| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
set -g default-terminal $ZSH_TMUX_TERM
source $HOME/.tmux.conf
source-file $ZSH_TMUX_CONFIG
\ No newline at end of file
......@@ -34,6 +34,10 @@ alias tkss='tmux kill-session -t'
# Tmux states this should be screen-256color, but you may need to change it on
# systems without the proper terminfo
: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
# Set the configuration path
: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf}
# Set -u option to support unicode
: ${ZSH_TMUX_UNICODE:=false}
# Determine if the terminal supports 256 colors
if [[ $terminfo[colors] == 256 ]]; then
......@@ -43,7 +47,8 @@ else
fi
# Set the correct local config file to use.
if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$HOME/.tmux.conf" ]]; then
if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then
export ZSH_TMUX_CONFIG
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf"
else
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf"
......@@ -59,13 +64,18 @@ function _zsh_tmux_plugin_run() {
local -a tmux_cmd
tmux_cmd=(command tmux)
[[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
[[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
# Try to connect to an existing session.
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
# If failed, just run tmux, fixing the TERM variable if requested.
if [[ $? -ne 0 ]]; then
[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG")
if [[ "$ZSH_TMUX_FIXTERM" == "true" ]]; then
tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG")
elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then
tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
fi
$tmux_cmd new-session
fi
......
# Tugboat plugin
This plugin adds autocompletion for Tugboat, a command line tool for interacting with your
[DigitalOcean droplets](https://www.digitalocean.com/products/droplets/).
To use it, add it to the plugins array in your `~/.zshrc` file:
```zsh
plugins=(... tugboat)
```
Further documentation for Tugboat can be found in the [Tugboat repository](https://github.com/petems/tugboat).
......@@ -12,10 +12,10 @@ alias acp='apt-cache policy'
#List all installed packages
alias agli='apt list --installed'
# superuser operations ######################################################
# List available updates only
alias aglu='sudo apt-get -u upgrade --assume-no'
alias aglu='apt list --upgradable'
# superuser operations ######################################################
alias afu='sudo apt-file update'
......
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