aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CODE_OF_CONDUCT.md46
-rw-r--r--TESTS.md33
-rw-r--r--docker/antibody/Dockerfile8
-rw-r--r--docker/antibody/install.zsh1
-rw-r--r--docker/antibody/zshrc2
-rw-r--r--docker/antigen/Dockerfile8
-rw-r--r--docker/antigen/install.zsh12
-rw-r--r--docker/antigen/zshrc4
-rw-r--r--docker/base-4.3.11/Dockerfile31
-rw-r--r--docker/base-5.0.3/Dockerfile33
-rw-r--r--docker/base-5.1.1/Dockerfile35
-rw-r--r--docker/base-5.2/Dockerfile35
-rw-r--r--docker/dotfile/Dockerfile5
-rw-r--r--docker/dotfile/zshrc1
-rw-r--r--docker/fred-sudoers2
-rw-r--r--docker/omz/Dockerfile8
-rw-r--r--docker/omz/install.zsh4
-rw-r--r--docker/omz/zshrc5
-rw-r--r--docker/prezto/Dockerfile7
-rw-r--r--docker/prezto/install.zsh18
-rw-r--r--docker/zgen/Dockerfile8
-rw-r--r--docker/zgen/install.zsh5
-rw-r--r--docker/zgen/zshrc10
-rw-r--r--docker/zim/Dockerfile7
-rw-r--r--docker/zim/install.zsh21
-rw-r--r--docker/zplug/Dockerfile8
-rw-r--r--docker/zplug/install.zsh5
-rw-r--r--docker/zplug/zshrc5
-rw-r--r--docker/zplugin/Dockerfile8
-rw-r--r--docker/zplugin/install.zsh12
-rw-r--r--docker/zplugin/zshrc.plugins5
-rw-r--r--docker/zpm/Dockerfile8
-rw-r--r--docker/zpm/install.zsh6
-rw-r--r--docker/zpm/zshrc3
-rw-r--r--docker/zulu/Dockerfile7
-rw-r--r--docker/zulu/install.zsh10
-rw-r--r--functions/icons.zsh4
-rwxr-xr-xpowerlevel9k.zsh-theme71
-rwxr-xr-xtest-in-docker179
-rwxr-xr-xtest/segments/go_version.spec4
40 files changed, 636 insertions, 48 deletions
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..22c9ebb4
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,46 @@
+# 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.
+
+## 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 both within project spaces and in public spaces when an individual is representing the project or its community. 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 bhilburn@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems 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 [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/TESTS.md b/TESTS.md
index d51051c5..eb5db704 100644
--- a/TESTS.md
+++ b/TESTS.md
@@ -13,10 +13,37 @@ Tests in separate files under `test/functions`.
These Tests tend to be more complex in setup than the basic tests. To avoid ending
up in a huge single file, there is one file per segment in `test/segments`.
-# Test-VMs
+# Manual Testing
If unit tests are not sufficient (e.g. you have an issue with your prompt that
-occurs only in a specific ZSH framework), then you could use our Test-VMs!
+occurs only in a specific ZSH framework) then you can use either Docker or
+or our Vagrant.
+
+## Docker
+
+This is the easiest to use _if_ you have Docker already installed and running.
+
+The command `./test-in-docker` should make it fairly easy to get into a running
+container with the framework of your choice.
+
+Examples:
+
+``` zsh
+# Test Antigen with the oldest version of ZSH
+$ ./test-in-docker antigen
+```
+
+``` zsh
+# Test Prezto with ZSH version 5.2
+$ ./test-in-docker --zsh 5.2 prezto
+```
+
+You can get Docker at <https://www.docker.com/community-edition>.
+
+**Note:** Not all frameworks work with all versions of ZSH (or the underlying OS).
+
+## Vagrant
+
Currently there are two test VMs. `test-vm` is an Ubuntu machine with several
pre-installed ZSH frameworks. And there is `test-bsd-vm` which is a FreeBSD!
-For how to run the machines see [here](test-vm/README.md). \ No newline at end of file
+For how to run the machines see [here](test-vm/README.md).
diff --git a/docker/antibody/Dockerfile b/docker/antibody/Dockerfile
new file mode 100644
index 00000000..84a60a89
--- /dev/null
+++ b/docker/antibody/Dockerfile
@@ -0,0 +1,8 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/antibody/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY ./ p9k/
+COPY docker/antibody/zshrc .zshrc
diff --git a/docker/antibody/install.zsh b/docker/antibody/install.zsh
new file mode 100644
index 00000000..4c54fa68
--- /dev/null
+++ b/docker/antibody/install.zsh
@@ -0,0 +1 @@
+curl -sL https://git.io/antibody | bash -s
diff --git a/docker/antibody/zshrc b/docker/antibody/zshrc
new file mode 100644
index 00000000..d516b679
--- /dev/null
+++ b/docker/antibody/zshrc
@@ -0,0 +1,2 @@
+source <(antibody init)
+antibody bundle ~/p9k/
diff --git a/docker/antigen/Dockerfile b/docker/antigen/Dockerfile
new file mode 100644
index 00000000..d8d0a4bc
--- /dev/null
+++ b/docker/antigen/Dockerfile
@@ -0,0 +1,8 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/antigen/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY ./ p9k/
+COPY docker/antigen/zshrc .zshrc
diff --git a/docker/antigen/install.zsh b/docker/antigen/install.zsh
new file mode 100644
index 00000000..6bab8ab3
--- /dev/null
+++ b/docker/antigen/install.zsh
@@ -0,0 +1,12 @@
+#!/bin/zsh
+
+mkdir ~/antigen
+
+curl \
+ -qLsSf \
+ -o ~/antigen/antigen.zsh \
+ https://git.io/antigen
+
+source ~/antigen/antigen.zsh
+
+# EOF
diff --git a/docker/antigen/zshrc b/docker/antigen/zshrc
new file mode 100644
index 00000000..0f8d4da4
--- /dev/null
+++ b/docker/antigen/zshrc
@@ -0,0 +1,4 @@
+source ~/antigen/antigen.zsh
+
+antigen theme "${HOME}/p9k" powerlevel9k --no-local-clone
+antigen apply
diff --git a/docker/base-4.3.11/Dockerfile b/docker/base-4.3.11/Dockerfile
new file mode 100644
index 00000000..805a7ae1
--- /dev/null
+++ b/docker/base-4.3.11/Dockerfile
@@ -0,0 +1,31 @@
+FROM centos:6
+
+RUN \
+ yum install -y \
+ curl \
+ git \
+ zsh \
+ mercurial \
+ subversion \
+ golang \
+ jq \
+ node \
+ ruby \
+ python \
+ python-virtualenv \
+ sudo
+
+RUN adduser --shell /bin/zsh --comment 'fred' --user-group fred
+
+COPY docker/fred-sudoers /etc/sudoers.d/fred
+
+USER fred
+WORKDIR /home/fred
+ENV LANG=en_US.UTF-8
+ENV TERM=xterm-256color
+ENV DEFAULT_USER=fred
+ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
+
+RUN touch .zshrc
+
+CMD ["/bin/zsh", "-l"]
diff --git a/docker/base-5.0.3/Dockerfile b/docker/base-5.0.3/Dockerfile
new file mode 100644
index 00000000..e0b6c6c3
--- /dev/null
+++ b/docker/base-5.0.3/Dockerfile
@@ -0,0 +1,33 @@
+FROM ubuntu:14.04
+
+RUN \
+ apt-get update && \
+ echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ curl \
+ git \
+ zsh \
+ mercurial \
+ subversion \
+ golang \
+ jq \
+ node \
+ ruby \
+ python \
+ python-virtualenv
+
+RUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred
+RUN locale-gen "en_US.UTF-8"
+
+COPY docker/fred-sudoers /etc/sudoers.d/fred
+
+USER fred
+WORKDIR /home/fred
+ENV LANG=en_US.UTF-8
+ENV TERM=xterm-256color
+ENV DEFAULT_USER=fred
+ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
+
+RUN touch .zshrc
+
+CMD ["/bin/zsh", "-l"]
diff --git a/docker/base-5.1.1/Dockerfile b/docker/base-5.1.1/Dockerfile
new file mode 100644
index 00000000..a7f644bf
--- /dev/null
+++ b/docker/base-5.1.1/Dockerfile
@@ -0,0 +1,35 @@
+FROM ubuntu:16.04
+
+RUN \
+ apt-get update && \
+ echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ curl \
+ git \
+ zsh \
+ mercurial \
+ subversion \
+ golang \
+ jq \
+ nodejs \
+ ruby \
+ python \
+ python-virtualenv \
+ sudo \
+ locales
+
+RUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred
+RUN locale-gen "en_US.UTF-8"
+
+COPY docker/fred-sudoers /etc/sudoers.d/fred
+
+USER fred
+WORKDIR /home/fred
+ENV LANG=en_US.UTF-8
+ENV TERM=xterm-256color
+ENV DEFAULT_USER=fred
+ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
+
+RUN touch .zshrc
+
+CMD ["/bin/zsh", "-l"]
diff --git a/docker/base-5.2/Dockerfile b/docker/base-5.2/Dockerfile
new file mode 100644
index 00000000..62a10074
--- /dev/null
+++ b/docker/base-5.2/Dockerfile
@@ -0,0 +1,35 @@
+FROM ubuntu:17.04
+
+RUN \
+ apt-get update && \
+ echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ curl \
+ git \
+ zsh \
+ mercurial \
+ subversion \
+ golang \
+ jq \
+ nodejs \
+ ruby \
+ python \
+ python-virtualenv \
+ sudo \
+ locales
+
+RUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred
+RUN locale-gen "en_US.UTF-8"
+
+COPY docker/fred-sudoers /etc/sudoers.d/fred
+
+USER fred
+WORKDIR /home/fred
+ENV LANG=en_US.UTF-8
+ENV TERM=xterm-256color
+ENV DEFAULT_USER=fred
+ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
+
+RUN touch .zshrc
+
+CMD ["/bin/zsh", "-l"]
diff --git a/docker/dotfile/Dockerfile b/docker/dotfile/Dockerfile
new file mode 100644
index 00000000..f29c4d56
--- /dev/null
+++ b/docker/dotfile/Dockerfile
@@ -0,0 +1,5 @@
+ARG base
+FROM p9k:${base}
+
+COPY ./ p9k/
+COPY docker/dotfile/zshrc .zshrc
diff --git a/docker/dotfile/zshrc b/docker/dotfile/zshrc
new file mode 100644
index 00000000..382b84a8
--- /dev/null
+++ b/docker/dotfile/zshrc
@@ -0,0 +1 @@
+source "${HOME}/p9k/prompt_powerlevel9k_setup"
diff --git a/docker/fred-sudoers b/docker/fred-sudoers
new file mode 100644
index 00000000..5fcd646f
--- /dev/null
+++ b/docker/fred-sudoers
@@ -0,0 +1,2 @@
+Defaults:fred !requiretty
+fred ALL=(ALL) NOPASSWD: ALL
diff --git a/docker/omz/Dockerfile b/docker/omz/Dockerfile
new file mode 100644
index 00000000..1a417b9f
--- /dev/null
+++ b/docker/omz/Dockerfile
@@ -0,0 +1,8 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/omz/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY docker/omz/zshrc .zshrc
+COPY ./ p9k/
diff --git a/docker/omz/install.zsh b/docker/omz/install.zsh
new file mode 100644
index 00000000..e2cdfa96
--- /dev/null
+++ b/docker/omz/install.zsh
@@ -0,0 +1,4 @@
+sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
+
+mkdir -p ~/.oh-my-zsh/custom/themes
+ln -nsf ~/p9k/ ~/.oh-my-zsh/custom/themes/powerlevel9k
diff --git a/docker/omz/zshrc b/docker/omz/zshrc
new file mode 100644
index 00000000..9e798e2d
--- /dev/null
+++ b/docker/omz/zshrc
@@ -0,0 +1,5 @@
+export ZSH=$HOME/.oh-my-zsh
+ZSH_THEME="powerlevel9k/powerlevel9k"
+plugins=(git rake ruby)
+
+source $ZSH/oh-my-zsh.sh
diff --git a/docker/prezto/Dockerfile b/docker/prezto/Dockerfile
new file mode 100644
index 00000000..70f3b65d
--- /dev/null
+++ b/docker/prezto/Dockerfile
@@ -0,0 +1,7 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/prezto/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY ./ p9k/
diff --git a/docker/prezto/install.zsh b/docker/prezto/install.zsh
new file mode 100644
index 00000000..9cca57ed
--- /dev/null
+++ b/docker/prezto/install.zsh
@@ -0,0 +1,18 @@
+#!/bin/zsh
+
+set -eu
+
+git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
+
+setopt EXTENDED_GLOB
+for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
+ ln -nsf "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
+done
+
+ln -s "${HOME}/p9k/powerlevel9k.zsh-theme" \
+ "${HOME}/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup"
+
+echo "zstyle ':prezto:module:prompt' theme 'powerlevel9k'" \
+ >> "${HOME}/.zpreztorc"
+
+# EOF
diff --git a/docker/zgen/Dockerfile b/docker/zgen/Dockerfile
new file mode 100644
index 00000000..48e44c77
--- /dev/null
+++ b/docker/zgen/Dockerfile
@@ -0,0 +1,8 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/zgen/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY ./ p9k/
+COPY docker/zgen/zshrc .zshrc
diff --git a/docker/zgen/install.zsh b/docker/zgen/install.zsh
new file mode 100644
index 00000000..5cdc6181
--- /dev/null
+++ b/docker/zgen/install.zsh
@@ -0,0 +1,5 @@
+#!/bin/zsh
+
+git clone https://github.com/tarjoilija/zgen.git "${HOME}/.zgen"
+
+# EOF
diff --git a/docker/zgen/zshrc b/docker/zgen/zshrc
new file mode 100644
index 00000000..1fcb75b9
--- /dev/null
+++ b/docker/zgen/zshrc
@@ -0,0 +1,10 @@
+# load zgen
+source ~/.zgen/zgen.zsh
+
+# if the init scipt doesn't exist
+if ! zgen saved; then
+ zgen load ~/p9k/powerlevel9k.zsh-theme
+
+ # generate the init script from plugins above
+ zgen save
+fi
diff --git a/docker/zim/Dockerfile b/docker/zim/Dockerfile
new file mode 100644
index 00000000..cfe0fc93
--- /dev/null
+++ b/docker/zim/Dockerfile
@@ -0,0 +1,7 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/zim/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY ./ p9k/
diff --git a/docker/zim/install.zsh b/docker/zim/install.zsh
new file mode 100644
index 00000000..d6c6006a
--- /dev/null
+++ b/docker/zim/install.zsh
@@ -0,0 +1,21 @@
+#!zsh
+
+git clone --recursive https://github.com/Eriner/zim.git "${ZDOTDIR:-${HOME}}/.zim"
+
+setopt EXTENDED_GLOB
+for template_file ( ${ZDOTDIR:-${HOME}}/.zim/templates/* ); do
+ user_file="${ZDOTDIR:-${HOME}}/.${template_file:t}"
+ touch ${user_file}
+ ( print -rn "$(<${template_file})$(<${user_file})" >! ${user_file} ) 2>/dev/null
+done
+
+source "${ZDOTDIR:-${HOME}}/.zlogin"
+
+ln -nsf \
+ ~/p9k/ \
+ ~/.zim/modules/prompt/external-themes/powerlevel9k
+ln -nsf \
+ ~/.zim/modules/prompt/external-themes/powerlevel9k/powerlevel9k.zsh-theme \
+ ~/.zim/modules/prompt/functions/prompt_powerlevel9k_setup
+
+sed -i "s/zprompt_theme='steeef'/zprompt_theme='powerlevel9k'/g" ~/.zimrc
diff --git a/docker/zplug/Dockerfile b/docker/zplug/Dockerfile
new file mode 100644
index 00000000..89c23d54
--- /dev/null
+++ b/docker/zplug/Dockerfile
@@ -0,0 +1,8 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/zplug/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY ./ p9k/
+COPY docker/zplug/zshrc .zshrc
diff --git a/docker/zplug/install.zsh b/docker/zplug/install.zsh
new file mode 100644
index 00000000..b01ff6ee
--- /dev/null
+++ b/docker/zplug/install.zsh
@@ -0,0 +1,5 @@
+#!zsh
+
+curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh| zsh
+
+# git clone https://github.com/zplug/zplug "${HOME}/.zplug"
diff --git a/docker/zplug/zshrc b/docker/zplug/zshrc
new file mode 100644
index 00000000..0a4ceb83
--- /dev/null
+++ b/docker/zplug/zshrc
@@ -0,0 +1,5 @@
+#!zsh
+
+source ~/.zplug/init.zsh
+zplug "${HOME}/p9k", use:"powerlevel9k.zsh-theme", from:local, as:theme
+zplug load --verbose
diff --git a/docker/zplugin/Dockerfile b/docker/zplugin/Dockerfile
new file mode 100644
index 00000000..90c35c0e
--- /dev/null
+++ b/docker/zplugin/Dockerfile
@@ -0,0 +1,8 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/zplugin/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY ./ p9k/
+COPY docker/zplugin/zshrc.plugins .zshrc.plugins
diff --git a/docker/zplugin/install.zsh b/docker/zplugin/install.zsh
new file mode 100644
index 00000000..fec4249d
--- /dev/null
+++ b/docker/zplugin/install.zsh
@@ -0,0 +1,12 @@
+sh -c "$(curl -fsSL https://raw.githubusercontent.com/psprint/zplugin/master/doc/install.sh)"
+
+# The 'zplugin snippet' only copies the .zsh-theme file, not everything else.
+mkdir -p ~/.zplugin/snippets
+ln -nsf \
+ ~/p9k/ \
+~/.zplugin/snippets/--SLASH--home--SLASH--fred--SLASH--p9k--SLASH--powerlevel9k--DOT--zsh-theme
+
+{
+ echo
+ echo "source ~/.zshrc.plugins"
+} >> ~/.zshrc
diff --git a/docker/zplugin/zshrc.plugins b/docker/zplugin/zshrc.plugins
new file mode 100644
index 00000000..2e9ba7a3
--- /dev/null
+++ b/docker/zplugin/zshrc.plugins
@@ -0,0 +1,5 @@
+#!zsh
+
+zplugin load psprint zsh-navigation-tools
+zplugin load psprint---zprompts
+zplugin snippet ~/p9k/powerlevel9k.zsh-theme
diff --git a/docker/zpm/Dockerfile b/docker/zpm/Dockerfile
new file mode 100644
index 00000000..c1c44e38
--- /dev/null
+++ b/docker/zpm/Dockerfile
@@ -0,0 +1,8 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/zpm/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY ./ p9k/
+COPY docker/zpm/zshrc .zshrc
diff --git a/docker/zpm/install.zsh b/docker/zpm/install.zsh
new file mode 100644
index 00000000..6f74e8e0
--- /dev/null
+++ b/docker/zpm/install.zsh
@@ -0,0 +1,6 @@
+# install zpm
+git clone --recursive https://github.com/zpm-zsh/zpm.git ~/.zpm
+
+# Install powerlevel9k
+mkdir ~/.zpm/plugins/powerlevel9k
+ln -s ~/p9k/powerlevel9k.zsh-theme ~/.zpm/plugins/powerlevel9k/powerlevel9k.plugin.zsh
diff --git a/docker/zpm/zshrc b/docker/zpm/zshrc
new file mode 100644
index 00000000..b107976e
--- /dev/null
+++ b/docker/zpm/zshrc
@@ -0,0 +1,3 @@
+source ~/.zpm/zpm.zsh
+
+zpm load powerlevel9k
diff --git a/docker/zulu/Dockerfile b/docker/zulu/Dockerfile
new file mode 100644
index 00000000..880a07d0
--- /dev/null
+++ b/docker/zulu/Dockerfile
@@ -0,0 +1,7 @@
+ARG base
+FROM p9k:${base}
+
+COPY docker/zulu/install.zsh /tmp/
+RUN zsh /tmp/install.zsh
+
+COPY ./ p9k/
diff --git a/docker/zulu/install.zsh b/docker/zulu/install.zsh
new file mode 100644
index 00000000..0ad6aae3
--- /dev/null
+++ b/docker/zulu/install.zsh
@@ -0,0 +1,10 @@
+#!zsh
+
+# install zulu https://github.com/zulu-zsh/zulu
+curl -L https://git.io/zulu-install | zsh && zsh
+
+{
+echo 'zulu fpath add ~/p9k'
+echo 'zulu fpath add ~/p9k/functions'
+echo 'zulu theme powerlevel9k'
+} >> ~/.zshrc
diff --git a/functions/icons.zsh b/functions/icons.zsh
index ea9d959b..93f3c3b5 100644
--- a/functions/icons.zsh
+++ b/functions/icons.zsh
@@ -80,6 +80,7 @@ case $POWERLEVEL9K_MODE in
RUST_ICON ''
PYTHON_ICON $'\U1F40D' # 🐍
SWIFT_ICON ''
+ GO_ICON ''
PUBLIC_IP_ICON ''
LOCK_ICON $'\UE138' # 
EXECUTION_TIME_ICON $'\UE89C' # 
@@ -150,6 +151,7 @@ case $POWERLEVEL9K_MODE in
RUST_ICON $'\uE6A8' # 
PYTHON_ICON $'\U1F40D' # 🐍
SWIFT_ICON ''
+ GO_ICON ''
PUBLIC_IP_ICON ''
LOCK_ICON $'\UE138' # 
EXECUTION_TIME_ICON $'\uF253'
@@ -220,6 +222,7 @@ case $POWERLEVEL9K_MODE in
RUST_ICON $'\uE7A8 ' # 
PYTHON_ICON $'\UE73C ' # 
SWIFT_ICON $'\uE755' # 
+ GO_ICON $'\uE626' # 
PUBLIC_IP_ICON $'\UF0AC' # 
LOCK_ICON $'\UF023' # 
EXECUTION_TIME_ICON $'\uF252' # 
@@ -290,6 +293,7 @@ case $POWERLEVEL9K_MODE in
RUST_ICON ''
PYTHON_ICON ''
SWIFT_ICON 'Swift'
+ GO_ICON 'Go'
PUBLIC_IP_ICON ''
LOCK_ICON $'\UE0A2'
EXECUTION_TIME_ICON 'Dur'
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 2e8c30bb..b08155ed 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -17,74 +17,57 @@
################################################################
## Turn on for Debugging
+#PS4='%s%f%b%k%F{blue}%{λ%}%L %F{240}%N:%i%(?.. %F{red}%?) %1(_.%F{yellow}%-1_ .)%s%f%b%k '
#zstyle ':vcs_info:*+*:*' debug true
#set -o xtrace
# Try to set the installation path
-if [[ -n "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then
- # If an installation path was set manually,
- # it should trump any other location found.
- # Do nothing. This is all right, as we use the
- # POWERLEVEL9K_INSTALLATION_PATH for further processing.
-elif [[ $(whence -w prompt_powerlevel9k_setup) =~ "function" ]]; then
- # Check if the theme was called as a function (e.g., from prezto)
- autoload -U is-at-least
- if is-at-least 5.0.8; then
- # Try to find the correct path of the script.
- POWERLEVEL9K_INSTALLATION_PATH=$(whence -v $0 | sed "s/$0 is a shell function from //")
- elif [[ -f "${ZDOTDIR:-$HOME}/.zprezto/modules/prompt/init.zsh" ]]; then
- # If there is an prezto installation, we assume that powerlevel9k is linked there.
- POWERLEVEL9K_INSTALLATION_PATH="${ZDOTDIR:-$HOME}/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup"
- fi
+if [[ -n "$POWERLEVEL9K_INSTALLATION_DIR" ]]; then
+ p9k_directory=${POWERLEVEL9K_INSTALLATION_DIR:A}
else
- # Last resort: Set installation path is script path
- POWERLEVEL9K_INSTALLATION_PATH="$0"
-fi
-
-# Resolve the installation path
-if [[ -L "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then
- # If this theme is sourced as a symlink, we need to locate the real URL
- filename="${POWERLEVEL9K_INSTALLATION_PATH:A}"
-elif [[ -d "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then
- # Directory
- filename="${POWERLEVEL9K_INSTALLATION_PATH}/powerlevel9k.zsh-theme"
-elif [[ -f "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then
- # Script is a file
- filename="$POWERLEVEL9K_INSTALLATION_PATH"
-elif [[ -z "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then
- # Fallback: specify an installation path!
- print -P "%F{red}We could not locate the installation path of powerlevel9k.%f"
- print -P "Please specify by setting %F{blue}POWERLEVEL9K_INSTALLATION_PATH%f (full path incl. file name) at the very beginning of your ~/.zshrc"
- return 1
-else
- print -P "%F{red}Script location could not be found! Maybe your %F{blue}POWERLEVEL9K_INSTALLATION_PATH%F{red} is not correct?%f"
- return 1
+ if [[ "${(%):-%N}" == '(eval)' ]]; then
+ if [[ "$0" == '-antigen-load' ]] && [[ -r "${PWD}/powerlevel9k.zsh-theme" ]]; then
+ # Antigen uses eval to load things so it can change the plugin (!!)
+ # https://github.com/zsh-users/antigen/issues/581
+ p9k_directory=$PWD
+ else
+ print -P "%F{red}You must set POWERLEVEL9K_INSTALLATION_DIR work from within an (eval).%f"
+ return 1
+ fi
+ else
+ # Get the path to file this code is executing in; then
+ # get the absolute path and strip the filename.
+ # See https://stackoverflow.com/a/28336473/108857
+ p9k_directory=${${(%):-%x}:A:h}
+ fi
fi
-script_location="$(dirname $filename)"
################################################################
# Source icon functions
################################################################
-source $script_location/functions/icons.zsh
+source "${p9k_directory}/functions/icons.zsh"
################################################################
# Source utility functions
################################################################
-source $script_location/functions/utilities.zsh
+source "${p9k_directory}/functions/utilities.zsh"
################################################################
# Source color functions
################################################################
-source $script_location/functions/colors.zsh
+source "${p9k_directory}/functions/colors.zsh"
################################################################
# Source VCS_INFO hooks / helper functions
################################################################
-source $script_location/functions/vcs.zsh
+source "${p9k_directory}/functions/vcs.zsh"
+
+# cleanup temporary variables.
+unset p9k_directory
################################################################
# Color Scheme
@@ -846,7 +829,7 @@ prompt_go_version() {
go_path=$(go env GOPATH 2>/dev/null)
if [[ -n "$go_version" && "${PWD##$go_path}" != "$PWD" ]]; then
- "$1_prompt_segment" "$0" "$2" "green" "255" "$go_version"
+ "$1_prompt_segment" "$0" "$2" "green" "255" "$go_version" "GO_ICON"
fi
}
@@ -1091,7 +1074,7 @@ prompt_rvm() {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && gemset="@$gemset"
- local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
+ local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $NF}')
if [[ -n "$version$gemset" ]]; then
"$1_prompt_segment" "$0" "$2" "240" "$DEFAULT_COLOR" "$version$gemset" 'RUBY_ICON'
diff --git a/test-in-docker b/test-in-docker
new file mode 100755
index 00000000..3c7255ec
--- /dev/null
+++ b/test-in-docker
@@ -0,0 +1,179 @@
+#!/usr/bin/env zsh
+
+set -eu
+
+# The default ZSH to use.
+default_version='4.3.11'
+
+setopt extended_glob glob_subst numeric_glob_sort
+cd "${${(%):-%x}:A:h}"
+
+# TODO: Crazy Logic to munge TERM to something supported in Ubuntu 14.04
+term=screen-256color
+
+# Note: If versions and frameworks looks complicated, it isn't that bad...
+# ...see Modifiers in zshexpn(1) for details.
+
+# List of ZSH versions
+typeset -a versions
+versions=( docker/base-*/Dockerfile(N.on:h:t:s/base-//) )
+
+# List of frameworks
+typeset -a frameworks
+frameworks=( docker/*/Dockerfile(N.on:h:t) )
+frameworks=${(@)frameworks:#base-*}
+
+# Known Issues
+typeset -A known_issues
+known_issues["4.3.11-antigen"]="Antigen commands that need git won't work; it needs a newer version of git."
+known_issues["4.3.11-zim"]="BROKEN: Zim wants ZSH 5.2 or newer."
+known_issues["5.0.3-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer."
+known_issues["5.1.1-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer."
+known_issues["4.3.11-zulu"]="Zulu doesn't work; it needs a newer version of git."
+
+err()
+{
+ print -P "%F{red}Error:%f $*"
+ exit 2
+}
+
+resolve_framework() {
+ local f=$1 found
+ found=${frameworks[(In:-1:)$f*]}
+ if (( found <= $#frameworks )); then
+ echo "${frameworks[$found]}"
+ fi
+}
+
+resolve_version() {
+ local v=$1 found
+ found=${versions[(In:-1:)$v*]}
+ if (( found <= $#versions )); then
+ echo "${versions[$found]}"
+ fi
+}
+
+check_for_known_issues() {
+ local version="$1"
+ local framework="$2"
+ local name="${version}-${framework}"
+
+ if (( ${+known_issues["$name"]} )); then
+ echo
+ print -P "%F{red}Known Issue: %F{yellow}${known_issues["$name"]}%f"
+ echo
+ fi
+}
+
+build_and_run() {
+ local version="$1"
+ local framework="$2"
+ local name="${version}-${framework}"
+
+ check_for_known_issues "$version" "$framework"
+
+ print -P "%F{green}Preparing containers...%f"
+
+ echo -n "p9k:base-${version}: "
+ docker build \
+ --quiet \
+ --tag "p9k:base-${version}" \
+ --file "docker/base-${version}/Dockerfile" \
+ .
+
+ echo -n "p9k:${version}-${framework}: "
+ docker build \
+ --quiet \
+ --build-arg="base=base-${version}" \
+ --tag "p9k:${version}-${framework}" \
+ --file "docker/${framework}/Dockerfile" \
+ .
+
+ print -P "%F{green}Starting ${name} container...%f"
+ exec docker run \
+ --rm \
+ --interactive \
+ --tty \
+ --hostname="${name//./_}" \
+ --env="TERM=${term}" \
+ "p9k:${version}-${framework}"
+}
+
+show_help() {
+ local f v
+ echo "Usage: ${(%):-%x} <framework>|--list"
+ echo
+ echo "Loads up a docker image with powershell9k configured in <framework>"
+ echo
+ echo " --frameworks Lists all available frameworks, newline separated."
+ echo " --versions Lists all available ZSH versions, newline separated."
+ echo " --zsh VER Uses ZSH with version VER."
+ echo " --help You're soaking in it."
+ echo
+ echo "ZSH versions:"
+ for v in "${(@)versions}"; do
+ echo " $v"
+ done
+ echo
+ echo "Framework containers:"
+ for f in "${(@)frameworks}"; do
+ echo " $f"
+ done
+}
+
+# No arguments
+if (( $# == 0 )); then
+ show_help
+ exit
+fi
+
+# Parse flags and such.
+use_version=$default_version
+use_framework=
+while (( $# > 0 )); do
+ case "$1" in
+ -f | --frameworks )
+ print -l "${(@)frameworks}"
+ exit
+ ;;
+ -v | --versions )
+ print -l "${(@)versions}"
+ exit
+ ;;
+ -z | --zsh )
+ shift
+ local v="$(resolve_version "$1")"
+ if [[ -n "$v" ]]; then
+ use_version=$v
+ else
+ err "No such ZSH version '${1}'"
+ fi
+ ;;
+ -h | --help )
+ show_help
+ exit
+ ;;;
+ -* )
+ err "Unknown option ${1}"
+ show_help
+ exit 1
+ ;;
+ * )
+ if [[ -z "$use_framework" ]]; then
+ local f="$(resolve_framework "$1")"
+ if [[ -n "$f" ]]; then
+ use_framework=$f
+ else
+ err "No such framework '${1}'"
+ fi
+ else
+ err "You can only specify one framework at a time; you already specified '${use_framework}'"
+ fi
+ ;;
+ esac
+ shift
+done
+
+build_and_run "$use_version" "$use_framework"
+
+# EOF
diff --git a/test/segments/go_version.spec b/test/segments/go_version.spec
index 907dceb3..2aac460b 100755
--- a/test/segments/go_version.spec
+++ b/test/segments/go_version.spec
@@ -35,12 +35,14 @@ function mockGoEmptyGopath() {
function testGo() {
alias go=mockGo
+ POWERLEVEL9K_GO_ICON=""
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(go_version)
PWD="$HOME/go/src/github.com/bhilburn/powerlevel9k"
- assertEquals "%K{green} %F{255}go1.5.3 %k%F{green}%f " "$(build_left_prompt)"
+ assertEquals "%K{green} %F{255%}%f %F{255}go1.5.3 %k%F{green}%f " "$(build_left_prompt)"
+ unset POWERLEVEL9K_GO_ICON
unset PWD
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unalias go