Unverified Commit 420e9d78 authored by Aaron N. Brock's avatar Aaron N. Brock Committed by GitHub
Browse files

Merge branch 'master' into colorize-chroma-support

parents 57226778 76d6b025
#compdef terraform #compdef terraform
local -a _terraform_cmds local -a _terraform_cmds opt_args
_terraform_cmds=( _terraform_cmds=(
'apply:Builds or changes infrastructure' 'apply:Builds or changes infrastructure'
'console:Interactive console for Terraform interpolations' 'console:Interactive console for Terraform interpolations'
...@@ -16,13 +16,21 @@ _terraform_cmds=( ...@@ -16,13 +16,21 @@ _terraform_cmds=(
'push:Upload this Terraform module to Atlas to run' 'push:Upload this Terraform module to Atlas to run'
'refresh:Update local state file against real resources' 'refresh:Update local state file against real resources'
'show:Inspect Terraform state or plan' 'show:Inspect Terraform state or plan'
'state:Advanced state management'
'taint:Manually mark a resource for recreation' 'taint:Manually mark a resource for recreation'
'untaint:Manually unmark a resource as tainted' 'untaint:Manually unmark a resource as tainted'
'validate:Validates the Terraform files' 'validate:Validates the Terraform files'
'version:Prints the Terraform version' 'version:Prints the Terraform version'
'workspace:Workspace management' '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() { __apply() {
_arguments \ _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.]' \ '-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() { ...@@ -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.]' \ '-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=[(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.]' \ '-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[("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.]' '-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() { ...@@ -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.]' \ '-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=[(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.]' \ '-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[("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.]' '-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() { ...@@ -140,7 +148,7 @@ __plan() {
'-parallelism=[(10) Limit the number of concurrent operations.]' \ '-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences.]' \ '-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.]' \ '-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[("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.]' \ '-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() { ...@@ -172,7 +180,7 @@ __refresh() {
'-no-color[If specified, output will not contain any color.]' \ '-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=[(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.]' \ '-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[("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=[(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() { ...@@ -183,6 +191,70 @@ __show() {
'-no-color[If specified, output will not contain any color.]' '-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() { __taint() {
_arguments \ _arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \ '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
...@@ -192,7 +264,8 @@ __taint() { ...@@ -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).]' \ '-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.]' \ '-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=[(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() { __untaint() {
...@@ -236,6 +309,8 @@ fi ...@@ -236,6 +309,8 @@ fi
local -a _command_args local -a _command_args
case "$words[1]" in case "$words[1]" in
0.12upgrade)
__012upgrade ;;
apply) apply)
__apply ;; __apply ;;
console) console)
...@@ -264,6 +339,14 @@ case "$words[1]" in ...@@ -264,6 +339,14 @@ case "$words[1]" in
__refresh ;; __refresh ;;
show) show)
__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)
__taint ;; __taint ;;
untaint) untaint)
......
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
Press `ESC` twice to correct previous console command. Press `ESC` twice to correct previous console command.
## Notes ## 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.
...@@ -25,5 +25,6 @@ __timer_display_timer_precmd() { ...@@ -25,5 +25,6 @@ __timer_display_timer_precmd() {
fi fi
} }
preexec_functions+=(__timer_save_time_preexec) autoload -U add-zsh-hook
precmd_functions+=(__timer_display_timer_precmd) add-zsh-hook preexec __timer_save_time_preexec
add-zsh-hook precmd __timer_display_timer_precmd
...@@ -46,6 +46,7 @@ fi ...@@ -46,6 +46,7 @@ fi
# Set the correct local config file to use. # Set the correct local config file to use.
if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; 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" export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf"
else else
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf" export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf"
......
...@@ -21,9 +21,9 @@ Original idea and aliases: [Ruslan Spivak](https://ruslanspivak.wordpress.com/20 ...@@ -21,9 +21,9 @@ Original idea and aliases: [Ruslan Spivak](https://ruslanspivak.wordpress.com/20
## Examples ## Examples
```zsh ```zsh
urlencode 'https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code' urlencode 'https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code'
# returns https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode # returns https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode
urldecode 'https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode' urldecode 'https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode'
# returns https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code # returns https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code
``` ```
...@@ -12,11 +12,11 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD ...@@ -12,11 +12,11 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD
alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"' alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"' alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
elif [[ $(whence python3) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then elif [[ $(whence python3) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
alias urlencode='python3 -c "import sys, urllib.parse as up; print(up.quote_plus(sys.argv[1]))"' alias urlencode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.quote_plus(sys.argv[1]))"'
alias urldecode='python3 -c "import sys, urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"' alias urldecode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"'
elif [[ $(whence python2) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then elif [[ $(whence python2) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
alias urlencode='python2 -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"' alias urlencode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.quote_plus(sys.argv[1])"'
alias urldecode='python2 -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"' alias urldecode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.unquote_plus(sys.argv[1])"'
elif [[ $(whence xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then elif [[ $(whence xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then
function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"} function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"}
function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"} function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"}
......
...@@ -96,7 +96,6 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then ...@@ -96,7 +96,6 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
# Append workon_cwd to the chpwd_functions array, so it will be called on cd # Append workon_cwd to the chpwd_functions array, so it will be called on cd
# http://zsh.sourceforge.net/Doc/Release/Functions.html # http://zsh.sourceforge.net/Doc/Release/Functions.html
if ! (( $chpwd_functions[(I)workon_cwd] )); then autoload -U add-zsh-hook
chpwd_functions+=(workon_cwd) add-zsh-hook chpwd workon_cwd
fi
fi fi
...@@ -13,7 +13,7 @@ wd ...@@ -13,7 +13,7 @@ wd
### oh-my-zsh ### oh-my-zsh
`wd` comes bundled with [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)! `wd` comes bundled with [oh-my-zshell](https://github.com/ohmyzsh/ohmyzsh)!
Just add the plugin in your `~/.zshrc` file: Just add the plugin in your `~/.zshrc` file:
...@@ -53,7 +53,7 @@ Run either in terminal: ...@@ -53,7 +53,7 @@ Run either in terminal:
#### Completion #### Completion
If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`: If you're NOT using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`:
fpath=(~/path/to/wd $fpath) fpath=(~/path/to/wd $fpath)
...@@ -85,7 +85,7 @@ Also, you may have to force a rebuild of `zcompdump` by running: ...@@ -85,7 +85,7 @@ Also, you may have to force a rebuild of `zcompdump` by running:
$ wd ... $ wd ...
This is a wrapper for the zsh `dirs` function. This is a wrapper for the zsh `dirs` function.
(You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)). (You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/ohmyzsh/ohmyzsh)).
* Remove warp point test point: * Remove warp point test point:
......
...@@ -7,7 +7,7 @@ export ZSH=$HOME/.oh-my-zsh ...@@ -7,7 +7,7 @@ export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load --- if set to "random", it will # Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case, # load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME # to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell" ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random # Set list of themes to pick from when loading at random
......
# ZSH Theme - Preview: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#gallifrey # ZSH Theme - Preview: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#gallifrey
return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
host_color="%(!.%{$fg[red]%}.%{$fg[green]%})" host_color="%(!.%{$fg[red]%}.%{$fg[green]%})"
......
...@@ -28,7 +28,8 @@ prompt_setup_pygmalion(){ ...@@ -28,7 +28,8 @@ prompt_setup_pygmalion(){
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
precmd_functions+=(prompt_pygmalion_precmd) autoload -U add-zsh-hook
add-zsh-hook precmd prompt_pygmalion_precmd
} }
prompt_pygmalion_precmd(){ prompt_pygmalion_precmd(){
...@@ -46,5 +47,3 @@ prompt_pygmalion_precmd(){ ...@@ -46,5 +47,3 @@ prompt_pygmalion_precmd(){
} }
prompt_setup_pygmalion prompt_setup_pygmalion
...@@ -12,7 +12,8 @@ prompt_setup_pygmalion(){ ...@@ -12,7 +12,8 @@ prompt_setup_pygmalion(){
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
precmd_functions+=(prompt_pygmalion_precmd) autoload -U add-zsh-hook
add-zsh-hook precmd prompt_pygmalion_precmd
} }
prompt_pygmalion_precmd(){ prompt_pygmalion_precmd(){
...@@ -30,5 +31,3 @@ prompt_pygmalion_precmd(){ ...@@ -30,5 +31,3 @@ prompt_pygmalion_precmd(){
} }
prompt_setup_pygmalion prompt_setup_pygmalion
#!/bin/sh #!/bin/sh
# #
# This script should be run via curl: # This script should be run via curl:
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" # sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or wget: # or wget:
# sh -c "$(wget -qO- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" # sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# #
# As an alternative, you can first download the install script and run it afterwards: # As an alternative, you can first download the install script and run it afterwards:
# wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh # wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
# sh install.sh # sh install.sh
# #
# You can tweak the install behavior by setting variables when running the script. For # You can tweak the install behavior by setting variables when running the script. For
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# #
# Respects the following environment variables: # Respects the following environment variables:
# ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh) # ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh)
# REPO - name of the GitHub repo to install from (default: robbyrussell/oh-my-zsh) # REPO - name of the GitHub repo to install from (default: ohmyzsh/ohmyzsh)
# REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS) # REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS)
# BRANCH - branch to check out immediately after install (default: master) # BRANCH - branch to check out immediately after install (default: master)
# #
...@@ -33,7 +33,7 @@ set -e ...@@ -33,7 +33,7 @@ set -e
# Default settings # Default settings
ZSH=${ZSH:-~/.oh-my-zsh} ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-robbyrussell/oh-my-zsh} REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git} REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master} BRANCH=${BRANCH:-master}
......
...@@ -31,6 +31,12 @@ git config fsck.zeroPaddedFilemode ignore ...@@ -31,6 +31,12 @@ git config fsck.zeroPaddedFilemode ignore
git config fetch.fsck.zeroPaddedFilemode ignore git config fetch.fsck.zeroPaddedFilemode ignore
git config receive.fsck.zeroPaddedFilemode ignore git config receive.fsck.zeroPaddedFilemode ignore
# Update upstream remote to ohmyzsh org
remote=$(git remote -v | awk '/https:\/\/github\.com\/robbyrussell\/oh-my-zsh\.git/{ print $1; exit }')
if [ -n "$remote" ]; then
git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
fi
printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh" printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
if git pull --rebase --stat origin master if git pull --rebase --stat origin master
then then
......
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