Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ev0rtex committed Feb 9, 2019
2 parents 5d3eea6 + 5336436 commit c3d655f
Show file tree
Hide file tree
Showing 16 changed files with 255 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://help.github.com/articles/about-codeowners/

* @zplug/maintainer
55 changes: 55 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Bug report
about: Create a report to help us improve

---

<!--
**Before Submitting**
Please read this instructions carefully!
1. If it is not reported according to this issue template, it may be closed unconditionally
2. In accordance with "Issue Type", you should uncomment below "EDITING AREA" corresponding the part
3. You checked the [FAQ](https://github.com/zplug/zplug/wiki/FAQ) for common problems.
4. Check your [requirements](https://github.com/zplug/zplug/wiki/FAQ#what-are-the-requirements) are satisfied.
-->

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Env (please complete the following information):**
- `zplug version`:
- `zsh --version`:
- `uname -a`:

**Minimal zshrc (with less than 30 lines)**

Create a minimal reproducing set of configurations for this issue. Please remove all unnecessary parts!

```zsh
source ~/.zplug/init.zsh

#zplug "foo/bar", tag:baz
#zplug "...

if zplug check || zplug install; then
zplug load --verbose
fi
```

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ zcompdump.zwc
# OS X
.DS_Store
**/.DS_Store

.ssh
22 changes: 22 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Sample zshrc

ZPLUG_SUDO_PASSWORD=
ZPLUG_PROTOCOL=ssh

source $HOME/.zplug/init.zsh

zplug "b4b4r07/ultimate", as:theme
zplug 'b4b4r07/zplug-doctor', lazy:yes
zplug 'b4b4r07/zplug-cd', lazy:yes
zplug 'b4b4r07/zplug-rm', lazy:yes

if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
echo
fi

zplug load

25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:xenial

RUN apt update && apt-get install -y software-properties-common && \
add-apt-repository -y ppa:jonathonf/vim && \
apt-get update && apt-get install -y locales build-essential openssh-server git vim zsh tmux curl unzip sudo && \
rm -rf /var/lib/apt/lists/*

RUN locale-gen en_US.UTF-8

RUN groupadd -g 1000 zplug && \
useradd -g zplug -G sudo -m -s /bin/zsh zplug && \
echo 'zplug:zplug' | chpasswd

# .ssh dir needs to be copied from your home
ADD .ssh /home/zplug/.ssh

ADD . /home/zplug/.zplug

RUN chown -R zplug:zplug /home/zplug
RUN chmod 600 /home/zplug/.ssh/id_rsa

USER zplug
WORKDIR /home/zplug

CMD ["/bin/zsh"]
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ latest | stable
### The best way

```console
$ curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh| zsh
$ curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
```

If you wonder this installation, please check it out:

- [zplug/installer](https://github.com/zplug/installer/blob/master/installer.zsh)
Curious about the installation script? Check it out at [zplug/installer](https://github.com/zplug/installer/blob/master/installer.zsh).

### Using [Homebrew](https://github.com/Homebrew/brew) (OS X)

Expand Down Expand Up @@ -253,8 +251,8 @@ All that's left is to run `zplug update`.
| `rename-to` | Specify the filename you want to rename the command to (use this only with `as:command`) | *filename* (-) | `rename-to:fzf` |
| `dir` | Installed directory of the package | **READ ONLY** | `dir:/path/to/user/repo` |
| `if` | Specify the conditions under which to install and use the package | *boolean* (-) | `if:"[ -d ~/.zsh ]"` |
| `hook-build` | Commands to after installation/update | *commands* (-) | `hook-build:"make install"` |
| `hook-load` | Commands to after loading | *commands* (-) | `hook-load:"echo 'Loaded!'"` |
| `hook-build` | Commands to run after installation/update | *commands* (-) | `hook-build:"make install"` |
| `hook-load` | Commands to run after loading | *commands* (-) | `hook-load:"echo 'Loaded!'"` |
| `frozen` | Do not update unless explicitly specified | truthy,falsy (false) | `frozen:1` |
| `on` | Load this package only if a different package is installed | *package* | `on:user/repo` |
| `defer` | Defers the loading of a package. If the value is 2 or above, zplug will source the plugin after `compinit` (see also [#26](https://github.com/zplug/zplug/issues/26)) | 0..3 (0) | `defer:2` |
Expand Down Expand Up @@ -350,6 +348,14 @@ Defaults to `$ZPLUG_HOME/repos`. You can change where the repositories are clone

Defaults to `''`. You can set sudo password for zplug's `hook-build` tag. However, this variable should not be managed in dotfiles and so on.

#### `ZPLUG_LOG_LOAD_SUCCESS`

Defaults to `false`. If true, zplug spit the log about its success operation out to file (you can see it with `zplug --log`).

#### `ZPLUG_LOG_LOAD_FAILURE`

Defaults to `false`. If true, zplug spit the log about its failure operation out to file (you can see it with `zplug --log`).

```zsh
# your .zshrc
source ~/.zshrc_secret
Expand Down
89 changes: 89 additions & 0 deletions autoload/commands/__help__
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env zsh
# Description:
# Display the help message

local f arg
local -a fs args

local -A opts cmds
local obj opt cmd
local -i max=0

while (( $# > 0 ))
do
arg="$1"
case "$arg" in
-*|--*)
break
;;
"")
;;
*)
fs=( "$(echo $ZPLUG_HOME/doc/man/man(1|5)/(zplug-|)${arg}.(1|5)(N))" )
# Non-existing man page
if [[ $fs[1] == "" ]]; then
__zplug::io::print::f \
--die \
--zplug \
"$arg: no such subcommand or tag\n"
return 1
fi
# List all hits pages
for f in "${fs[@]}"
do
if [[ -f $f ]]; then
args+=( "$f" )
fi
done
;;
esac
shift
done

if (( $#args > 0 )); then
man "${args[@]}"
return $status
fi

# Measure max length
{
cmds=( "${(kv)_zplug_commands[@]}" )
for opt in "${(k)_zplug_options[@]}"
do
opts[--$opt]="$_zplug_options[$opt]"
done

for obj in "${(k)cmds[@]}" "${(k)opts[@]}"
do
if (( $#obj > $max )); then
max=$#obj
fi
done
}

# Help message format
{
printf "usage: zplug [OPTIONS] [COMMANDS [options] [args]]\n"
printf " zplug is a next-generation plugin manager for zsh\n"

for obj in \
OPTIONS "${(k)opts[@]}" \
COMMANDS "${(k)cmds[@]}"; do \
case "$obj" in
OPTIONS | COMMANDS)
printf "\n$obj:\n"
;;
*)
desc="(None)"
[[ -n $opts[$obj] ]] && desc="$opts[$obj]"
[[ -n $cmds[$obj] ]] && desc="$cmds[$obj]"
printf " %-${max}s %s\n" \
"$obj" \
"$desc"
;;
esac
done
printf "\n"
} >&2

return 0
2 changes: 1 addition & 1 deletion autoload/options/__help__
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ fi
printf "\n"
} >&2

return 1
return 0
2 changes: 1 addition & 1 deletion autoload/zplug
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ case "$arg" in
__zplug::core::options::parse "$argv[@]"
;;

check | install | update | list | clean | status | clear | load | info)
check | install | update | list | clean | status | clear | load | info | help)
shift
__zplug::core::core::run_interfaces \
"$arg" \
Expand Down
2 changes: 1 addition & 1 deletion base/base/base.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ __zplug::base::base::git_version()
fi

__zplug::base::base::version_requirement \
${(M)${(z)"$(git --version)"}:#[0-9]*[0-9]} ">" "${@:?}"
${(M)${(z)"$(git --version|head -1)"}:#[0-9]*[0-9]} ">" "${@:?}"
return $status
}

Expand Down
5 changes: 4 additions & 1 deletion base/core/core.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ __zplug::core::core::prepare()

# Add to the PATH
path=(
${ZPLUG_BIN:-"$ZPLUG_ROOT/bin"}
${ZPLUG_ROOT:+"$ZPLUG_ROOT/bin"}
${ZPLUG_BIN:-${ZPLUG_HOME:+"$ZPLUG_HOME/bin"}}
"$path[@]"
)

Expand Down Expand Up @@ -170,6 +171,8 @@ __zplug::core::core::variable()
typeset -gx ZPLUG_SUDO_PASSWORD

typeset -gx ZPLUG_ERROR_LOG=${ZPLUG_ERROR_LOG:-$ZPLUG_HOME/.error_log}
typeset -gx ZPLUG_LOG_LOAD_SUCCESS=${ZPLUG_LOG_LOAD_SUCCESS:-false}
typeset -gx ZPLUG_LOG_LOAD_FAILURE=${ZPLUG_LOG_LOAD_FAILURE:-false}

typeset -gx ZPLUG_BIN=${ZPLUG_BIN:-$ZPLUG_HOME/bin}
typeset -gx ZPLUG_CACHE_DIR=${ZPLUG_CACHE_DIR:-$ZPLUG_HOME/cache}
Expand Down
12 changes: 6 additions & 6 deletions base/core/load.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ __zplug::core::load::prepare()
setopt nomonitor
zstyle ':zplug:core:load' 'verbose' no

__zplug::io::file::rm_touch "$_zplug_load_log[success]"
__zplug::io::file::rm_touch "$_zplug_load_log[failure]"
$ZPLUG_LOG_LOAD_SUCCESS && __zplug::io::file::rm_touch "$_zplug_load_log[success]"
$ZPLUG_LOG_LOAD_FAILURE && __zplug::io::file::rm_touch "$_zplug_load_log[failure]"
}

__zplug::core::load::from_cache()
Expand Down Expand Up @@ -121,9 +121,9 @@ __zplug::core::load::as_plugin()
if [[ -n $hook ]]; then
eval ${=hook}
fi
__zplug::job::handle::flock "$_zplug_load_log[success]" "$repo"
$ZPLUG_LOG_LOAD_SUCCESS && __zplug::job::handle::flock "$_zplug_load_log[success]" "$repo"
else
__zplug::job::handle::flock "$_zplug_load_log[failure]" "$repo"
$ZPLUG_LOG_LOAD_FAILURE && __zplug::job::handle::flock "$_zplug_load_log[failure]" "$repo"
fi

return $status_code
Expand Down Expand Up @@ -176,9 +176,9 @@ __zplug::core::load::as_command()
if [[ -n $hook ]]; then
eval ${=hook}
fi
__zplug::job::handle::flock "$_zplug_load_log[success]" "$repo"
$ZPLUG_LOG_LOAD_SUCCESS && __zplug::job::handle::flock "$_zplug_load_log[success]" "$repo"
else
__zplug::job::handle::flock "$_zplug_load_log[failure]" "$repo"
$ZPLUG_LOG_LOAD_FAILURE && __zplug::job::handle::flock "$_zplug_load_log[failure]" "$repo"
fi

return $status_code
Expand Down
9 changes: 9 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

cp -R ~/.ssh .ssh

docker build -t zplug -f Dockerfile .

rm -rf .ssh
2 changes: 1 addition & 1 deletion misc/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ zplug clear
as:command, \
use:"bin/{histuniq,color}"
# theme
zplug "S1cK94/minimal", \
zplug "b4b4r07/ultimate", \
as:theme

tests+=(
Expand Down
7 changes: 7 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

zshrc_path=${1:-${PWD}/.zshrc}

docker run --rm -v $zshrc_path:/home/zplug/.zshrc -it zplug

0 comments on commit c3d655f

Please sign in to comment.