Merge changes from #4241 into installer-portable-colors
Conflicts: tools/install.sh tools/upgrade.sh
This commit is contained in:
commit
82c76f6b5c
@ -3,9 +3,9 @@
|
||||
|
||||
Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again.
|
||||
|
||||
__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interface with your command prompt, you'll be able take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often.
|
||||
__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often.
|
||||
|
||||
To learn more, visit http://ohmyz.sh and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on twitter.
|
||||
To learn more, visit http://ohmyz.sh and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
|
||||
|
||||
## Getting Started
|
||||
|
||||
@ -43,7 +43,9 @@ If you spot a plugin (or several) that you would like to use with Oh My Zsh, you
|
||||
|
||||
For example, this line might begin to look like...
|
||||
|
||||
`plugins=(git bundler osx rake ruby)`
|
||||
```shell
|
||||
plugins=(git bundler osx rake ruby)
|
||||
```
|
||||
|
||||
#### Using Plugins
|
||||
|
||||
@ -51,7 +53,7 @@ Most plugins (should! we're working on this) include a __README__, which documen
|
||||
|
||||
### Themes
|
||||
|
||||
We'll admit it. Early in the Oh My Zsh world... we may have gotten far too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out!
|
||||
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out!
|
||||
|
||||
#### Selecting a Theme
|
||||
|
||||
@ -59,23 +61,37 @@ _Robby's theme is the default one. It's not the fanciest one. It's not the simpl
|
||||
|
||||
Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like:
|
||||
|
||||
`ZSH_THEME="robbyrussell"`
|
||||
```shell
|
||||
ZSH_THEME="robbyrussell"
|
||||
```
|
||||
|
||||
To use a different theme, simple change the value to match the name of your desired theme. For example:
|
||||
To use a different theme, simply change the value to match the name of your desired theme. For example:
|
||||
|
||||
`ZSH_THEME="agnoster"` (this is one of the fancy ones)
|
||||
```shell
|
||||
ZSH_THEME="agnoster" # (this is one of the fancy ones)
|
||||
```
|
||||
|
||||
Open up a new terminal window and your prompt should look something like...
|
||||
|
||||
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes).
|
||||
![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png)
|
||||
|
||||
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes).
|
||||
|
||||
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
|
||||
|
||||
|
||||
```shell
|
||||
ZSH_THEME="random" # (...please let it be pie... please be some pie..)
|
||||
```
|
||||
|
||||
|
||||
## Advanced Topics
|
||||
|
||||
If you're the type that likes to get their hands dirty... these sections might resonate.
|
||||
If you're the type that likes to get their hands dirty, these sections might resonate.
|
||||
|
||||
### Advanced Installation
|
||||
|
||||
For those who want to install this manually and/or set custom paths.
|
||||
Some users may want to change the default path, or manually install Oh My Zsh.
|
||||
|
||||
#### Custom Directory
|
||||
|
||||
@ -83,27 +99,37 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory)
|
||||
|
||||
If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
|
||||
|
||||
`curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh`
|
||||
```shell
|
||||
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh
|
||||
```
|
||||
|
||||
#### Manual Installation
|
||||
|
||||
##### 1. Clone the repository:
|
||||
|
||||
`git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh`
|
||||
```shell
|
||||
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
||||
```
|
||||
|
||||
##### 2. *Optionally*, backup your existing @~/.zshrc@ file:
|
||||
##### 2. *Optionally*, backup your existing `~/.zshrc` file:
|
||||
|
||||
`cp ~/.zshrc ~/.zshrc.orig`
|
||||
```shell
|
||||
cp ~/.zshrc ~/.zshrc.orig
|
||||
```
|
||||
|
||||
##### 3. Create a new zsh configuration file
|
||||
|
||||
You can create a new zsh config file by copying the template that we included for you.
|
||||
|
||||
`cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc`
|
||||
```shell
|
||||
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
||||
```
|
||||
|
||||
##### 4. Change your default shell
|
||||
|
||||
`chsh -s /bin/zsh`
|
||||
```shell
|
||||
chsh -s /bin/zsh
|
||||
```
|
||||
|
||||
##### 5. Initialize your new zsh configuration
|
||||
|
||||
@ -120,7 +146,7 @@ If you have any hiccups installing, here are a few common fixes.
|
||||
|
||||
If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory.
|
||||
|
||||
If you have many functions that go well together, you can put them as a `abcyzeae.plugin.zsh` file in the `custom/plugins/` directory and then enable this plugin.
|
||||
If you have many functions that go well together, you can put them as a `XYZ.plugin.zsh` file in the `custom/plugins/` directory and then enable this plugin.
|
||||
|
||||
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
|
||||
|
||||
@ -128,17 +154,23 @@ If you would like to override the functionality of a plugin distributed with Oh
|
||||
|
||||
By default, you will be prompted to check for upgrades every few weeks. If you would like `oh-my-zsh` to automatically upgrade itself without prompting you, set the following in your `~/.zshrc`:
|
||||
|
||||
`DISABLE_UPDATE_PROMPT=true`
|
||||
```shell
|
||||
DISABLE_UPDATE_PROMPT=true
|
||||
```
|
||||
|
||||
To disable automatic upgrades, set the following in your `~/.zshrc`:
|
||||
|
||||
`DISABLE_AUTO_UPDATE=true`
|
||||
```shell
|
||||
DISABLE_AUTO_UPDATE=true
|
||||
```
|
||||
|
||||
### Manual Updates
|
||||
|
||||
If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?)... you just need to run:
|
||||
If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run:
|
||||
|
||||
`upgrade_oh_my_zsh`
|
||||
```shell
|
||||
upgrade_oh_my_zsh
|
||||
```
|
||||
|
||||
Magic!
|
||||
|
||||
@ -154,7 +186,7 @@ I'm far from being a [Zsh](http://www.zsh.org/) expert and suspect there are man
|
||||
|
||||
We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can.
|
||||
|
||||
### Do NOT Send Us Themes
|
||||
### Do NOT send us themes
|
||||
|
||||
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page.
|
||||
|
||||
@ -166,12 +198,12 @@ Thank you so much!
|
||||
|
||||
## Follow Us
|
||||
|
||||
We have an [ohmyzsh](https://twitter.com/ohmyzsh) account. You should follow it.
|
||||
We have an [@ohmyzsh](https://twitter.com/ohmyzsh) Twitter account. You should follow it.
|
||||
|
||||
## Merchandise
|
||||
|
||||
We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town!
|
||||
|
||||
## LICENSE
|
||||
## License
|
||||
|
||||
Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt).
|
||||
|
@ -15,6 +15,22 @@ function take() {
|
||||
cd $1
|
||||
}
|
||||
|
||||
function open_command() {
|
||||
local open_cmd
|
||||
|
||||
# define the open command
|
||||
case "$OSTYPE" in
|
||||
darwin*) open_cmd="open" ;;
|
||||
cygwin*) open_cmd="cygstart" ;;
|
||||
linux*) open_cmd="xdg-open" ;;
|
||||
*) echo "Platform $OSTYPE not supported"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
nohup $open_cmd "$@" &>/dev/null
|
||||
}
|
||||
|
||||
#
|
||||
# Get the value of an alias.
|
||||
#
|
||||
|
@ -7,6 +7,9 @@
|
||||
# (In screen, only short_tab_title is used)
|
||||
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
|
||||
function title {
|
||||
emulate -L zsh
|
||||
setopt prompt_subst
|
||||
|
||||
[[ "$EMACS" == *term* ]] && return
|
||||
|
||||
# if $2 is unset use $1 as default
|
||||
@ -23,6 +26,10 @@ function title {
|
||||
|
||||
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
|
||||
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
|
||||
# Avoid duplication of directory in terminals with independent dir display
|
||||
if [[ $TERM_PROGRAM == Apple_Terminal ]]; then
|
||||
ZSH_THEME_TERM_TITLE_IDLE="%n@%m"
|
||||
fi
|
||||
|
||||
# Runs before showing the prompt
|
||||
function omz_termsupport_precmd {
|
||||
@ -43,7 +50,7 @@ function omz_termsupport_preexec {
|
||||
setopt extended_glob
|
||||
|
||||
# cmd name only, or if this is sudo or ssh, the next cmd
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]:gs/%/%%}
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||
local LINE="${2:gs/%/%%}"
|
||||
|
||||
title '$CMD' '%100>...>$LINE%<<'
|
||||
|
11
oh-my-zsh.sh
11
oh-my-zsh.sh
@ -29,11 +29,6 @@ for config_file ($ZSH/lib/*.zsh); do
|
||||
source $config_file
|
||||
done
|
||||
|
||||
# Load all of your custom configurations from custom/
|
||||
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
|
||||
source $config_file
|
||||
done
|
||||
unset config_file
|
||||
|
||||
is_plugin() {
|
||||
local base_dir=$1
|
||||
@ -77,6 +72,12 @@ for plugin ($plugins); do
|
||||
fi
|
||||
done
|
||||
|
||||
# Load all of your custom configurations from custom/
|
||||
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
|
||||
source $config_file
|
||||
done
|
||||
unset config_file
|
||||
|
||||
# Load the theme
|
||||
if [ "$ZSH_THEME" = "random" ]; then
|
||||
themes=($ZSH/themes/*zsh-theme)
|
||||
|
@ -15,7 +15,7 @@ if [ $commands[autojump] ]; then # check if autojump is installed
|
||||
. /usr/local/share/autojump/autojump.zsh
|
||||
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
|
||||
. /opt/local/etc/profile.d/autojump.zsh
|
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
|
||||
. `brew --prefix`/etc/autojump.zsh
|
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew
|
||||
. `brew --prefix`/etc/autojump.sh
|
||||
fi
|
||||
fi
|
||||
|
@ -49,7 +49,8 @@ function push_future() {
|
||||
}
|
||||
|
||||
# Called by zsh when directory changes
|
||||
function chpwd() {
|
||||
chpwd_functions+=(chpwd_dirhistory)
|
||||
function chpwd_dirhistory() {
|
||||
push_past $PWD
|
||||
# If DIRHISTORY_CD is not set...
|
||||
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
|
||||
|
@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
|
||||
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
|
||||
fi
|
||||
|
||||
chpwd() {
|
||||
chpwd_functions+=(chpwd_dirpersist)
|
||||
chpwd_dirpersist() {
|
||||
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
|
||||
local -ax my_stack
|
||||
my_stack=( ${PWD} ${dirstack} )
|
||||
|
@ -1 +1,5 @@
|
||||
# Docker-compose plugin for oh my zsh
|
||||
|
||||
A copy of the completion script from the [docker-compose](1) git repo.
|
||||
|
||||
[1]:[https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose]
|
||||
|
308
plugins/docker-compose/_docker-compose
Normal file
308
plugins/docker-compose/_docker-compose
Normal file
@ -0,0 +1,308 @@
|
||||
#compdef docker-compose
|
||||
|
||||
# Description
|
||||
# -----------
|
||||
# zsh completion for docker-compose
|
||||
# https://github.com/sdurrheimer/docker-compose-zsh-completion
|
||||
# -------------------------------------------------------------------------
|
||||
# Version
|
||||
# -------
|
||||
# 0.1.0
|
||||
# -------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
# * Steve Durrheimer <s.durrheimer@gmail.com>
|
||||
# -------------------------------------------------------------------------
|
||||
# Inspiration
|
||||
# -----------
|
||||
# * @albers docker-compose bash completion script
|
||||
# * @felixr docker zsh completion script : https://github.com/felixr/docker-zsh-completion
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# For compatibility reasons, Compose and therefore its completion supports several
|
||||
# stack compositon files as listed here, in descending priority.
|
||||
# Support for these filenames might be dropped in some future version.
|
||||
__docker-compose_compose_file() {
|
||||
local file
|
||||
for file in docker-compose.y{,a}ml fig.y{,a}ml ; do
|
||||
[ -e $file ] && {
|
||||
echo $file
|
||||
return
|
||||
}
|
||||
done
|
||||
echo docker-compose.yml
|
||||
}
|
||||
|
||||
# Extracts all service names from docker-compose.yml.
|
||||
___docker-compose_all_services_in_compose_file() {
|
||||
local already_selected
|
||||
local -a services
|
||||
already_selected=$(echo ${words[@]} | tr " " "|")
|
||||
awk -F: '/^[a-zA-Z0-9]/{print $1}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | grep -Ev "$already_selected"
|
||||
}
|
||||
|
||||
# All services, even those without an existing container
|
||||
__docker-compose_services_all() {
|
||||
services=$(___docker-compose_all_services_in_compose_file)
|
||||
_alternative "args:services:($services)"
|
||||
}
|
||||
|
||||
# All services that have an entry with the given key in their docker-compose.yml section
|
||||
___docker-compose_services_with_key() {
|
||||
local already_selected
|
||||
local -a buildable
|
||||
already_selected=$(echo ${words[@]} | tr " " "|")
|
||||
# flatten sections to one line, then filter lines containing the key and return section name.
|
||||
awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | awk -F: -v key=": +$1:" '$0 ~ key {print $1}' 2>/dev/null | grep -Ev "$already_selected"
|
||||
}
|
||||
|
||||
# All services that are defined by a Dockerfile reference
|
||||
__docker-compose_services_from_build() {
|
||||
buildable=$(___docker-compose_services_with_key build)
|
||||
_alternative "args:buildable services:($buildable)"
|
||||
}
|
||||
|
||||
# All services that are defined by an image
|
||||
__docker-compose_services_from_image() {
|
||||
pullable=$(___docker-compose_services_with_key image)
|
||||
_alternative "args:pullable services:($pullable)"
|
||||
}
|
||||
|
||||
__docker-compose_get_services() {
|
||||
local kind expl
|
||||
declare -a running stopped lines args services
|
||||
|
||||
docker_status=$(docker ps > /dev/null 2>&1)
|
||||
if [ $? -ne 0 ]; then
|
||||
_message "Error! Docker is not running."
|
||||
return 1
|
||||
fi
|
||||
|
||||
kind=$1
|
||||
shift
|
||||
[[ $kind = (stopped|all) ]] && args=($args -a)
|
||||
|
||||
lines=(${(f)"$(_call_program commands docker ps ${args})"})
|
||||
services=(${(f)"$(_call_program commands docker-compose 2>/dev/null ${compose_file:+-f $compose_file} ${compose_project:+-p $compose_project} ps -q)"})
|
||||
|
||||
# Parse header line to find columns
|
||||
local i=1 j=1 k header=${lines[1]}
|
||||
declare -A begin end
|
||||
while (( $j < ${#header} - 1 )) {
|
||||
i=$(( $j + ${${header[$j,-1]}[(i)[^ ]]} - 1))
|
||||
j=$(( $i + ${${header[$i,-1]}[(i) ]} - 1))
|
||||
k=$(( $j + ${${header[$j,-1]}[(i)[^ ]]} - 2))
|
||||
begin[${header[$i,$(($j-1))]}]=$i
|
||||
end[${header[$i,$(($j-1))]}]=$k
|
||||
}
|
||||
lines=(${lines[2,-1]})
|
||||
|
||||
# Container ID
|
||||
local line s name
|
||||
local -a names
|
||||
for line in $lines; do
|
||||
if [[ $services == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then
|
||||
names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}})
|
||||
for name in $names; do
|
||||
s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}"
|
||||
s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"
|
||||
s="$s, ${${${line[$begin[IMAGE],$end[IMAGE]]}/:/\\:}%% ##}"
|
||||
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then
|
||||
stopped=($stopped $s)
|
||||
else
|
||||
running=($running $s)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
[[ $kind = (running|all) ]] && _describe -t services-running "running services" running
|
||||
[[ $kind = (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped
|
||||
}
|
||||
|
||||
__docker-compose_stoppedservices() {
|
||||
__docker-compose_get_services stopped "$@"
|
||||
}
|
||||
|
||||
__docker-compose_runningservices() {
|
||||
__docker-compose_get_services running "$@"
|
||||
}
|
||||
|
||||
__docker-compose_services () {
|
||||
__docker-compose_get_services all "$@"
|
||||
}
|
||||
|
||||
__docker-compose_caching_policy() {
|
||||
oldp=( "$1"(Nmh+1) ) # 1 hour
|
||||
(( $#oldp ))
|
||||
}
|
||||
|
||||
__docker-compose_commands () {
|
||||
local cache_policy
|
||||
|
||||
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
|
||||
if [[ -z "$cache_policy" ]]; then
|
||||
zstyle ":completion:${curcontext}:" cache-policy __docker-compose_caching_policy
|
||||
fi
|
||||
|
||||
if ( [[ ${+_docker_compose_subcommands} -eq 0 ]] || _cache_invalid docker_compose_subcommands) \
|
||||
&& ! _retrieve_cache docker_compose_subcommands;
|
||||
then
|
||||
local -a lines
|
||||
lines=(${(f)"$(_call_program commands docker-compose 2>&1)"})
|
||||
_docker_compose_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:})
|
||||
_store_cache docker_compose_subcommands _docker_compose_subcommands
|
||||
fi
|
||||
_describe -t docker-compose-commands "docker-compose command" _docker_compose_subcommands
|
||||
}
|
||||
|
||||
__docker-compose_subcommand () {
|
||||
local -a _command_args
|
||||
integer ret=1
|
||||
case "$words[1]" in
|
||||
(build)
|
||||
_arguments \
|
||||
'--no-cache[Do not use cache when building the image]' \
|
||||
'*:services:__docker-compose_services_from_build' && ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments ':subcommand:__docker-compose_commands' && ret=0
|
||||
;;
|
||||
(kill)
|
||||
_arguments \
|
||||
'-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(logs)
|
||||
_arguments \
|
||||
'--no-color[Produce monochrome output.]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(migrate-to-labels)
|
||||
_arguments \
|
||||
'(-):Recreate containers to add labels' && ret=0
|
||||
;;
|
||||
(port)
|
||||
_arguments \
|
||||
'--protocol=-[tcp or udap (defaults to tcp)]:protocol:(tcp udp)' \
|
||||
'--index=-[index of the container if there are mutiple instances of a service (defaults to 1)]:index: ' \
|
||||
'1:running services:__docker-compose_runningservices' \
|
||||
'2:port:_ports' && ret=0
|
||||
;;
|
||||
(ps)
|
||||
_arguments \
|
||||
'-q[Only display IDs]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(pull)
|
||||
_arguments \
|
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
|
||||
'*:services:__docker-compose_services_from_image' && ret=0
|
||||
;;
|
||||
(rm)
|
||||
_arguments \
|
||||
'(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \
|
||||
'-v[Remove volumes associated with containers]' \
|
||||
'*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
;;
|
||||
(run)
|
||||
_arguments \
|
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
|
||||
'-d[Detached mode: Run container in the background, print new container name.]' \
|
||||
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
|
||||
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
|
||||
'(-u --user)'{-u,--user=-}'[Run as specified username or uid]:username or uid:_users' \
|
||||
"--no-deps[Don't start linked services.]" \
|
||||
'--rm[Remove container after run. Ignored in detached mode.]' \
|
||||
"--service-ports[Run command with the service's ports enabled and mapped to the host.]" \
|
||||
'-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \
|
||||
'(-):services:__docker-compose_services' \
|
||||
'(-):command: _command_names -e' \
|
||||
'*::arguments: _normal' && ret=0
|
||||
;;
|
||||
(scale)
|
||||
_arguments '*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(start)
|
||||
_arguments '*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
;;
|
||||
(stop|restart)
|
||||
_arguments \
|
||||
'(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(up)
|
||||
_arguments \
|
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
|
||||
'-d[Detached mode: Run containers in the background, print new container names.]' \
|
||||
'--no-color[Produce monochrome output.]' \
|
||||
"--no-deps[Don't start linked services.]" \
|
||||
"--no-recreate[If containers already exist, don't recreate them.]" \
|
||||
"--no-build[Don't build an image, even if it's missing]" \
|
||||
'(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \
|
||||
"--x-smart-recreate[Only recreate containers whose configuration or image needs to be updated. (EXPERIMENTAL)]" \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(version)
|
||||
_arguments \
|
||||
"--short[Shows only Compose's version number.]" && ret=0
|
||||
;;
|
||||
(*)
|
||||
_message 'Unknown sub command'
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_docker-compose () {
|
||||
# Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`.
|
||||
# Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`.
|
||||
if [[ $service != docker-compose ]]; then
|
||||
_call_function - _$service
|
||||
return
|
||||
fi
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
'(- :)'{-h,--help}'[Get help]' \
|
||||
'--verbose[Show more output]' \
|
||||
'(- :)'{-v,--version}'[Print version and exit]' \
|
||||
'(-f --file)'{-f,--file}'[Specify an alternate docker-compose file (default: docker-compose.yml)]:file:_files -g "*.yml"' \
|
||||
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
|
||||
'(-): :->command' \
|
||||
'(-)*:: :->option-or-argument' && ret=0
|
||||
|
||||
local counter=1
|
||||
#local compose_file compose_project
|
||||
while [ $counter -lt ${#words[@]} ]; do
|
||||
case "${words[$counter]}" in
|
||||
-f|--file)
|
||||
(( counter++ ))
|
||||
compose_file="${words[$counter]}"
|
||||
;;
|
||||
-p|--project-name)
|
||||
(( counter++ ))
|
||||
compose_project="${words[$counter]}"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
(( counter++ ))
|
||||
done
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
__docker-compose_commands && ret=0
|
||||
;;
|
||||
(option-or-argument)
|
||||
curcontext=${curcontext%:*:*}:docker-compose-$words[1]:
|
||||
__docker-compose_subcommand && ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_docker-compose "$@"
|
@ -1,14 +0,0 @@
|
||||
# Authors:
|
||||
# https://github.com/tristola
|
||||
#
|
||||
# Docker-compose related zsh aliases
|
||||
|
||||
# Aliases ###################################################################
|
||||
|
||||
alias dcup='docker-compose up'
|
||||
alias dcb='docker-compose build'
|
||||
alias dcrm='docker-compose rm'
|
||||
alias dcps='docker-compose ps'
|
||||
alias dcstop='docker-compose stop'
|
||||
alias dcrestart='docker-compose restart'
|
||||
|
@ -27,7 +27,7 @@ __docker_all_containers() {
|
||||
# output a selectable list of all docker images
|
||||
__docker_images() {
|
||||
declare -a img_cmd
|
||||
img_cmd=($(docker images | awk 'NR>1{print $1}'))
|
||||
img_cmd=($(docker images | awk 'NR>1{print $1}'| sed 's/:/\\:/g'))
|
||||
_describe 'images' img_cmd
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,19 @@
|
||||
# Ember-cli
|
||||
# Ember CLI
|
||||
|
||||
**Maintainer:** [BilalBudhani](http://www.github.com/BilalBudhani)
|
||||
**Maintainers:** [BilalBudhani](http://www.github.com/BilalBudhani), [eubenesa](http://www.github.com/eubenesa)
|
||||
|
||||
Ember-cli (http://www.ember-cli.com/)
|
||||
Ember CLI (http://www.ember-cli.com/)
|
||||
|
||||
### List of Aliases
|
||||
|
||||
alias es='ember serve'
|
||||
alias ea='ember addon'
|
||||
alias eb='ember build'
|
||||
alias ed='ember destroy'
|
||||
alias eg='ember generate'
|
||||
alias eh='ember help'
|
||||
alias ein='ember init'
|
||||
alias eia='ember install:addon'
|
||||
alias eib='ember install:bower'
|
||||
alias ein='ember install:npm'
|
||||
alias ei='ember install'
|
||||
alias et='ember test'
|
||||
alias eu='ember update'
|
||||
alias ev='ember version'
|
||||
alias es='ember serve'
|
||||
alias ea='ember addon'
|
||||
alias eb='ember build'
|
||||
alias ed='ember destroy'
|
||||
alias eg='ember generate'
|
||||
alias eh='ember help'
|
||||
alias ein='ember init'
|
||||
alias ei='ember install'
|
||||
alias et='ember test'
|
||||
alias eu='ember update'
|
||||
alias ev='ember version'
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Ember ClI
|
||||
# visit http://www.ember-cli.com/ to view user guid
|
||||
# Ember CLI
|
||||
# Visit http://www.ember-cli.com/ to view user guide
|
||||
|
||||
alias es='ember serve'
|
||||
alias ea='ember addon'
|
||||
@ -8,9 +8,6 @@ alias ed='ember destroy'
|
||||
alias eg='ember generate'
|
||||
alias eh='ember help'
|
||||
alias ein='ember init'
|
||||
alias eia='ember install:addon'
|
||||
alias eib='ember install:bower'
|
||||
alias ein='ember install:npm'
|
||||
alias ei='ember install'
|
||||
alias et='ember test'
|
||||
alias eu='ember update'
|
||||
|
135
plugins/emoji/README.md
Normal file
135
plugins/emoji/README.md
Normal file
@ -0,0 +1,135 @@
|
||||
# emoji plugin
|
||||
|
||||
Support for conveniently working with Unicode emoji in Zsh.
|
||||
|
||||
## Features
|
||||
|
||||
This plugin provides support for working with Unicode emoji characters in `zsh` using human-readable identifiers. It provides global variables which map emoji names to the actual characters, country names to their flags, and some named groupings of emoji. It also provides associated functions for displaying them.
|
||||
|
||||
#### Variables
|
||||
|
||||
Variable | Description
|
||||
----------------- | --------------------------------
|
||||
$emoji | Maps emoji names to characters
|
||||
$emoji_flags | Maps country names to flag characters (using region indicators)
|
||||
$emoji_groups | Named groups of emoji. Keys are group names; values are whitespace-separated lists of character names
|
||||
|
||||
You may define new emoji groups at run time by modifying `$emoji_groups`. The special group name `all` is reserved for use by the plugin. You should not modify `$emoji` or `$emoji_flags`.
|
||||
|
||||
#### Functions
|
||||
|
||||
Function | Description
|
||||
---------------- | -------------------------------
|
||||
random_emoji | Prints a random emoji character
|
||||
display_emoji | Displays emoji, along with their names
|
||||
|
||||
## Usage and Examples
|
||||
|
||||
To output a specific emoji, use:
|
||||
```
|
||||
$> echo $emoji[<name>]
|
||||
```
|
||||
E.g.:
|
||||
```
|
||||
$> echo $emoji[mouse_face]
|
||||
```
|
||||
|
||||
To output a random emoji, use:
|
||||
```
|
||||
$> random_emoji
|
||||
```
|
||||
To output a random emoji from a particular group, use:
|
||||
```
|
||||
$> random_emoji <group>
|
||||
```
|
||||
E.g.:
|
||||
```
|
||||
$> random_emoji fruits
|
||||
$> random_emoji animals
|
||||
$> random_emoji vehicles
|
||||
$> random_emoji faces
|
||||
```
|
||||
|
||||
The defined group names can be found with `echo ${(k)emoji_groups}`.
|
||||
|
||||
To list all available emoji with their names, use:
|
||||
```
|
||||
$> display_emoji
|
||||
$> display_emoji fruits
|
||||
$> display_emoji animals
|
||||
$> display_emoji vehicles
|
||||
$> display_emoji faces
|
||||
```
|
||||
|
||||
To use emoji in a prompt:
|
||||
```
|
||||
PROMPT="$emoji[penguin] > ""
|
||||
PROMPT='$(random_emoji fruits) > '
|
||||
surfer=$emoji[surfer]
|
||||
PROMPT="$surfer > "
|
||||
```
|
||||
|
||||
## Technical Details
|
||||
|
||||
The emoji names and codes are sourced from Unicode Technical Report \#51, which provides information on emoji support in Unicode. It can be found at http://www.unicode.org/reports/tr51/index.html.
|
||||
|
||||
The group definitions are added by this OMZ plugin. They are not based on external definitions. (As far as I can tell. -apjanke)
|
||||
|
||||
The values in the `$emoji*` maps are the emoji characters themselves, not escape sequences or other forms that require interpretation. They can be used in any context and do not require escape sequence support from commands like `echo` or `print`.
|
||||
|
||||
The emoji in the main `$emoji` map are standalone character sequences which can all be output on their own, without worrying about combining characters. The values may actually be multi-code-point sequences, instead of a single code point, and may include combining characters in those sequences. But they're arranged so their effects do not extend beyond that sequence.
|
||||
|
||||
The exception to this is the skin tone variation selectors. These are included in the main `$emoji` map because they can be displayed on their own, as well as used as combining characters. (If they follow a character that is not one of the emoji characters they combine with, they are displayed as color swatches.)
|
||||
|
||||
|
||||
## Experimental Features
|
||||
|
||||
This defines some additional variables and functions, but these are experimental and subject to change at any time. You shouldn't rely on them being available. They're mostly for the use of emoji plugin developers to help decide what to include in future revisions.
|
||||
|
||||
Variables:
|
||||
|
||||
Variable | Description
|
||||
----------------- | --------------------------------
|
||||
$emoji2 | Auxiliary and combining characters
|
||||
$emoji_skintone | Skin tone modifiers (from Unicode 8.0)
|
||||
|
||||
|
||||
#### Skin Tone Variation Selection
|
||||
|
||||
This includes experimental support for the skin tone Variation Selectors introduced with Unicode 8.0, which let you select different skin tones for emoji involving humans.
|
||||
|
||||
NOTE: This really is experimental. The skin tone selectors are a relatively new feature and may not be supported by all systems. And the support in this plugin is a work in progress. It may not work in all places. In fact, I haven't gotten it to work anywhere yet. -apjanke
|
||||
|
||||
The "variation selectors" are combining characters which change the appearance of the preceding character. A variation selector character can be output immediately following a human emoji to change its skin tone color. You can also output a variation selector on its own to display a color swatch of that skin tone.
|
||||
|
||||
The `$emoji_skintone` associative array maps skin tone IDs to the variation selector characters. To use one, output it immediately following a smiley or other human emoji.
|
||||
|
||||
```
|
||||
echo "$emoji[smiling_face_with_open_mouth]$emoji_skintone[4]"
|
||||
```
|
||||
|
||||
Note that `$emoji_skintone` is an associative array, and its keys are the *names* of "Fitzpatrick Skin Type" groups, not linear indexes into a normal array. The names are `1_2`, `3`, `4`, `5`, and `6`. (Types 1 and 2 are combined into a single color.) See the [Diversity section in Unicode TR 51](http://www.unicode.org/reports/tr51/index.html#Diversity) for details.
|
||||
|
||||
## TODO
|
||||
|
||||
These are things that could be enhanced in future revisions of the plugin.
|
||||
|
||||
* Incorporate CLDR data for ordering and groupings
|
||||
* Short :bracket: style names (from gemoji)
|
||||
* Incorporate `gemoji` data
|
||||
* Country codes for flags
|
||||
* ZWJ combining function?
|
||||
|
||||
#### Gemoji support
|
||||
|
||||
The [gemoji project](https://github.com/github/gemoji) seems to be the de facto main source for short names and other emoji-related metadata that isn't included in the official Unicode reports. (I'm saying this just from looking at the google results for "emoji short names" and related searches. -apjanke)
|
||||
|
||||
If this plugin is updated to provide short names, CLDR sorting data, and similar stuff, it should probably be changed to use the Gemoji project, and the `update_emoji.pl` script be rewritten in Ruby so it can use the Gemoji library directly instead of parsing its data files.
|
||||
|
||||
This does *not* mean that it should use Gemoji at run time. None of the `zsh` plugin stuff should call Gemoji or Ruby code. Rather, the "build time" `update_emoji.pl` script should be rewritten to use Gemoji to generate a pure-native-`zsh` character definition file which would be checked in to the repo and can be called by OMZ users without having Gemoji installed.
|
||||
|
||||
#### ZWJ combining function
|
||||
|
||||
One of the newer features of Unicode emoji is the ability to use the "Zero-Width Joiner" character to compose multiple emoji characters in to a single "emoji ligature" glyph. For example, this is [how Apple supports "family" emoji with various genders and skin tones](http://www.unicode.org/reports/tr51/index.html#ZWJ_Sequences).
|
||||
|
||||
These are a pain to write out (and probably worse to read), and it might be convenient to have a couple functions for concisely composing them, if wider support for them appears.
|
1303
plugins/emoji/emoji-char-definitions.zsh
Normal file
1303
plugins/emoji/emoji-char-definitions.zsh
Normal file
File diff suppressed because it is too large
Load Diff
1308
plugins/emoji/emoji-data.txt
Normal file
1308
plugins/emoji/emoji-data.txt
Normal file
File diff suppressed because it is too large
Load Diff
288
plugins/emoji/emoji.plugin.zsh
Normal file
288
plugins/emoji/emoji.plugin.zsh
Normal file
@ -0,0 +1,288 @@
|
||||
# emoji plugin
|
||||
#
|
||||
# Makes emoji support available within ZSH
|
||||
#
|
||||
# See the README for documentation.
|
||||
|
||||
_omz_emoji_plugin_dir="${0:h}"
|
||||
|
||||
() {
|
||||
|
||||
local LC_ALL=en_US.UTF-8
|
||||
|
||||
typeset -gAH emoji_groups
|
||||
typeset -gAH emoji_con
|
||||
typeset -gAH emoji2
|
||||
typeset -gAH emoji_skintone
|
||||
|
||||
source "$_omz_emoji_plugin_dir/emoji-char-definitions.zsh"
|
||||
unset _omz_emoji_plugin_dir
|
||||
|
||||
# These additional emoji are not in the definition file, but are useful in conjunction with it
|
||||
|
||||
# This is a combinin character that can be placed after any other character to surround
|
||||
# it in a "keycap" symbol.
|
||||
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
|
||||
# It's unclear whether this should be in the $emoji array, because those characters are all ones
|
||||
# which can be displayed on their own.
|
||||
#emoji[combining_enclosing_keycap]="\U20E3"
|
||||
|
||||
emoji[regional_indicator_symbol_letter_d_regional_indicator_symbol_letter_e]=$'\xF0\x9F\x87\xA9\xF0\x9F\x87\xAA'
|
||||
emoji[regional_indicator_symbol_letter_g_regional_indicator_symbol_letter_b]=$'\xF0\x9F\x87\xAC\xF0\x9F\x87\xA7'
|
||||
emoji[regional_indicator_symbol_letter_c_regional_indicator_symbol_letter_n]=$'\xF0\x9F\x87\xA8\xF0\x9F\x87\xB3'
|
||||
emoji[regional_indicator_symbol_letter_j_regional_indicator_symbol_letter_p]=$'\xF0\x9F\x87\xAF\xF0\x9F\x87\xB5'
|
||||
emoji[regional_indicator_symbol_letter_k_regional_indicator_symbol_letter_r]=$'\xF0\x9F\x87\xB0\xF0\x9F\x87\xB7'
|
||||
emoji[regional_indicator_symbol_letter_f_regional_indicator_symbol_letter_r]=$'\xF0\x9F\x87\xAB\xF0\x9F\x87\xB7'
|
||||
emoji[regional_indicator_symbol_letter_e_regional_indicator_symbol_letter_s]=$'\xF0\x9F\x87\xAA\xF0\x9F\x87\xB8'
|
||||
emoji[regional_indicator_symbol_letter_i_regional_indicator_symbol_letter_t]=$'\xF0\x9F\x87\xAE\xF0\x9F\x87\xB9'
|
||||
emoji[regional_indicator_symbol_letter_u_regional_indicator_symbol_letter_s]=$'\xF0\x9F\x87\xBA\xF0\x9F\x87\xB8'
|
||||
emoji[regional_indicator_symbol_letter_r_regional_indicator_symbol_letter_u]=$'\xF0\x9F\x87\xB7\xF0\x9F\x87\xBA'
|
||||
|
||||
# Nonstandard alias names
|
||||
emoji[vulcan_salute]=$'\U1F596'
|
||||
|
||||
|
||||
# Emoji combining and auxiliary characters
|
||||
|
||||
# "Variation Selectors" for controlling text vs emoji style presentation
|
||||
# These apply to the immediately preceding character
|
||||
emoji2[text_style]=$'\UFE0E'
|
||||
emoji2[emoji_style]=$'\UFE0F'
|
||||
# Joiner that indicates a single combined-form glyph (ligature) should be used
|
||||
emoji2[zero_width_joiner]=$'\U200D'
|
||||
# Skin tone modifiers
|
||||
emoji2[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB'
|
||||
emoji2[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC'
|
||||
emoji2[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD'
|
||||
emoji2[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE'
|
||||
emoji2[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF'
|
||||
# Various other combining characters. (Incomplete list; I selected ones that sound useful)
|
||||
emoji2[combining_enclosing_circle]=$'\U20DD'
|
||||
emoji2[combining_enclosing_square]=$'\U20DE'
|
||||
emoji2[combining_enclosing_diamond]=$'\U20DF'
|
||||
emoji2[combining_enclosing_circle_backslash]=$'\U20E0'
|
||||
emoji2[combining_enclosing_screen]=$'\U20E2'
|
||||
emoji2[combining_enclosing_keycap]=$'\U20E3'
|
||||
emoji2[combining_enclosing_upward_pointing_triangle]=$'\U20E4'
|
||||
|
||||
# Easier access to skin tone modifiers
|
||||
emoji_skintone[1_2]=$'\U1F3FB'
|
||||
emoji_skintone[3]=$'\U1F3FC'
|
||||
emoji_skintone[4]=$'\U1F3FD'
|
||||
emoji_skintone[5]=$'\U1F3FE'
|
||||
emoji_skintone[6]=$'\U1F3FF'
|
||||
|
||||
# Emoji groups
|
||||
# These are stored in a single associative array, $emoji_groups, to avoid cluttering up the global
|
||||
# namespace, and to allow adding additional group definitions at run time.
|
||||
# The keys are the group names, and the values are whitespace-separated lists of emoji character names.
|
||||
|
||||
emoji_groups[fruits]="
|
||||
tomato
|
||||
aubergine
|
||||
grapes
|
||||
melon
|
||||
watermelon
|
||||
tangerine
|
||||
banana
|
||||
pineapple
|
||||
red_apple
|
||||
green_apple
|
||||
peach
|
||||
cherries
|
||||
strawberry
|
||||
lemon
|
||||
pear
|
||||
"
|
||||
|
||||
emoji_groups[vehicles]="
|
||||
airplane
|
||||
rocket
|
||||
railway_car
|
||||
high_speed_train
|
||||
high_speed_train_with_bullet_nose
|
||||
bus
|
||||
ambulance
|
||||
fire_engine
|
||||
police_car
|
||||
taxi
|
||||
automobile
|
||||
recreational_vehicle
|
||||
delivery_truck
|
||||
ship
|
||||
speedboat
|
||||
bicycle
|
||||
helicopter
|
||||
steam_locomotive
|
||||
train
|
||||
light_rail
|
||||
tram
|
||||
oncoming_bus
|
||||
trolleybus
|
||||
minibus
|
||||
oncoming_police_car
|
||||
oncoming_taxi
|
||||
oncoming_automobile
|
||||
articulated_lorry
|
||||
tractor
|
||||
monorail
|
||||
mountain_railway
|
||||
suspension_railway
|
||||
mountain_cableway
|
||||
aerial_tramway
|
||||
rowboat
|
||||
bicyclist
|
||||
mountain_bicyclist
|
||||
sailboat
|
||||
"
|
||||
|
||||
emoji_groups[animals]="
|
||||
snail
|
||||
snake
|
||||
horse
|
||||
sheep
|
||||
monkey
|
||||
chicken
|
||||
boar
|
||||
elephant
|
||||
octopus
|
||||
spiral_shell
|
||||
bug
|
||||
ant
|
||||
honeybee
|
||||
lady_beetle
|
||||
fish
|
||||
tropical_fish
|
||||
blowfish
|
||||
turtle
|
||||
hatching_chick
|
||||
baby_chick
|
||||
front_facing_baby_chick
|
||||
bird
|
||||
penguin
|
||||
koala
|
||||
poodle
|
||||
bactrian_camel
|
||||
dolphin
|
||||
mouse_face
|
||||
cow_face
|
||||
tiger_face
|
||||
rabbit_face
|
||||
cat_face
|
||||
dragon_face
|
||||
spouting_whale
|
||||
horse_face
|
||||
monkey_face
|
||||
dog_face
|
||||
pig_face
|
||||
frog_face
|
||||
hamster_face
|
||||
wolf_face
|
||||
bear_face
|
||||
panda_face
|
||||
rat
|
||||
mouse
|
||||
ox
|
||||
water_buffalo
|
||||
cow
|
||||
tiger
|
||||
leopard
|
||||
rabbit
|
||||
cat
|
||||
dragon
|
||||
crocodile
|
||||
whale
|
||||
ram
|
||||
goat
|
||||
rooster
|
||||
dog
|
||||
pig
|
||||
dromedary_camel
|
||||
"
|
||||
|
||||
emoji_groups[faces]="
|
||||
grinning_face_with_smiling_eyes
|
||||
face_with_tears_of_joy
|
||||
smiling_face_with_open_mouth
|
||||
smiling_face_with_open_mouth_and_smiling_eyes
|
||||
smiling_face_with_open_mouth_and_cold_sweat
|
||||
smiling_face_with_open_mouth_and_tightly_closed_eyes
|
||||
winking_face
|
||||
smiling_face_with_smiling_eyes
|
||||
face_savouring_delicious_food
|
||||
relieved_face
|
||||
smiling_face_with_heart_shaped_eyes
|
||||
smirking_face
|
||||
unamused_face
|
||||
face_with_cold_sweat
|
||||
pensive_face
|
||||
confounded_face
|
||||
face_throwing_a_kiss
|
||||
kissing_face_with_closed_eyes
|
||||
face_with_stuck_out_tongue_and_winking_eye
|
||||
face_with_stuck_out_tongue_and_tightly_closed_eyes
|
||||
disappointed_face
|
||||
angry_face
|
||||
pouting_face
|
||||
crying_face
|
||||
persevering_face
|
||||
face_with_look_of_triumph
|
||||
disappointed_but_relieved_face
|
||||
fearful_face
|
||||
weary_face
|
||||
sleepy_face
|
||||
tired_face
|
||||
loudly_crying_face
|
||||
face_with_open_mouth_and_cold_sweat
|
||||
face_screaming_in_fear
|
||||
astonished_face
|
||||
flushed_face
|
||||
dizzy_face
|
||||
face_with_medical_mask
|
||||
"
|
||||
|
||||
}
|
||||
|
||||
# Prints a random emoji character
|
||||
#
|
||||
# random_emoji [group]
|
||||
#
|
||||
function random_emoji() {
|
||||
local group=$1
|
||||
local names
|
||||
if [[ -z "$group" || "$group" == "all" ]]; then
|
||||
names=(${(k)emoji})
|
||||
else
|
||||
names=(${=emoji_groups[$group]})
|
||||
fi
|
||||
local list_size=${#names}
|
||||
[[ $list_size -eq 0 ]] && return 1
|
||||
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
||||
local name=${names[$random_index]}
|
||||
echo ${emoji[$name]}
|
||||
}
|
||||
|
||||
# Displays a listing of emoji with their names
|
||||
#
|
||||
# display_emoji [group]
|
||||
#
|
||||
function display_emoji() {
|
||||
local group=$1
|
||||
local names
|
||||
if [[ -z "$group" || "$group" == "all" ]]; then
|
||||
names=(${(k)emoji})
|
||||
else
|
||||
names=(${=emoji_groups[$group]})
|
||||
fi
|
||||
# The extra spaces in output here are a hack for readability, since some
|
||||
# terminals treat these emoji chars as single-width.
|
||||
for i in $names; do
|
||||
printf '%s ' "$emoji[$i]"
|
||||
done
|
||||
print
|
||||
for i in $names; do
|
||||
echo "${emoji[$i]} = $i"
|
||||
done
|
||||
}
|
||||
|
||||
|
113
plugins/emoji/update_emoji.pl
Normal file
113
plugins/emoji/update_emoji.pl
Normal file
@ -0,0 +1,113 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# update_emoji.pl
|
||||
#
|
||||
# This script generates the emoji.plugin.zsh emoji definitions from the Unicode
|
||||
# character data for the emoji characters.
|
||||
#
|
||||
# The data file can be found at http://unicode.org/Public/emoji/latest/emoji-data.txt
|
||||
# as referenced in Unicode TR51 (http://www.unicode.org/reports/tr51/index.html).
|
||||
#
|
||||
# This is known to work with the data file from version 1.0. It may not work with later
|
||||
# versions if the format changes. In particular, this reads line comments to get the
|
||||
# emoji character name and unicode version.
|
||||
#
|
||||
# Country names have punctuation and other non-letter characters removed from their name,
|
||||
# to avoid possible complications with having to escape the strings when using them as
|
||||
# array subscripts. The definition file seems to use some combining characters like accents
|
||||
# that get stripped during this process.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use 5.010;
|
||||
use autodie;
|
||||
|
||||
use Path::Class;
|
||||
use File::Copy;
|
||||
|
||||
# Parse definitions out of the data file and convert
|
||||
sub process_emoji_data_file {
|
||||
my ( $infile, $outfilename ) = @_;
|
||||
my $file = file($infile);
|
||||
my $outfile = file($outfilename);
|
||||
my $outfilebase = $outfile->basename();
|
||||
my $tempfilename = "$outfilename.tmp";
|
||||
my $tempfile = file($tempfilename);
|
||||
my $outfh = $tempfile->openw();
|
||||
$outfh->print("
|
||||
# $outfilebase - Emoji character definitions for oh-my-zsh emoji plugin
|
||||
#
|
||||
# This file is auto-generated by update_emoji.pl. Do not edit it manually.
|
||||
#
|
||||
# This contains the definition for:
|
||||
# \$emoji - which maps character names to Unicode characters
|
||||
# \$emoji_flags - maps country names to Unicode flag characters using region indicators
|
||||
|
||||
# Main emoji
|
||||
typeset -gAH emoji
|
||||
# National flags
|
||||
typeset -gAH emoji_flags
|
||||
# Combining modifiers
|
||||
typeset -gAH emoji_mod
|
||||
|
||||
");
|
||||
|
||||
my $fh = $file->openr();
|
||||
my $line_num = 0;
|
||||
while ( my $line = $fh->getline() ) {
|
||||
$line_num++;
|
||||
$_ = $line;
|
||||
# Skip all-comment lines (from the header) and blank lines
|
||||
# (But don't strip comments on normal lines; we need to parse those for
|
||||
# the emoji names.)
|
||||
next if /^\s*#/ or /^\s*$/;
|
||||
|
||||
if (/^(\S.*?\S)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w.*?)\s*#\s*V(\S+)\s\(.*?\)\s*(\w.*\S)\s*$/) {
|
||||
my ($code, $style, $level, $modifier_status, $sources, $version, $keycap_name)
|
||||
= ($1, $2, $3, $4, $5, $6, $7);
|
||||
#print "code=$code style=$style level=$level modifier_status=$modifier_status sources=$sources version=$version name=$keycap_name\n";
|
||||
my @code_points = split /\s+/, $code;
|
||||
my @sources = split /\s+/, $sources;
|
||||
|
||||
my $flag_country = "";
|
||||
if ( $keycap_name =~ /^flag for (\S.*?)\s*$/) {
|
||||
$flag_country = $1;
|
||||
}
|
||||
|
||||
my $zsh_code = join '', map { "\\U$_" } @code_points;
|
||||
# Convert keycap names to valid associative array names that do not require any
|
||||
# quoting. Works fine for most stuff, but is clumsy for flags.
|
||||
my $omz_name = lc($keycap_name);
|
||||
$omz_name =~ s/[^A-Za-z0-9]/_/g;
|
||||
my $zsh_flag_country = $flag_country;
|
||||
$zsh_flag_country =~ s/[^\p{Letter}]/_/g;
|
||||
if ($flag_country) {
|
||||
$outfh->print("emoji_flags[$zsh_flag_country]=\$'$zsh_code'\n");
|
||||
} else {
|
||||
$outfh->print("emoji[$omz_name]=\$'$zsh_code'\n");
|
||||
}
|
||||
# Modifiers are included in both the main set and their separate map,
|
||||
# because they have a standalone representation as a color swatch.
|
||||
if ( $modifier_status eq "modifier" ) {
|
||||
$outfh->print("emoji_mod[$omz_name]=\$'$zsh_code'\n");
|
||||
}
|
||||
} else {
|
||||
die "Failed parsing line $line_num: '$_'";
|
||||
}
|
||||
}
|
||||
$fh->close();
|
||||
$outfh->print("\n");
|
||||
$outfh->close();
|
||||
|
||||
move($tempfilename, $outfilename)
|
||||
or die "Failed moving temp file to $outfilename: $!";
|
||||
}
|
||||
|
||||
my $datafile = "emoji-data.txt";
|
||||
my $zsh_def_file = "emoji-char-definitions.zsh";
|
||||
process_emoji_data_file($datafile, $zsh_def_file);
|
||||
|
||||
print "Updated definition file $zsh_def_file\n";
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ if [ $commands[fasd] ]; then # check if fasd is installed
|
||||
fi
|
||||
source "$fasd_cache"
|
||||
unset fasd_cache
|
||||
alias v='f -e vim'
|
||||
alias o='a -e open'
|
||||
fi
|
||||
|
||||
alias v='f -e vim'
|
||||
alias o='a -e open_command'
|
||||
fi
|
||||
|
@ -1,6 +1,7 @@
|
||||
# start fbterm automatically in /dev/tty*
|
||||
|
||||
if [[ $(tty|grep -o '/dev/tty') = /dev/tty ]] ; then
|
||||
fbterm
|
||||
exit
|
||||
if (( ${+commands[fbterm]} )); then
|
||||
if [[ "$TTY" = /dev/tty* ]] ; then
|
||||
fbterm && exit
|
||||
fi
|
||||
fi
|
||||
|
@ -43,6 +43,7 @@ The search content are
|
||||
* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
|
||||
* `emberjs <emberjs.com>`
|
||||
* `stackoverflow <stackoverflow.com>`
|
||||
* `npmjs <npmjs.com>`
|
||||
|
||||
|
||||
## Aliases ##
|
||||
@ -69,6 +70,7 @@ There are a few aliases presented as well:
|
||||
* `reactjs` A shorthand for `frontend reactjs`
|
||||
* `emberjs` A shorthand for `frontend emberjs`
|
||||
* `stackoverflow` A shorthand for `frontend stackoverflow`
|
||||
* `npmjs` A shorthand for `frontend npmjs`
|
||||
|
||||
|
||||
## Author
|
||||
|
@ -37,6 +37,7 @@ function _frontend() {
|
||||
'reactjs: Search in React website'
|
||||
'emberjs: Search in Ember website'
|
||||
'stackoverflow: Search in StackOverflow website'
|
||||
'npmjs: Search in NPMJS website'
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
@ -110,6 +111,9 @@ function _frontend() {
|
||||
stackoverflow)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
npmjs)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
@ -2,14 +2,6 @@
|
||||
|
||||
function frontend() {
|
||||
|
||||
# get the open command
|
||||
local open_cmd
|
||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
||||
open_cmd='open'
|
||||
else
|
||||
open_cmd='xdg-open'
|
||||
fi
|
||||
|
||||
# no keyword provided, simply show how call methods
|
||||
if [[ $# -le 1 ]]; then
|
||||
echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"
|
||||
@ -17,7 +9,7 @@ function frontend() {
|
||||
fi
|
||||
|
||||
# check whether the search engine is supported
|
||||
if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow)' ]];
|
||||
if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow|npmjs)' ]];
|
||||
then
|
||||
echo "Search valid search content $1 not supported."
|
||||
echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
|
||||
@ -41,6 +33,7 @@ function frontend() {
|
||||
echo "* reactjs"
|
||||
echo "* emberjs"
|
||||
echo "* stackoverflow"
|
||||
echo "* npmjs"
|
||||
echo ""
|
||||
|
||||
return 1
|
||||
@ -107,13 +100,16 @@ function frontend() {
|
||||
"stackoverflow")
|
||||
url="${url}stackoverflow.com"
|
||||
url="${url}/search?q=$2" ;;
|
||||
"npmjs")
|
||||
url="${url}www.npmjs.com"
|
||||
url="${url}/search?q=$2" ;;
|
||||
*) echo "INVALID PARAM!"
|
||||
return ;;
|
||||
esac
|
||||
|
||||
echo "$url"
|
||||
|
||||
$open_cmd "$url"
|
||||
open_command "$url"
|
||||
|
||||
}
|
||||
|
||||
@ -156,3 +152,4 @@ alias emberjs='frontend emberjs'
|
||||
|
||||
# search websites
|
||||
alias stackoverflow='frontend stackoverflow'
|
||||
alias npmjs='frontend npmjs'
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
|
||||
#Alias
|
||||
alias gf='git flow'
|
||||
alias gfl='git flow'
|
||||
alias gcd='git checkout develop'
|
||||
alias gch='git checkout hotfix'
|
||||
alias gcr='git checkout release'
|
||||
|
@ -1,57 +1,92 @@
|
||||
# ZSH Git Prompt Plugin from:
|
||||
# http://github.com/olivierverdier/zsh-git-prompt
|
||||
#
|
||||
export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt
|
||||
|
||||
# Allow for functions in the prompt.
|
||||
setopt PROMPT_SUBST
|
||||
__GIT_PROMPT_DIR="${0:A:h}"
|
||||
|
||||
## Enable auto-execution of functions.
|
||||
typeset -ga preexec_functions
|
||||
typeset -ga precmd_functions
|
||||
typeset -ga chpwd_functions
|
||||
## Hook function definitions
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
|
||||
# Append git functions needed for prompt.
|
||||
preexec_functions+='preexec_update_git_vars'
|
||||
precmd_functions+='precmd_update_git_vars'
|
||||
chpwd_functions+='chpwd_update_git_vars'
|
||||
|
||||
## Function definitions
|
||||
function preexec_update_git_vars() {
|
||||
case "$2" in
|
||||
git*)
|
||||
git*|hub*|gh*|stg*)
|
||||
__EXECUTED_GIT_COMMAND=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function precmd_update_git_vars() {
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ]; then
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ ! -n "$ZSH_THEME_GIT_PROMPT_CACHE" ]; then
|
||||
update_current_git_vars
|
||||
unset __EXECUTED_GIT_COMMAND
|
||||
fi
|
||||
}
|
||||
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
chpwd_functions+=(chpwd_update_git_vars)
|
||||
precmd_functions+=(precmd_update_git_vars)
|
||||
preexec_functions+=(preexec_update_git_vars)
|
||||
|
||||
|
||||
## Function definitions
|
||||
function update_current_git_vars() {
|
||||
unset __CURRENT_GIT_STATUS
|
||||
|
||||
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
|
||||
_GIT_STATUS=`python ${gitstatus}`
|
||||
__CURRENT_GIT_STATUS=("${(f)_GIT_STATUS}")
|
||||
_GIT_STATUS=$(python ${gitstatus} 2>/dev/null)
|
||||
__CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
|
||||
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
|
||||
GIT_AHEAD=$__CURRENT_GIT_STATUS[2]
|
||||
GIT_BEHIND=$__CURRENT_GIT_STATUS[3]
|
||||
GIT_STAGED=$__CURRENT_GIT_STATUS[4]
|
||||
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5]
|
||||
GIT_CHANGED=$__CURRENT_GIT_STATUS[6]
|
||||
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
|
||||
}
|
||||
|
||||
function prompt_git_info() {
|
||||
git_super_status() {
|
||||
precmd_update_git_vars
|
||||
if [ -n "$__CURRENT_GIT_STATUS" ]; then
|
||||
echo "(%{${fg[red]}%}$__CURRENT_GIT_STATUS[1]%{${fg[default]}%}$__CURRENT_GIT_STATUS[2]%{${fg[magenta]}%}$__CURRENT_GIT_STATUS[3]%{${fg[default]}%})"
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
|
||||
if [ "$GIT_BEHIND" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_AHEAD" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD$GIT_AHEAD%{${reset_color}%}"
|
||||
fi
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
|
||||
if [ "$GIT_STAGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CONFLICTS" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CHANGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_UNTRACKED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
echo "$STATUS"
|
||||
fi
|
||||
}
|
||||
|
||||
# Default values for the appearance of the prompt.
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
|
||||
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
|
||||
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{…%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}"
|
||||
|
||||
# Set the prompt.
|
||||
#PROMPT='%B%m%~%b$(prompt_git_info) %# '
|
||||
# for a right prompt:
|
||||
#RPROMPT='%b$(prompt_git_info)'
|
||||
RPROMPT='$(prompt_git_info)'
|
||||
RPROMPT='$(git_super_status)'
|
||||
|
@ -1,82 +1,84 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
from subprocess import Popen, PIPE
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import re
|
||||
|
||||
# change those symbols to whatever you prefer
|
||||
symbols = {
|
||||
'ahead of': '↑',
|
||||
'behind': '↓',
|
||||
'staged': '♦',
|
||||
'changed': '‣',
|
||||
'untracked': '…',
|
||||
'clean': '⚡',
|
||||
'unmerged': '≠',
|
||||
'sha1': ':'
|
||||
}
|
||||
|
||||
output, error = Popen(
|
||||
['git', 'status'], stdout=PIPE, stderr=PIPE, universal_newlines=True).communicate()
|
||||
|
||||
if error:
|
||||
import sys
|
||||
sys.exit(0)
|
||||
lines = output.splitlines()
|
||||
|
||||
behead_re = re.compile(
|
||||
r"^# Your branch is (ahead of|behind) '(.*)' by (\d+) commit")
|
||||
diverge_re = re.compile(r"^# and have (\d+) and (\d+) different")
|
||||
|
||||
status = ''
|
||||
staged = re.compile(r'^# Changes to be committed:$', re.MULTILINE)
|
||||
changed = re.compile(r'^# Changed but not updated:$', re.MULTILINE)
|
||||
untracked = re.compile(r'^# Untracked files:$', re.MULTILINE)
|
||||
unmerged = re.compile(r'^# Unmerged paths:$', re.MULTILINE)
|
||||
import shlex
|
||||
from subprocess import Popen, PIPE, check_output
|
||||
|
||||
|
||||
def execute(*command):
|
||||
out, err = Popen(stdout=PIPE, stderr=PIPE, *command).communicate()
|
||||
if not err:
|
||||
nb = len(out.splitlines())
|
||||
def get_tagname_or_hash():
|
||||
"""return tagname if exists else hash"""
|
||||
cmd = 'git log -1 --format="%h%d"'
|
||||
output = check_output(shlex.split(cmd)).decode('utf-8').strip()
|
||||
hash_, tagname = None, None
|
||||
# get hash
|
||||
m = re.search('\(.*\)$', output)
|
||||
if m:
|
||||
hash_ = output[:m.start()-1]
|
||||
# get tagname
|
||||
m = re.search('tag: .*[,\)]', output)
|
||||
if m:
|
||||
tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
|
||||
|
||||
if tagname:
|
||||
return tagname
|
||||
elif hash_:
|
||||
return hash_
|
||||
return None
|
||||
|
||||
|
||||
# `git status --porcelain --branch` can collect all information
|
||||
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
|
||||
po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE)
|
||||
stdout, sterr = po.communicate()
|
||||
if po.returncode != 0:
|
||||
sys.exit(0) # Not a git repository
|
||||
|
||||
# collect git status information
|
||||
untracked, staged, changed, conflicts = [], [], [], []
|
||||
ahead, behind = 0, 0
|
||||
status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
|
||||
for st in status:
|
||||
if st[0] == '#' and st[1] == '#':
|
||||
if re.search('Initial commit on', st[2]):
|
||||
branch = st[2].split(' ')[-1]
|
||||
elif re.search('no branch', st[2]): # detached status
|
||||
branch = get_tagname_or_hash()
|
||||
elif len(st[2].strip().split('...')) == 1:
|
||||
branch = st[2].strip()
|
||||
else:
|
||||
nb = '?'
|
||||
return nb
|
||||
# current and remote branch info
|
||||
branch, rest = st[2].strip().split('...')
|
||||
if len(rest.split(' ')) == 1:
|
||||
# remote_branch = rest.split(' ')[0]
|
||||
pass
|
||||
else:
|
||||
# ahead or behind
|
||||
divergence = ' '.join(rest.split(' ')[1:])
|
||||
divergence = divergence.lstrip('[').rstrip(']')
|
||||
for div in divergence.split(', '):
|
||||
if 'ahead' in div:
|
||||
ahead = int(div[len('ahead '):].strip())
|
||||
elif 'behind' in div:
|
||||
behind = int(div[len('behind '):].strip())
|
||||
elif st[0] == '?' and st[1] == '?':
|
||||
untracked.append(st)
|
||||
else:
|
||||
if st[1] == 'M':
|
||||
changed.append(st)
|
||||
if st[0] == 'U':
|
||||
conflicts.append(st)
|
||||
elif st[0] != ' ':
|
||||
staged.append(st)
|
||||
|
||||
if staged.search(output):
|
||||
nb = execute(
|
||||
['git', 'diff', '--staged', '--name-only', '--diff-filter=ACDMRT'])
|
||||
status += '%s%s' % (symbols['staged'], nb)
|
||||
if unmerged.search(output):
|
||||
nb = execute(['git', 'diff', '--staged', '--name-only', '--diff-filter=U'])
|
||||
status += '%s%s' % (symbols['unmerged'], nb)
|
||||
if changed.search(output):
|
||||
nb = execute(['git', 'diff', '--name-only', '--diff-filter=ACDMRT'])
|
||||
status += '%s%s' % (symbols['changed'], nb)
|
||||
if untracked.search(output):
|
||||
status += symbols['untracked']
|
||||
if status == '':
|
||||
status = symbols['clean']
|
||||
|
||||
remote = ''
|
||||
|
||||
bline = lines[0]
|
||||
if bline.find('Not currently on any branch') != -1:
|
||||
branch = symbols['sha1'] + Popen([
|
||||
'git',
|
||||
'rev-parse',
|
||||
'--short',
|
||||
'HEAD'], stdout=PIPE).communicate()[0][:-1]
|
||||
else:
|
||||
branch = bline.split(' ')[-1]
|
||||
bstatusline = lines[1]
|
||||
match = behead_re.match(bstatusline)
|
||||
if match:
|
||||
remote = symbols[match.groups()[0]]
|
||||
remote += match.groups()[2]
|
||||
elif lines[2:]:
|
||||
div_match = diverge_re.match(lines[2])
|
||||
if div_match:
|
||||
remote = "{behind}{1}{ahead of}{0}".format(
|
||||
*div_match.groups(), **symbols)
|
||||
|
||||
print('\n'.join([branch, remote, status]))
|
||||
out = ' '.join([
|
||||
branch,
|
||||
str(ahead),
|
||||
str(behind),
|
||||
str(len(staged)),
|
||||
str(len(conflicts)),
|
||||
str(len(changed)),
|
||||
str(len(untracked)),
|
||||
])
|
||||
print(out, end='')
|
||||
|
@ -68,10 +68,12 @@ alias gc!='git commit -v --amend'
|
||||
alias gca='git commit -v -a'
|
||||
alias gca!='git commit -v -a --amend'
|
||||
alias gcan!='git commit -v -a -s --no-edit --amend'
|
||||
alias gcam='git commit -a -m'
|
||||
alias gcb='git checkout -b'
|
||||
alias gcf='git config --list'
|
||||
alias gcl='git clone --recursive'
|
||||
alias gclean='git reset --hard && git clean -dfx'
|
||||
alias gclean='git clean -fd'
|
||||
alias gpristine='git reset --hard && git clean -dfx'
|
||||
alias gcm='git checkout master'
|
||||
alias gcmsg='git commit -m'
|
||||
alias gco='git checkout'
|
||||
|
@ -143,5 +143,6 @@ _arguments \
|
||||
$_command_args \
|
||||
'(--app)--app[the app name]' \
|
||||
'(--remote)--remote[the remote name]' \
|
||||
'(--help)--help[help about the current command]' \
|
||||
&& return 0
|
||||
|
||||
|
21
plugins/jira/_jira
Normal file
21
plugins/jira/_jira
Normal file
@ -0,0 +1,21 @@
|
||||
#compdef jira
|
||||
#autoload
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'new:create a new issue'
|
||||
'dashboard:open the dashboard'
|
||||
'reported:search for issues reported by a user'
|
||||
'assigned:search for issues assigned to a user'
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
_describe -t commands "jira subcommand" _1st_arguments
|
||||
return
|
||||
;;
|
||||
esac
|
@ -1,97 +1,118 @@
|
||||
# To use: add a .jira-url file in the base of your project
|
||||
# You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
|
||||
# .jira-url in the current directory takes precedence
|
||||
# CLI support for JIRA interaction
|
||||
#
|
||||
# If you use Rapid Board, set:
|
||||
#JIRA_RAPID_BOARD="true"
|
||||
# in you .zshrc
|
||||
# Setup:
|
||||
# Add a .jira-url file in the base of your project
|
||||
# You can also set $JIRA_URL in your .zshrc or put .jira-url in your home directory
|
||||
# A .jira-url in the current directory takes precedence.
|
||||
# The same goes with .jira-prefix and $JIRA_PREFIX.
|
||||
#
|
||||
# Setup: cd to/my/project
|
||||
# For example:
|
||||
# cd to/my/project
|
||||
# echo "https://name.jira.com" >> .jira-url
|
||||
# Usage: jira # opens a new issue
|
||||
#
|
||||
# Variables:
|
||||
# $JIRA_RAPID_BOARD - set to "true" if you use Rapid Board
|
||||
# $JIRA_DEFAULT_ACTION - action to do when `jira` is called witn no args
|
||||
# defaults to "new"
|
||||
# $JIRA_NAME - Your JIRA username. Used as default for assigned/reported
|
||||
# $JIRA_PREFIX - Prefix added to issue ID arguments
|
||||
#
|
||||
#
|
||||
# Usage:
|
||||
# jira # Performs the default action
|
||||
# jira new # opens a new issue
|
||||
# jira reported [username]
|
||||
# jira assigned [username]
|
||||
# jira dashboard
|
||||
# jira ABC-123 # Opens an existing issue
|
||||
open_jira_issue () {
|
||||
local open_cmd
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
open_cmd='open'
|
||||
else
|
||||
open_cmd='xdg-open'
|
||||
fi
|
||||
# jira ABC-123 m # Opens an existing issue for adding a comment
|
||||
|
||||
if [ -f .jira-url ]; then
|
||||
: ${JIRA_DEFAULT_ACTION:=new}
|
||||
|
||||
function jira() {
|
||||
local action=${1:=$JIRA_DEFAULT_ACTION}
|
||||
|
||||
local jira_url jira_prefix
|
||||
if [[ -f .jira-url ]]; then
|
||||
jira_url=$(cat .jira-url)
|
||||
elif [ -f ~/.jira-url ]; then
|
||||
elif [[ -f ~/.jira-url ]]; then
|
||||
jira_url=$(cat ~/.jira-url)
|
||||
elif [[ "x$JIRA_URL" != "x" ]]; then
|
||||
jira_url=$JIRA_URL
|
||||
elif [[ -n "${JIRA_URL}" ]]; then
|
||||
jira_url=${JIRA_URL}
|
||||
else
|
||||
echo "JIRA url is not specified anywhere."
|
||||
_jira_url_help
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -f .jira-prefix ]; then
|
||||
if [[ -f .jira-prefix ]]; then
|
||||
jira_prefix=$(cat .jira-prefix)
|
||||
elif [ -f ~/.jira-prefix ]; then
|
||||
elif [[ -f ~/.jira-prefix ]]; then
|
||||
jira_prefix=$(cat ~/.jira-prefix)
|
||||
elif [[ -n "${JIRA_PREFIX}" ]]; then
|
||||
jira_prefix=${JIRA_PREFIX}
|
||||
else
|
||||
jira_prefix=""
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
|
||||
if [[ $action == "new" ]]; then
|
||||
echo "Opening new issue"
|
||||
$open_cmd "${jira_url}/secure/CreateIssue!default.jspa"
|
||||
elif [[ "$1" = "assigned" || "$1" = "reported" ]]; then
|
||||
jira_query $@
|
||||
open_command "${jira_url}/secure/CreateIssue!default.jspa"
|
||||
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
|
||||
_jira_query $@
|
||||
elif [[ "$action" == "dashboard" ]]; then
|
||||
echo "Opening dashboard"
|
||||
open_command "${jira_url}/secure/Dashboard.jspa"
|
||||
else
|
||||
local addcomment=''
|
||||
# Anything that doesn't match a special action is considered an issue name
|
||||
local issue_arg=$action
|
||||
local issue="${jira_prefix}${issue_arg}"
|
||||
local url_fragment=''
|
||||
if [[ "$2" == "m" ]]; then
|
||||
addcomment="#add-comment"
|
||||
echo "Add comment to issue #$1"
|
||||
url_fragment="#add-comment"
|
||||
echo "Add comment to issue #$issue"
|
||||
else
|
||||
echo "Opening issue #$1"
|
||||
echo "Opening issue #$issue"
|
||||
fi
|
||||
|
||||
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
|
||||
$open_cmd "$jira_url/issues/$jira_prefix$1$addcomment"
|
||||
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
|
||||
open_command "${jira_url}/issues/${issue}${url_fragment}"
|
||||
else
|
||||
$open_cmd "$jira_url/browse/$jira_prefix$1$addcomment"
|
||||
open_command "${jira_url}/browse/${issue}${url_fragment}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
jira_name () {
|
||||
if [[ -z "$1" ]]; then
|
||||
if [[ "x${JIRA_NAME}" != "x" ]]; then
|
||||
jira_name=${JIRA_NAME}
|
||||
else
|
||||
echo "JIRA_NAME not specified"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
jira_name=$@
|
||||
fi
|
||||
function _jira_url_help() {
|
||||
cat << EOF
|
||||
JIRA url is not specified anywhere.
|
||||
Valid options, in order of precedence:
|
||||
.jira-url file
|
||||
\$HOME/.jira-url file
|
||||
JIRA_URL environment variable
|
||||
EOF
|
||||
}
|
||||
|
||||
jira_query () {
|
||||
verb="$1"
|
||||
if [[ "${verb}" = "reported" ]]; then
|
||||
function _jira_query() {
|
||||
local verb="$1"
|
||||
local jira_name lookup preposition query
|
||||
if [[ "${verb}" == "reported" ]]; then
|
||||
lookup=reporter
|
||||
preposition=by
|
||||
elif [[ "${verb}" = "assigned" ]]; then
|
||||
elif [[ "${verb}" == "assigned" ]]; then
|
||||
lookup=assignee
|
||||
preposition=to
|
||||
else
|
||||
echo "not a valid lookup $verb"
|
||||
echo "not a valid lookup: $verb" >&2
|
||||
return 1
|
||||
fi
|
||||
shift 1
|
||||
jira_name $@
|
||||
if [[ $? = 1 ]]; then
|
||||
jira_name=${2:=$JIRA_NAME}
|
||||
if [[ -z $jira_name ]]; then
|
||||
echo "JIRA_NAME not specified" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Browsing issues ${verb} ${preposition} ${jira_name}"
|
||||
$open_cmd "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
|
||||
query="${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
|
||||
open_command "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${query}"
|
||||
}
|
||||
|
||||
alias jira='open_jira_issue'
|
||||
|
||||
|
@ -8,7 +8,8 @@ mkdir -p $ZSH_CACHE_DIR
|
||||
cache_file="$ZSH_CACHE_DIR/last-working-dir"
|
||||
|
||||
# Updates the last directory once directory is changed.
|
||||
function chpwd() {
|
||||
chpwd_functions+=(chpwd_last_working_dir)
|
||||
function chpwd_last_working_dir() {
|
||||
# Use >| in case noclobber is set to avoid "file exists" error
|
||||
pwd >| "$cache_file"
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ open_lighthouse_ticket () {
|
||||
else
|
||||
lighthouse_url=$(cat .lighthouse-url);
|
||||
echo "Opening ticket #$1";
|
||||
`open $lighthouse_url/tickets/$1`;
|
||||
open_command "$lighthouse_url/tickets/$1";
|
||||
fi
|
||||
}
|
||||
|
||||
|
27
plugins/man/man.zsh
Normal file
27
plugins/man/man.zsh
Normal file
@ -0,0 +1,27 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Author
|
||||
# ------
|
||||
#
|
||||
# * Jerry Ling<jerryling315@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Usgae
|
||||
# -----
|
||||
#
|
||||
# man will be inserted before the command
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
man-command-line() {
|
||||
[[ -z $BUFFER ]] && zle up-history
|
||||
[[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER"
|
||||
}
|
||||
zle -N man-command-line
|
||||
# Defined shortcut keys: [Esc]man
|
||||
bindkey "\e"man man-command-line
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Also, you might want to use man-preview included in 'osx' plugin
|
||||
# just substitute "man" in the function with "man-preview" after you included OS X in
|
||||
# the .zshrc
|
34
plugins/n98-magerun/n98-magerun.plugin.zsh
Executable file
34
plugins/n98-magerun/n98-magerun.plugin.zsh
Executable file
@ -0,0 +1,34 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# FILE: n98-magerun.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
|
||||
# AUTHOR: Andrew Dwyer (andrewrdwyer at gmail dot com)
|
||||
# VERSION: 1.0.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# n98-magerun basic command completion
|
||||
_n98_magerun_get_command_list () {
|
||||
$_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z\-:]+/ { print $1 }'
|
||||
}
|
||||
|
||||
|
||||
_n98_magerun () {
|
||||
_arguments '1: :->command' '*:optional arg:_files'
|
||||
|
||||
case $state in
|
||||
command)
|
||||
compadd $(_n98_magerun_get_command_list)
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
}
|
||||
|
||||
compdef _n98_magerun n98-magerun.phar
|
||||
compdef _n98_magerun n98-magerun
|
||||
|
||||
# Aliases
|
||||
alias n98='n98-magerun.phar'
|
||||
alias mage='n98-magerun.phar'
|
||||
alias magefl='n98-magerun.phar cache:flush'
|
||||
|
||||
# Install n98-magerun into the current directory
|
||||
alias mage-get='wget https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar'
|
@ -1,13 +1,5 @@
|
||||
# Open the node api for your current version to the optional section.
|
||||
# TODO: Make the section part easier to use.
|
||||
function node-docs {
|
||||
# get the open command
|
||||
local open_cmd
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
open_cmd='open'
|
||||
else
|
||||
open_cmd='xdg-open'
|
||||
fi
|
||||
|
||||
$open_cmd "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1"
|
||||
open_command "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
function tab() {
|
||||
local command="cd \\\"$PWD\\\"; clear; "
|
||||
local command="cd \\\"$PWD\\\"; clear"
|
||||
(( $# > 0 )) && command="${command}; $*"
|
||||
|
||||
the_app=$(
|
||||
|
@ -18,8 +18,6 @@ if [[ -x `which curl` ]]; then
|
||||
W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
|
||||
if [ "$W" -a "$TXT" ]; then
|
||||
echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}“${TXT}”${END_COLOR}"
|
||||
else
|
||||
quote
|
||||
fi
|
||||
}
|
||||
#quote
|
||||
|
@ -2,14 +2,11 @@ _homebrew-installed() {
|
||||
type brew &> /dev/null
|
||||
}
|
||||
|
||||
_rbenv-from-homebrew-installed() {
|
||||
brew --prefix rbenv &> /dev/null
|
||||
}
|
||||
|
||||
FOUND_RBENV=0
|
||||
rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv")
|
||||
if _homebrew-installed && _rbenv-from-homebrew-installed ; then
|
||||
rbenvdirs=($(brew --prefix rbenv) "${rbenvdirs[@]}")
|
||||
if _homebrew-installed && rbenv_homebrew_path=$(brew --prefix rbenv 2>/dev/null); then
|
||||
rbenvdirs=($rbenv_homebrew_path "${rbenvdirs[@]}")
|
||||
unset rbenv_homebrew_path
|
||||
fi
|
||||
|
||||
for rbenvdir in "${rbenvdirs[@]}" ; do
|
||||
|
@ -61,11 +61,11 @@ function gems {
|
||||
local current_ruby=`rvm-prompt i v p`
|
||||
local current_gemset=`rvm-prompt g`
|
||||
|
||||
gem list $@ | sed \
|
||||
-Ee "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
||||
-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
|
||||
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||
gem list $@ | sed -E \
|
||||
-e "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
||||
-e "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
|
||||
-e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||
-e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||
}
|
||||
|
||||
function _rvm_completion {
|
||||
|
25
plugins/spring/README.md
Normal file
25
plugins/spring/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Spring Boot oh-my-zsh plugin
|
||||
oh-my-zsh Spring Boot plugin
|
||||
|
||||
## Spring Boot autocomplete plugin
|
||||
|
||||
- Adds autocomplete options for all spring boot commands.
|
||||
|
||||
## Manual Install
|
||||
|
||||
$ cd ~/.oh-my-zsh/plugins
|
||||
$ git clone git@github.com:linux-china/oh-my-zsh-spring-boot-plugin.git spring
|
||||
|
||||
Adjust your .zshrc file and add spring to plugins=(...)
|
||||
|
||||
## Tips
|
||||
|
||||
* Install Spring Cloud plugin: spring install org.springframework.cloud:spring-cloud-cli:1.0.2.RELEASE
|
||||
|
||||
## Reference
|
||||
|
||||
* Spring Boot: http://projects.spring.io/spring-boot/
|
||||
* Spring Boot CLI: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli
|
||||
|
||||
Maintainer : linux_china ([@linux_china](https://twitter.com/linux_china))
|
||||
|
29
plugins/spring/_spring
Normal file
29
plugins/spring/_spring
Normal file
@ -0,0 +1,29 @@
|
||||
#compdef spring 'spring'
|
||||
#autoload
|
||||
|
||||
_spring() {
|
||||
|
||||
local cword
|
||||
let cword=CURRENT-1
|
||||
|
||||
local hints
|
||||
hints=()
|
||||
|
||||
local reply
|
||||
while read -r line; do
|
||||
reply=`echo "$line" | awk '{printf $1 ":"; for (i=2; i<NF; i++) printf $i " "; print $NF}'`
|
||||
hints+=("$reply")
|
||||
done < <(spring hint ${cword} ${words[*]})
|
||||
|
||||
if ((cword == 1)) {
|
||||
_describe -t commands 'commands' hints
|
||||
return 0
|
||||
}
|
||||
|
||||
_describe -t options 'options' hints
|
||||
_files
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
_spring "$@"
|
@ -5,7 +5,7 @@ _symfony_console () {
|
||||
}
|
||||
|
||||
_symfony2_get_command_list () {
|
||||
`_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[a-z]+/ { print $1 }'
|
||||
`_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[^ ]+ / { print $1 }'
|
||||
}
|
||||
|
||||
_symfony2 () {
|
||||
|
@ -1,11 +1,12 @@
|
||||
user_commands=(
|
||||
list-units is-active status show help list-unit-files
|
||||
is-enabled list-jobs show-environment)
|
||||
is-enabled list-jobs show-environment cat)
|
||||
|
||||
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)
|
||||
link load cancel set-environment unset-environment
|
||||
edit)
|
||||
|
||||
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
|
||||
|
11
plugins/terraform/README.md
Normal file
11
plugins/terraform/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
## atom
|
||||
|
||||
Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently.
|
||||
|
||||
### Requirements
|
||||
|
||||
* [Terraform](https://terraform.io/)
|
||||
|
||||
### Usage
|
||||
|
||||
* Type `terraform` into your prompt and hit `TAB` to see available completion options
|
177
plugins/terraform/_terraform
Normal file
177
plugins/terraform/_terraform
Normal file
@ -0,0 +1,177 @@
|
||||
#compdef terraform
|
||||
|
||||
local -a _terraform_cmds
|
||||
_terraform_cmds=(
|
||||
'apply:Builds or changes infrastructure'
|
||||
'destroy:Destroy Terraform-managed infrastructure'
|
||||
'get:Download and install modules for the configuration'
|
||||
'graph:Create a visual graph of Terraform resources'
|
||||
'init:Initializes Terraform configuration from a module'
|
||||
'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'
|
||||
'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'
|
||||
'version:Prints the Terraform version'
|
||||
)
|
||||
|
||||
__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.]' \
|
||||
'-input=[(true) Ask for input for variables if not directly set.]' \
|
||||
'-no-color[If specified, output will not contain any color.]' \
|
||||
'-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-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.]' \
|
||||
'-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.]'
|
||||
}
|
||||
|
||||
__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.]' \
|
||||
'-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-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.]' \
|
||||
'-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.]'
|
||||
}
|
||||
|
||||
__get() {
|
||||
_arguments \
|
||||
'-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]'
|
||||
}
|
||||
|
||||
__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.]'
|
||||
}
|
||||
|
||||
__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.]' \
|
||||
'-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.]'
|
||||
}
|
||||
|
||||
__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.]'
|
||||
}
|
||||
|
||||
__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]' \
|
||||
'-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.]' \
|
||||
'-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \
|
||||
'-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.]' \
|
||||
'-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.]'
|
||||
}
|
||||
|
||||
__push() {
|
||||
_arguments \
|
||||
'-atlas-address=[(url) An alternate address to an Atlas instance. Defaults to https://atlas.hashicorp.com.]' \
|
||||
'-upload-modules=[(true) If true (default), then the modules being used are all locked at their current checkout and uploaded completely to Atlas. This prevents Atlas from running terraform get for you.]' \
|
||||
'-name=[(name) Name of the infrastructure configuration in Atlas. The format of this is: "username/name" so that you can upload configurations not just to your account but to other accounts and organizations. This setting can also be set in the configuration in the Atlas section.]' \
|
||||
'-no-color[Disables output with coloring]' \
|
||||
'-overwrite=[(foo) Marks a specific variable to be updated on Atlas. Normally, if a variable is already set in Atlas, Terraform will not send the local value (even if it is different). This forces it to send the local value to Atlas. This flag can be repeated multiple times.]' \
|
||||
'-token=[(token) Atlas API token to use to authorize the upload. If blank or unspecified, the ATLAS_TOKEN environmental variable will be used.]' \
|
||||
'-var=[("foo=bar") Set the value of a variable for the Terraform configuration.]' \
|
||||
'-var-file=[(foo) Set the value of variables using a variable file.]' \
|
||||
'-vcs=[(true) If true (default), then Terraform will detect if a VCS is in use, such as Git, and will only upload files that are comitted to version control. If no version control system is detected, Terraform will upload all files in path (parameter to the command).]'
|
||||
}
|
||||
|
||||
__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.]' \
|
||||
'-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.]' \
|
||||
'-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.]'
|
||||
}
|
||||
|
||||
__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.]' \
|
||||
'-no-color[If specified, output will not contain any color.]'
|
||||
}
|
||||
|
||||
__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.]' \
|
||||
'-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.]'
|
||||
}
|
||||
|
||||
_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "terraform command" _terraform_cmds
|
||||
return
|
||||
fi
|
||||
|
||||
local -a _command_args
|
||||
case "$words[1]" in
|
||||
apply)
|
||||
__apply ;;
|
||||
destroy)
|
||||
__destroy ;;
|
||||
get)
|
||||
__get ;;
|
||||
graph)
|
||||
__graph ;;
|
||||
init)
|
||||
__init ;;
|
||||
output)
|
||||
__output ;;
|
||||
plan)
|
||||
__plan ;;
|
||||
push)
|
||||
__push ;;
|
||||
refresh)
|
||||
__refresh ;;
|
||||
remote)
|
||||
__remote ;;
|
||||
show)
|
||||
__show ;;
|
||||
taint)
|
||||
__taint ;;
|
||||
esac
|
9
plugins/thefuck/README.md
Normal file
9
plugins/thefuck/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# The Fuck
|
||||
|
||||
[The Fuck](https://github.com/nvbn/thefuck) plugin — magnificent app which corrects your previous console command.
|
||||
|
||||
## Usage
|
||||
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.
|
17
plugins/thefuck/thefuck.plugin.zsh
Normal file
17
plugins/thefuck/thefuck.plugin.zsh
Normal file
@ -0,0 +1,17 @@
|
||||
if [[ -z $commands[thefuck] ]]; then
|
||||
echo 'thefuck is not installed, you should "pip install thefuck" first'
|
||||
return -1
|
||||
fi
|
||||
|
||||
# Register alias
|
||||
eval "$(thefuck-alias)"
|
||||
|
||||
fuck-command-line() {
|
||||
local FUCK="$(THEFUCK_REQUIRE_CONFIRMATION=0 thefuck $(fc -ln -1 | tail -n 1) 2> /dev/null)"
|
||||
[[ -z $FUCK ]] && echo -n -e "\a" && return
|
||||
BUFFER=$FUCK
|
||||
zle end-of-line
|
||||
}
|
||||
zle -N fuck-command-line
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey "\e\e" fuck-command-line
|
@ -3,6 +3,7 @@
|
||||
# https://github.com/dbb
|
||||
# https://github.com/Mappleconfusers
|
||||
# Nicolas Jonas nextgenthemes.com
|
||||
# https://github.com/loctauxphilippe
|
||||
#
|
||||
# Debian, Ubuntu and friends related zsh aliases and functions for zsh
|
||||
|
||||
@ -28,6 +29,7 @@ compdef _ppap ppap='sudo ppa-purge'
|
||||
|
||||
alias ag='sudo apt-get' # age - but without sudo
|
||||
alias aga='sudo apt-get autoclean' # aac
|
||||
alias agar='sudo apt-get autoremove'
|
||||
alias agb='sudo apt-get build-dep' # abd
|
||||
alias agc='sudo apt-get clean' # adc
|
||||
alias agd='sudo apt-get dselect-upgrade' # ads
|
||||
@ -38,9 +40,11 @@ alias agu='sudo apt-get update' # ad
|
||||
alias agud='sudo apt-get update && sudo apt-get dist-upgrade' #adu
|
||||
alias agug='sudo apt-get upgrade' # ag
|
||||
alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg
|
||||
alias agar='sudo apt-get autoremove'
|
||||
|
||||
compdef _ag ag='sudo apt-get'
|
||||
compdef _aga aga='sudo apt-get autoclean'
|
||||
compdef _agar agar='sudo apt-get autoremove'
|
||||
compdef _agb agb='sudo apt-get build-dep'
|
||||
compdef _agc agc='sudo apt-get clean'
|
||||
compdef _agd agd='sudo apt-get dselect-upgrade'
|
||||
@ -51,6 +55,7 @@ compdef _agu agu='sudo apt-get update'
|
||||
compdef _agud agud='sudo apt-get update && sudo apt-get dist-upgrade'
|
||||
compdef _agug agug='sudo apt-get upgrade'
|
||||
compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade'
|
||||
compdef _agar agar='sudo apt-get autoremove'
|
||||
|
||||
# Remove ALL kernel images and headers EXCEPT the one in use
|
||||
alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
|
||||
@ -65,7 +70,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
||||
|
||||
# apt-add-repository with automatic install/upgrade of the desired package
|
||||
# Usage: aar ppa:xxxxxx/xxxxxx [packagename]
|
||||
# If packagename is not given as 2nd arument the function will ask for it and guess the defaupt by taking
|
||||
# If packagename is not given as 2nd argument the function will ask for it and guess the default by taking
|
||||
# the part after the / from the ppa name wich is sometimes the right name for the package you want to install
|
||||
aar() {
|
||||
if [ -n "$2" ]; then
|
||||
|
@ -14,32 +14,38 @@ elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then
|
||||
source "/etc/bash_completion.d/virtualenvwrapper"
|
||||
}
|
||||
else
|
||||
print "zsh virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}.\n"\
|
||||
print "[oh-my-zsh] virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}.\n"\
|
||||
"Please install with \`pip install virtualenvwrapper\`" >&2
|
||||
return
|
||||
fi
|
||||
if ! type workon &>/dev/null; then
|
||||
print "zsh virtualenvwrapper plugin: shell function 'workon' not defined.\n"\
|
||||
print "[oh-my-zsh] virtualenvwrapper plugin: shell function 'workon' not defined.\n"\
|
||||
"Please check ${virtualenvwrapper}" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$WORKON_HOME" == "" ]]; then
|
||||
print "\$WORKON_HOME is not defined so ZSH plugin virtualenvwrapper will not work" >&2
|
||||
print "[oh-my-zsh] \$WORKON_HOME is not defined so plugin virtualenvwrapper will not work" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||
# Automatically activate Git projects' virtual environments based on the
|
||||
# Automatically activate Git projects or other customized virtualenvwrapper projects based on the
|
||||
# directory name of the project. Virtual environment name can be overridden
|
||||
# by placing a .venv file in the project root with a virtualenv name in it
|
||||
# by placing a .venv file in the project root with a virtualenv name in it.
|
||||
function workon_cwd {
|
||||
if [ ! $WORKON_CWD ]; then
|
||||
WORKON_CWD=1
|
||||
if [[ -z "$WORKON_CWD" ]]; then
|
||||
local WORKON_CWD=1
|
||||
# Check if this is a Git repo
|
||||
local GIT_REPO_ROOT=""
|
||||
local GIT_TOPLEVEL="$(git rev-parse --show-toplevel 2> /dev/null)"
|
||||
if [[ $? == 0 ]]; then
|
||||
GIT_REPO_ROOT="$GIT_TOPLEVEL"
|
||||
fi
|
||||
# Get absolute path, resolving symlinks
|
||||
PROJECT_ROOT="${PWD:A}"
|
||||
while [[ "$PROJECT_ROOT" != "/" && ! -e "$PROJECT_ROOT/.venv" ]]; do
|
||||
local PROJECT_ROOT="${PWD:A}"
|
||||
while [[ "$PROJECT_ROOT" != "/" && ! -e "$PROJECT_ROOT/.venv" \
|
||||
&& ! -d "$PROJECT_ROOT/.git" && "$PROJECT_ROOT" != "$GIT_REPO_ROOT" ]]; do
|
||||
PROJECT_ROOT="${PROJECT_ROOT:h}"
|
||||
done
|
||||
if [[ "$PROJECT_ROOT" == "/" ]]; then
|
||||
@ -47,7 +53,7 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||
fi
|
||||
# Check for virtualenv name override
|
||||
if [[ -f "$PROJECT_ROOT/.venv" ]]; then
|
||||
ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
|
||||
ENV_NAME="$(cat "$PROJECT_ROOT/.venv")"
|
||||
elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
|
||||
ENV_NAME="$PROJECT_ROOT/.venv"
|
||||
elif [[ "$PROJECT_ROOT" != "." ]]; then
|
||||
@ -69,8 +75,6 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||
# Note: this only happens if the virtualenv was activated automatically
|
||||
deactivate && unset CD_VIRTUAL_ENV
|
||||
fi
|
||||
unset PROJECT_ROOT
|
||||
unset WORKON_CWD
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -13,15 +13,15 @@ function vundle-init () {
|
||||
|
||||
function vundle () {
|
||||
vundle-init
|
||||
vim -c "execute \"PluginInstall\" | q | q"
|
||||
vim -c "execute \"PluginInstall\" | qa"
|
||||
}
|
||||
|
||||
function vundle-update () {
|
||||
vundle-init
|
||||
vim -c "execute \"PluginInstall!\" | q | q"
|
||||
vim -c "execute \"PluginInstall!\" | qa"
|
||||
}
|
||||
|
||||
function vundle-clean () {
|
||||
vundle-init
|
||||
vim -c "execute \"PluginClean!\" | q | q"
|
||||
vim -c "execute \"PluginClean!\" | qa"
|
||||
}
|
||||
|
@ -12,18 +12,9 @@ function web_search() {
|
||||
duckduckgo "https://www.duckduckgo.com/?q="
|
||||
yandex "https://yandex.ru/yandsearch?text="
|
||||
github "https://github.com/search?q="
|
||||
baidu "https://www.baidu.com/s?wd="
|
||||
)
|
||||
|
||||
# define the open command
|
||||
case "$OSTYPE" in
|
||||
darwin*) open_cmd="open" ;;
|
||||
cygwin*) open_cmd="cygstart" ;;
|
||||
linux*) open_cmd="xdg-open" ;;
|
||||
*) echo "Platform $OSTYPE not supported"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# check whether the search engine is supported
|
||||
if [[ -z "$urls[$1]" ]]; then
|
||||
echo "Search engine $1 not supported."
|
||||
@ -41,7 +32,7 @@ function web_search() {
|
||||
url="${(j://:)${(s:/:)urls[$1]}[1,2]}"
|
||||
fi
|
||||
|
||||
nohup $open_cmd "$url" &>/dev/null
|
||||
open_command "$url"
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +42,7 @@ alias yahoo='web_search yahoo'
|
||||
alias ddg='web_search duckduckgo'
|
||||
alias yandex='web_search yandex'
|
||||
alias github='web_search github'
|
||||
alias baidu='web_search baidu'
|
||||
|
||||
#add your own !bang searches here
|
||||
alias wiki='web_search duckduckgo \!w'
|
||||
|
@ -13,7 +13,7 @@ patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset
|
||||
}
|
||||
|
||||
function box_name {
|
||||
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-HOST}
|
||||
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
|
||||
}
|
||||
|
||||
PROMPT='
|
||||
|
@ -21,7 +21,7 @@ function prompt_char {
|
||||
}
|
||||
|
||||
function box_name {
|
||||
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-HOST}
|
||||
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@ function prompt_char {
|
||||
}
|
||||
|
||||
function box_name {
|
||||
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-HOST}
|
||||
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
|
||||
}
|
||||
|
||||
local ruby_env=''
|
||||
|
@ -18,6 +18,12 @@ else
|
||||
BOLD=""
|
||||
NORMAL=""
|
||||
fi
|
||||
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
|
||||
if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
|
||||
echo "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!"
|
||||
exit
|
||||
fi
|
||||
unset CHECK_ZSH_INSTALLED
|
||||
|
||||
if [ ! -n "$ZSH" ]; then
|
||||
ZSH=~/.oh-my-zsh
|
||||
@ -43,14 +49,16 @@ fi
|
||||
|
||||
printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
|
||||
cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
|
||||
sed -i -e "/^export ZSH=/ c\\
|
||||
sed "/^export ZSH=/ c\\
|
||||
export ZSH=$ZSH
|
||||
" ~/.zshrc
|
||||
" ~/.zshrc > ~/.zshrc-omztemp
|
||||
mv -f ~/.zshrc-omztemp ~/.zshrc
|
||||
|
||||
printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n"
|
||||
sed -i -e "/export PATH=/ c\\
|
||||
sed "/export PATH=/ c\\
|
||||
export PATH=\"$PATH\"
|
||||
" ~/.zshrc
|
||||
" ~/.zshrc > ~/.zshrc-omztemp
|
||||
mv -f ~/.zshrc-omztemp ~/.zshrc
|
||||
|
||||
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
|
||||
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
|
||||
|
@ -3,7 +3,7 @@
|
||||
# supports them.
|
||||
ncolors=$(tput colors)
|
||||
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||
RED=="$(tput setaf 1)"
|
||||
RED="$(tput setaf 1)"
|
||||
GREEN="$(tput setaf 2)"
|
||||
YELLOW="$(tput setaf 3)"
|
||||
BLUE="$(tput setaf 4)"
|
||||
|
Loading…
Reference in New Issue
Block a user