mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-26 00:09:10 +01:00
Merge branch 'master' into master
This commit is contained in:
commit
0232ac4bb1
17
.github/main.workflow
vendored
Normal file
17
.github/main.workflow
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
workflow "Triage Pull Request" {
|
||||
on = "pull_request"
|
||||
resolves = ["Triage"]
|
||||
}
|
||||
|
||||
# Only act if there are code changes: if the pull_request
|
||||
# event's action is either 'opened' (new PR) or 'synchronize' (new commits)
|
||||
action "Filter actions" {
|
||||
uses = "actions/bin/filter@0ac6d44"
|
||||
args = "action 'opened|synchronize'"
|
||||
}
|
||||
|
||||
action "Triage" {
|
||||
needs = ["Filter actions"]
|
||||
uses = "ohmyzsh/github-actions/pull-request-triage@master"
|
||||
secrets = ["GITHUB_TOKEN"]
|
||||
}
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,7 +1,5 @@
|
||||
# custom files
|
||||
custom/
|
||||
!custom/plugins/example
|
||||
!custom/example.zsh
|
||||
|
||||
# temp files directories
|
||||
cache/
|
||||
|
76
CODE_OF_CONDUCT.md
Normal file
76
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all project spaces, and it also applies when
|
||||
an individual is representing the project or its community in public spaces.
|
||||
Examples of representing a project or community include using an official
|
||||
project e-mail address, posting via an official social media account, or acting
|
||||
as an appointed representative at an online or offline event. Representation of
|
||||
a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ohmyzsh@planetargon.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
@ -1,8 +1,10 @@
|
||||
# CONTRIBUTING GUIDELINES
|
||||
|
||||
Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated.
|
||||
Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged, and appreciated.
|
||||
It is also essential for the development of the project.
|
||||
|
||||
First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md).
|
||||
|
||||
These guidelines are an attempt at better addressing the huge amount of pending
|
||||
issues and pull requests. Please read them closely.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2009-2018 Robby Russell and contributors
|
||||
Copyright (c) 2009-2019 Robby Russell and contributors
|
||||
See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
21
README.md
21
README.md
@ -2,7 +2,7 @@
|
||||
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
|
||||
</p>
|
||||
|
||||
Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration.
|
||||
Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration.
|
||||
|
||||
Sounds boring. Let's try again.
|
||||
|
||||
@ -12,7 +12,7 @@ Once installed, your terminal shell will become the talk of the town _or your mo
|
||||
|
||||
Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬
|
||||
|
||||
To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
|
||||
To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
|
||||
|
||||
## Getting Started
|
||||
|
||||
@ -21,7 +21,7 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t
|
||||
__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
|
||||
|
||||
* Unix-like operating system (macOS or Linux)
|
||||
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
|
||||
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
|
||||
* `curl` or `wget` should be installed
|
||||
* `git` should be installed
|
||||
|
||||
@ -75,7 +75,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 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!
|
||||
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://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out!
|
||||
|
||||
#### Selecting a Theme
|
||||
|
||||
@ -141,7 +141,7 @@ export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubus
|
||||
##### 1. Clone the repository:
|
||||
|
||||
```shell
|
||||
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
||||
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
||||
```
|
||||
|
||||
##### 2. *Optionally*, backup your existing `~/.zshrc` file:
|
||||
@ -163,6 +163,7 @@ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
||||
```shell
|
||||
chsh -s /bin/zsh
|
||||
```
|
||||
You must log out and log back in to see this change.
|
||||
|
||||
##### 5. Initialize your new zsh configuration
|
||||
|
||||
@ -213,12 +214,16 @@ Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy b
|
||||
|
||||
If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration.
|
||||
|
||||
## Contributing
|
||||
## How do I contribute to Oh My Zsh?
|
||||
|
||||
I'm far from being a [Zsh](http://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
|
||||
Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md).
|
||||
|
||||
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
|
||||
|
||||
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.
|
||||
|
||||
See [Contributing](CONTRIBUTING.md) for more details.
|
||||
|
||||
### 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.
|
||||
@ -238,7 +243,7 @@ We're on the social media.
|
||||
|
||||
## Merchandise
|
||||
|
||||
We have [stickers](https://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!
|
||||
We have [stickers, shirts, and coffee mugs available](https://shop.planetargon.com/collections/oh-my-zsh?utm_source=github) for you to show off your love of Oh My Zsh. Again, you will become the talk of the town!
|
||||
|
||||
## License
|
||||
|
||||
|
4
custom/themes/example.zsh-theme
Normal file
4
custom/themes/example.zsh-theme
Normal file
@ -0,0 +1,4 @@
|
||||
# Put your custom themes in this folder.
|
||||
# Example:
|
||||
|
||||
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
|
@ -2,10 +2,6 @@
|
||||
# insecure ownership or permissions) by:
|
||||
#
|
||||
# * Human-readably notifying the user of these insecurities.
|
||||
# * Moving away all existing completion caches to a temporary directory. Since
|
||||
# any of these caches may have been generated from insecure directories, they
|
||||
# are all suspect now. Failing to do so typically causes subsequent compinit()
|
||||
# calls to fail with "command not found: compdef" errors. (That's bad.)
|
||||
function handle_completion_insecurities() {
|
||||
# List of the absolute paths of all unique insecure directories, split on
|
||||
# newline from compaudit()'s output resembling:
|
||||
@ -22,39 +18,27 @@ function handle_completion_insecurities() {
|
||||
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
|
||||
|
||||
# If no such directories exist, get us out of here.
|
||||
if (( ! ${#insecure_dirs} )); then
|
||||
print "[oh-my-zsh] No insecure completion-dependent directories detected."
|
||||
return
|
||||
fi
|
||||
[[ -z "${insecure_dirs}" ]] && return
|
||||
|
||||
# List ownership and permissions of all insecure directories.
|
||||
print "[oh-my-zsh] Insecure completion-dependent directories detected:"
|
||||
ls -ld "${(@)insecure_dirs}"
|
||||
print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all"
|
||||
print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh."
|
||||
print "[oh-my-zsh] See the above list for directories with group or other writability.\n"
|
||||
|
||||
# Locally enable the "NULL_GLOB" option, thus removing unmatched filename
|
||||
# globs from argument lists *AND* printing no warning when doing so. Failing
|
||||
# to do so prints an unreadable warning if no completion caches exist below.
|
||||
setopt local_options null_glob
|
||||
cat <<EOD
|
||||
|
||||
# List of the absolute paths of all unique existing completion caches.
|
||||
local -aU zcompdump_files
|
||||
zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* )
|
||||
[oh-my-zsh] For safety, we will not load completions from these directories until
|
||||
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
|
||||
[oh-my-zsh] See the above list for directories with group or other writability.
|
||||
|
||||
# Move such caches to a temporary directory.
|
||||
if (( ${#zcompdump_files} )); then
|
||||
# Absolute path of the directory to which such files will be moved.
|
||||
local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad"
|
||||
[oh-my-zsh] To fix your permissions you can do so by disabling
|
||||
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
|
||||
[oh-my-zsh] owner of these directories is either root or your current user.
|
||||
[oh-my-zsh] The following command may help:
|
||||
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
|
||||
|
||||
# List such files first.
|
||||
print "[oh-my-zsh] Insecure completion caches also detected:"
|
||||
ls -l "${(@)zcompdump_files}"
|
||||
[oh-my-zsh] If the above didn't help or you want to skip the verification of
|
||||
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
|
||||
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
|
||||
|
||||
# For safety, move rather than permanently remove such files.
|
||||
print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n"
|
||||
mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}"
|
||||
mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/"
|
||||
fi
|
||||
EOD
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ else
|
||||
fi
|
||||
unset CASE_SENSITIVE HYPHEN_INSENSITIVE
|
||||
|
||||
# Complete . and .. special directories
|
||||
zstyle ':completion:*' special-dirs true
|
||||
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
if [[ "$ENABLE_CORRECTION" == "true" ]]; then
|
||||
alias cp='nocorrect cp'
|
||||
alias ebuild='nocorrect ebuild'
|
||||
alias gist='nocorrect gist'
|
||||
alias heroku='nocorrect heroku'
|
||||
|
@ -21,14 +21,18 @@ alias 9='cd -9'
|
||||
|
||||
alias md='mkdir -p'
|
||||
alias rd=rmdir
|
||||
alias d='dirs -v | head -10'
|
||||
|
||||
function d () {
|
||||
if [[ -n $1 ]]; then
|
||||
dirs "$@"
|
||||
else
|
||||
dirs -v | head -10
|
||||
fi
|
||||
}
|
||||
compdef _dirs d
|
||||
|
||||
# List directory contents
|
||||
alias lsa='ls -lah'
|
||||
alias l='ls -lah'
|
||||
alias ll='ls -lh'
|
||||
alias la='ls -lAh'
|
||||
|
||||
# Push and pop directories on directory stack
|
||||
alias pu='pushd'
|
||||
alias po='popd'
|
||||
|
@ -11,21 +11,20 @@ function upgrade_oh_my_zsh() {
|
||||
}
|
||||
|
||||
function take() {
|
||||
mkdir -p $1
|
||||
cd $1
|
||||
mkdir -p $@ && cd ${@:$#}
|
||||
}
|
||||
|
||||
function open_command() {
|
||||
emulate -L zsh
|
||||
setopt shwordsplit
|
||||
|
||||
local open_cmd
|
||||
|
||||
# define the open command
|
||||
case "$OSTYPE" in
|
||||
darwin*) open_cmd='open' ;;
|
||||
cygwin*) open_cmd='cygstart' ;;
|
||||
linux*) open_cmd='xdg-open' ;;
|
||||
linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || {
|
||||
open_cmd='cmd.exe /c start ""'
|
||||
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
|
||||
} ;;
|
||||
msys*) open_cmd='start ""' ;;
|
||||
*) echo "Platform $OSTYPE not supported"
|
||||
return 1
|
||||
@ -34,9 +33,9 @@ function open_command() {
|
||||
|
||||
# don't use nohup on OSX
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
$open_cmd "$@" &>/dev/null
|
||||
${=open_cmd} "$@" &>/dev/null
|
||||
else
|
||||
nohup $open_cmd "$@" &>/dev/null
|
||||
nohup ${=open_cmd} "$@" &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
@ -52,8 +51,7 @@ function open_command() {
|
||||
# 1 if it does not exist
|
||||
#
|
||||
function alias_value() {
|
||||
alias "$1" | sed "s/^$1='\(.*\)'$/\1/"
|
||||
test $(alias "$1")
|
||||
(( $+aliases[$1] )) && echo $aliases[$1]
|
||||
}
|
||||
|
||||
#
|
||||
@ -81,7 +79,7 @@ function try_alias_value() {
|
||||
# 0 if the variable exists, 3 if it was set
|
||||
#
|
||||
function default() {
|
||||
test `typeset +m "$1"` && return 0
|
||||
(( $+parameters[$1] )) && return 0
|
||||
typeset -g "$1"="$2" && return 3
|
||||
}
|
||||
|
||||
@ -95,8 +93,8 @@ function default() {
|
||||
# 0 if the env variable exists, 3 if it was set
|
||||
#
|
||||
function env_default() {
|
||||
env | grep -q "^$1=" && return 0
|
||||
export "$1=$2" && return 3
|
||||
(( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
|
||||
export "$1=$2" && return 3
|
||||
}
|
||||
|
||||
|
||||
|
42
lib/git.zsh
42
lib/git.zsh
@ -10,13 +10,10 @@ function git_prompt_info() {
|
||||
|
||||
# Checks if working tree is dirty
|
||||
function parse_git_dirty() {
|
||||
local STATUS=''
|
||||
local STATUS
|
||||
local -a FLAGS
|
||||
FLAGS=('--porcelain')
|
||||
FLAGS=('--porcelain' '--ignore-submodules=dirty')
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
||||
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
||||
FLAGS+='--ignore-submodules=dirty'
|
||||
fi
|
||||
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
||||
FLAGS+='--untracked-files=no'
|
||||
fi
|
||||
@ -77,8 +74,8 @@ function git_current_branch() {
|
||||
# Gets the number of commits ahead from remote
|
||||
function git_commits_ahead() {
|
||||
if command git rev-parse --git-dir &>/dev/null; then
|
||||
local commits="$(git rev-list --count @{upstream}..HEAD)"
|
||||
if [[ "$commits" != 0 ]]; then
|
||||
local commits="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)"
|
||||
if [[ -n "$commits" && "$commits" != 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
@ -87,8 +84,8 @@ function git_commits_ahead() {
|
||||
# Gets the number of commits behind remote
|
||||
function git_commits_behind() {
|
||||
if command git rev-parse --git-dir &>/dev/null; then
|
||||
local commits="$(git rev-list --count HEAD..@{upstream})"
|
||||
if [[ "$commits" != 0 ]]; then
|
||||
local commits="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)"
|
||||
if [[ -n "$commits" && "$commits" != 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
@ -181,28 +178,6 @@ function git_prompt_status() {
|
||||
echo $STATUS
|
||||
}
|
||||
|
||||
# Compares the provided version of git to the version installed and on path
|
||||
# Outputs -1, 0, or 1 if the installed version is less than, equal to, or
|
||||
# greater than the input version, respectively.
|
||||
function git_compare_version() {
|
||||
local INPUT_GIT_VERSION INSTALLED_GIT_VERSION
|
||||
INPUT_GIT_VERSION=(${(s/./)1})
|
||||
INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null))
|
||||
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]})
|
||||
|
||||
for i in {1..3}; do
|
||||
if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then
|
||||
echo 1
|
||||
return 0
|
||||
fi
|
||||
if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
|
||||
echo -1
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo 0
|
||||
}
|
||||
|
||||
# Outputs the name of the current user
|
||||
# Usage example: $(git_current_user_name)
|
||||
function git_current_user_name() {
|
||||
@ -214,8 +189,3 @@ function git_current_user_name() {
|
||||
function git_current_user_email() {
|
||||
command git config user.email 2>/dev/null
|
||||
}
|
||||
|
||||
# This is unlikely to change so make it all statically assigned
|
||||
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
|
||||
# Clean up the namespace slightly by removing the checker function
|
||||
unfunction git_compare_version
|
||||
|
@ -1,24 +1,40 @@
|
||||
## Command history configuration
|
||||
if [ -z "$HISTFILE" ]; then
|
||||
HISTFILE=$HOME/.zsh_history
|
||||
fi
|
||||
## History wrapper
|
||||
function omz_history {
|
||||
local clear list
|
||||
zparseopts -E c=clear l=list
|
||||
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
if [[ -n "$clear" ]]; then
|
||||
# if -c provided, clobber the history file
|
||||
echo -n >| "$HISTFILE"
|
||||
echo >&2 History file deleted. Reload the session to see its effects.
|
||||
elif [[ -n "$list" ]]; then
|
||||
# if -l provided, run as if calling `fc' directly
|
||||
builtin fc "$@"
|
||||
else
|
||||
# unless a number is provided, show all history events (starting from 1)
|
||||
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Show history
|
||||
case $HIST_STAMPS in
|
||||
"mm/dd/yyyy") alias history='fc -fl 1' ;;
|
||||
"dd.mm.yyyy") alias history='fc -El 1' ;;
|
||||
"yyyy-mm-dd") alias history='fc -il 1' ;;
|
||||
*) alias history='fc -l 1' ;;
|
||||
# Timestamp format
|
||||
case ${HIST_STAMPS-} in
|
||||
"mm/dd/yyyy") alias history='omz_history -f' ;;
|
||||
"dd.mm.yyyy") alias history='omz_history -E' ;;
|
||||
"yyyy-mm-dd") alias history='omz_history -i' ;;
|
||||
"") alias history='omz_history' ;;
|
||||
*) alias history="omz_history -t '$HIST_STAMPS'" ;;
|
||||
esac
|
||||
|
||||
setopt append_history
|
||||
setopt extended_history
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_ignore_dups # ignore duplication command history list
|
||||
setopt hist_ignore_space
|
||||
setopt hist_verify
|
||||
setopt inc_append_history
|
||||
setopt share_history # share command history data
|
||||
## History file configuration
|
||||
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
|
||||
HISTSIZE=50000
|
||||
SAVEHIST=10000
|
||||
|
||||
## History command configuration
|
||||
setopt extended_history # record timestamp of command in HISTFILE
|
||||
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||
setopt hist_ignore_space # ignore commands that start with space
|
||||
setopt hist_verify # show command with history expansion to user before running it
|
||||
setopt inc_append_history # add commands to HISTFILE in order of execution
|
||||
setopt share_history # share command history data
|
||||
|
@ -18,13 +18,11 @@ fi
|
||||
## jobs
|
||||
setopt long_list_jobs
|
||||
|
||||
## pager
|
||||
env_default PAGER 'less'
|
||||
env_default LESS '-R'
|
||||
env_default 'PAGER' 'less'
|
||||
env_default 'LESS' '-R'
|
||||
|
||||
## super user alias
|
||||
alias _='sudo'
|
||||
alias please='sudo'
|
||||
|
||||
## more intelligent acking for ubuntu users
|
||||
if which ack-grep &> /dev/null; then
|
||||
|
@ -10,9 +10,15 @@
|
||||
# Dummy implementations that return false to prevent command_not_found
|
||||
# errors with themes, that implement these functions
|
||||
# Real implementations will be used when the respective plugins are loaded
|
||||
function chruby_prompt_info hg_prompt_info pyenv_prompt_info \
|
||||
rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \
|
||||
virtualenv_prompt_info {
|
||||
function chruby_prompt_info \
|
||||
rbenv_prompt_info \
|
||||
hg_prompt_info \
|
||||
pyenv_prompt_info \
|
||||
svn_prompt_info \
|
||||
vi_mode_prompt_info \
|
||||
virtualenv_prompt_info \
|
||||
jenv_prompt_info \
|
||||
{
|
||||
return 1
|
||||
}
|
||||
|
||||
@ -22,10 +28,13 @@ function rvm_prompt_info() {
|
||||
[ -f $HOME/.rvm/bin/rvm-prompt ] || return 1
|
||||
local rvm_prompt
|
||||
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
|
||||
[[ "${rvm_prompt}x" == "x" ]] && return 1
|
||||
echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}"
|
||||
[[ -z "${rvm_prompt}" ]] && return 1
|
||||
echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
||||
}
|
||||
|
||||
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
||||
|
||||
|
||||
# use this to enable users to see their ruby version, no matter which
|
||||
# version management system they use
|
||||
function ruby_prompt_info() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#! /bin/zsh
|
||||
# A script to make using 256 colors in zsh less painful.
|
||||
# P.C. Shyamshankar <sykora@lucentbeing.com>
|
||||
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
|
||||
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
|
||||
|
||||
typeset -AHg FX FG BG
|
||||
|
||||
|
@ -21,7 +21,7 @@ function title {
|
||||
print -Pn "\e]2;$2:q\a" # set window name
|
||||
print -Pn "\e]1;$1:q\a" # set tab name
|
||||
;;
|
||||
screen*)
|
||||
screen*|tmux*)
|
||||
print -Pn "\ek$1:q\e\\" # set screen hardstatus
|
||||
;;
|
||||
*)
|
||||
@ -80,7 +80,7 @@ preexec_functions+=(omz_termsupport_preexec)
|
||||
|
||||
|
||||
# Keep Apple Terminal.app's current working directory updated
|
||||
# Based on this answer: http://superuser.com/a/315029
|
||||
# Based on this answer: https://superuser.com/a/315029
|
||||
# With extra fixes to handle multibyte chars and non-UTF-8 locales
|
||||
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||
|
@ -19,7 +19,7 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
|
||||
# coreutils, so prefer it to "gls".
|
||||
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
|
||||
colorls -G -d . &>/dev/null && alias ls='colorls -G'
|
||||
elif [[ "$OSTYPE" == darwin* ]]; then
|
||||
elif [[ "$OSTYPE" == (darwin|freebsd)* ]]; then
|
||||
# this is a good alias, it works by default just using $LSCOLORS
|
||||
ls -G . &>/dev/null && alias ls='ls -G'
|
||||
|
||||
@ -45,11 +45,10 @@ setopt prompt_subst
|
||||
|
||||
[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
|
||||
|
||||
# Apply theming defaults
|
||||
PS1="%n@%m:%~%# "
|
||||
|
||||
# git theming default: Variables for theming the git info prompt
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
|
||||
ZSH_THEME_RUBY_PROMPT_PREFIX="("
|
||||
ZSH_THEME_RUBY_PROMPT_SUFFIX=")"
|
||||
|
58
oh-my-zsh.sh
58
oh-my-zsh.sh
@ -1,6 +1,17 @@
|
||||
# Set ZSH_CACHE_DIR to the path where cache files should be created
|
||||
# or else we will use the default cache/
|
||||
if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
||||
ZSH_CACHE_DIR="$ZSH/cache"
|
||||
fi
|
||||
|
||||
# Migrate .zsh-update file to $ZSH_CACHE_DIR
|
||||
if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
|
||||
mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update
|
||||
fi
|
||||
|
||||
# Check for updates on initial load...
|
||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
|
||||
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
|
||||
env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
|
||||
fi
|
||||
|
||||
# Initializes Oh My Zsh
|
||||
@ -11,29 +22,12 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
|
||||
# Load all stock functions (from $fpath files) called below.
|
||||
autoload -U compaudit compinit
|
||||
|
||||
: ${ZSH_DISABLE_COMPFIX:=true}
|
||||
|
||||
# Set ZSH_CUSTOM to the path where your custom config files
|
||||
# and plugins exists, or else we will use the default custom/
|
||||
if [[ -z "$ZSH_CUSTOM" ]]; then
|
||||
ZSH_CUSTOM="$ZSH/custom"
|
||||
fi
|
||||
|
||||
# Set ZSH_CACHE_DIR to the path where cache files should be created
|
||||
# or else we will use the default cache/
|
||||
if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
||||
ZSH_CACHE_DIR="$ZSH/cache"
|
||||
fi
|
||||
|
||||
|
||||
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
||||
# TIP: Add files you don't want in git to .gitignore
|
||||
for config_file ($ZSH/lib/*.zsh); do
|
||||
custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
|
||||
[ -f "${custom_config_file}" ] && config_file=${custom_config_file}
|
||||
source $config_file
|
||||
done
|
||||
|
||||
|
||||
is_plugin() {
|
||||
local base_dir=$1
|
||||
@ -41,6 +35,7 @@ is_plugin() {
|
||||
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|
||||
|| test -f $base_dir/plugins/$name/_$name
|
||||
}
|
||||
|
||||
# Add all defined plugins to fpath. This must be done
|
||||
# before running compinit.
|
||||
for plugin ($plugins); do
|
||||
@ -48,6 +43,8 @@ for plugin ($plugins); do
|
||||
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
|
||||
elif is_plugin $ZSH $plugin; then
|
||||
fpath=($ZSH/plugins/$plugin $fpath)
|
||||
else
|
||||
echo "[oh-my-zsh] plugin '$plugin' not found"
|
||||
fi
|
||||
done
|
||||
|
||||
@ -65,18 +62,25 @@ if [ -z "$ZSH_COMPDUMP" ]; then
|
||||
fi
|
||||
|
||||
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
|
||||
# If completion insecurities exist, warn the user without enabling completions.
|
||||
if ! compaudit &>/dev/null; then
|
||||
# This function resides in the "lib/compfix.zsh" script sourced above.
|
||||
handle_completion_insecurities
|
||||
# Else, enable and cache completions to the desired file.
|
||||
else
|
||||
compinit -d "${ZSH_COMPDUMP}"
|
||||
fi
|
||||
source $ZSH/lib/compfix.zsh
|
||||
# If completion insecurities exist, warn the user
|
||||
handle_completion_insecurities
|
||||
# Load only from secure directories
|
||||
compinit -i -C -d "${ZSH_COMPDUMP}"
|
||||
else
|
||||
compinit -i -d "${ZSH_COMPDUMP}"
|
||||
# If the user wants it, load from all found directories
|
||||
compinit -u -C -d "${ZSH_COMPDUMP}"
|
||||
fi
|
||||
|
||||
|
||||
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
||||
# TIP: Add files you don't want in git to .gitignore
|
||||
for config_file ($ZSH/lib/*.zsh); do
|
||||
custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
|
||||
[ -f "${custom_config_file}" ] && config_file=${custom_config_file}
|
||||
source $config_file
|
||||
done
|
||||
|
||||
# Load all of the plugins that were defined in ~/.zshrc
|
||||
for plugin ($plugins); do
|
||||
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
|
||||
|
@ -48,8 +48,13 @@ _arguments \
|
||||
|
||||
case "$state" in
|
||||
specify_device)
|
||||
_values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \
|
||||
{printf "%s[%s] ",$1,$6 }')
|
||||
_values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
|
||||
{sub(/ +/," ",$0); \
|
||||
gsub(":","\\:",$1); \
|
||||
for(i=1;i<=NF;i++) {
|
||||
if($i ~ /model:/) { split($i,m,":") } \
|
||||
else if($i ~ /product:/) { split($i,p,":") } } \
|
||||
printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""}
|
||||
return
|
||||
;;
|
||||
esac
|
||||
@ -59,4 +64,4 @@ if (( CURRENT == 1 )); then
|
||||
return
|
||||
fi
|
||||
|
||||
_files
|
||||
_files
|
||||
|
34
plugins/ansible/README.md
Normal file
34
plugins/ansible/README.md
Normal file
@ -0,0 +1,34 @@
|
||||
# ansible plugin
|
||||
|
||||
## Introduction
|
||||
|
||||
The `ansible plugin` adds several aliases for useful [ansible](https://docs.ansible.com/ansible/latest/index.html) commands and [aliases](#aliases).
|
||||
|
||||
To use it, add `ansible` to the plugins array of your zshrc file:
|
||||
|
||||
```
|
||||
plugins=(... ansible)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Command | Description |
|
||||
|:-------------------------------------------|:--------------------------------------------------------------------|
|
||||
| `ansible-version` / `aver` | Show the version on ansible installed in this host |
|
||||
| `ansible-role-init <role name>` / `arinit` | Creates the Ansible Role as per Ansible Galaxy standard |
|
||||
| `a` | command `ansible` |
|
||||
| `aconf` | command `ansible-config` |
|
||||
| `acon` | command `ansible-console` |
|
||||
| `ainv` | command `ansible-inventory` |
|
||||
| `aplaybook` | command `ansible-playbook` |
|
||||
| `ainv` | command `ansible-inventory` |
|
||||
| `adoc` | command `ansible-doc` |
|
||||
| `agal` | command `ansible-galaxy` |
|
||||
| `apull` | command `ansible-pull` |
|
||||
| `aval` | command `ansible-vault` |
|
||||
|
||||
## Maintainer
|
||||
|
||||
### [Deepankumar](https://github.com/deepan10)
|
||||
|
||||
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
|
28
plugins/ansible/ansible.plugin.zsh
Normal file
28
plugins/ansible/ansible.plugin.zsh
Normal file
@ -0,0 +1,28 @@
|
||||
# Functions
|
||||
function ansible-version(){
|
||||
ansible --version
|
||||
}
|
||||
|
||||
function ansible-role-init(){
|
||||
if ! [ -z $1] ; then
|
||||
echo "Ansible Role : $1 Creating...."
|
||||
ansible-galaxy init $1
|
||||
tree $1
|
||||
else
|
||||
echo "Usage : ansible-role-init <role name>"
|
||||
echo "Example : ansible-role-init role1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Alias
|
||||
alias a='ansible '
|
||||
alias aconf='ansible-config '
|
||||
alias acon='ansible-console '
|
||||
alias aver='ansible-version'
|
||||
alias arinit='ansible-role-init'
|
||||
alias aplaybook='ansible-playbook '
|
||||
alias ainv='ansible-inventory '
|
||||
alias adoc='ansible-doc '
|
||||
alias agal='ansible-galaxy '
|
||||
alias apull='ansible-pull '
|
||||
alias aval='ansible-vault'
|
12
plugins/ant/README.md
Normal file
12
plugins/ant/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Ant
|
||||
|
||||
This plugin provides completion for [Ant](https://ant.apache.org/).
|
||||
|
||||
To use it add ant to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... ant)
|
||||
```
|
||||
|
||||
It caches ant targets in a file named `.ant_targets`, you might want to add that to
|
||||
your `.gitignore` file.
|
@ -2,6 +2,51 @@
|
||||
|
||||
## Features
|
||||
|
||||
#### YAY
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
| yaconf | yay -Pg | Print current configuration |
|
||||
| yain | yay -S | Install packages from the repositories |
|
||||
| yains | yay -U | Install a package from a local file |
|
||||
| yainsd | yay -S --asdeps | Install packages as dependencies of another package |
|
||||
| yaloc | yay -Qi | Display information about a package in the local database |
|
||||
| yalocs | yay -Qs | Search for packages in the local database |
|
||||
| yalst | yay -Qe | List installed packages including from AUR (tagged as "local") |
|
||||
| yamir | yay -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| yaorph | yay -Qtd | Remove orphans using yay |
|
||||
| yare | yay -R | Remove packages, keeping its settings and dependencies |
|
||||
| yarem | yay -Rns | Remove packages, including its settings and unneeded dependencies |
|
||||
| yarep | yay -Si | Display information about a package in the repositories |
|
||||
| yareps | yay -Ss | Search for packages in the repositories |
|
||||
| yaupg | yay -Syu | Sync with repositories before upgrading packages |
|
||||
| yasu | yay -Syu --no-confirm | Same as `yaupg`, but without confirmation |
|
||||
|
||||
#### TRIZEN
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
| trconf | trizen -C | Fix all configuration files with vimdiff |
|
||||
| trin | trizen -S | Install packages from the repositories |
|
||||
| trins | trizen -U | Install a package from a local file |
|
||||
| trinsd | trizen -S --asdeps | Install packages as dependencies of another package |
|
||||
| trloc | trizen -Qi | Display information about a package in the local database |
|
||||
| trlocs | trizen -Qs | Search for packages in the local database |
|
||||
| trlst | trizen -Qe | List installed packages including from AUR (tagged as "local") |
|
||||
| trmir | trizen -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| trorph | trizen -Qtd | Remove orphans using yaourt |
|
||||
| trre | trizen -R | Remove packages, keeping its settings and dependencies |
|
||||
| trrem | trizen -Rns | Remove packages, including its settings and unneeded dependencies |
|
||||
| trrep | trizen -Si | Display information about a package in the repositories |
|
||||
| trreps | trizen -Ss | Search for packages in the repositories |
|
||||
| trupd | trizen -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
|
||||
| trupd | trizen -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| trupd | trizen -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| trupd | trizen -Sy | Update and refresh the local package database |
|
||||
| trupg | trizen -Syua | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| trsu | trizen -Syua --no-confirm | Same as `trupg`, but without confirmation |
|
||||
| upgrade | trizen -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
#### YAOURT
|
||||
|
||||
| Alias | Command | Description |
|
||||
@ -27,7 +72,7 @@
|
||||
| yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation |
|
||||
| upgrade | yaourt -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
### PACAUR
|
||||
#### PACAUR
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
@ -74,7 +119,9 @@
|
||||
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server |
|
||||
| pacfiles | pacman -Fs | Search package file names for matching strings. |
|
||||
| pacfiles | pacman -Fs | Search package file names for matching strings |
|
||||
| pacls | pacman -Ql | List files in a package |
|
||||
| pacown | pacman -Qo | Show which package owns a file |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|------------------------------------------------------|
|
||||
@ -82,6 +129,7 @@
|
||||
| paclist | List all installed packages with a short description |
|
||||
| pacmanallkeys | Get all keys for developers and trusted users |
|
||||
| pacmansignkeys | Locally trust all keys passed as parameters |
|
||||
| pacweb | Open the website of an ArchLinux package |
|
||||
|
||||
---
|
||||
|
||||
@ -95,3 +143,4 @@
|
||||
- ornicar - thibault.duplessis@gmail.com
|
||||
- Juraj Fiala - doctorjellyface@riseup.net
|
||||
- Majora320 (Moses Miller) - Majora320@gmail.com
|
||||
- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
|
||||
|
@ -1,3 +1,32 @@
|
||||
if (( $+commands[trizen] )); then
|
||||
alias trconf='trizen -C'
|
||||
alias trupg='trizen -Syua'
|
||||
alias trsu='trizen -Syua --noconfirm'
|
||||
alias trin='trizen -S'
|
||||
alias trins='trizen -U'
|
||||
alias trre='trizen -R'
|
||||
alias trrem='trizen -Rns'
|
||||
alias trrep='trizen -Si'
|
||||
alias trreps='trizen -Ss'
|
||||
alias trloc='trizen -Qi'
|
||||
alias trlocs='trizen -Qs'
|
||||
alias trlst='trizen -Qe'
|
||||
alias trorph='trizen -Qtd'
|
||||
alias trinsd='trizen -S --asdeps'
|
||||
alias trmir='trizen -Syy'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias trupd='trizen -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias trupd='trizen -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias trupd='trizen -Sy && sudo aur'
|
||||
else
|
||||
alias trupd='trizen -Sy'
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[yaourt] )); then
|
||||
alias yaconf='yaourt -C'
|
||||
alias yaupg='yaourt -Syua'
|
||||
@ -27,6 +56,35 @@ if (( $+commands[yaourt] )); then
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[yay] )); then
|
||||
alias yaconf='yay -Pg'
|
||||
alias yaupg='yay -Syu'
|
||||
alias yasu='yay -Syu --noconfirm'
|
||||
alias yain='yay -S'
|
||||
alias yains='yay -U'
|
||||
alias yare='yay -R'
|
||||
alias yarem='yay -Rns'
|
||||
alias yarep='yay -Si'
|
||||
alias yareps='yay -Ss'
|
||||
alias yaloc='yay -Qi'
|
||||
alias yalocs='yay -Qs'
|
||||
alias yalst='yay -Qe'
|
||||
alias yaorph='yay -Qtd'
|
||||
alias yainsd='yay -S --asdeps'
|
||||
alias yamir='yay -Syy'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias yaupd='yay -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias yaupd='yay -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias yaupd='yay -Sy && sudo aur'
|
||||
else
|
||||
alias yaupd='yay -Sy'
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[pacaur] )); then
|
||||
alias paupg='pacaur -Syu'
|
||||
alias pasu='pacaur -Syu --noconfirm'
|
||||
@ -54,16 +112,24 @@ if (( $+commands[pacaur] )); then
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[pacaur] )); then
|
||||
upgrade() {
|
||||
if (( $+commands[trizen] )); then
|
||||
function upgrade() {
|
||||
trizen -Syu
|
||||
}
|
||||
elif (( $+commands[pacaur] )); then
|
||||
function upgrade() {
|
||||
pacaur -Syu
|
||||
}
|
||||
elif (( $+commands[yaourt] )); then
|
||||
upgrade() {
|
||||
function upgrade() {
|
||||
yaourt -Syu
|
||||
}
|
||||
elif (( $+commands[yay] )); then
|
||||
function upgrade() {
|
||||
yay -Syu
|
||||
}
|
||||
else
|
||||
upgrade() {
|
||||
function upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
fi
|
||||
@ -83,7 +149,9 @@ alias pacmir='sudo pacman -Syy'
|
||||
alias paclsorphans='sudo pacman -Qdt'
|
||||
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
||||
alias pacfileupg='sudo pacman -Fy'
|
||||
alias pacfiles='pacman tFs'
|
||||
alias pacfiles='pacman -Fs'
|
||||
alias pacls='pacman -Ql'
|
||||
alias pacown='pacman -Qo'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
@ -96,13 +164,13 @@ else
|
||||
alias pacupd='sudo pacman -Sy'
|
||||
fi
|
||||
|
||||
paclist() {
|
||||
function paclist() {
|
||||
# Source: https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \
|
||||
awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}'
|
||||
}
|
||||
|
||||
pacdisowned() {
|
||||
function pacdisowned() {
|
||||
emulate -L zsh
|
||||
|
||||
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
||||
@ -120,14 +188,14 @@ pacdisowned() {
|
||||
comm -23 "$fs" "$db"
|
||||
}
|
||||
|
||||
pacmanallkeys() {
|
||||
function pacmanallkeys() {
|
||||
emulate -L zsh
|
||||
curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
|
||||
awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
|
||||
xargs sudo pacman-key --recv-keys
|
||||
}
|
||||
|
||||
pacmansignkeys() {
|
||||
function pacmansignkeys() {
|
||||
emulate -L zsh
|
||||
for key in $*; do
|
||||
sudo pacman-key --recv-keys $key
|
||||
@ -136,3 +204,16 @@ pacmansignkeys() {
|
||||
--no-permission-warning --command-fd 0 --edit-key $key
|
||||
done
|
||||
}
|
||||
|
||||
if (( $+commands[xdg-open] )); then
|
||||
function pacweb() {
|
||||
pkg="$1"
|
||||
infos="$(pacman -Si "$pkg")"
|
||||
if [[ -z "$infos" ]]; then
|
||||
return
|
||||
fi
|
||||
repo="$(grep '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
|
||||
arch="$(grep '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
|
||||
xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
|
||||
}
|
||||
fi
|
||||
|
@ -1,7 +1,19 @@
|
||||
# Find where asdf should be installed.
|
||||
# Find where asdf should be installed
|
||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
||||
|
||||
# Load asdf, if found.
|
||||
if [ -f $ASDF_DIR/asdf.sh ]; then
|
||||
. $ASDF_DIR/asdf.sh
|
||||
# If not found, check for Homebrew package
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then
|
||||
ASDF_DIR="$(brew --prefix asdf)"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
|
||||
fi
|
||||
|
||||
# Load command
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
. "$ASDF_DIR/asdf.sh"
|
||||
|
||||
# Load completions
|
||||
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
|
||||
. "$ASDF_COMPLETIONS/asdf.bash"
|
||||
fi
|
||||
fi
|
||||
|
11
plugins/autojump/README.md
Normal file
11
plugins/autojump/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Autojump plugin
|
||||
|
||||
This plugin loads the [autojump navigation tool](https://github.com/wting/autojump).
|
||||
|
||||
To use it, add `autojump` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... autojump)
|
||||
```
|
||||
|
||||
More info on the usage: https://github.com/wting/autojump
|
@ -1,23 +1,39 @@
|
||||
if [ $commands[autojump] ]; then # check if autojump is installed
|
||||
if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
|
||||
. $HOME/.autojump/etc/profile.d/autojump.zsh
|
||||
elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation
|
||||
. $HOME/.autojump/share/autojump/autojump.zsh
|
||||
elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation
|
||||
. $HOME/.nix-profile/etc/profile.d/autojump.zsh
|
||||
elif [ -f /run/current-system/sw/share/autojump/autojump.zsh ]; then # nixos installation
|
||||
. /run/current-system/sw/share/autojump/autojump.zsh
|
||||
elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
|
||||
. /usr/share/autojump/autojump.zsh
|
||||
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
|
||||
. /etc/profile.d/autojump.zsh
|
||||
elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation
|
||||
. /etc/profile.d/autojump.sh
|
||||
elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation
|
||||
. /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.sh ]; then # mac os x with brew
|
||||
. `brew --prefix`/etc/autojump.sh
|
||||
(( $+commands[autojump] )) || {
|
||||
echo '[oh-my-zsh] Please install autojump first (https://github.com/wting/autojump)'
|
||||
return
|
||||
}
|
||||
|
||||
declare -a autojump_paths
|
||||
autojump_paths=(
|
||||
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
||||
$HOME/.autojump/share/autojump/autojump.zsh # manual installation
|
||||
$HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
|
||||
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
|
||||
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
|
||||
/etc/profile.d/autojump.zsh # manual installation
|
||||
/etc/profile.d/autojump.sh # Gentoo installation
|
||||
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
|
||||
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
||||
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
||||
)
|
||||
|
||||
for file in $autojump_paths; do
|
||||
if [[ -f "$file" ]]; then
|
||||
source "$file"
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# if no path found, try Homebrew
|
||||
if (( ! found && $+commands[brew] )); then
|
||||
file=$(brew --prefix)/etc/profile.d/autojump.sh
|
||||
if [[ -f "$file" ]]; then
|
||||
source "$file"
|
||||
found=1
|
||||
fi
|
||||
fi
|
||||
|
||||
(( ! found )) && echo '[oh-my-zsh] autojump script not found'
|
||||
|
||||
unset autojump_paths file found
|
||||
|
8
plugins/autopep8/README.md
Normal file
8
plugins/autopep8/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# autopep8 plugin
|
||||
|
||||
This plugin adds completion for [autopep8](https://pypi.org/project/autopep8/), a tool that automatically formats Python code to conform to the [PEP 8](http://www.python.org/dev/peps/pep-0008/) style guide.
|
||||
|
||||
To use it, add autopep8 to the plugins array of your zshrc file:
|
||||
```
|
||||
plugins=(... autopep8)
|
||||
```
|
38
plugins/aws/README.md
Normal file
38
plugins/aws/README.md
Normal file
@ -0,0 +1,38 @@
|
||||
# aws
|
||||
|
||||
This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html)
|
||||
and a few utilities to manage AWS profiles and display them in the prompt.
|
||||
|
||||
To use it, add `aws` to the plugins array in your zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... aws)
|
||||
```
|
||||
|
||||
## Plugin commands
|
||||
|
||||
* `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
|
||||
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI.
|
||||
Run `asp` without arguments to clear the profile.
|
||||
|
||||
* `agp`: gets the current value of `$AWS_PROFILE`.
|
||||
|
||||
* `aws_change_access_key`: changes the AWS access key of a profile.
|
||||
|
||||
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
|
||||
Used to provide completion for the `asp` function.
|
||||
|
||||
## Plugin options
|
||||
|
||||
* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT.
|
||||
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
|
||||
see the AWS profile prompt.
|
||||
|
||||
## Theme
|
||||
|
||||
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
|
||||
the current `$AWS_PROFILE`. It uses two variables to control how that is shown:
|
||||
|
||||
- ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`.
|
||||
|
||||
- ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`.
|
@ -1,52 +1,85 @@
|
||||
_homebrew-installed() {
|
||||
type brew &> /dev/null
|
||||
_xit=$?
|
||||
if [ $_xit -eq 0 ];then
|
||||
# ok , we have brew installed
|
||||
# speculatively we check default brew prefix
|
||||
if [ -h /usr/local/opt/awscli ];then
|
||||
_brew_prefix="/usr/local/opt/awscli"
|
||||
else
|
||||
# ok , it is not default prefix
|
||||
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
||||
_brew_prefix=$(brew --prefix awscli)
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
return $_xit
|
||||
fi
|
||||
}
|
||||
|
||||
_awscli-homebrew-installed() {
|
||||
[ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null
|
||||
}
|
||||
|
||||
export AWS_HOME=~/.aws
|
||||
# AWS profile selection
|
||||
|
||||
function agp {
|
||||
echo $AWS_DEFAULT_PROFILE
|
||||
echo $AWS_PROFILE
|
||||
}
|
||||
|
||||
function asp {
|
||||
local rprompt=${RPROMPT/<aws:$(agp)>/}
|
||||
|
||||
export AWS_DEFAULT_PROFILE=$1
|
||||
export AWS_PROFILE=$1
|
||||
export AWS_EB_PROFILE=$1
|
||||
|
||||
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$rprompt"
|
||||
if [[ -z "$1" ]]; then
|
||||
echo AWS profile cleared.
|
||||
fi
|
||||
}
|
||||
|
||||
function aws_change_access_key {
|
||||
if [[ -z "$1" ]] then
|
||||
echo "usage: $0 <profile>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo Insert the credentials when asked.
|
||||
asp "$1"
|
||||
aws iam create-access-key
|
||||
aws configure --profile "$1"
|
||||
|
||||
echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\`
|
||||
echo Your current keys are:
|
||||
aws iam list-access-keys
|
||||
}
|
||||
|
||||
function aws_profiles {
|
||||
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
|
||||
reply=($(grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/'))
|
||||
}
|
||||
compctl -K aws_profiles asp aws_change_access_key
|
||||
|
||||
|
||||
# AWS prompt
|
||||
|
||||
function aws_prompt_info() {
|
||||
[[ -z $AWS_PROFILE ]] && return
|
||||
echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}"
|
||||
}
|
||||
|
||||
compctl -K aws_profiles asp
|
||||
|
||||
if _homebrew-installed && _awscli-homebrew-installed ; then
|
||||
_aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
|
||||
else
|
||||
_aws_zsh_completer_path=$(which aws_zsh_completer.sh)
|
||||
if [ "$SHOW_AWS_PROMPT" != false ]; then
|
||||
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
||||
fi
|
||||
|
||||
[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
|
||||
unset _aws_zsh_completer_path
|
||||
|
||||
# Load awscli completions
|
||||
|
||||
_awscli-homebrew-installed() {
|
||||
# check if Homebrew is installed
|
||||
(( $+commands[brew] )) || return 1
|
||||
|
||||
# speculatively check default brew prefix
|
||||
if [ -h /usr/local/opt/awscli ]; then
|
||||
_brew_prefix=/usr/local/opt/awscli
|
||||
else
|
||||
# ok, it is not in the default prefix
|
||||
# this call to brew is expensive (about 400 ms), so at least let's make it only once
|
||||
_brew_prefix=$(brew --prefix awscli)
|
||||
fi
|
||||
}
|
||||
|
||||
# get aws_zsh_completer.sh location from $PATH
|
||||
_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
|
||||
|
||||
# otherwise check common locations
|
||||
if [[ -z $_aws_zsh_completer_path ]]; then
|
||||
# Homebrew
|
||||
if _awscli-homebrew-installed; then
|
||||
_aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
|
||||
# Ubuntu
|
||||
elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
|
||||
_aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
|
||||
# RPM
|
||||
else
|
||||
_aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
|
||||
unset _aws_zsh_completer_path _brew_prefix
|
||||
|
13
plugins/battery/README.md
Normal file
13
plugins/battery/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Battery Plugin
|
||||
|
||||
This plugin adds some functions you can use to display battery information in your custom theme.
|
||||
|
||||
To use, add `battery` to the list of plugins in your `.zshrc` file:
|
||||
|
||||
`plugins=(... battery)`
|
||||
|
||||
Then, add the `battery_pct_prompt` function to your custom theme. For example:
|
||||
|
||||
```
|
||||
RPROMPT='$(battery_pct_prompt)'
|
||||
```
|
@ -1,11 +1,11 @@
|
||||
## bbedit
|
||||
|
||||
Plugin for BBEdit, an HTML and text editor for Mac OS X
|
||||
Plugin for BBEdit, an HTML and text editor for Mac OS X
|
||||
|
||||
### Requirements
|
||||
|
||||
* [BBEdit](http://www.barebones.com/products/bbedit/)
|
||||
* [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html)
|
||||
* [BBEdit](https://www.barebones.com/products/bbedit/)
|
||||
* [BBEdit Command-Line Tools](https://www.barebones.com/support/bbedit/cmd-line-tools.html)
|
||||
|
||||
### Usage
|
||||
|
||||
|
@ -13,7 +13,7 @@ Just add bgnotify to your plugins list in your `.zshrc`
|
||||
- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
|
||||
* `brew install terminal-notifier` (or `gem install terminal-notifier`)
|
||||
- On ubuntu you're already all set!
|
||||
- On windows you can use [notifu](http://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
||||
- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
||||
|
||||
|
||||
## Screenshots
|
||||
|
2
plugins/bgnotify/bgnotify.plugin.zsh
Executable file → Normal file
2
plugins/bgnotify/bgnotify.plugin.zsh
Executable file → Normal file
@ -42,7 +42,7 @@ bgnotify () { ## args: (title, subtitle)
|
||||
elif hash notify-send 2>/dev/null; then #ubuntu gnome!
|
||||
notify-send "$1" "$2"
|
||||
elif hash kdialog 2>/dev/null; then #ubuntu kde!
|
||||
kdialog -title "$1" --passivepopup "$2" 5
|
||||
kdialog --title "$1" --passivepopup "$2" 5
|
||||
elif hash notifu 2>/dev/null; then #cygwyn support!
|
||||
notifu /m "$2" /p "$1"
|
||||
fi
|
||||
|
18
plugins/bower/README.md
Normal file
18
plugins/bower/README.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Bower plugin
|
||||
|
||||
This plugin adds completion for [Bower](https://bower.io/) and a few useful aliases for common Bower commands.
|
||||
|
||||
To use it, add `bower` to the plugins array in your zshrc file:
|
||||
|
||||
```
|
||||
plugins=(... bower)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-----------------|--------------------------------------------------------|
|
||||
| bi | `bower install` | Installs the project dependencies listed in bower.json |
|
||||
| bl | `bower list` | List local packages and possible updates |
|
||||
| bs | `bower search` | Finds all packages or a specific package. |
|
||||
|
21
plugins/brew/README.md
Normal file
21
plugins/brew/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# brew plugin
|
||||
|
||||
The plugin adds several aliases for common [brew](https://brew.sh) commands.
|
||||
|
||||
To use it, add `brew` to the plugins array of your zshrc file:
|
||||
```
|
||||
plugins=(... brew)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|--------|----------------------|---------------|
|
||||
| brewp | `brew pin` | Pin a specified formulae, preventing them from being upgraded when issuing the brew upgrade <formulae> command. |
|
||||
| brews | `brew list -1` | List installed formulae, one entry per line, or the installed files for a given formulae. |
|
||||
| brewsp | `brew list --pinned` | Show the versions of pinned formulae, or only the specified (pinned) formulae if formulae are given. |
|
||||
| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. |
|
||||
| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. |
|
||||
| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. |
|
||||
| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. |
|
||||
| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. |
|
@ -1,7 +1,11 @@
|
||||
alias brewp='brew pin'
|
||||
alias brews='brew list -1'
|
||||
alias brewsp='brew list --pinned'
|
||||
alias bubo='brew update && brew outdated'
|
||||
alias bubc='brew upgrade && brew cleanup'
|
||||
alias bubu='bubo && bubc'
|
||||
alias bcubo='brew update && brew cask outdated'
|
||||
alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup'
|
||||
|
||||
if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then
|
||||
print -P '%F{yellow}'Oh My Zsh brew plugin:
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
- adds completion for basic bundler commands
|
||||
- adds short aliases for common bundler commands
|
||||
- `be` aliased to `bundle exec`
|
||||
- `be` aliased to `bundle exec`.
|
||||
It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
|
||||
- `bl` aliased to `bundle list`
|
||||
- `bp` aliased to `bundle package`
|
||||
- `bo` aliased to `bundle open`
|
||||
@ -13,7 +14,8 @@
|
||||
- looks for a binstub under `./bin/` and executes it (if present)
|
||||
- calls `bundle exec <gem executable>` otherwise
|
||||
|
||||
For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file.
|
||||
Common gems wrapped by default (by name of the executable):
|
||||
`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
|
||||
|
||||
## Configuration
|
||||
|
||||
|
@ -54,10 +54,14 @@ done
|
||||
## Functions
|
||||
|
||||
bundle_install() {
|
||||
if _bundler-installed && _within-bundled-project; then
|
||||
if ! _bundler-installed; then
|
||||
echo "Bundler is not installed"
|
||||
elif ! _within-bundled-project; then
|
||||
echo "Can't 'bundle install' outside a bundled project"
|
||||
else
|
||||
local bundler_version=`bundle version | cut -d' ' -f3`
|
||||
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
|
||||
if [[ "$OSTYPE" = darwin* ]]
|
||||
if [[ "$OSTYPE" = (darwin|freebsd)* ]]
|
||||
then
|
||||
local cores_num="$(sysctl -n hw.ncpu)"
|
||||
else
|
||||
@ -67,8 +71,6 @@ bundle_install() {
|
||||
else
|
||||
bundle install $@
|
||||
fi
|
||||
else
|
||||
echo "Can't 'bundle install' outside a bundled project"
|
||||
fi
|
||||
}
|
||||
|
||||
|
12
plugins/bwana/README.md
Normal file
12
plugins/bwana/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Bwana
|
||||
|
||||
This plugin provides a function to open `man` pages directly with [Bwana](https://www.bruji.com/bwana/).
|
||||
|
||||
To use it add bwana to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... bwana)
|
||||
```
|
||||
|
||||
The `bwana` function opens the man page of the passed argument in the Bwana app.
|
||||
For example: `bwana ln` opens the man page for `ln` in Bwana.
|
@ -1,13 +1,13 @@
|
||||
#
|
||||
# Requires http://www.bruji.com/bwana/
|
||||
# Requires https://www.bruji.com/bwana/
|
||||
#
|
||||
if [[ -e /Applications/Bwana.app ]] ||
|
||||
( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
|
||||
then
|
||||
function man() {
|
||||
function bwana() {
|
||||
open "man:$1"
|
||||
}
|
||||
else
|
||||
echo "Bwana lets you read man files in Safari through a man: URI scheme"
|
||||
echo "To use it within Zsh, install it from http://www.bruji.com/bwana/"
|
||||
echo "Bwana lets you read man files in Safari through a man: URI scheme"
|
||||
echo "To use it within Zsh, install it from https://www.bruji.com/bwana/"
|
||||
fi
|
||||
|
9
plugins/cabal/README.md
Normal file
9
plugins/cabal/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Cabal
|
||||
|
||||
This plugin provides completion for [Cabal](https://www.haskell.org/cabal/), a build tool for Haskell. It
|
||||
also provides a function `cabal_sandbox_info` that prints whether the current working directory is in a sandbox.
|
||||
|
||||
To use it, add cabal to the plugins array of your zshrc file:
|
||||
```
|
||||
plugins=(... cabal)
|
||||
```
|
15
plugins/cake/README.md
Normal file
15
plugins/cake/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Cake
|
||||
|
||||
This plugin provides completion for [CakePHP](https://cakephp.org/).
|
||||
|
||||
To use it add cake to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... cake)
|
||||
```
|
||||
|
||||
## Note
|
||||
|
||||
This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
|
||||
It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your
|
||||
`.gitignore` files.
|
14
plugins/capistrano/README.md
Normal file
14
plugins/capistrano/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Capistrano
|
||||
|
||||
This plugin provides completion for [Capistrano](https://capistranorb.com/).
|
||||
|
||||
To use it add capistrano to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... capistrano)
|
||||
```
|
||||
|
||||
For a working completion use the `capit` command instead of `cap`, because cap is a
|
||||
[reserved word in zsh](http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module).
|
||||
|
||||
`capit` automatically runs cap with bundler if a Gemfile is found.
|
@ -1,7 +1,7 @@
|
||||
# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
|
||||
# Added `capit` because `cap` is a reserved word. `cap` completion doesn't work.
|
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
|
||||
|
||||
func capit() {
|
||||
function capit() {
|
||||
if [ -f Gemfile ]
|
||||
then
|
||||
bundle exec cap $*
|
||||
|
@ -1,6 +1,6 @@
|
||||
# cargo
|
||||
|
||||
This plugin adds completion for the Rust build tool [`cargo`](https://github.com/rust-lang/cargo).
|
||||
This plugin adds completion for the Rust build tool [`Cargo`](https://github.com/rust-lang/cargo).
|
||||
|
||||
To use it, add `cargo` to the plugins array in your zshrc file:
|
||||
|
||||
@ -8,4 +8,4 @@ To use it, add `cargo` to the plugins array in your zshrc file:
|
||||
plugins=(... cargo)
|
||||
```
|
||||
|
||||
Updated on October 4th, 2016.
|
||||
Updated on March 3rd, 2019, from [Cargo 0.34.0](https://github.com/rust-lang/cargo/releases/tag/0.34.0).
|
||||
|
@ -1,23 +1,37 @@
|
||||
#compdef cargo
|
||||
|
||||
typeset -A opt_args
|
||||
autoload -U regexp-replace
|
||||
|
||||
_cargo() {
|
||||
zstyle -T ':completion:*:*:cargo:*' tag-order && \
|
||||
zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
|
||||
|
||||
_cargo() {
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
# leading items in parentheses are an exclusion list for the arguments following that arg
|
||||
# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
|
||||
# - => exclude all other options
|
||||
# 1 => exclude positional arg 1
|
||||
# * => exclude all other args
|
||||
# +blah => exclude +blah
|
||||
_arguments \
|
||||
'(- 1 *)'{-h,--help}'[show help message]' \
|
||||
'(- 1 *)--list[list installed commands]' \
|
||||
'(- 1 *)'{-V,--version}'[show version information]' \
|
||||
'(- 1 *)'--list'[list installed commands]' \
|
||||
'(- 1 *)'--explain'[Run `rustc --explain CODE`]' \
|
||||
'(- 1 *)'{-v,--verbose}'[use verbose output]' \
|
||||
'(- 1 *)'--color'[colorization option]' \
|
||||
'(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \
|
||||
'(- 1 *)'--locked'[Require Cargo.lock is up to date]' \
|
||||
'1: :_cargo_cmds' \
|
||||
{-v,--verbose}'[use verbose output]' \
|
||||
--color'[colorization option]' \
|
||||
'(+beta +nightly)+stable[use the stable toolchain]' \
|
||||
'(+stable +nightly)+beta[use the beta toolchain]' \
|
||||
'(+stable +beta)+nightly[use the nightly toolchain]' \
|
||||
'1: :->command' \
|
||||
'*:: :->args'
|
||||
|
||||
case $state in
|
||||
command)
|
||||
_alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
|
||||
;;
|
||||
|
||||
args)
|
||||
case $words[1] in
|
||||
bench)
|
||||
@ -54,6 +68,23 @@ case $state in
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
check)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-default-features[do not check the default features]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
|
||||
'--release=[check in release mode]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
clean)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
@ -105,7 +136,7 @@ case $state in
|
||||
git-checkout)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--reference=[REF]' \
|
||||
'--url=[URL]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
@ -142,10 +173,10 @@ case $state in
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--path=[local filesystem path to crate to install]' \
|
||||
'--path=[local filesystem path to crate to install]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--rev=[specific commit to use when installing from git]' \
|
||||
'--root=[directory to install packages into]' \
|
||||
'--root=[directory to install packages into]: :_files -/' \
|
||||
'--tag=[tag to use when installing from git]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--vers=[version to install from crates.io]' \
|
||||
@ -270,7 +301,7 @@ case $state in
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to the manifest to fetch dependencies for]' \
|
||||
'--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \
|
||||
'--no-default-features[do not compile default features for the package]' \
|
||||
'(-p, --package)'{-p,--package}'=[profile to compile for]' \
|
||||
'--profile=[profile to build the selected target for]' \
|
||||
@ -288,7 +319,7 @@ case $state in
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to the manifest to document]' \
|
||||
'--manifest-path=[path to the manifest to document]: :_files -/' \
|
||||
'--no-default-features[do not build the `default` feature]' \
|
||||
'--open[open the docs in a browser after the operation]' \
|
||||
'(-p, --package)'{-p,--package}'=[package to document]' \
|
||||
@ -327,6 +358,15 @@ case $state in
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'1: :_test_names' \
|
||||
'(--doc --bin --example --test --bench)--lib[only test library]' \
|
||||
'(--lib --bin --example --test --bench)--doc[only test documentation]' \
|
||||
'(--lib --doc --example --test --bench)--bin=[binary name]' \
|
||||
'(--lib --doc --bin --test --bench)--example=[example name]' \
|
||||
'(--lib --doc --bin --example --bench)--test=[test name]' \
|
||||
'(--lib --doc --bin --example --test)--bench=[benchmark name]' \
|
||||
'--message-format:error format:(human json short)' \
|
||||
'--frozen[require lock and cache up to date]' \
|
||||
'--locked[require lock up to date]'
|
||||
;;
|
||||
|
||||
uninstall)
|
||||
@ -335,7 +375,7 @@ case $state in
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \
|
||||
'--root=[directory to uninstall packages from]' \
|
||||
'--root=[directory to uninstall packages from]: :_files -/' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
;;
|
||||
|
||||
@ -386,19 +426,20 @@ esac
|
||||
_cargo_cmds(){
|
||||
local -a commands;commands=(
|
||||
'bench:execute all benchmarks of a local package'
|
||||
'build:compile the current project'
|
||||
'build:compile the current package'
|
||||
'check:check the current package without compiling'
|
||||
'clean:remove generated artifacts'
|
||||
'doc:build package documentation'
|
||||
'fetch:fetch package dependencies'
|
||||
'generate-lockfile:create lockfile'
|
||||
'git-checkout:git checkout'
|
||||
'help:get help for commands'
|
||||
'init:create new project in current directory'
|
||||
'init:create new package in current directory'
|
||||
'install:install a Rust binary'
|
||||
'locate-project:print "Cargo.toml" location'
|
||||
'login:login to remote server'
|
||||
'metadata:the metadata for a project in json'
|
||||
'new:create a new project'
|
||||
'metadata:the metadata for a package in json'
|
||||
'new:create a new package'
|
||||
'owner:manage the owners of a crate on the registry'
|
||||
'package:assemble local package into a distributable tarball'
|
||||
'pkgid:print a fully qualified package specification'
|
||||
@ -415,8 +456,12 @@ local -a commands;commands=(
|
||||
'version:show version information'
|
||||
'yank:remove pushed file from index'
|
||||
)
|
||||
_describe 'command' commands
|
||||
_describe -t common-commands 'common commands' commands
|
||||
}
|
||||
|
||||
_cargo_all_cmds(){
|
||||
local -a commands;commands=($(cargo --list))
|
||||
_describe -t all-commands 'all commands' commands
|
||||
}
|
||||
|
||||
|
||||
@ -484,7 +529,7 @@ _benchmark_names()
|
||||
_get_names_from_array "bench"
|
||||
}
|
||||
|
||||
# These flags are mutally exclusive specifiers for the scope of a command; as
|
||||
# These flags are mutually exclusive specifiers for the scope of a command; as
|
||||
# they are used in multiple places without change, they are expanded into the
|
||||
# appropriate command's `_arguments` where appropriate.
|
||||
set command_scope_spec
|
||||
@ -496,5 +541,4 @@ command_scope_spec=(
|
||||
'(--bench --bin --example --lib)--test=[test name]'
|
||||
)
|
||||
|
||||
|
||||
_cargo
|
||||
|
35
plugins/catimg/README.md
Normal file
35
plugins/catimg/README.md
Normal file
@ -0,0 +1,35 @@
|
||||
# catimg
|
||||
|
||||
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
||||
|
||||
## Requirements
|
||||
|
||||
- `convert` (ImageMagick)
|
||||
|
||||
## Enabling the plugin
|
||||
|
||||
1. Open your `.zshrc` file and add `catimg` in the plugins section:
|
||||
|
||||
```zsh
|
||||
plugins=(
|
||||
# all your enabled plugins
|
||||
catimg
|
||||
)
|
||||
```
|
||||
|
||||
2. Reload the source file or restart your Terminal session:
|
||||
|
||||
```console
|
||||
$ source ~/.zshrc
|
||||
$
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| -------- | ---------------------------------------- |
|
||||
| `catimg` | Displays the given image on the terminal |
|
||||
|
||||
## Usage examples
|
||||
|
||||
[![asciicast](https://asciinema.org/a/204702.png)](https://asciinema.org/a/204702)
|
@ -1,10 +1,10 @@
|
||||
################################################################################
|
||||
# catimg script by Eduardo San Martin Morote aka Posva #
|
||||
# http://posva.net #
|
||||
# https://posva.net #
|
||||
# #
|
||||
# Ouput the content of an image to the stdout using the 256 colors of the #
|
||||
# terminal. #
|
||||
# Github: https://github.com/posva/catimg #
|
||||
# GitHub: https://github.com/posva/catimg #
|
||||
################################################################################
|
||||
|
||||
|
||||
|
4
plugins/catimg/catimg.sh
Executable file → Normal file
4
plugins/catimg/catimg.sh
Executable file → Normal file
@ -1,10 +1,10 @@
|
||||
################################################################################
|
||||
# catimg script by Eduardo San Martin Morote aka Posva #
|
||||
# http://posva.net #
|
||||
# https://posva.net #
|
||||
# #
|
||||
# Ouput the content of an image to the stdout using the 256 colors of the #
|
||||
# terminal. #
|
||||
# Github: https://github.com/posva/catimg #
|
||||
# GitHub: https://github.com/posva/catimg #
|
||||
################################################################################
|
||||
|
||||
function help() {
|
||||
|
9
plugins/celery/README.md
Normal file
9
plugins/celery/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Celery
|
||||
|
||||
This plugin provides completion for [Celery](http://www.celeryproject.org/).
|
||||
|
||||
To use it add celery to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... celery)
|
||||
```
|
@ -111,5 +111,11 @@ function chruby_prompt_info() {
|
||||
}
|
||||
|
||||
# complete on installed rubies
|
||||
_chruby() { compadd $(chruby | tr -d '* ') }
|
||||
_chruby() {
|
||||
compadd $(chruby | tr -d '* ')
|
||||
local default_path='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
|
||||
if PATH=${default_path} type ruby &> /dev/null; then
|
||||
compadd system
|
||||
fi
|
||||
}
|
||||
compdef _chruby chruby
|
||||
|
@ -1,2 +0,0 @@
|
||||
License: GPL v2
|
||||
Thanks to http://www.k-lug.org/~kessler/projects.html for the fortune file.
|
20
plugins/chucknorris/README.md
Normal file
20
plugins/chucknorris/README.md
Normal file
@ -0,0 +1,20 @@
|
||||
# chucknorris
|
||||
|
||||
Chuck Norris fortunes plugin for oh-my-zsh
|
||||
|
||||
**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff)
|
||||
|
||||
To use it add `chucknorris` to the plugins array in you zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... chucknorris)
|
||||
```
|
||||
|
||||
|
||||
Depends on fortune (and cowsay if using chuck_cow) being installed (available via homebrew, apt, ...). Perfectly suitable as MOTD.
|
||||
|
||||
|
||||
| Command | Description |
|
||||
| ----------- | ------------------------------- |
|
||||
| `chuck` | Print random Chuck Norris quote |
|
||||
| `chuck_cow` | Print quote in cowthink |
|
File diff suppressed because it is too large
Load Diff
@ -1,2 +1,6 @@
|
||||
#!/bin/zsh
|
||||
alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb
|
||||
alias cloudapp="${0:a:h}/cloudapp.rb"
|
||||
|
||||
# Ensure only the owner can access the credentials file
|
||||
if [[ -f ~/.cloudapp ]]; then
|
||||
chmod 600 ~/.cloudapp
|
||||
fi
|
||||
|
58
plugins/cloudfoundry/README.md
Normal file
58
plugins/cloudfoundry/README.md
Normal file
@ -0,0 +1,58 @@
|
||||
# Cloudfoundry Plugin
|
||||
|
||||
This plugin is intended to offer a few simple aliases for regular users of the [Cloud Foundry Cli][1]. Most are just simple aliases that will save a bit of typing. Others include mini functions and or accept parameters. Take a look at the table below for details.
|
||||
|
||||
| Alias | Command | Description |
|
||||
|----------|-----------------------------|--------------------------------------------------------------------------|
|
||||
| cfl | `cf login` | Login to Cloud Foundry |
|
||||
| cft | `cf target` | Target the cli at a specific Org/Space in Cloud Foundry |
|
||||
| cfa | `cf apps` | List all applications in the current Org/Space |
|
||||
| cfs | `cf services` | List all services in the current Org/Space |
|
||||
| cfm | `cf marketplace` | List the services available in the Marketplace |
|
||||
| cfp | `cf push` | Push your application code to Cloud Foundry |
|
||||
| cfcs | `cf create-service` | Create a service based on a Marketplace offering |
|
||||
| cfbs | `cf bind-service` | Bind an application to a service you created |
|
||||
| cfus | `cf unbind-service` | Unbind a service from an application |
|
||||
| cfds | `cf delete-service` | Delete a service you no longer have bound |
|
||||
| cfup | `cf cups` | Create a "user-provided-service" |
|
||||
| cflg | `cf logs` | Tail the logs of an application (requires <APP_NAME>) |
|
||||
| cfr | `cf routes` | List all the routes in the current Space |
|
||||
| cfe | `cf env` | Show the environment variables for an application (requires <APP_NAME>) |
|
||||
| cfsh | `cf ssh` | Attach to a running container (requires an <APP_NAME> etc.) |
|
||||
| cfsc | `cf scale` | Scale an application (requires an <APP_NAME> etc.) |
|
||||
| cfev | `cf events` | Show the application events (requires <APP_NAME>) |
|
||||
| cfdor | `cf delete-orphaned-routes` | Delete routes that are no longer bound to applications |
|
||||
| cfbpk | `cf buildpacks` | List the available buildpacks |
|
||||
| cfdm | `cf domains` | List the domains associates with this Cloud Foundry foundation |
|
||||
| cfsp | `cf spaces` | List all the Spaces in the current Org |
|
||||
| cfap | `cf app` | Show the details of a deployed application (requires <APP_NAME>) |
|
||||
| cfh. | `export CF_HOME=$PWD/.cf` | Set the current directory as CF_HOME |
|
||||
| cfh~ | `export CF_HOME=~/.cf` | Set the user's root directory as CF_HOME |
|
||||
| cfhu | `unset CF_HOME` | Unsets CF_HOME |
|
||||
| cfpm | `cf push -f` | Push an application using a manifest (requires <MANIFEST_FILE> location) |
|
||||
| cflr | `cf logs --recent` | Show the recent logs (requires <APP_NAME>) |
|
||||
| cfsrt | `cf start` | Start an application (requires <APP_NAME>) |
|
||||
| cfstp | `cf stop` | Stop an application (requires <APP_NAME>) |
|
||||
| cfstg | `cf restage` | Restage an application (requires <APP_NAME>) |
|
||||
| cfdel | `cf delete` | Delete an application (requires <APP_NAME>) |
|
||||
| cfsrtall | - | Start all apps that are currently in the "Stopped" state |
|
||||
| cfstpall | - | Stop all apps that are currently in the "Started" state |
|
||||
|
||||
For help and advice on what any of the commands does, consult the built in `cf` help functions as follows:-
|
||||
|
||||
```bash
|
||||
cf help # List the most popular and commonly used commands
|
||||
cf help -a # Complete list of all possible commands
|
||||
cf <COMMAND_NAME> --help # Help on a specific command including arguments and examples
|
||||
```
|
||||
|
||||
Alternatively, seek out the [online documentation][3]. And don't forget, there are loads of great [community plugins for the cf-cli][4] command line tool that can greatly extend its power and usefulness.
|
||||
|
||||
## Contributors
|
||||
|
||||
Contributed to `oh_my_zsh` by [benwilcock][2].
|
||||
|
||||
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
|
||||
[2]: https://github.com/benwilcock
|
||||
[3]: https://docs.cloudfoundry.org/cf-cli/getting-started.html
|
||||
[4]: https://plugins.cloudfoundry.org/
|
34
plugins/cloudfoundry/cloudfoundry.plugin.zsh
Normal file
34
plugins/cloudfoundry/cloudfoundry.plugin.zsh
Normal file
@ -0,0 +1,34 @@
|
||||
# Some Useful CloudFoundry Aliases & Functions
|
||||
alias cfl="cf login"
|
||||
alias cft="cf target"
|
||||
alias cfa="cf apps"
|
||||
alias cfs="cf services"
|
||||
alias cfm="cf marketplace"
|
||||
alias cfp="cf push"
|
||||
alias cfcs="cf create-service"
|
||||
alias cfbs="cf bind-service"
|
||||
alias cfus="cf unbind-service"
|
||||
alias cfds="cf delete-service"
|
||||
alias cfup="cf cups"
|
||||
alias cflg="cf logs"
|
||||
alias cfr="cf routes"
|
||||
alias cfe="cf env"
|
||||
alias cfsh="cf ssh"
|
||||
alias cfsc="cf scale"
|
||||
alias cfev="cf events"
|
||||
alias cfdor="cf delete-orphaned-routes"
|
||||
alias cfbpk="cf buildpacks"
|
||||
alias cfdm="cf domains"
|
||||
alias cfsp="cf spaces"
|
||||
function cfap() { cf app $1 }
|
||||
function cfh.() { export CF_HOME=$PWD/.cf }
|
||||
function cfh~() { export CF_HOME=~/.cf }
|
||||
function cfhu() { unset CF_HOME }
|
||||
function cfpm() { cf push -f $1 }
|
||||
function cflr() { cf logs $1 --recent }
|
||||
function cfsrt() { cf start $1 }
|
||||
function cfstp() { cf stop $1 }
|
||||
function cfstg() { cf restage $1 }
|
||||
function cfdel() { cf delete $1 }
|
||||
function cfsrtall() {cf apps | awk '/stopped/ { system("cf start " $1)}'}
|
||||
function cfstpall() {cf apps | awk '/started/ { system("cf stop " $1)}'}
|
@ -1,6 +1,6 @@
|
||||
#compdef coffee
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
|
||||
# Copyright (c) 2011 Github zsh-users - https://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -28,7 +28,7 @@
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for Coffee.js v0.6.11 (http://coffeejs.org)
|
||||
# Completion script for Coffee.js v0.6.11 (https://coffeescript.org)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
|
29
plugins/colorize/README.md
Normal file
29
plugins/colorize/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
# colorize
|
||||
|
||||
With this plugin you can syntax-highlight file contents of over 300 supported languages and other text formats.
|
||||
|
||||
Colorize will highlight the content based on the filename extension. If it can't find a syntax-highlighting
|
||||
method for a given extension, it will try to find one by looking at the file contents. If no highlight method
|
||||
is found it will just cat the file normally, without syntax highlighting.
|
||||
|
||||
To use it, add colorize to the plugins array of your zshrc file:
|
||||
```
|
||||
plugins=(... colorize)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
|
||||
If no arguments are passed it will colorize the standard input or stdin.
|
||||
|
||||
* `cless <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and
|
||||
open less. If no arguments are passed it will colorize the standard input or stdin.
|
||||
|
||||
Note that `cless` will behave as less when provided more than one file: you have to navigate files with
|
||||
the commands `:n` for next and `:p` for previous. The downside is that less options are not supported.
|
||||
But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`.
|
||||
In the latter form, the file contents will be concatenated and presented by less as a single file.
|
||||
|
||||
## Requirements
|
||||
|
||||
You have to install Pygments first: [pygments.org](http://pygments.org/download/)
|
@ -1,29 +1,49 @@
|
||||
# Plugin for highlighting file content
|
||||
# Plugin highlights file content based on the filename extension.
|
||||
# If no highlighting method supported for given extension then it tries
|
||||
# guess it by looking for file content.
|
||||
|
||||
#easier alias to use plugin
|
||||
# easier alias to use the plugin
|
||||
alias ccat='colorize_via_pygmentize'
|
||||
alias cless='colorize_via_pygmentize_less'
|
||||
|
||||
colorize_via_pygmentize() {
|
||||
if [ ! -x "$(which pygmentize)" ]; then
|
||||
echo "package \'Pygments\' is not installed!"
|
||||
return -1
|
||||
if ! (( $+commands[pygmentize] )); then
|
||||
echo "package 'Pygments' is not installed!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# pygmentize stdin if no arguments passed
|
||||
if [ $# -eq 0 ]; then
|
||||
pygmentize -g $@
|
||||
pygmentize -g
|
||||
return $?
|
||||
fi
|
||||
|
||||
for FNAME in $@
|
||||
# guess lexer from file extension, or
|
||||
# guess it from file contents if unsuccessful
|
||||
local FNAME lexer
|
||||
for FNAME in "$@"
|
||||
do
|
||||
filename=$(basename "$FNAME")
|
||||
lexer=`pygmentize -N \"$filename\"`
|
||||
if [ "Z$lexer" != "Ztext" ]; then
|
||||
pygmentize -l $lexer "$FNAME"
|
||||
lexer=$(pygmentize -N "$FNAME")
|
||||
if [[ $lexer != text ]]; then
|
||||
pygmentize -l "$lexer" "$FNAME"
|
||||
else
|
||||
pygmentize -g "$FNAME"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
colorize_via_pygmentize_less() (
|
||||
# this function is a subshell so tmp_files can be shared to cleanup function
|
||||
declare -a tmp_files
|
||||
|
||||
cleanup () {
|
||||
[[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}"
|
||||
exit
|
||||
}
|
||||
trap 'cleanup' EXIT HUP TERM INT
|
||||
|
||||
while (( $# != 0 )); do #TODO: filter out less opts
|
||||
tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")"
|
||||
tmp_files+=("$tmp_file")
|
||||
colorize_via_pygmentize "$1" > "$tmp_file"
|
||||
shift 1
|
||||
done
|
||||
|
||||
less -f "${tmp_files[@]}"
|
||||
)
|
||||
|
32
plugins/command-not-found/README.md
Normal file
32
plugins/command-not-found/README.md
Normal file
@ -0,0 +1,32 @@
|
||||
# command-not-found plugin
|
||||
|
||||
This plugin uses the command-not-found package for zsh to provide suggested packages to be installed if a command cannot be found.
|
||||
|
||||
To use it, add `command-not-found` to the plugins array of your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... command-not-found)
|
||||
```
|
||||
|
||||
An example of how this plugin works in Ubuntu:
|
||||
```
|
||||
$ mutt
|
||||
The program 'mutt' can be found in the following packages:
|
||||
* mutt
|
||||
* mutt-kz
|
||||
* mutt-patched
|
||||
Try: sudo apt install <selected package>
|
||||
```
|
||||
|
||||
### Supported platforms
|
||||
|
||||
It works out of the box with the command-not-found packages for:
|
||||
|
||||
- [Ubuntu](https://www.porcheron.info/command-not-found-for-zsh/)
|
||||
- [Debian](https://packages.debian.org/search?keywords=command-not-found)
|
||||
- [Arch Linux](https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found)
|
||||
- [macOS (Homebrew)](https://github.com/Homebrew/homebrew-command-not-found)
|
||||
- [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound)
|
||||
- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
|
||||
|
||||
You can add support for other platforms by submitting a Pull Request.
|
@ -1,5 +1,5 @@
|
||||
# Uses the command-not-found package zsh support
|
||||
# as seen in http://www.porcheron.info/command-not-found-for-zsh/
|
||||
# as seen in https://www.porcheron.info/command-not-found-for-zsh/
|
||||
# this is installed in Ubuntu
|
||||
|
||||
[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found
|
||||
@ -31,3 +31,10 @@ if type brew &> /dev/null; then
|
||||
eval "$(brew command-not-found-init)";
|
||||
fi
|
||||
fi
|
||||
|
||||
# NixOS command-not-found support
|
||||
if [ -x /run/current-system/sw/bin/command-not-found ]; then
|
||||
command_not_found_handler () {
|
||||
/run/current-system/sw/bin/command-not-found $@
|
||||
}
|
||||
fi
|
||||
|
@ -13,7 +13,7 @@ alias lS='ls -1FSsh'
|
||||
alias lart='ls -1Fcart'
|
||||
alias lrt='ls -1Fcrt'
|
||||
|
||||
alias zshrc='$EDITOR ~/.zshrc' # Quick access to the ~/.zshrc file
|
||||
alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file
|
||||
|
||||
alias grep='grep --color'
|
||||
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
|
||||
@ -44,8 +44,6 @@ alias p='ps -f'
|
||||
alias sortnr='sort -n -r'
|
||||
alias unexport='unset'
|
||||
|
||||
alias whereami=display_info
|
||||
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
|
29
plugins/composer/README.md
Normal file
29
plugins/composer/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
# composer
|
||||
|
||||
This plugin provides completion for [composer](https://getcomposer.org/), as well as aliases
|
||||
for frequent composer commands. It also adds Composer's global binaries to the PATH, using
|
||||
Composer if available.
|
||||
|
||||
To use it add `composer` to the plugins array in your zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... composer)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------ | -------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||
| `c` | composer | Starts composer |
|
||||
| `csu` | composer self-update | Updates composer to the latest version |
|
||||
| `cu` | composer update | Updates composer dependencies and `composer.lock` file |
|
||||
| `cr` | composer require | Adds new packages to `composer.json` |
|
||||
| `crm` | composer remove | Removes packages from `composer.json` |
|
||||
| `ci` | composer install | Resolves and installs dependencies from `composer.json` |
|
||||
| `ccp` | composer create-project | Create new project from an existing package |
|
||||
| `cdu` | composer dump-autoload | Updates the autoloader |
|
||||
| `cdo` | composer dump-autoload --optimize-autoloader | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
|
||||
| `cgu` | composer global update | Allows update command to run on COMPOSER_HOME directory |
|
||||
| `cgr` | composer global require | Allows require command to run on COMPOSER_HOME directory |
|
||||
| `cgrm` | composer global remove | Allows remove command to run on COMPOSER_HOME directory |
|
||||
| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
|
@ -51,5 +51,10 @@ alias cgrm='composer global remove'
|
||||
# install composer in the current directory
|
||||
alias cget='curl -s https://getcomposer.org/installer | php'
|
||||
|
||||
# Add Composer's global binaries to PATH
|
||||
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null)
|
||||
# Add Composer's global binaries to PATH, using Composer if available.
|
||||
if (( $+commands[composer] )); then
|
||||
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null)
|
||||
else
|
||||
[ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin
|
||||
[ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin
|
||||
fi
|
||||
|
10
plugins/copydir/README.md
Normal file
10
plugins/copydir/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
# copydir plugin
|
||||
|
||||
Copies the path of your current folder to the system clipboard.
|
||||
|
||||
To use, add `copydir` to your plugins array:
|
||||
```
|
||||
plugins=(... copydir)
|
||||
```
|
||||
|
||||
Then use the command `copydir` to copy the $PWD.
|
10
plugins/copyfile/README.md
Normal file
10
plugins/copyfile/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
# copyfile plugin
|
||||
|
||||
Puts the contents of a file in your system clipboard so you can paste it anywhere.
|
||||
|
||||
To use, add `copyfile` to your plugins array:
|
||||
```
|
||||
plugins=(... copyfile)
|
||||
```
|
||||
|
||||
Then you can run the command `copyfile <filename>` to copy the file named `filename`.
|
9
plugins/cpanm/README.md
Normal file
9
plugins/cpanm/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Cpanm
|
||||
|
||||
This plugin provides completion for [Cpanm](https://github.com/miyagawa/cpanminus) ([docs](https://metacpan.org/pod/App::cpanminus)).
|
||||
|
||||
To use it add cpanm to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... cpanm)
|
||||
```
|
@ -6,9 +6,6 @@
|
||||
#
|
||||
# Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011)
|
||||
#
|
||||
# The latest code is always located at:
|
||||
# https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm
|
||||
#
|
||||
|
||||
local arguments curcontext="$curcontext"
|
||||
typeset -A opt_args
|
||||
|
86
plugins/dash/dash.plugin.zsh
Normal file
86
plugins/dash/dash.plugin.zsh
Normal file
@ -0,0 +1,86 @@
|
||||
# Usage: dash [keyword:]query
|
||||
dash() { open dash://"$*" }
|
||||
compdef _dash dash
|
||||
|
||||
_dash() {
|
||||
# No sense doing this for anything except the 2nd position and if we haven't
|
||||
# specified which docset to query against
|
||||
if [[ $CURRENT -eq 2 && ! "$words[2]" =~ ":" ]]; then
|
||||
local -a _all_docsets
|
||||
_all_docsets=()
|
||||
# Use defaults to get the array of docsets from preferences
|
||||
# Have to smash it into one big line so that each docset is an element of
|
||||
# our DOCSETS array
|
||||
DOCSETS=("${(@f)$(defaults read com.kapeli.dashdoc docsets | tr -d '\n' | grep -oE '\{.*?\}')}")
|
||||
|
||||
# remove all newlines since defaults prints so pretty like
|
||||
# Now get each docset and output each on their own line
|
||||
for doc in "$DOCSETS[@]"; do
|
||||
# Only output docsets that are actually enabled
|
||||
if [[ "`echo $doc | grep -Eo \"isEnabled = .*?;\" | sed 's/[^01]//g'`" == "0" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
keyword=''
|
||||
|
||||
# Order of preference as explained to me by @kapeli via email
|
||||
KEYWORD_LOCATORS=(keyword suggestedKeyword platform)
|
||||
for locator in "$KEYWORD_LOCATORS[@]"; do
|
||||
# Echo the docset, try to find the appropriate keyword
|
||||
# Strip doublequotes and colon from any keyword so that everything has the
|
||||
# same format when output (we'll add the colon in the completion)
|
||||
keyword=`echo $doc | grep -Eo "$locator = .*?;" | sed -e "s/$locator = \(.*\);/\1/" -e "s/[\":]//g"`
|
||||
if [[ ! -z "$keyword" ]]; then
|
||||
# if we fall back to platform, we should do some checking per @kapeli
|
||||
if [[ "$locator" == "platform" ]]; then
|
||||
# Since these are the only special cases right now, let's not do the
|
||||
# expensive processing unless we have to
|
||||
if [[ "$keyword" == "python" || "$keyword" == "java" || \
|
||||
"$keyword" == "qt" || "$keyword" == "cocs2d" ]]; then
|
||||
docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"`
|
||||
if [[ "$keyword" == "python" ]]; then
|
||||
if [[ "$docsetName" == "Python 2" ]]; then
|
||||
keyword="python2"
|
||||
elif [[ "$docsetName" == "Python 3" ]]; then
|
||||
keyword="python3"
|
||||
fi
|
||||
elif [[ "$keyword" == "java" ]]; then
|
||||
if [[ "$docsetName" == "Java SE7" ]]; then
|
||||
keyword="java7"
|
||||
elif [[ "$docsetName" == "Java SE6" ]]; then
|
||||
keyword="java6"
|
||||
elif [[ "$docsetName" == "Java SE8" ]]; then
|
||||
keyword="java8"
|
||||
fi
|
||||
elif [[ "$keyword" == "qt" ]]; then
|
||||
if [[ "$docsetName" == "Qt 5" ]]; then
|
||||
keyword="qt5"
|
||||
elif [[ "$docsetName" == "Qt 4" ]]; then
|
||||
keyword="qt4"
|
||||
elif [[ "$docsetName" == "Qt" ]]; then
|
||||
keyword="qt4"
|
||||
fi
|
||||
elif [[ "$keyword" == "cocos2d" ]]; then
|
||||
if [[ "$docsetName" == "Cocos3D" ]]; then
|
||||
keyword="cocos3d"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Bail once we have a match
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If we have a keyword, add it to the list!
|
||||
if [[ ! -z "$keyword" ]]; then
|
||||
_all_docsets+=($keyword)
|
||||
fi
|
||||
done
|
||||
|
||||
# special thanks to [arx] on #zsh for getting me sorted on this piece
|
||||
compadd -qS: -- "$_all_docsets[@]"
|
||||
return
|
||||
fi
|
||||
}
|
75
plugins/debian/README.md
Normal file
75
plugins/debian/README.md
Normal file
@ -0,0 +1,75 @@
|
||||
# debian
|
||||
|
||||
This plugin provides debian related zsh aliases.
|
||||
To use it add `debian` to the plugins array in your zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... debian)
|
||||
```
|
||||
|
||||
## Common Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| -------- | ------------------------------------------------------------------------------|--------------------------------------------------------------------------- |
|
||||
| `age` | apt-get | Command line tool for handling packages |
|
||||
| `api` | aptitude | Same functionality as `apt-get`, provides extra options while installation |
|
||||
| `acs` | apt-cache search | Command line tool for searching apt software package cache |
|
||||
| `aps` | aptitude search | Searches installed packages using aptitude |
|
||||
| `as` | aptitude -F \"* %p -> %d \n(%v/%V)\" \ -no-gui --disable-columns search | - |
|
||||
| `afs` | apt-file search --regexp | Search file in packages |
|
||||
| `asrc` | apt-get source | Fetch source packages through `apt-get` |
|
||||
| `app` | apt-cache policy | Displays priority of package sources |
|
||||
|
||||
## Superuser Operations Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| -------- | -------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------- |
|
||||
| `aac` | sudo $apt_pref autoclean | Clears out the local repository of retrieved package files |
|
||||
| `abd` | sudo $apt_pref build-dep | Installs all dependencies for building packages |
|
||||
| `ac` | sudo $apt_pref clean | Clears out the local repository of retrieved package files except lock files |
|
||||
| `ad` | sudo $apt_pref update | Updates the package lists for upgrades for packages |
|
||||
| `adg` | sudo $apt_pref update && sudo $apt_pref $apt_upgr | Update and upgrade packages |
|
||||
| `adu` | sudo $apt_pref update && sudo $apt_pref dist-upgrade | Smart upgrade that handles dependencies |
|
||||
| `afu` | sudo apt-file update | Update the files in packages |
|
||||
| `au` | sudo $apt_pref $apt_upgr | - |
|
||||
| `ai` | sudo $apt_pref install | Command-line tool to install package |
|
||||
| `ail` | sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install | Install all packages given on the command line while using only the first word of each line |
|
||||
| `ap` | sudo $apt_pref purge | Removes packages along with configuration files |
|
||||
| `ar` | sudo $apt_pref remove | Removes packages, keeps the configuration files |
|
||||
| `ads` | sudo apt-get dselect-upgrade | Installs packages from list and removes all not in the list |
|
||||
| `dia` | sudo dpkg -i ./*.deb | Install all .deb files in the current directory |
|
||||
| `di` | sudo dpkg -i | Install all .deb files in the current directory |
|
||||
| `kclean` | sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`)) | Remove ALL kernel images and headers EXCEPT the one in use |
|
||||
|
||||
- `$apt_pref` - Use apt or aptitude if installed, fallback is apt-get.
|
||||
- `$apt_upgr` - Use upgrade.
|
||||
|
||||
## Aliases - Commands using `su`
|
||||
|
||||
| Alias | Command |
|
||||
| -------- | ------------------------------------------------------------------------------|
|
||||
| `aac` | su -ls \'$apt_pref autoclean\' root |
|
||||
| `ac` | su -ls \'$apt_pref clean\' root |
|
||||
| `ad` | su -lc \'$apt_pref update\' root |
|
||||
| `adg` | su -lc \'$apt_pref update && aptitude $apt_upgr\' root |
|
||||
| `adu` | su -lc \'$apt_pref update && aptitude dist-upgrade\' root |
|
||||
| `afu` | su -lc "apt-file update |
|
||||
| `ag` | su -lc \'$apt_pref $apt_upgr\' root |
|
||||
| `dia` | su -lc "dpkg -i ./*.deb" root |
|
||||
|
||||
## Miscellaneous Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| -------- | -------------------------------------------------|---------------------------------------- |
|
||||
| `allpkgs`| aptitude search -F "%p" --disable-columns ~i | Display all installed packages |
|
||||
| `mydeb` | time dpkg-buildpackage -rfakeroot -us -uc | Create a basic .deb package |
|
||||
|
||||
## Functions
|
||||
|
||||
| Fucntion | Description |
|
||||
|-----------------------|-------------------------------------------------------------------------------|
|
||||
| `apt-copy` | Create a simple script that can be used to 'duplicate' a system |
|
||||
| `apt-history` | Displays apt history for a command |
|
||||
| `kerndeb` | Builds kernel packages |
|
||||
| `apt-list-packages` | List packages by size |
|
||||
|
@ -5,9 +5,12 @@
|
||||
#
|
||||
# Debian-related zsh aliases and functions for zsh
|
||||
|
||||
# Use aptitude if installed, or apt-get if not.
|
||||
# Use apt or aptitude if installed, fallback is apt-get
|
||||
# You can just set apt_pref='apt-get' to override it.
|
||||
if [[ -e $( which -p aptitude 2>&1 ) ]]; then
|
||||
if [[ -e $( which -p apt 2>&1 ) ]]; then
|
||||
apt_pref='apt'
|
||||
apt_upgr='upgrade'
|
||||
elif [[ -e $( which -p aptitude 2>&1 ) ]]; then
|
||||
apt_pref='aptitude'
|
||||
apt_upgr='safe-upgrade'
|
||||
else
|
||||
@ -176,7 +179,7 @@ apt-copy() {
|
||||
# apt-history remove
|
||||
# apt-history rollback
|
||||
# apt-history list
|
||||
# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
|
||||
# Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
|
||||
apt-history () {
|
||||
case "$1" in
|
||||
install)
|
||||
|
78
plugins/dircycle/README.md
Normal file
78
plugins/dircycle/README.md
Normal file
@ -0,0 +1,78 @@
|
||||
# dircycle
|
||||
|
||||
Plugin for cycling through the directory stack
|
||||
|
||||
This plugin enables directory navigation similar to using back and forward on browsers or common file explorers like Finder or Nautilus. It uses a small zle trick that lets you cycle through your directory stack left or right using <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> / <kbd>Right</kbd> . This is useful when moving back and forth between directories in development environments, and can be thought of as kind of a nondestructive pushd/popd.
|
||||
|
||||
## Enabling the plugin
|
||||
|
||||
1. Open your `.zshrc` file and add `dircycle` in the plugins section:
|
||||
|
||||
```zsh
|
||||
plugins=(
|
||||
# all your enabled plugins
|
||||
dircycle
|
||||
)
|
||||
```
|
||||
|
||||
2. Reload the source file or restart your Terminal session:
|
||||
|
||||
```console
|
||||
$ source ~/.zshrc
|
||||
$
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
Say you opened these directories on the terminal:
|
||||
|
||||
```console
|
||||
~$ cd Projects
|
||||
~/Projects$ cd Hacktoberfest
|
||||
~/Projects/Hacktoberfest$ cd oh-my-zsh
|
||||
~/Projects/Hacktoberfest/oh-my-zsh$ dirs -v
|
||||
0 ~/Projects/Hacktoberfest/oh-my-zsh
|
||||
1 ~/Projects/Hacktoberfest
|
||||
2 ~/Projects
|
||||
3 ~
|
||||
```
|
||||
|
||||
By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$CWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
|
||||
|
||||
And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$CWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
|
||||
|
||||
Here's a example history table with the same accessed directories like above:
|
||||
|
||||
| Current `$CWD` | Key press | New `$CWD` |
|
||||
| --------------- | ----------------------------------------------------- | --------------- |
|
||||
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Hacktoberfest` |
|
||||
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Projects` |
|
||||
| `Projects` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `~` |
|
||||
| `~` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `Projects` |
|
||||
| `Projects` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `Hacktoberfest` |
|
||||
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `oh-my-zsh` |
|
||||
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `~` |
|
||||
|
||||
Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$CWD`, it will change back to the first known `$CWD`, which in the example is `~`.
|
||||
|
||||
Here's an asciinema cast demonstrating the example above:
|
||||
|
||||
[![asciicast](https://asciinema.org/a/204406.png)](https://asciinema.org/a/204406)
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| -------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| `insert-cycledleft` | Change `$CWD` to the previous known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
|
||||
| `insert-cycledright` | Change `$CWD` to the next known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
|
||||
|
||||
## Rebinding keys
|
||||
|
||||
You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> / <kbd>Right</kbd> in `xterm-256color`:
|
||||
|
||||
```zsh
|
||||
bindkey '^[[1;4D' insert-cycledleft
|
||||
bindkey '^[[1;4C' insert-cycledright
|
||||
```
|
||||
|
||||
You can get the bindkey sequence by pressing <kbd>Ctrl</kbd> + <kbd>V</kbd>, then pressing the keyboard shortcut you want to use.
|
@ -9,31 +9,36 @@
|
||||
# pushd -N: start counting from right of `dirs' output
|
||||
|
||||
switch-to-dir () {
|
||||
[[ ${#dirstack} -eq 0 ]] && return
|
||||
setopt localoptions nopushdminus
|
||||
[[ ${#dirstack} -eq 0 ]] && return 1
|
||||
|
||||
while ! builtin pushd -q $1 &>/dev/null; do
|
||||
# We found a missing directory: pop it out of the dir stack
|
||||
builtin popd -q $1
|
||||
|
||||
# Stop trying if there are no more directories in the dir stack
|
||||
[[ ${#dirstack} -eq 0 ]] && break
|
||||
[[ ${#dirstack} -eq 0 ]] && return 1
|
||||
done
|
||||
}
|
||||
|
||||
insert-cycledleft () {
|
||||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
switch-to-dir +1 || return
|
||||
|
||||
switch-to-dir +1
|
||||
local fn
|
||||
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
|
||||
(( $+functions[$fn] )) && $fn
|
||||
done
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledleft
|
||||
|
||||
insert-cycledright () {
|
||||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
switch-to-dir -0 || return
|
||||
|
||||
switch-to-dir -0
|
||||
local fn
|
||||
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
|
||||
(( $+functions[$fn] )) && $fn
|
||||
done
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledright
|
||||
|
17
plugins/dirhistory/README.md
Normal file
17
plugins/dirhistory/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Dirhistory plugin
|
||||
|
||||
This plugin adds keyboard shortcuts for navigating directory history and hierarchy.
|
||||
|
||||
To use it, add `dirhistory` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... dirhistory)
|
||||
```
|
||||
## Keyboard Shortcuts
|
||||
|
||||
| Shortcut | Description |
|
||||
|-----------------------------------|-----------------------------------------------------------|
|
||||
| <kbd>alt</kbd> + <kbd>left</kbd> | Go to previous directory |
|
||||
| <kbd>alt</kbd> + <kbd>right</kbd> | Undo <kbd>alt</kbd> + <kbd>left</kbd> |
|
||||
| <kbd>alt</kbd> + <kbd>up</kbd> | Move into the parent directory |
|
||||
| <kbd>alt</kbd> + <kbd>down</kbd> | Move into the first child directory by alphabetical order |
|
@ -2,6 +2,10 @@
|
||||
# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories
|
||||
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
|
||||
#
|
||||
# Navigate directory hierarchy using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented)
|
||||
# ALT-UP moves to higher hierarchy (cd ..)
|
||||
# ALT-DOWN moves into the first directory found in alphabetical order
|
||||
#
|
||||
|
||||
dirhistory_past=($PWD)
|
||||
dirhistory_future=()
|
||||
@ -120,7 +124,9 @@ zle -N dirhistory_zle_dirhistory_back
|
||||
bindkey "\e[3D" dirhistory_zle_dirhistory_back
|
||||
bindkey "\e[1;3D" dirhistory_zle_dirhistory_back
|
||||
# Mac teminal (alt+left/right)
|
||||
bindkey "^[b" dirhistory_zle_dirhistory_back
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
|
||||
bindkey "^[b" dirhistory_zle_dirhistory_back
|
||||
fi
|
||||
# Putty:
|
||||
bindkey "\e\e[D" dirhistory_zle_dirhistory_back
|
||||
# GNU screen:
|
||||
@ -129,8 +135,56 @@ bindkey "\eO3D" dirhistory_zle_dirhistory_back
|
||||
zle -N dirhistory_zle_dirhistory_future
|
||||
bindkey "\e[3C" dirhistory_zle_dirhistory_future
|
||||
bindkey "\e[1;3C" dirhistory_zle_dirhistory_future
|
||||
bindkey "^[f" dirhistory_zle_dirhistory_future
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
|
||||
bindkey "^[f" dirhistory_zle_dirhistory_future
|
||||
fi
|
||||
bindkey "\e\e[C" dirhistory_zle_dirhistory_future
|
||||
bindkey "\eO3C" dirhistory_zle_dirhistory_future
|
||||
|
||||
|
||||
#
|
||||
# HIERARCHY Implemented in this section, in case someone wants to split it to another plugin if it clashes bindings
|
||||
#
|
||||
|
||||
# Move up in hierarchy
|
||||
function dirhistory_up() {
|
||||
cd .. || return 1
|
||||
}
|
||||
|
||||
# Move down in hierarchy
|
||||
function dirhistory_down() {
|
||||
cd "$(find . -mindepth 1 -maxdepth 1 -type d | sort -n | head -n 1)" || return 1
|
||||
}
|
||||
|
||||
|
||||
# Bind keys to hierarchy navigation
|
||||
function dirhistory_zle_dirhistory_up() {
|
||||
zle kill-buffer # Erase current line in buffer
|
||||
dirhistory_up
|
||||
zle accept-line
|
||||
}
|
||||
|
||||
function dirhistory_zle_dirhistory_down() {
|
||||
zle kill-buffer # Erase current line in buffer
|
||||
dirhistory_down
|
||||
zle accept-line
|
||||
}
|
||||
|
||||
zle -N dirhistory_zle_dirhistory_up
|
||||
# xterm in normal mode
|
||||
bindkey "\e[3A" dirhistory_zle_dirhistory_up
|
||||
bindkey "\e[1;3A" dirhistory_zle_dirhistory_up
|
||||
# Mac teminal (alt+up)
|
||||
#bindkey "^[?" dirhistory_zle_dirhistory_up #dont know it
|
||||
# Putty:
|
||||
bindkey "\e\e[A" dirhistory_zle_dirhistory_up
|
||||
# GNU screen:
|
||||
bindkey "\eO3A" dirhistory_zle_dirhistory_up
|
||||
|
||||
zle -N dirhistory_zle_dirhistory_down
|
||||
bindkey "\e[3B" dirhistory_zle_dirhistory_down
|
||||
bindkey "\e[1;3B" dirhistory_zle_dirhistory_down
|
||||
# Mac teminal (alt+down)
|
||||
#bindkey "^[?" dirhistory_zle_dirhistory_down #dont know it
|
||||
bindkey "\e\e[B" dirhistory_zle_dirhistory_down
|
||||
bindkey "\eO3B" dirhistory_zle_dirhistory_down
|
||||
|
9
plugins/dirpersist/README.md
Normal file
9
plugins/dirpersist/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Dirpersist plugin
|
||||
|
||||
This plugin keeps a running tally of the previous 20 unique directories in the $HOME/.zdirs file. When you cd to a new directory, it is prepended to the beginning of the file.
|
||||
|
||||
To use it, add `dirpersist` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... dirpersist)
|
||||
```
|
56
plugins/django/README.md
Normal file
56
plugins/django/README.md
Normal file
@ -0,0 +1,56 @@
|
||||
# Django plugin
|
||||
|
||||
This plugin adds completion and hints for the [Django Project](https://www.djangoproject.com/) `manage.py` commands
|
||||
and options.
|
||||
|
||||
To use it, add `django` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... django)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```zsh
|
||||
$> python manage.py (press <TAB> here)
|
||||
```
|
||||
|
||||
Would result in:
|
||||
|
||||
```zsh
|
||||
cleanup -- remove old data from the database
|
||||
compilemessages -- compile .po files to .mo for use with gettext
|
||||
createcachetable -- creates table for SQL cache backend
|
||||
createsuperuser -- create a superuser
|
||||
dbshell -- run command-line client for the current database
|
||||
diffsettings -- display differences between the current settings and Django defaults
|
||||
dumpdata -- output contents of database as a fixture
|
||||
flush -- execute 'sqlflush' on the current database
|
||||
inspectdb -- output Django model module for tables in database
|
||||
loaddata -- install the named fixture(s) in the database
|
||||
makemessages -- pull out all strings marked for translation
|
||||
reset -- executes 'sqlreset' for the given app(s)
|
||||
runfcgi -- run this project as a fastcgi
|
||||
runserver -- start a lightweight web server for development
|
||||
...
|
||||
```
|
||||
|
||||
If you want to see the options available for a specific command, try:
|
||||
|
||||
```zsh
|
||||
$> python manage.py makemessages (press <TAB> here)
|
||||
```
|
||||
|
||||
And that would result in:
|
||||
|
||||
```zsh
|
||||
--all -a -- re-examine all code and templates
|
||||
--domain -d -- domain of the message files (default: "django")
|
||||
--extensions -e -- file extension(s) to examine (default: ".html")
|
||||
--help -- display help information
|
||||
--locale -l -- locale to process (default: all)
|
||||
--pythonpath -- directory to add to the Python path
|
||||
--settings -- python path to settings module
|
||||
...
|
||||
```
|
||||
|
@ -154,7 +154,7 @@ _managepy-makemessages(){
|
||||
"--no-default-ignore[Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.]" \
|
||||
"--no-wrap[Don't break long message lines into several lines.]" \
|
||||
"--no-location[Don't write '#: filename:line' lines.]" \
|
||||
'--no-obsolete[emove obsolete message strings.]' \
|
||||
'--no-obsolete[Remove obsolete message strings.]' \
|
||||
'--keep-pot[Keep .pot file after making messages.]' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
0
plugins/dnf/README.md
Executable file → Normal file
0
plugins/dnf/README.md
Executable file → Normal file
@ -1,4 +1,29 @@
|
||||
# Docker-compose plugin for oh my zsh
|
||||
# Docker-compose
|
||||
|
||||
A copy of the completion script from the [docker-compose](https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose) git repo.
|
||||
This plugin provides completion for [docker-compose](https://docs.docker.com/compose/) as well as some
|
||||
aliases for frequent docker-compose commands.
|
||||
|
||||
To use it, add docker-compose to the plugins array of your zshrc file:
|
||||
```
|
||||
plugins=(... docker-compose)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-----------|--------------------------|------------------------------------------------------------------|
|
||||
| dco | `docker-compose` | Docker-compose main command |
|
||||
| dcb | `docker-compose build` | Build containers |
|
||||
| dce | `docker-compose exec` | Execute command inside a container |
|
||||
| dcps | `docker-compose ps` | List containers |
|
||||
| dcrestart | `docker-compose restart` | Restart container |
|
||||
| dcrm | `docker-compose rm` | Remove container |
|
||||
| dcr | `docker-compose run` | Run a command in container |
|
||||
| dcstop | `docker-compose stop` | Stop a container |
|
||||
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
|
||||
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
|
||||
| dcdn | `docker-compose down` | Stop and remove containers |
|
||||
| dcl | `docker-compose logs` | Show logs of container |
|
||||
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||
| dcstart | `docker-compose start` | Start a container |
|
||||
|
@ -23,7 +23,7 @@ __docker-compose_all_services_in_compose_file() {
|
||||
local already_selected
|
||||
local -a services
|
||||
already_selected=$(echo $words | tr " " "|")
|
||||
__docker-compose_q config --services \
|
||||
__docker-compose_q ps --services "$@" \
|
||||
| grep -Ev "^(${already_selected})$"
|
||||
}
|
||||
|
||||
@ -31,125 +31,42 @@ __docker-compose_all_services_in_compose_file() {
|
||||
__docker-compose_services_all() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
services=$(__docker-compose_all_services_in_compose_file)
|
||||
services=$(__docker-compose_all_services_in_compose_file "$@")
|
||||
_alternative "args:services:($services)" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
# 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.
|
||||
__docker-compose_q config \
|
||||
| sed -n -e '/^services:/,/^[^ ]/p' \
|
||||
| sed -n 's/^ //p' \
|
||||
| awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
|
||||
| grep " \+$1:" \
|
||||
| cut -d: -f1 \
|
||||
| grep -Ev "^(${already_selected})$"
|
||||
}
|
||||
|
||||
# All services that are defined by a Dockerfile reference
|
||||
__docker-compose_services_from_build() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
buildable=$(__docker-compose_services_with_key build)
|
||||
_alternative "args:buildable services:($buildable)" && ret=0
|
||||
|
||||
return ret
|
||||
__docker-compose_services_all --filter source=build
|
||||
}
|
||||
|
||||
# All services that are defined by an image
|
||||
__docker-compose_services_from_image() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
pullable=$(__docker-compose_services_with_key image)
|
||||
_alternative "args:pullable services:($pullable)" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
__docker-compose_get_services() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
local kind
|
||||
declare -a running paused 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 $docker_options ps $args)"})
|
||||
services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options 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 )); do
|
||||
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
|
||||
done
|
||||
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
|
||||
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then
|
||||
paused=($paused $s)
|
||||
fi
|
||||
running=($running $s)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
[[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0
|
||||
[[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0
|
||||
[[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0
|
||||
|
||||
return ret
|
||||
__docker-compose_services_all --filter source=image
|
||||
}
|
||||
|
||||
__docker-compose_pausedservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services paused "$@"
|
||||
__docker-compose_services_all --filter status=paused
|
||||
}
|
||||
|
||||
__docker-compose_stoppedservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services stopped "$@"
|
||||
__docker-compose_services_all --filter status=stopped
|
||||
}
|
||||
|
||||
__docker-compose_runningservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services running "$@"
|
||||
__docker-compose_services_all --filter status=running
|
||||
}
|
||||
|
||||
__docker-compose_services() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services all "$@"
|
||||
__docker-compose_services_all
|
||||
}
|
||||
|
||||
__docker-compose_caching_policy() {
|
||||
@ -196,9 +113,12 @@ __docker-compose_subcommand() {
|
||||
$opts_help \
|
||||
"*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \
|
||||
'--force-rm[Always remove intermediate containers.]' \
|
||||
'--memory[Memory limit for the build container.]' \
|
||||
'(--quiet -q)'{--quiet,-q}'[Curb build output]' \
|
||||
'(--memory -m)'{--memory,-m}'[Memory limit for the build container.]' \
|
||||
'--no-cache[Do not use cache when building the image.]' \
|
||||
'--pull[Always attempt to pull a newer version of the image.]' \
|
||||
'--compress[Compress the build context using gzip.]' \
|
||||
'--parallel[Build images in parallel.]' \
|
||||
'*:services:__docker-compose_services_from_build' && ret=0
|
||||
;;
|
||||
(bundle)
|
||||
@ -213,7 +133,8 @@ __docker-compose_subcommand() {
|
||||
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
|
||||
'--resolve-image-digests[Pin image tags to digests.]' \
|
||||
'--services[Print the service names, one per line.]' \
|
||||
'--volumes[Print the volume names, one per line.]' && ret=0
|
||||
'--volumes[Print the volume names, one per line.]' \
|
||||
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
|
||||
;;
|
||||
(create)
|
||||
_arguments \
|
||||
@ -222,11 +143,12 @@ __docker-compose_subcommand() {
|
||||
$opts_no_recreate \
|
||||
$opts_no_build \
|
||||
"(--no-build)--build[Build images before creating containers.]" \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
'*:services:__docker-compose_services' && ret=0
|
||||
;;
|
||||
(down)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
$opts_timeout \
|
||||
"--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \
|
||||
'(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \
|
||||
$opts_remove_orphans && ret=0
|
||||
@ -235,16 +157,18 @@ __docker-compose_subcommand() {
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--json[Output events as a stream of json objects]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
'*:services:__docker-compose_services' && ret=0
|
||||
;;
|
||||
(exec)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-d[Detached mode: Run command in the background.]' \
|
||||
'--privileged[Give extended privileges to the process.]' \
|
||||
'(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \
|
||||
'(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \
|
||||
'-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \
|
||||
'--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
|
||||
'*'{-e,--env}'[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
|
||||
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
|
||||
'(-):running services:__docker-compose_runningservices' \
|
||||
'(-):command: _command_names -e' \
|
||||
'*::arguments: _normal' && ret=0
|
||||
@ -252,12 +176,12 @@ __docker-compose_subcommand() {
|
||||
(help)
|
||||
_arguments ':subcommand:__docker-compose_commands' && ret=0
|
||||
;;
|
||||
(images)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-q[Only display IDs]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(images)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-q[Only display IDs]' \
|
||||
'*:services:__docker-compose_services' && ret=0
|
||||
;;
|
||||
(kill)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
@ -271,7 +195,7 @@ __docker-compose_subcommand() {
|
||||
$opts_no_color \
|
||||
'--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \
|
||||
'(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
'*:services:__docker-compose_services' && ret=0
|
||||
;;
|
||||
(pause)
|
||||
_arguments \
|
||||
@ -290,12 +214,16 @@ __docker-compose_subcommand() {
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-q[Only display IDs]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
'--filter KEY=VAL[Filter services by a property]:<filtername>=<value>:' \
|
||||
'*:services:__docker-compose_services' && ret=0
|
||||
;;
|
||||
(pull)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \
|
||||
'--no-parallel[Disable parallel pulling]' \
|
||||
'(-q --quiet)'{-q,--quiet}'[Pull without printing progress information]' \
|
||||
'--include-deps[Also pull services declared as dependencies]' \
|
||||
'*:services:__docker-compose_services_from_image' && ret=0
|
||||
;;
|
||||
(push)
|
||||
@ -317,6 +245,7 @@ __docker-compose_subcommand() {
|
||||
$opts_no_deps \
|
||||
'-d[Detached mode: Run container in the background, print new container name.]' \
|
||||
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
|
||||
'*'{-l,--label}'[KEY=VAL Add or override a label (can be used multiple times)]:label KEY=VAL: ' \
|
||||
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
|
||||
'--name=[Assign a name to the container]:name: ' \
|
||||
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
|
||||
@ -326,6 +255,7 @@ __docker-compose_subcommand() {
|
||||
'(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
|
||||
'(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \
|
||||
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
|
||||
"--use-aliases[Use the services network aliases in the network(s) the container connects to]" \
|
||||
'(-):services:__docker-compose_services' \
|
||||
'(-):command: _command_names -e' \
|
||||
'*::arguments: _normal' && ret=0
|
||||
@ -369,8 +299,10 @@ __docker-compose_subcommand() {
|
||||
"(--no-build)--build[Build images before starting containers.]" \
|
||||
"(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \
|
||||
'(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \
|
||||
'--scale[SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.]:service scale SERVICE=NUM: ' \
|
||||
'--exit-code-from=[Return the exit code of the selected service container. Implies --abort-on-container-exit]:service:__docker-compose_services' \
|
||||
$opts_remove_orphans \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
'*:services:__docker-compose_services' && ret=0
|
||||
;;
|
||||
(version)
|
||||
_arguments \
|
||||
@ -409,8 +341,11 @@ _docker-compose() {
|
||||
'(- :)'{-h,--help}'[Get help]' \
|
||||
'*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \
|
||||
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
|
||||
'--verbose[Show more output]' \
|
||||
"--compatibility[If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent]" \
|
||||
'(- :)'{-v,--version}'[Print version and exit]' \
|
||||
'--verbose[Show more output]' \
|
||||
'--log-level=[Set log level]:level:(DEBUG INFO WARNING ERROR CRITICAL)' \
|
||||
'--no-ansi[Do not print ANSI control characters]' \
|
||||
'(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \
|
||||
'--tls[Use TLS; implied by --tlsverify]' \
|
||||
'--tlscacert=[Trust certs signed only by this CA]:ca path:' \
|
||||
@ -421,7 +356,7 @@ _docker-compose() {
|
||||
'(-): :->command' \
|
||||
'(-)*:: :->option-or-argument' && ret=0
|
||||
|
||||
local -a relevant_compose_flags relevant_docker_flags compose_options docker_options
|
||||
local -a relevant_compose_flags relevant_compose_repeatable_flags relevant_docker_flags compose_options docker_options
|
||||
|
||||
relevant_compose_flags=(
|
||||
"--file" "-f"
|
||||
@ -435,6 +370,10 @@ _docker-compose() {
|
||||
"--skip-hostname-check"
|
||||
)
|
||||
|
||||
relevant_compose_repeatable_flags=(
|
||||
"--file" "-f"
|
||||
)
|
||||
|
||||
relevant_docker_flags=(
|
||||
"--host" "-H"
|
||||
"--tls"
|
||||
@ -452,9 +391,18 @@ _docker-compose() {
|
||||
fi
|
||||
fi
|
||||
if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then
|
||||
compose_options+=$k
|
||||
if [[ -n "$opt_args[$k]" ]]; then
|
||||
compose_options+=$opt_args[$k]
|
||||
if [[ -n "${relevant_compose_repeatable_flags[(r)$k]}" ]]; then
|
||||
values=("${(@s/:/)opt_args[$k]}")
|
||||
for value in $values
|
||||
do
|
||||
compose_options+=$k
|
||||
compose_options+=$value
|
||||
done
|
||||
else
|
||||
compose_options+=$k
|
||||
if [[ -n "$opt_args[$k]" ]]; then
|
||||
compose_options+=$opt_args[$k]
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
@ -18,6 +18,7 @@ alias dcrm='docker-compose rm'
|
||||
alias dcr='docker-compose run'
|
||||
alias dcstop='docker-compose stop'
|
||||
alias dcup='docker-compose up'
|
||||
alias dcupd='docker-compose up -d'
|
||||
alias dcdn='docker-compose down'
|
||||
alias dcl='docker-compose logs'
|
||||
alias dclf='docker-compose logs -f'
|
||||
|
359
plugins/docker-machine/_docker-machine
Normal file
359
plugins/docker-machine/_docker-machine
Normal file
@ -0,0 +1,359 @@
|
||||
#compdef docker-machine
|
||||
# Description
|
||||
# -----------
|
||||
# zsh completion for docker-machine
|
||||
# https://github.com/leonhartX/docker-machine-zsh-completion
|
||||
# -------------------------------------------------------------------------
|
||||
# Version
|
||||
# -------
|
||||
# 0.1.1
|
||||
# -------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
# * Ke Xu <leonhartx.k@gmail.com>
|
||||
# -------------------------------------------------------------------------
|
||||
# Inspiration
|
||||
# -----------
|
||||
# * @sdurrheimer docker-compose-zsh-completion https://github.com/sdurrheimer/docker-compose-zsh-completion
|
||||
# * @ilkka _docker-machine
|
||||
|
||||
|
||||
__docker-machine_get_hosts() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
local state
|
||||
declare -a hosts
|
||||
state=$1; shift
|
||||
if [[ $state != all ]]; then
|
||||
hosts=(${(f)"$(_call_program commands docker-machine ls -q --filter state=$state)"})
|
||||
else
|
||||
hosts=(${(f)"$(_call_program commands docker-machine ls -q)"})
|
||||
fi
|
||||
_describe 'host' hosts "$@" && ret=0
|
||||
return ret
|
||||
}
|
||||
|
||||
__docker-machine_hosts_with_state() {
|
||||
declare -a hosts
|
||||
hosts=(${(f)"$(_call_program commands docker-machine ls -f '{{.Name}}\:{{.DriverName}}\({{.State}}\)\ {{.URL}}')"})
|
||||
_describe 'host' hosts
|
||||
}
|
||||
|
||||
__docker-machine_hosts_all() {
|
||||
__docker-machine_get_hosts all "$@"
|
||||
}
|
||||
|
||||
__docker-machine_hosts_running() {
|
||||
__docker-machine_get_hosts Running "$@"
|
||||
}
|
||||
|
||||
__docker-machine_get_swarm() {
|
||||
declare -a swarms
|
||||
swarms=(${(f)"$(_call_program commands docker-machine ls -f {{.Swarm}} | awk '{print $1}')"})
|
||||
_describe 'swarm' swarms
|
||||
}
|
||||
|
||||
__docker-machine_hosts_and_files() {
|
||||
_alternative "hosts:host:__docker-machine_hosts_all -qS ':'" 'files:files:_path_files'
|
||||
}
|
||||
|
||||
__docker-machine_filters() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
|
||||
if compset -P '*='; then
|
||||
case "${${words[-1]%=*}#*=}" in
|
||||
(driver)
|
||||
_describe -t driver-filter-opts "driver filter" opts_driver && ret=0
|
||||
;;
|
||||
(swarm)
|
||||
__docker-machine_get_swarm && ret=0
|
||||
;;
|
||||
(state)
|
||||
opts_state=('Running' 'Paused' 'Saved' 'Stopped' 'Stopping' 'Starting' 'Error')
|
||||
_describe -t state-filter-opts "state filter" opts_state && ret=0
|
||||
;;
|
||||
(name)
|
||||
__docker-machine_hosts_all && ret=0
|
||||
;;
|
||||
(label)
|
||||
_message 'label' && ret=0
|
||||
;;
|
||||
*)
|
||||
_message 'value' && ret=0
|
||||
;;
|
||||
esac
|
||||
else
|
||||
opts=('driver' 'swarm' 'state' 'name' 'label')
|
||||
_describe -t filter-opts "filter" opts -qS "=" && ret=0
|
||||
fi
|
||||
return ret
|
||||
}
|
||||
|
||||
__get_swarm_discovery() {
|
||||
declare -a masters serivces
|
||||
local service
|
||||
services=()
|
||||
masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}'))
|
||||
for master in $masters; do
|
||||
service=${${${(f)"$(_call_program commands docker-machine inspect -f '{{.HostOptions.SwarmOptions.Discovery}}:{{.Name}}' $master)"}/:/\\:}}
|
||||
services=($services $service)
|
||||
done
|
||||
_describe -t services "swarm service" services && ret=0
|
||||
return ret
|
||||
}
|
||||
|
||||
__get_create_argument() {
|
||||
typeset -g docker_machine_driver
|
||||
if [[ CURRENT -le 2 ]]; then
|
||||
docker_machine_driver="none"
|
||||
elif [[ CURRENT > 2 && $words[CURRENT-2] = '-d' || $words[CURRENT-2] = '--driver' ]]; then
|
||||
docker_machine_driver=$words[CURRENT-1]
|
||||
elif [[ $words[CURRENT-1] =~ '^(-d|--driver)=' ]]; then
|
||||
docker_machine_driver=${${words[CURRENT-1]}/*=/}
|
||||
fi
|
||||
local driver_opt_cmd
|
||||
local -a opts_provider opts_common opts_read_argument
|
||||
opts_read_argument=(
|
||||
": :->argument"
|
||||
)
|
||||
opts_common=(
|
||||
$opts_help \
|
||||
'(--driver -d)'{--driver=,-d=}'[Driver to create machine with]:dirver:->driver-option' \
|
||||
'--engine-install-url=[Custom URL to use for engine installation]:url' \
|
||||
'*--engine-opt=[Specify arbitrary flags to include with the created engine in the form flag=value]:flag' \
|
||||
'*--engine-insecure-registry=[Specify insecure registries to allow with the created engine]:registry' \
|
||||
'*--engine-registry-mirror=[Specify registry mirrors to use]:mirror' \
|
||||
'*--engine-label=[Specify labels for the created engine]:label' \
|
||||
'--engine-storage-driver=[Specify a storage driver to use with the engine]:storage-driver:->storage-driver-option' \
|
||||
'*--engine-env=[Specify environment variables to set in the engine]:environment' \
|
||||
'--swarm[Configure Machine with Swarm]' \
|
||||
'--swarm-image=[Specify Docker image to use for Swarm]:image' \
|
||||
'--swarm-master[Configure Machine to be a Swarm master]' \
|
||||
'--swarm-discovery=[Discovery service to use with Swarm]:service:->swarm-service' \
|
||||
'--swarm-strategy=[Define a default scheduling strategy for Swarm]:strategy:(spread binpack random)' \
|
||||
'*--swarm-opt=[Define arbitrary flags for swarm]:flag' \
|
||||
'*--swarm-join-opt=[Define arbitrary flags for Swarm join]:flag' \
|
||||
'--swarm-host=[ip/socket to listen on for Swarm master]:host' \
|
||||
'--swarm-addr=[addr to advertise for Swarm (default: detect and use the machine IP)]:address' \
|
||||
'--swarm-experimental[Enable Swarm experimental features]' \
|
||||
'*--tls-san=[Support extra SANs for TLS certs]:option'
|
||||
)
|
||||
driver_opt_cmd="docker-machine create -d $docker_machine_driver | grep $docker_machine_driver | sed -e 's/\(--.*\)\ *\[\1[^]]*\]/*\1/g' -e 's/\(\[[^]]*\)/\\\\\\1\\\\/g' -e 's/\".*\"\(.*\)/\1/g' | awk '{printf \"%s[\", \$1; for(i=2;i<=NF;i++) {printf \"%s \", \$i}; print \"]\"}'"
|
||||
if [[ $docker_machine_driver != "none" ]]; then
|
||||
opts_provider=(${(f)"$(_call_program commands $driver_opt_cmd)"})
|
||||
_arguments \
|
||||
$opts_provider \
|
||||
$opts_read_argument \
|
||||
$opts_common && ret=0
|
||||
else
|
||||
_arguments $opts_common && ret=0
|
||||
fi
|
||||
case $state in
|
||||
(driver-option)
|
||||
_describe -t driver-option "driver" opts_driver && ret=0
|
||||
;;
|
||||
(storage-driver-option)
|
||||
_describe -t storage-driver-option "storage driver" opts_storage_driver && ret=0
|
||||
;;
|
||||
(swarm-service)
|
||||
__get_swarm_discovery && ret=0
|
||||
;;
|
||||
(argument)
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
return ret
|
||||
}
|
||||
|
||||
|
||||
__docker-machine_subcommand() {
|
||||
local -a opts_help
|
||||
opts_help=("(- :)--help[Print usage]")
|
||||
local -a opts_only_host opts_driver opts_storage_driver opts_stragery
|
||||
opts_only_host=(
|
||||
"$opts_help"
|
||||
"*:host:__docker-machine_hosts_all"
|
||||
)
|
||||
opts_driver=('amazonec2' 'azure' 'digitalocean' 'exoscale' 'generic' 'google' 'hyperv' 'none' 'openstack' 'rackspace' 'softlayer' 'virtualbox' 'vmwarefusion' 'vmwarevcloudair' 'vmwarevsphere')
|
||||
opts_storage_driver=('overlay' 'aufs' 'btrfs' 'devicemapper' 'vfs' 'zfs')
|
||||
integer ret=1
|
||||
|
||||
case "$words[1]" in
|
||||
(active)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' && ret=0
|
||||
;;
|
||||
(config)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--swarm[Display the Swarm config instead of the Docker daemon]' \
|
||||
"*:host:__docker-machine_hosts_all" && ret=0
|
||||
;;
|
||||
(create)
|
||||
__get_create_argument
|
||||
;;
|
||||
(env)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--swarm[Display the Swarm config instead of the Docker daemon]' \
|
||||
'--shell=[Force environment to be configured for a specified shell: \[fish, cmd, powershell\], default is auto-detect]:shell' \
|
||||
'(--unset -u)'{--unset,-u}'[Unset variables instead of setting them]' \
|
||||
'--no-proxy[Add machine IP to NO_PROXY environment variable]' \
|
||||
'*:host:__docker-machine_hosts_running' && ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments ':subcommand:__docker-machine_commands' && ret=0
|
||||
;;
|
||||
(inspect)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--format -f)'{--format=,-f=}'[Format the output using the given go template]:template' \
|
||||
'*:host:__docker-machine_hosts_all' && ret=0
|
||||
;;
|
||||
(ip)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_running' && ret=0
|
||||
;;
|
||||
(kill)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(ls)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--quiet -q)'{--quiet,-q}'[Enable quiet mode]' \
|
||||
'*--filter=[Filter output based on conditions provided]:filter:->filter-options' \
|
||||
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' \
|
||||
'(--format -f)'{--format=,-f=}'[Pretty-print machines using a Go template]:template' && ret=0
|
||||
case $state in
|
||||
(filter-options)
|
||||
__docker-machine_filters && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(provision)
|
||||
_arguments $opts_only_host && ret=0
|
||||
;;
|
||||
(regenerate-certs)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--force -f)'{--force,-f}'[Force rebuild and do not prompt]' \
|
||||
'*:host:__docker-machine_hosts_all' && ret=0
|
||||
;;
|
||||
(restart)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(rm)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--force -f)'{--force,-f}'[Remove local configuration even if machine cannot be removed, also implies an automatic yes (`-y`)]' \
|
||||
'-y[Assumes automatic yes to proceed with remove, without prompting further user confirmation]' \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(scp)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--recursive -r)'{--recursive,-r}'[Copy files recursively (required to copy directories))]' \
|
||||
'*:files:__docker-machine_hosts_and_files' && ret=0
|
||||
;;
|
||||
(ssh)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_running' && ret=0
|
||||
;;
|
||||
(start)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(status)
|
||||
_arguments $opts_only_host && ret=0
|
||||
;;
|
||||
(stop)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(upgrade)
|
||||
_arguments $opts_only_host && ret=0
|
||||
;;
|
||||
(url)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_running' && ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
|
||||
__docker-machine_commands() {
|
||||
local cache_policy
|
||||
|
||||
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
|
||||
if [[ -z "$cache_policy" ]]; then
|
||||
zstyle ":completion:${curcontext}:" cache-policy __docker-machine_caching_policy
|
||||
fi
|
||||
|
||||
if ( [[ ${+_docker_machine_subcommands} -eq 0 ]] || _cache_invalid docker_machine_subcommands) \
|
||||
&& ! _retrieve_cache docker_machine_subcommands;
|
||||
then
|
||||
local -a lines
|
||||
lines=(${(f)"$(_call_program commands docker-machine 2>&1)"})
|
||||
_docker_machine_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/$'\t'##/:})
|
||||
(( $#_docker_machine_subcommands > 0 )) && _store_cache docker_machine_subcommands _docker_machine_subcommands
|
||||
fi
|
||||
_describe -t docker-machine-commands "docker-machine command" _docker_machine_subcommands
|
||||
}
|
||||
|
||||
__docker-machine_caching_policy() {
|
||||
oldp=( "$1"(Nmh+1) )
|
||||
(( $#oldp ))
|
||||
}
|
||||
|
||||
_docker-machine() {
|
||||
if [[ $service != docker-machine ]]; then
|
||||
_call_function - _$service
|
||||
return
|
||||
fi
|
||||
|
||||
local curcontext="$curcontext" state line
|
||||
integer ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
"(- :)"{-h,--help}"[Show help]" \
|
||||
"(-D --debug)"{-D,--debug}"[Enable debug mode]" \
|
||||
'(-s --stroage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \
|
||||
'--tls-ca-cert[CA to verify remotes against]:file:_files' \
|
||||
'--tls-ca-key[Private key to generate certificates]:file:_files' \
|
||||
'--tls-client-cert[Client cert to use for TLS]:file:_files' \
|
||||
'--tls-client-key[Private key used in client TLS auth]:file:_files' \
|
||||
'--github-api-token[Token to use for requests to the Github API]' \
|
||||
'--native-ssh[Use the native (Go-based) SSH implementation.]' \
|
||||
'--bugsnag-api-token[BugSnag API token for crash reporting]' \
|
||||
'(- :)'{-v,--version}'[Print the version]' \
|
||||
"(-): :->command" \
|
||||
"(-)*:: :->option-or-argument" && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
__docker-machine_commands && ret=0
|
||||
;;
|
||||
(option-or-argument)
|
||||
curcontext=${curcontext%:*:*}:docker-machine-$words[1]:
|
||||
__docker-machine_subcommand && ret=0
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_docker-machine "$@"
|
@ -431,7 +431,7 @@ __docker_complete_events_filter() {
|
||||
integer ret=1
|
||||
declare -a opts
|
||||
|
||||
opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'type' 'volume')
|
||||
opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'scope' 'type' 'volume')
|
||||
|
||||
if compset -P '*='; then
|
||||
case "${${words[-1]%=*}#*=}" in
|
||||
@ -450,9 +450,9 @@ __docker_complete_events_filter() {
|
||||
;;
|
||||
(event)
|
||||
local -a event_opts
|
||||
event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disconnect' 'exec_create' 'exec_detach'
|
||||
'exec_start' 'export' 'health_status' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start'
|
||||
'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update')
|
||||
event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disable' 'disconnect' 'enable' 'exec_create' 'exec_detach'
|
||||
'exec_start' 'export' 'health_status' 'import' 'install' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'remove' 'rename' 'resize'
|
||||
'restart' 'save' 'start' 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update')
|
||||
_describe -t event-filter-opts "event filter options" event_opts && ret=0
|
||||
;;
|
||||
(image)
|
||||
@ -461,6 +461,11 @@ __docker_complete_events_filter() {
|
||||
(network)
|
||||
__docker_complete_networks && ret=0
|
||||
;;
|
||||
(scope)
|
||||
local -a scope_opts
|
||||
scope_opts=('local' 'swarm')
|
||||
_describe -t scope-filter-opts "scope filter options" scope_opts && ret=0
|
||||
;;
|
||||
(type)
|
||||
local -a type_opts
|
||||
type_opts=('container' 'daemon' 'image' 'network' 'volume')
|
||||
@ -612,6 +617,7 @@ __docker_container_subcommand() {
|
||||
"($help)*--dns=[Custom DNS servers]:DNS server: "
|
||||
"($help)*--dns-option=[Custom DNS options]:DNS option: "
|
||||
"($help)*--dns-search=[Custom DNS search domains]:DNS domains: "
|
||||
"($help)*--domainname=[Container NIS domain name]:domainname:_hosts"
|
||||
"($help)*"{-e=,--env=}"[Environment variables]:environment variable: "
|
||||
"($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: "
|
||||
"($help)*--env-file=[Read environment variables from a file]:environment file:_files"
|
||||
@ -889,7 +895,7 @@ __docker_container_subcommand() {
|
||||
$opts_help \
|
||||
$opts_attach_exec_run_start \
|
||||
"($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \
|
||||
"($help -i --interactive)"{-i,--interactive}"[Attach container's stding]" \
|
||||
"($help -i --interactive)"{-i,--interactive}"[Attach container's stdin]" \
|
||||
"($help -)*:containers:__docker_complete_stopped_containers" && ret=0
|
||||
;;
|
||||
(stats)
|
||||
@ -923,7 +929,7 @@ __docker_container_subcommand() {
|
||||
local state
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
opts_create_run_update \
|
||||
$opts_create_run_update \
|
||||
"($help -)*: :->values" && ret=0
|
||||
case $state in
|
||||
(values)
|
||||
@ -2209,7 +2215,7 @@ __docker_stack_subcommand() {
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \
|
||||
"($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file]:compose file:_files -g \"*.(yml|yaml)\"" \
|
||||
"($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \
|
||||
"($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \
|
||||
"($help -):stack:__docker_complete_stacks" && ret=0
|
||||
;;
|
||||
@ -2280,6 +2286,9 @@ __docker_swarm_subcommand() {
|
||||
$opts_help \
|
||||
"($help)--advertise-addr=[Advertised address]:ip\:port: " \
|
||||
"($help)--data-path-addr=[Data path IP or interface]:ip " \
|
||||
"($help)--data-path-port=[Data Path Port]:port " \
|
||||
"($help)--default-addr-pool=[Default address pool]" \
|
||||
"($help)--default-addr-pool-mask-length=[Default address pool subnet mask length]" \
|
||||
"($help)--autolock[Enable manager autolocking]" \
|
||||
"($help)--availability=[Availability of the node]:availability:(active drain pause)" \
|
||||
"($help)--cert-expiry=[Validity period for node certificates]:duration: " \
|
||||
@ -3024,4 +3033,4 @@ _docker "$@"
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 4
|
||||
# End:
|
||||
# vim: ft=zsh sw=4 ts=4 et
|
||||
# vim: ft=zsh sw=4 ts=4 et
|
||||
|
9
plugins/doctl/README.md
Normal file
9
plugins/doctl/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Doctl
|
||||
|
||||
This plugin provides completion for [Doctl](https://github.com/digitalocean/doctl).
|
||||
|
||||
To use it add doctl to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... doctl)
|
||||
```
|
9
plugins/doctl/doctl.plugin.zsh
Normal file
9
plugins/doctl/doctl.plugin.zsh
Normal file
@ -0,0 +1,9 @@
|
||||
# Autocompletion for doctl, the command line tool for DigitalOcean service
|
||||
#
|
||||
# doctl project: https://github.com/digitalocean/doctl
|
||||
#
|
||||
# Author: https://github.com/HalisCz
|
||||
|
||||
if [ $commands[doctl] ]; then
|
||||
source <(doctl completion zsh)
|
||||
fi
|
@ -2,19 +2,19 @@
|
||||
|
||||
Automatically load your project ENV variables from `.env` file when you `cd` into project root directory.
|
||||
|
||||
Storing configuration in the environment is one of the tenets of a [twelve-factor app](http://www.12factor.net). Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables.
|
||||
Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables.
|
||||
|
||||
## Installation
|
||||
|
||||
Just add the plugin to your `.zshrc`:
|
||||
|
||||
```sh
|
||||
plugins=(git man dotenv)
|
||||
plugins=(... dotenv)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Create `.env` file inside your project directory and put your local ENV variables there.
|
||||
Create `.env` file inside your project root directory and put your ENV variables there.
|
||||
|
||||
For example:
|
||||
```sh
|
||||
@ -30,5 +30,16 @@ SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
|
||||
MONGO_URI=mongodb://127.0.0.1:27017
|
||||
PORT=3001
|
||||
```
|
||||
You can even mix both formats, although it's probably a bad idea.
|
||||
|
||||
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it supposed to be local only.
|
||||
## Version Control
|
||||
|
||||
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This plugin only sources the `.env` file. Nothing less, nothing more. It doesn't do any checks. It's designed to be the fastest and simplest option. You're responsible for the `.env` file content. You can put some code (or weird symbols) there, but do it on your own risk. `dotenv` is the basic tool, yet it does the job.
|
||||
|
||||
If you need more advanced and feature-rich ENV management, check out these awesome projects:
|
||||
* [direnv](https://github.com/direnv/direnv)
|
||||
* [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv)
|
||||
|
@ -1,10 +1,19 @@
|
||||
#!/bin/zsh
|
||||
|
||||
source_env() {
|
||||
if [[ -f .env ]]; then
|
||||
source .env
|
||||
# test .env syntax
|
||||
zsh -fn .env || echo 'dotenv: error when sourcing `.env` file' >&2
|
||||
|
||||
if [[ -o a ]]; then
|
||||
source .env
|
||||
else
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd source_env
|
||||
|
||||
source_env
|
||||
|
@ -16,4 +16,4 @@ Author: [Fabio Fernandes](https://github.com/fabiofl)
|
||||
|
||||
- Upload a file: `droplr ./path/to/file/`
|
||||
|
||||
- Shorten a link: `droplr http://example.com`
|
||||
- Shorten a link: `droplr https://example.com`
|
||||
|
83
plugins/drush/README.md
Normal file
83
plugins/drush/README.md
Normal file
@ -0,0 +1,83 @@
|
||||
# Drush
|
||||
|
||||
## Description
|
||||
This plugin offers aliases and functions to make the work with drush easier and more productive.
|
||||
|
||||
To enable it, add the `drush` to your `plugins` array in `~/.zshrc`:
|
||||
|
||||
```
|
||||
plugins=(... drush)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
| Alias | Description | Command |
|
||||
|-------|-----------------------------------------------------------------------|-----------------------------|
|
||||
| dr | Display drush help | drush |
|
||||
| drca | Clear all drupal caches. | drush cc all |
|
||||
| drcb | Clear block cache. | drush cc block |
|
||||
| drcg | Clear registry cache. | drush cc registry |
|
||||
| drcj | Clear css-js cache. | drush cc css-js |
|
||||
| drcm | Clear menu cache. | drush cc menu |
|
||||
| drcml | Clear module-list cache. | drush cc module-list |
|
||||
| drcr | Run all cron hooks in all active modules for specified site. | drush core-cron |
|
||||
| drct | Clear theme-registry cache. | drush cc theme-registry |
|
||||
| drcv | Clear views cache. (Make sure that the views module is enabled) | drush cc views |
|
||||
| drdmp | Backup database in a new dump.sql file | drush drush sql-dump --ordered-dump --result-file=dump.sql|
|
||||
| drf | Display features status | drush features |
|
||||
| drfr | Revert a feature module on your site. | drush features-revert -y |
|
||||
| drfu | Update a feature module on your site. | drush features-update -y |
|
||||
| drfra | Revert all enabled feature module on your site. | drush features-revert-all |
|
||||
| drif | Flush all derived images. | drush image-flush --all |
|
||||
| drpm | Show a list of available modules. | drush pm-list --type=module |
|
||||
| drst | Provides a birds-eye view of the current Drupal installation, if any. | drush core-status |
|
||||
| drup | Apply any database updates required (as with running update.php). | drush updatedb |
|
||||
| drups | List any pending database updates. | drush updatedb-status |
|
||||
| drv | Show drush version. | drush version |
|
||||
| drvd | Delete a variable. | drush variable-del |
|
||||
| drvg | Get a list of some or all site variables and values. | drush variable-get |
|
||||
| drvs | Set a variable. | drush variable-set |
|
||||
|
||||
## Functions
|
||||
|
||||
### dren
|
||||
Download and enable one or more extensions (modules or themes).
|
||||
Must be invoked with one or more parameters. e.g.:
|
||||
`dren devel` or `dren devel module_filter views`
|
||||
|
||||
### drf
|
||||
Edit drushrc, site alias, and Drupal settings.php files.
|
||||
Can be invoked with one or without parameters. e.g.:
|
||||
`drf 1`
|
||||
|
||||
### dris
|
||||
Disable one or more extensions (modules or themes)
|
||||
Must be invoked with one or more parameters. e.g.:
|
||||
`dris devel` or `dris devel module_filter views`
|
||||
|
||||
### drpu
|
||||
Uninstall one or more modules.
|
||||
Must be invoked with one or more parameters. e.g.:
|
||||
`drpu devel` or `drpu devel module_filter views`
|
||||
|
||||
### drnew
|
||||
Creates a brand new drupal website.
|
||||
Note: As soon as the installation is complete, drush will print a username and a random password into the terminal:
|
||||
```
|
||||
Installation complete. User name: admin User password: cf7t8yqNEm
|
||||
```
|
||||
|
||||
## Additional features
|
||||
|
||||
### Autocomplete
|
||||
The [completion script for drush](https://github.com/drush-ops/drush/blob/8.0.1/drush.complete.sh) comes enabled with this plugin.
|
||||
So, it is possible to type a command:
|
||||
```
|
||||
drush sql
|
||||
```
|
||||
|
||||
And as soon as the tab key is pressed, the script will display the available commands:
|
||||
```
|
||||
drush sql
|
||||
sqlc sql-conf sql-create sql-dump sql-query sql-sanitize
|
||||
sql-cli sql-connect sql-drop sqlq sqlsan sql-sync
|
||||
```
|
50
plugins/drush/drush.complete.sh
Normal file
50
plugins/drush/drush.complete.sh
Normal file
@ -0,0 +1,50 @@
|
||||
# BASH completion script for Drush.
|
||||
#
|
||||
# Place this in your /etc/bash_completion.d/ directory or source it from your
|
||||
# ~/.bash_completion or ~/.bash_profile files. Alternatively, source
|
||||
# examples/example.bashrc instead, as it will automatically find and source
|
||||
# this file.
|
||||
#
|
||||
# If you're using ZSH instead of BASH, add the following to your ~/.zshrc file
|
||||
# and source it.
|
||||
#
|
||||
# autoload bashcompinit
|
||||
# bashcompinit
|
||||
# source /path/to/your/drush.complete.sh
|
||||
|
||||
# Ensure drush is available.
|
||||
which drush > /dev/null || alias drush &> /dev/null || return
|
||||
|
||||
__drush_ps1() {
|
||||
f="${TMPDIR:-/tmp/}/drush-env-${USER}/drush-drupal-site-$$"
|
||||
if [ -f $f ]
|
||||
then
|
||||
__DRUPAL_SITE=$(cat "$f")
|
||||
else
|
||||
__DRUPAL_SITE="$DRUPAL_SITE"
|
||||
fi
|
||||
|
||||
# Set DRUSH_PS1_SHOWCOLORHINTS to a non-empty value and define a
|
||||
# __drush_ps1_colorize_alias() function for color hints in your Drush PS1
|
||||
# prompt. See example.prompt.sh for an example implementation.
|
||||
if [ -n "${__DRUPAL_SITE-}" ] && [ -n "${DRUSH_PS1_SHOWCOLORHINTS-}" ]; then
|
||||
__drush_ps1_colorize_alias
|
||||
fi
|
||||
|
||||
[[ -n "$__DRUPAL_SITE" ]] && printf "${1:- (%s)}" "$__DRUPAL_SITE"
|
||||
}
|
||||
|
||||
# Completion function, uses the "drush complete" command to retrieve
|
||||
# completions for a specific command line COMP_WORDS.
|
||||
_drush_completion() {
|
||||
# Set IFS to newline (locally), since we only use newline separators, and
|
||||
# need to retain spaces (or not) after completions.
|
||||
local IFS=$'\n'
|
||||
# The '< /dev/null' is a work around for a bug in php libedit stdin handling.
|
||||
# Note that libedit in place of libreadline in some distributions. See:
|
||||
# https://bugs.launchpad.net/ubuntu/+source/php5/+bug/322214
|
||||
COMPREPLY=( $(drush --early=includes/complete.inc "${COMP_WORDS[@]}" < /dev/null 2> /dev/null) )
|
||||
}
|
||||
|
||||
# Register our completion function. We include common short aliases for Drush.
|
||||
complete -o bashdefault -o default -o nospace -F _drush_completion d dr drush drush5 drush6 drush7 drush8 drush.php
|
104
plugins/drush/drush.plugin.zsh
Normal file
104
plugins/drush/drush.plugin.zsh
Normal file
@ -0,0 +1,104 @@
|
||||
# Drush support.
|
||||
|
||||
function dren() {
|
||||
drush en $@ -y
|
||||
}
|
||||
|
||||
function dris() {
|
||||
drush pm-disable $@ -y
|
||||
}
|
||||
|
||||
function drpu() {
|
||||
drush pm-uninstall $@ -y
|
||||
}
|
||||
|
||||
function drf() {
|
||||
if [[ $1 == "" ]] then
|
||||
drush core-config
|
||||
else
|
||||
drush core-config --choice=$1
|
||||
fi
|
||||
}
|
||||
|
||||
function drfi() {
|
||||
if [[ $1 == "fields" ]]; then
|
||||
drush field-info fields
|
||||
elif [[ $1 == "types" ]]; then
|
||||
drush field-info types
|
||||
else
|
||||
drush field-info
|
||||
fi
|
||||
}
|
||||
|
||||
function drnew() {
|
||||
|
||||
cd ~
|
||||
echo "Website's name: "
|
||||
read WEBSITE_NAME
|
||||
|
||||
HOST=http://$(hostname -i)/
|
||||
|
||||
if [[ $WEBSITE_NAME == "" ]] then
|
||||
MINUTES=$(date +%M:%S)
|
||||
WEBSITE_NAME="Drupal-$MINUTES"
|
||||
echo "Your website will be named: $WEBSITE_NAME"
|
||||
fi
|
||||
|
||||
drush dl drupal --drupal-project-rename=$WEBSITE_NAME
|
||||
|
||||
echo "Type your localhost directory: (Leave empty for /var/www/html/)"
|
||||
read DIRECTORY
|
||||
|
||||
if [[ $DIRECTORY == "" ]] then
|
||||
DIRECTORY="/var/www/html/"
|
||||
fi
|
||||
|
||||
echo "Moving to $DIRECTORY$WEBSITE_NAME"
|
||||
sudo mv $WEBSITE_NAME $DIRECTORY
|
||||
cd $DIRECTORY$WEBSITE_NAME
|
||||
|
||||
echo "Database's user: "
|
||||
read DATABASE_USR
|
||||
echo "Database's password: "
|
||||
read -s DATABASE_PWD
|
||||
echo "Database's name for your project: "
|
||||
read DATABASE
|
||||
|
||||
DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE"
|
||||
drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME
|
||||
|
||||
open_command $HOST$WEBSITE_NAME
|
||||
echo "Done"
|
||||
|
||||
}
|
||||
|
||||
# Aliases, sorted alphabetically.
|
||||
alias dr="drush"
|
||||
alias drca="drush cc all" # Deprecated for Drush 8
|
||||
alias drcb="drush cc block" # Deprecated for Drush 8
|
||||
alias drcg="drush cc registry" # Deprecated for Drush 8
|
||||
alias drcj="drush cc css-js"
|
||||
alias drcm="drush cc menu"
|
||||
alias drcml="drush cc module-list"
|
||||
alias drcr="drush core-cron"
|
||||
alias drct="drush cc theme-registry"
|
||||
alias drcv="drush cc views"
|
||||
alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql"
|
||||
alias drf="drush features"
|
||||
alias drfr="drush features-revert -y"
|
||||
alias drfu="drush features-update -y"
|
||||
alias drfra="drush features-revert-all"
|
||||
alias drif="drush image-flush --all"
|
||||
alias drpm="drush pm-list --type=module"
|
||||
alias drst="drush core-status"
|
||||
alias drup="drush updatedb"
|
||||
alias drups="drush updatedb-status"
|
||||
alias drv="drush version"
|
||||
alias drvd="drush variable-del"
|
||||
alias drvg="drush variable-get"
|
||||
alias drvs="drush variable-set"
|
||||
|
||||
# Enable drush autocomplete support
|
||||
autoload bashcompinit
|
||||
bashcompinit
|
||||
source $(dirname $0)/drush.complete.sh
|
30
plugins/emacs/README.md
Normal file
30
plugins/emacs/README.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Emacs plugin
|
||||
|
||||
This plugin utilizes the Emacs daemon capability, allowing the user to quickly open frames, whether they are opened in a terminal via a ssh connection, or X frames opened on the same host. The plugin also provides some aliases for such operations.
|
||||
|
||||
- You don't have the cost of starting Emacs all the time anymore
|
||||
- Opening a file is as fast as Emacs does not have anything else to do.
|
||||
- You can share opened buffered across opened frames.
|
||||
- Configuration changes made at runtime are applied to all frames.
|
||||
|
||||
**NOTE:** requires Emacs 24 and newer.
|
||||
|
||||
To use it, add emacs to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... emacs)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that is just a wrapper around [`emacsclient`](https://www.emacswiki.org/emacs/EmacsClient).
|
||||
|
||||
| Alias | Command | Description |
|
||||
|--------|----------------------------------------------------|----------------------------------------------------------------|
|
||||
| emacs | `$EMACS_LAUNCHER --no-wait` | Opens a temporary emacsclient frame |
|
||||
| e | `emacs` | Same as emacs alias |
|
||||
| te | `$EMACS_LAUNCHER -nw` | Open terminal emacsclient |
|
||||
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
|
||||
| eframe | `emacsclient --alternate-editor "" --create-frame` | Create new X frame |
|
||||
| efile | - | Print the path to the file open in the current buffer |
|
||||
| ecd | - | Print the directory of the file open in the the current buffer |
|
@ -10,7 +10,7 @@
|
||||
# - Configuration changes made at runtime are applied to all frames.
|
||||
|
||||
|
||||
if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then
|
||||
if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
|
||||
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
|
||||
|
||||
# set EDITOR if not already defined.
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Ember CLI
|
||||
|
||||
**Maintainers:** [BilalBudhani](http://www.github.com/BilalBudhani), [eubenesa](http://www.github.com/eubenesa)
|
||||
**Maintainers:** [BilalBudhani](https://github.com/BilalBudhani), [eubenesa](https://github.com/eubenesa), [scottkidder](https://github.com/scottkidder]
|
||||
|
||||
Ember CLI (http://www.ember-cli.com/)
|
||||
Ember CLI (https://www.ember-cli.com/)
|
||||
|
||||
### List of Aliases
|
||||
|
||||
@ -17,5 +17,6 @@ Alias | Ember-CLI command
|
||||
**ein** | *ember init*
|
||||
**ei** | *ember install*
|
||||
**et** | *ember test*
|
||||
**ets** | *ember test --serve*
|
||||
**eu** | *ember update*
|
||||
**ev** | *ember version*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user