abra zsh config 2.0
This commit is contained in:
@@ -6,11 +6,34 @@ Loads prompt [themes][1].
|
||||
Settings
|
||||
--------
|
||||
|
||||
### Prompt Theme
|
||||
|
||||
To select a prompt theme, add the following to *zpreztorc*, and replace **name**
|
||||
with the name of the theme you wish to load. Setting it to **random** will load
|
||||
a random theme.
|
||||
|
||||
zstyle ':prezto:module:prompt' theme 'name'
|
||||
```sh
|
||||
zstyle ':prezto:module:prompt' theme 'name'
|
||||
```
|
||||
|
||||
### Prompt Display Length
|
||||
|
||||
To change working directory prompt display length from 'short', set the
|
||||
following to 'long' (without `~` expansion) or 'full' (with `~` expansion)
|
||||
in *zpreztorc*.
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:prompt' pwd-length 'short'
|
||||
```
|
||||
|
||||
### Display Return Value
|
||||
|
||||
Some prompts display the return value in the prompt. If a prompt has support,
|
||||
this can be disabled with the following snippet.
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:prompt' show-return-val 'no'
|
||||
```
|
||||
|
||||
Theming
|
||||
-------
|
||||
@@ -26,7 +49,7 @@ There are three theme functions, a setup function, a help function, and
|
||||
a preview function. The setup function **must** always be defined. The help
|
||||
function and the preview functions are optional.
|
||||
|
||||
#### prompt_name_setup
|
||||
#### `prompt_name_setup`
|
||||
|
||||
This function is called by the `prompt` function to install the theme. This
|
||||
function may define other functions as necessary to maintain the prompt,
|
||||
@@ -36,51 +59,57 @@ including a function that displays help or a function used to preview it.
|
||||
|
||||
The most basic example of this function can be seen below.
|
||||
|
||||
function prompt_name_setup {
|
||||
PROMPT='%m%# '
|
||||
RPROMPT=''
|
||||
}
|
||||
```sh
|
||||
function prompt_name_setup {
|
||||
PROMPT='%m%# '
|
||||
RPROMPT=''
|
||||
}
|
||||
```
|
||||
|
||||
#### prompt_name_help
|
||||
#### `prompt_name_help`
|
||||
|
||||
If the `prompt_name_setup` function is customizable via parameters, a help
|
||||
function **should** be defined. The user will access it via `prompt -h name`.
|
||||
|
||||
The most basic example of this function can be seen below.
|
||||
|
||||
function prompt_name_help {
|
||||
cat <<EOH
|
||||
This prompt is color-scheme-able. You can invoke it thus:
|
||||
```sh
|
||||
function prompt_name_help {
|
||||
cat <<EOH
|
||||
This prompt is color-scheme-able. You can invoke it thus:
|
||||
|
||||
prompt theme [<color1>] [<color2>]
|
||||
prompt theme [<color1>] [<color2>]
|
||||
|
||||
where the color is for the left-hand prompt.
|
||||
EOH
|
||||
}
|
||||
where the color is for the left-hand prompt.
|
||||
EOH
|
||||
}
|
||||
```
|
||||
|
||||
#### prompt_name_preview
|
||||
#### `prompt_name_preview`
|
||||
|
||||
If the `prompt_name_setup` function is customizable via parameters, a preview
|
||||
function **should** be defined. The user will access it via `prompt -p name`.
|
||||
|
||||
The most basic example of this function can be seen below.
|
||||
|
||||
function prompt_name_preview {
|
||||
if (( $# > 0 )); then
|
||||
prompt_preview_theme theme "$@"
|
||||
else
|
||||
prompt_preview_theme theme red green blue
|
||||
print
|
||||
prompt_preview_theme theme yellow magenta black
|
||||
fi
|
||||
}
|
||||
```sh
|
||||
function prompt_name_preview {
|
||||
if (( $# > 0 )); then
|
||||
prompt_preview_theme theme "$@"
|
||||
else
|
||||
prompt_preview_theme theme red green blue
|
||||
print
|
||||
prompt_preview_theme theme yellow magenta black
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
### Hook Functions
|
||||
|
||||
There are many Zsh [hook][2] functions, but mostly the *precmd* hook will be
|
||||
used.
|
||||
|
||||
#### prompt_name_precmd
|
||||
#### `prompt_name_precmd`
|
||||
|
||||
This hook is called before the prompt is displayed and is useful for getting
|
||||
information to display in a prompt.
|
||||
@@ -93,11 +122,25 @@ a function before you calling it.
|
||||
|
||||
The most basic example of this function can be seen below.
|
||||
|
||||
function prompt_name_precmd {
|
||||
if (( $+functions[git-info] )); then
|
||||
git-info
|
||||
fi
|
||||
}
|
||||
```sh
|
||||
function prompt_name_precmd {
|
||||
if (( $+functions[git-info] )); then
|
||||
git-info
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
### Fonts aren't displaying properly.
|
||||
|
||||
On most systems, themes which use special characters need to have a patched font
|
||||
installed and configured properly.
|
||||
|
||||
Powerline provides some information on [terminal support][4] and [how to install
|
||||
patched fonts][5] which should fix most font issues.
|
||||
|
||||
|
||||
Authors
|
||||
-------
|
||||
@@ -109,3 +152,5 @@ Authors
|
||||
[1]: http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Prompt-Themes
|
||||
[2]: http://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions
|
||||
[3]: https://github.com/sorin-ionescu/prezto/issues
|
||||
[4]: http://powerline.readthedocs.io/en/master/usage.html#terminal-emulator-requirements
|
||||
[5]: http://powerline.readthedocs.io/en/latest/installation.html#fonts-installation
|
||||
|
1
.zprezto/modules/prompt/external/agnoster/.git_backup
vendored
Normal file
1
.zprezto/modules/prompt/external/agnoster/.git_backup
vendored
Normal file
@@ -0,0 +1 @@
|
||||
gitdir: ../../../../.git/modules/modules/prompt/external/agnoster
|
@@ -26,7 +26,9 @@
|
||||
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
||||
|
||||
CURRENT_BG='NONE'
|
||||
PRIMARY_FG=black
|
||||
if [[ -z "$PRIMARY_FG" ]]; then
|
||||
PRIMARY_FG=black
|
||||
fi
|
||||
|
||||
# Characters
|
||||
SEGMENT_SEPARATOR="\ue0b0"
|
||||
@@ -97,7 +99,7 @@ prompt_git() {
|
||||
ref="$DETACHED ${ref/.../}"
|
||||
fi
|
||||
prompt_segment $color $PRIMARY_FG
|
||||
print -Pn " $ref"
|
||||
print -n " $ref"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -120,12 +122,22 @@ prompt_status() {
|
||||
[[ -n "$symbols" ]] && prompt_segment $PRIMARY_FG default " $symbols "
|
||||
}
|
||||
|
||||
# Display current virtual environment
|
||||
prompt_virtualenv() {
|
||||
if [[ -n $VIRTUAL_ENV ]]; then
|
||||
color=cyan
|
||||
prompt_segment $color $PRIMARY_FG
|
||||
print -Pn " $(basename $VIRTUAL_ENV) "
|
||||
fi
|
||||
}
|
||||
|
||||
## Main prompt
|
||||
prompt_agnoster_main() {
|
||||
RETVAL=$?
|
||||
CURRENT_BG='NONE'
|
||||
prompt_status
|
||||
prompt_context
|
||||
prompt_virtualenv
|
||||
prompt_dir
|
||||
prompt_git
|
||||
prompt_end
|
||||
|
12
.zprezto/modules/prompt/external/async/.editorconfig_backup
vendored
Normal file
12
.zprezto/modules/prompt/external/async/.editorconfig_backup
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{yml,json}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
1
.zprezto/modules/prompt/external/async/.git_backup
vendored
Normal file
1
.zprezto/modules/prompt/external/async/.git_backup
vendored
Normal file
@@ -0,0 +1 @@
|
||||
gitdir: ../../../../.git/modules/modules/prompt/external/async
|
54
.zprezto/modules/prompt/external/async/.travis.yml_backup
vendored
Normal file
54
.zprezto/modules/prompt/external/async/.travis.yml_backup
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
language: sh
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- build-essential
|
||||
|
||||
env:
|
||||
global:
|
||||
- ZSH_DIST=$HOME/.zshdist
|
||||
matrix:
|
||||
# Use _ZSH_VERSION since if ZSH_VERSION is present, travis cacher thinks it
|
||||
# is running in zsh and tries to use zsh specific functions.
|
||||
- _ZSH_VERSION=5.5.1
|
||||
- _ZSH_VERSION=5.4.2
|
||||
- _ZSH_VERSION=5.3.1
|
||||
- _ZSH_VERSION=5.3
|
||||
- _ZSH_VERSION=5.2
|
||||
- _ZSH_VERSION=5.1.1
|
||||
- _ZSH_VERSION=5.0.8
|
||||
- _ZSH_VERSION=5.0.2
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $ZSH_DIST
|
||||
|
||||
before_script:
|
||||
- >
|
||||
setup_zsh() {
|
||||
dest="$ZSH_DIST/$1"
|
||||
if [[ ! -d $dest/bin ]]; then
|
||||
tmp="$(mktemp --directory --tmpdir="${TMPDIR:/tmp}" zshbuild.XXXXXX)"
|
||||
(
|
||||
cd "$tmp" &&
|
||||
curl -L http://downloads.sourceforge.net/zsh/zsh-${1}.tar.gz | tar zx &&
|
||||
cd zsh-$1 &&
|
||||
./configure --prefix="$dest" &&
|
||||
make &&
|
||||
mkdir -p "$dest" &&
|
||||
make install ||
|
||||
echo "Failed to build zsh-${1}!"
|
||||
)
|
||||
fi
|
||||
export PATH="$dest/bin:$PATH"
|
||||
}
|
||||
- setup_zsh $_ZSH_VERSION
|
||||
- zsh --version
|
||||
|
||||
script:
|
||||
- zsh test.zsh -v
|
||||
|
||||
allow_failures:
|
||||
- env: _ZSH_VERSION=5.0.2
|
||||
- env: _ZSH_VERSION=5.0.8
|
21
.zprezto/modules/prompt/external/async/LICENSE
vendored
Normal file
21
.zprezto/modules/prompt/external/async/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Mathias Fredriksson <mafredri@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
163
.zprezto/modules/prompt/external/async/README.md
vendored
Normal file
163
.zprezto/modules/prompt/external/async/README.md
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
# zsh-async
|
||||
|
||||
```
|
||||
Because your terminal should be able to perform tasks asynchronously without external tools!
|
||||
```
|
||||
|
||||
## Intro (TL;DR)
|
||||
|
||||
With `zsh-async` you can run multiple asynchronous jobs, enforce unique jobs (multiple instances of the same job will not run), flush all currently running jobs and create multiple workers (each with their own jobs). For each worker you can register a callback-function through which you will be notified about the job results (job name, return code, output and execution time).
|
||||
|
||||
## Overview
|
||||
|
||||
`zsh-async` is a small library for running asynchronous tasks in zsh without requiring any external tools. It utilizes `zsh/zpty` to launch a pseudo-terminal in which all commands get executed without blocking any other processes. Checking for completed tasks can be done manually, by polling, or better yet, automatically whenever a process has finished executing by notifying through a `SIGWINCH` kill-signal.
|
||||
|
||||
This library bridges the gap between spawning child processes and disowning them. Child processes launched by normal means clutter the terminal with output about their state, and disowned processes become separate entities, no longer under control of the parent. Now you can have both!
|
||||
|
||||
## Usage
|
||||
|
||||
The async worker is a separate environment (think web worker). You send it a job (command + parameters) to execute and it returns the result of that execution through a callback function. If you find that you need to stop/start a worker to update global state (variables) you should consider refactoring so that state is passed during the `async_job` call (e.g. `async_job my_worker my_function $state1 $state2`).
|
||||
|
||||
### Installation
|
||||
|
||||
#### Manual
|
||||
|
||||
You can either source the `async.zsh` script directly or insert under your `$fpath` as async and autoload it through `autoload -Uz async && async`.
|
||||
|
||||
#### Integration
|
||||
|
||||
##### zplug
|
||||
|
||||
```
|
||||
zplug "mafredri/zsh-async", from:"github", use:"async.zsh"
|
||||
```
|
||||
|
||||
### Functions
|
||||
|
||||
The `zsh-async` library has a bunch of functions that need to be used to perform async actions:
|
||||
|
||||
#### `async_init`
|
||||
|
||||
Initializes the async library (not required if using async from `$fpath` with autoload.)
|
||||
|
||||
#### `async_start_worker <worker_name> [-u] [-n] [-p <pid>]`
|
||||
|
||||
Start a new async worker with optional parameters, a worker can be told to only run unique tasks and to notify a process when tasks are complete.
|
||||
|
||||
* `-u` unique. Only unique job names can run, e.g. the command `git status` will have `git` as the unique job name identifier
|
||||
|
||||
* `-n` notify through `SIGWINCH` signal. Needs to be caught with a `trap '' WINCH` in the process defined by `-p`
|
||||
|
||||
**NOTE:** When `zsh-async` is used in an interactive shell with ZLE enabled this option is not needed. Signaling through `SIGWINCH` has been replaced by a ZLE watcher that is triggered on output from the `zpty` instance (still requires a callback function through `async_register_callback` though). Technically zsh versions prior to `5.2` do not return the file descriptor for zpty instances, however, `zsh-async` attempts to deduce it anyway.
|
||||
|
||||
* `-p` pid to notify (defaults to current pid)
|
||||
|
||||
#### `async_stop_worker <worker_name_1> [<worker_name_2>]`
|
||||
|
||||
Simply stops a worker and all active jobs will be terminated immediately.
|
||||
|
||||
#### `async_job <worker_name> <my_function> [<function_params>]`
|
||||
|
||||
Start a new asynchronous job on specified worker, assumes the worker is running.
|
||||
|
||||
#### `async_process_results <worker_name> <callback_function>`
|
||||
|
||||
Get results from finished jobs and pass it to the to callback function. This is the only way to reliably return the job name, return code, output and execution time and with minimal effort.
|
||||
|
||||
The `callback_function` is called with the following parameters:
|
||||
|
||||
* `$1` job name, e.g. the function passed to async_job
|
||||
* `$2` return code
|
||||
* Returns `-1` if return code is missing, this should never happen, if it does, you have likely run into a bug. Please open a new [issue](https://github.com/mafredri/zsh-async/issues/new) with a detailed description of what you were doing.
|
||||
* `$3` resulting (stdout) output from job execution
|
||||
* `$4` execution time, floating point e.g. 0.0076138973 seconds
|
||||
* `$5` resulting (stderr) error output from job execution
|
||||
* `$6` has next result in buffer (0 = buffer empty, 1 = yes)
|
||||
* This means another async job has completed and is pending in the buffer, it's very likely that your callback function will be called a second time (or more) in this execution. It's generally a good idea to e.g. delay prompt updates (`zle reset-prompt`) until the buffer is empty to prevent strange states in ZLE.
|
||||
|
||||
#### `async_register_callback <worker_name> <callback_function>`
|
||||
|
||||
Register a callback for completed jobs. As soon as a job is finished, `async_process_results` will be called with the specified callback function. This requires that a worker is initialized with the -n (notify) option.
|
||||
|
||||
#### `async_unregister_callback <worker_name>`
|
||||
|
||||
Unregister the callback for a specific worker.
|
||||
|
||||
#### `async_flush_jobs <worker_name>`
|
||||
|
||||
Flush all current jobs running on a worker. This will terminate any and all running processes under the worker by sending a `SIGTERM` to the entire process group, use with caution.
|
||||
|
||||
## Example code
|
||||
|
||||
```zsh
|
||||
#!/usr/bin/env zsh
|
||||
source ./async.zsh
|
||||
async_init
|
||||
|
||||
# Initialize a new worker (with notify option)
|
||||
async_start_worker my_worker -n
|
||||
|
||||
# Create a callback function to process results
|
||||
COMPLETED=0
|
||||
completed_callback() {
|
||||
COMPLETED=$(( COMPLETED + 1 ))
|
||||
print $@
|
||||
}
|
||||
|
||||
# Register callback function for the workers completed jobs
|
||||
async_register_callback my_worker completed_callback
|
||||
|
||||
# Give the worker some tasks to perform
|
||||
async_job my_worker print hello
|
||||
async_job my_worker sleep 0.3
|
||||
|
||||
# Wait for the two tasks to be completed
|
||||
while (( COMPLETED < 2 )); do
|
||||
print "Waiting..."
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
print "Completed $COMPLETED tasks!"
|
||||
|
||||
# Output:
|
||||
# Waiting...
|
||||
# print 0 hello 0.001583099365234375
|
||||
# Waiting...
|
||||
# Waiting...
|
||||
# sleep 0 0.30631208419799805
|
||||
# Completed 2 tasks!
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Tests are located in `*_test.zsh` and can be run by executing the test runner: `./test.zsh`.
|
||||
|
||||
Example:
|
||||
|
||||
```console
|
||||
$ ./test.zsh
|
||||
ok ./async_test.zsh 2.334s
|
||||
```
|
||||
|
||||
The test suite can also run specific tasks that match a pattern, for example:
|
||||
|
||||
```console
|
||||
$ ./test.zsh -v -run zle
|
||||
=== RUN test_zle_watcher
|
||||
--- PASS: test_zle_watcher (0.07s)
|
||||
PASS
|
||||
ok ./async_test.zsh 0.070s
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
* A NULL-character (`$'\0'`) is used by `async_job` to signify the end of the command, it is recommended not to pass them as arguments, although they should work when passing multiple arguments to `async_job` (because of quoting).
|
||||
* Tell me? :)
|
||||
|
||||
## Tips
|
||||
|
||||
If you do not wish to use the `notify` feature, you can couple `zsh-async` with `zsh/sched` or the zsh `periodic` function for scheduling the worker results to be processed.
|
||||
|
||||
## Why did I make this?
|
||||
|
||||
I found a great theme for zsh, [Pure](https://github.com/sindresorhus/pure) by Sindre Sorhus. After using it for a while I noticed some graphical glitches due to the terminal being updated by a disowned process. Thus, I became inspired to get my hands dirty and find a solution. I tried many things, coprocesses (seemed too limited by themselves), different combinations of trapping kill-signals, etc. I also had problems with the zsh process ending up in a deadlock due to some zsh bug. After working out the kinks, I ended up with this and thought, hey, why not make it a library.
|
2
.zprezto/modules/prompt/external/async/async.plugin.zsh
vendored
Normal file
2
.zprezto/modules/prompt/external/async/async.plugin.zsh
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
0=${(%):-%N}
|
||||
source ${0:A:h}/async.zsh
|
499
.zprezto/modules/prompt/external/async/async.zsh
vendored
Normal file
499
.zprezto/modules/prompt/external/async/async.zsh
vendored
Normal file
@@ -0,0 +1,499 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
#
|
||||
# zsh-async
|
||||
#
|
||||
# version: 1.6.2
|
||||
# author: Mathias Fredriksson
|
||||
# url: https://github.com/mafredri/zsh-async
|
||||
#
|
||||
|
||||
typeset -g ASYNC_VERSION=1.6.2
|
||||
# Produce debug output from zsh-async when set to 1.
|
||||
typeset -g ASYNC_DEBUG=${ASYNC_DEBUG:-0}
|
||||
|
||||
# Wrapper for jobs executed by the async worker, gives output in parseable format with execution time
|
||||
_async_job() {
|
||||
# Disable xtrace as it would mangle the output.
|
||||
setopt localoptions noxtrace
|
||||
|
||||
# Store start time for job.
|
||||
float -F duration=$EPOCHREALTIME
|
||||
|
||||
# Run the command and capture both stdout (`eval`) and stderr (`cat`) in
|
||||
# separate subshells. When the command is complete, we grab write lock
|
||||
# (mutex token) and output everything except stderr inside the command
|
||||
# block, after the command block has completed, the stdin for `cat` is
|
||||
# closed, causing stderr to be appended with a $'\0' at the end to mark the
|
||||
# end of output from this job.
|
||||
local stdout stderr ret tok
|
||||
{
|
||||
stdout=$(eval "$@")
|
||||
ret=$?
|
||||
duration=$(( EPOCHREALTIME - duration )) # Calculate duration.
|
||||
|
||||
# Grab mutex lock, stalls until token is available.
|
||||
read -r -k 1 -p tok || exit 1
|
||||
|
||||
# Return output (<job_name> <return_code> <stdout> <duration> <stderr>).
|
||||
print -r -n - ${(q)1} $ret ${(q)stdout} $duration
|
||||
} 2> >(stderr=$(cat) && print -r -n - " "${(q)stderr}$'\0')
|
||||
|
||||
# Unlock mutex by inserting a token.
|
||||
print -n -p $tok
|
||||
}
|
||||
|
||||
# The background worker manages all tasks and runs them without interfering with other processes
|
||||
_async_worker() {
|
||||
# Reset all options to defaults inside async worker.
|
||||
emulate -R zsh
|
||||
|
||||
# Make sure monitor is unset to avoid printing the
|
||||
# pids of child processes.
|
||||
unsetopt monitor
|
||||
|
||||
# Redirect stderr to `/dev/null` in case unforseen errors produced by the
|
||||
# worker. For example: `fork failed: resource temporarily unavailable`.
|
||||
# Some older versions of zsh might also print malloc errors (know to happen
|
||||
# on at least zsh 5.0.2 and 5.0.8) likely due to kill signals.
|
||||
exec 2>/dev/null
|
||||
|
||||
# When a zpty is deleted (using -d) all the zpty instances created before
|
||||
# the one being deleted receive a SIGHUP, unless we catch it, the async
|
||||
# worker would simply exit (stop working) even though visible in the list
|
||||
# of zpty's (zpty -L).
|
||||
TRAPHUP() {
|
||||
return 0 # Return 0, indicating signal was handled.
|
||||
}
|
||||
|
||||
local -A storage
|
||||
local unique=0
|
||||
local notify_parent=0
|
||||
local parent_pid=0
|
||||
local coproc_pid=0
|
||||
local processing=0
|
||||
|
||||
local -a zsh_hooks zsh_hook_functions
|
||||
zsh_hooks=(chpwd periodic precmd preexec zshexit zshaddhistory)
|
||||
zsh_hook_functions=(${^zsh_hooks}_functions)
|
||||
unfunction $zsh_hooks &>/dev/null # Deactivate all zsh hooks inside the worker.
|
||||
unset $zsh_hook_functions # And hooks with registered functions.
|
||||
unset zsh_hooks zsh_hook_functions # Cleanup.
|
||||
|
||||
child_exit() {
|
||||
local -a pids
|
||||
pids=(${${(v)jobstates##*:*:}%\=*})
|
||||
|
||||
# If coproc (cat) is the only child running, we close it to avoid
|
||||
# leaving it running indefinitely and cluttering the process tree.
|
||||
if (( ! processing )) && [[ $#pids = 1 ]] && [[ $coproc_pid = $pids[1] ]]; then
|
||||
coproc :
|
||||
coproc_pid=0
|
||||
fi
|
||||
|
||||
# On older version of zsh (pre 5.2) we notify the parent through a
|
||||
# SIGWINCH signal because `zpty` did not return a file descriptor (fd)
|
||||
# prior to that.
|
||||
if (( notify_parent )); then
|
||||
# We use SIGWINCH for compatibility with older versions of zsh
|
||||
# (pre 5.1.1) where other signals (INFO, ALRM, USR1, etc.) could
|
||||
# cause a deadlock in the shell under certain circumstances.
|
||||
kill -WINCH $parent_pid
|
||||
fi
|
||||
}
|
||||
|
||||
# Register a SIGCHLD trap to handle the completion of child processes.
|
||||
trap child_exit CHLD
|
||||
|
||||
# Process option parameters passed to worker
|
||||
while getopts "np:u" opt; do
|
||||
case $opt in
|
||||
n) notify_parent=1;;
|
||||
p) parent_pid=$OPTARG;;
|
||||
u) unique=1;;
|
||||
esac
|
||||
done
|
||||
|
||||
killjobs() {
|
||||
local tok
|
||||
local -a pids
|
||||
pids=(${${(v)jobstates##*:*:}%\=*})
|
||||
|
||||
# No need to send SIGHUP if no jobs are running.
|
||||
(( $#pids == 0 )) && continue
|
||||
(( $#pids == 1 )) && [[ $coproc_pid = $pids[1] ]] && continue
|
||||
|
||||
# Grab lock to prevent half-written output in case a child
|
||||
# process is in the middle of writing to stdin during kill.
|
||||
(( coproc_pid )) && read -r -k 1 -p tok
|
||||
|
||||
kill -HUP -$$ # Send to entire process group.
|
||||
coproc : # Quit coproc.
|
||||
coproc_pid=0 # Reset pid.
|
||||
}
|
||||
|
||||
local request
|
||||
local -a cmd
|
||||
while :; do
|
||||
# Wait for jobs sent by async_job.
|
||||
read -r -d $'\0' request || {
|
||||
# Since we handle SIGHUP above (and thus do not know when `zpty -d`)
|
||||
# occurs, a failure to read probably indicates that stdin has
|
||||
# closed. This is why we propagate the signal to all children and
|
||||
# exit manually.
|
||||
kill -HUP -$$ # Send SIGHUP to all jobs.
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Check for non-job commands sent to worker
|
||||
case $request in
|
||||
_unset_trap) notify_parent=0; continue;;
|
||||
_killjobs) killjobs; continue;;
|
||||
esac
|
||||
|
||||
# Parse the request using shell parsing (z) to allow commands
|
||||
# to be parsed from single strings and multi-args alike.
|
||||
cmd=("${(z)request}")
|
||||
|
||||
# Name of the job (first argument).
|
||||
local job=$cmd[1]
|
||||
|
||||
# If worker should perform unique jobs
|
||||
if (( unique )); then
|
||||
# Check if a previous job is still running, if yes, let it finnish
|
||||
for pid in ${${(v)jobstates##*:*:}%\=*}; do
|
||||
if [[ ${storage[$job]} == $pid ]]; then
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Guard against closing coproc from trap before command has started.
|
||||
processing=1
|
||||
|
||||
# Because we close the coproc after the last job has completed, we must
|
||||
# recreate it when there are no other jobs running.
|
||||
if (( ! coproc_pid )); then
|
||||
# Use coproc as a mutex for synchronized output between children.
|
||||
coproc cat
|
||||
coproc_pid="$!"
|
||||
# Insert token into coproc
|
||||
print -n -p "t"
|
||||
fi
|
||||
|
||||
# Run job in background, completed jobs are printed to stdout.
|
||||
_async_job $cmd &
|
||||
# Store pid because zsh job manager is extremely unflexible (show jobname as non-unique '$job')...
|
||||
storage[$job]="$!"
|
||||
|
||||
processing=0 # Disable guard.
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Get results from finnished jobs and pass it to the to callback function. This is the only way to reliably return the
|
||||
# job name, return code, output and execution time and with minimal effort.
|
||||
#
|
||||
# usage:
|
||||
# async_process_results <worker_name> <callback_function>
|
||||
#
|
||||
# callback_function is called with the following parameters:
|
||||
# $1 = job name, e.g. the function passed to async_job
|
||||
# $2 = return code
|
||||
# $3 = resulting stdout from execution
|
||||
# $4 = execution time, floating point e.g. 2.05 seconds
|
||||
# $5 = resulting stderr from execution
|
||||
# $6 = has next result in buffer (0 = buffer empty, 1 = yes)
|
||||
#
|
||||
async_process_results() {
|
||||
setopt localoptions unset noshwordsplit noksharrays noposixidentifiers noposixstrings
|
||||
|
||||
local worker=$1
|
||||
local callback=$2
|
||||
local caller=$3
|
||||
local -a items
|
||||
local null=$'\0' data
|
||||
integer -l len pos num_processed has_next
|
||||
|
||||
typeset -gA ASYNC_PROCESS_BUFFER
|
||||
|
||||
# Read output from zpty and parse it if available.
|
||||
while zpty -r -t $worker data 2>/dev/null; do
|
||||
ASYNC_PROCESS_BUFFER[$worker]+=$data
|
||||
len=${#ASYNC_PROCESS_BUFFER[$worker]}
|
||||
pos=${ASYNC_PROCESS_BUFFER[$worker][(i)$null]} # Get index of NULL-character (delimiter).
|
||||
|
||||
# Keep going until we find a NULL-character.
|
||||
if (( ! len )) || (( pos > len )); then
|
||||
continue
|
||||
fi
|
||||
|
||||
while (( pos <= len )); do
|
||||
# Take the content from the beginning, until the NULL-character and
|
||||
# perform shell parsing (z) and unquoting (Q) as an array (@).
|
||||
items=("${(@Q)${(z)ASYNC_PROCESS_BUFFER[$worker][1,$pos-1]}}")
|
||||
|
||||
# Remove the extracted items from the buffer.
|
||||
ASYNC_PROCESS_BUFFER[$worker]=${ASYNC_PROCESS_BUFFER[$worker][$pos+1,$len]}
|
||||
|
||||
len=${#ASYNC_PROCESS_BUFFER[$worker]}
|
||||
if (( len > 1 )); then
|
||||
pos=${ASYNC_PROCESS_BUFFER[$worker][(i)$null]} # Get index of NULL-character (delimiter).
|
||||
fi
|
||||
|
||||
has_next=$(( len != 0 ))
|
||||
if (( $#items == 5 )); then
|
||||
items+=($has_next)
|
||||
$callback "${(@)items}" # Send all parsed items to the callback.
|
||||
else
|
||||
# In case of corrupt data, invoke callback with *async* as job
|
||||
# name, non-zero exit status and an error message on stderr.
|
||||
$callback "async" 1 "" 0 "$0:$LINENO: error: bad format, got ${#items} items (${(q)items})" $has_next
|
||||
fi
|
||||
|
||||
(( num_processed++ ))
|
||||
done
|
||||
done
|
||||
|
||||
(( num_processed )) && return 0
|
||||
|
||||
# Avoid printing exit value when `setopt printexitvalue` is active.`
|
||||
[[ $caller = trap || $caller = watcher ]] && return 0
|
||||
|
||||
# No results were processed
|
||||
return 1
|
||||
}
|
||||
|
||||
# Watch worker for output
|
||||
_async_zle_watcher() {
|
||||
setopt localoptions noshwordsplit
|
||||
typeset -gA ASYNC_PTYS ASYNC_CALLBACKS
|
||||
local worker=$ASYNC_PTYS[$1]
|
||||
local callback=$ASYNC_CALLBACKS[$worker]
|
||||
|
||||
if [[ -n $callback ]]; then
|
||||
async_process_results $worker $callback watcher
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Start a new asynchronous job on specified worker, assumes the worker is running.
|
||||
#
|
||||
# usage:
|
||||
# async_job <worker_name> <my_function> [<function_params>]
|
||||
#
|
||||
async_job() {
|
||||
setopt localoptions noshwordsplit noksharrays noposixidentifiers noposixstrings
|
||||
|
||||
local worker=$1; shift
|
||||
|
||||
local -a cmd
|
||||
cmd=("$@")
|
||||
if (( $#cmd > 1 )); then
|
||||
cmd=(${(q)cmd}) # Quote special characters in multi argument commands.
|
||||
fi
|
||||
|
||||
# Quote the cmd in case RC_EXPAND_PARAM is set.
|
||||
zpty -w $worker "$cmd"$'\0'
|
||||
}
|
||||
|
||||
# This function traps notification signals and calls all registered callbacks
|
||||
_async_notify_trap() {
|
||||
setopt localoptions noshwordsplit
|
||||
|
||||
local k
|
||||
for k in ${(k)ASYNC_CALLBACKS}; do
|
||||
async_process_results $k ${ASYNC_CALLBACKS[$k]} trap
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Register a callback for completed jobs. As soon as a job is finnished, async_process_results will be called with the
|
||||
# specified callback function. This requires that a worker is initialized with the -n (notify) option.
|
||||
#
|
||||
# usage:
|
||||
# async_register_callback <worker_name> <callback_function>
|
||||
#
|
||||
async_register_callback() {
|
||||
setopt localoptions noshwordsplit nolocaltraps
|
||||
|
||||
typeset -gA ASYNC_CALLBACKS
|
||||
local worker=$1; shift
|
||||
|
||||
ASYNC_CALLBACKS[$worker]="$*"
|
||||
|
||||
# Enable trap when the ZLE watcher is unavailable, allows
|
||||
# workers to notify (via -n) when a job is done.
|
||||
if [[ ! -o interactive ]] || [[ ! -o zle ]]; then
|
||||
trap '_async_notify_trap' WINCH
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Unregister the callback for a specific worker.
|
||||
#
|
||||
# usage:
|
||||
# async_unregister_callback <worker_name>
|
||||
#
|
||||
async_unregister_callback() {
|
||||
typeset -gA ASYNC_CALLBACKS
|
||||
|
||||
unset "ASYNC_CALLBACKS[$1]"
|
||||
}
|
||||
|
||||
#
|
||||
# Flush all current jobs running on a worker. This will terminate any and all running processes under the worker, use
|
||||
# with caution.
|
||||
#
|
||||
# usage:
|
||||
# async_flush_jobs <worker_name>
|
||||
#
|
||||
async_flush_jobs() {
|
||||
setopt localoptions noshwordsplit
|
||||
|
||||
local worker=$1; shift
|
||||
|
||||
# Check if the worker exists
|
||||
zpty -t $worker &>/dev/null || return 1
|
||||
|
||||
# Send kill command to worker
|
||||
async_job $worker "_killjobs"
|
||||
|
||||
# Clear the zpty buffer.
|
||||
local junk
|
||||
if zpty -r -t $worker junk '*'; then
|
||||
(( ASYNC_DEBUG )) && print -n "async_flush_jobs $worker: ${(V)junk}"
|
||||
while zpty -r -t $worker junk '*'; do
|
||||
(( ASYNC_DEBUG )) && print -n "${(V)junk}"
|
||||
done
|
||||
(( ASYNC_DEBUG )) && print
|
||||
fi
|
||||
|
||||
# Finally, clear the process buffer in case of partially parsed responses.
|
||||
typeset -gA ASYNC_PROCESS_BUFFER
|
||||
unset "ASYNC_PROCESS_BUFFER[$worker]"
|
||||
}
|
||||
|
||||
#
|
||||
# Start a new async worker with optional parameters, a worker can be told to only run unique tasks and to notify a
|
||||
# process when tasks are complete.
|
||||
#
|
||||
# usage:
|
||||
# async_start_worker <worker_name> [-u] [-n] [-p <pid>]
|
||||
#
|
||||
# opts:
|
||||
# -u unique (only unique job names can run)
|
||||
# -n notify through SIGWINCH signal
|
||||
# -p pid to notify (defaults to current pid)
|
||||
#
|
||||
async_start_worker() {
|
||||
setopt localoptions noshwordsplit
|
||||
|
||||
local worker=$1; shift
|
||||
zpty -t $worker &>/dev/null && return
|
||||
|
||||
typeset -gA ASYNC_PTYS
|
||||
typeset -h REPLY
|
||||
typeset has_xtrace=0
|
||||
|
||||
# Make sure async worker is started without xtrace
|
||||
# (the trace output interferes with the worker).
|
||||
[[ -o xtrace ]] && {
|
||||
has_xtrace=1
|
||||
unsetopt xtrace
|
||||
}
|
||||
|
||||
if (( ! ASYNC_ZPTY_RETURNS_FD )) && [[ -o interactive ]] && [[ -o zle ]]; then
|
||||
# When zpty doesn't return a file descriptor (on older versions of zsh)
|
||||
# we try to guess it anyway.
|
||||
integer -l zptyfd
|
||||
exec {zptyfd}>&1 # Open a new file descriptor (above 10).
|
||||
exec {zptyfd}>&- # Close it so it's free to be used by zpty.
|
||||
fi
|
||||
|
||||
zpty -b $worker _async_worker -p $$ $@ || {
|
||||
async_stop_worker $worker
|
||||
return 1
|
||||
}
|
||||
|
||||
# Re-enable it if it was enabled, for debugging.
|
||||
(( has_xtrace )) && setopt xtrace
|
||||
|
||||
if [[ $ZSH_VERSION < 5.0.8 ]]; then
|
||||
# For ZSH versions older than 5.0.8 we delay a bit to give
|
||||
# time for the worker to start before issuing commands,
|
||||
# otherwise it will not be ready to receive them.
|
||||
sleep 0.001
|
||||
fi
|
||||
|
||||
if [[ -o interactive ]] && [[ -o zle ]]; then
|
||||
if (( ! ASYNC_ZPTY_RETURNS_FD )); then
|
||||
REPLY=$zptyfd # Use the guessed value for the file desciptor.
|
||||
fi
|
||||
|
||||
ASYNC_PTYS[$REPLY]=$worker # Map the file desciptor to the worker.
|
||||
zle -F $REPLY _async_zle_watcher # Register the ZLE handler.
|
||||
|
||||
# Disable trap in favor of ZLE handler when notify is enabled (-n).
|
||||
async_job $worker _unset_trap
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Stop one or multiple workers that are running, all unfetched and incomplete work will be lost.
|
||||
#
|
||||
# usage:
|
||||
# async_stop_worker <worker_name_1> [<worker_name_2>]
|
||||
#
|
||||
async_stop_worker() {
|
||||
setopt localoptions noshwordsplit
|
||||
|
||||
local ret=0 worker k v
|
||||
for worker in $@; do
|
||||
# Find and unregister the zle handler for the worker
|
||||
for k v in ${(@kv)ASYNC_PTYS}; do
|
||||
if [[ $v == $worker ]]; then
|
||||
zle -F $k
|
||||
unset "ASYNC_PTYS[$k]"
|
||||
fi
|
||||
done
|
||||
async_unregister_callback $worker
|
||||
zpty -d $worker 2>/dev/null || ret=$?
|
||||
|
||||
# Clear any partial buffers.
|
||||
typeset -gA ASYNC_PROCESS_BUFFER
|
||||
unset "ASYNC_PROCESS_BUFFER[$worker]"
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
#
|
||||
# Initialize the required modules for zsh-async. To be called before using the zsh-async library.
|
||||
#
|
||||
# usage:
|
||||
# async_init
|
||||
#
|
||||
async_init() {
|
||||
(( ASYNC_INIT_DONE )) && return
|
||||
typeset -g ASYNC_INIT_DONE=1
|
||||
|
||||
zmodload zsh/zpty
|
||||
zmodload zsh/datetime
|
||||
|
||||
# Check if zsh/zpty returns a file descriptor or not,
|
||||
# shell must also be interactive with zle enabled.
|
||||
typeset -g ASYNC_ZPTY_RETURNS_FD=0
|
||||
[[ -o interactive ]] && [[ -o zle ]] && {
|
||||
typeset -h REPLY
|
||||
zpty _async_test :
|
||||
(( REPLY )) && ASYNC_ZPTY_RETURNS_FD=1
|
||||
zpty -d _async_test
|
||||
}
|
||||
}
|
||||
|
||||
async() {
|
||||
async_init
|
||||
}
|
||||
|
||||
async "$@"
|
574
.zprezto/modules/prompt/external/async/async_test.zsh
vendored
Normal file
574
.zprezto/modules/prompt/external/async/async_test.zsh
vendored
Normal file
@@ -0,0 +1,574 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
test__async_job_print_hi() {
|
||||
coproc cat
|
||||
print -n -p t # Insert token into coproc.
|
||||
|
||||
local line
|
||||
local -a out
|
||||
line=$(_async_job print hi)
|
||||
# Remove trailing null, parse, unquote and interpret as array.
|
||||
line=$line[1,$#line-1]
|
||||
out=("${(@Q)${(z)line}}")
|
||||
|
||||
coproc exit
|
||||
|
||||
[[ $out[1] = print ]] || t_error "command name should be print, got" $out[1]
|
||||
[[ $out[2] = 0 ]] || t_error "want exit code 0, got" $out[2]
|
||||
[[ $out[3] = hi ]] || t_error "want output: hi, got" $out[3]
|
||||
}
|
||||
|
||||
test__async_job_stderr() {
|
||||
coproc cat
|
||||
print -n -p t # Insert token into coproc.
|
||||
|
||||
local line
|
||||
local -a out
|
||||
line=$(_async_job print 'hi 1>&2')
|
||||
# Remove trailing null, parse, unquote and interpret as array.
|
||||
line=$line[1,$#line-1]
|
||||
out=("${(@Q)${(z)line}}")
|
||||
|
||||
coproc exit
|
||||
|
||||
[[ $out[2] = 0 ]] || t_error "want status 0, got" $out[2]
|
||||
[[ -z $out[3] ]] || t_error "want empty output, got" $out[3]
|
||||
[[ $out[5] = hi ]] || t_error "want stderr: hi, got" $out[5]
|
||||
}
|
||||
|
||||
test__async_job_wait_for_token() {
|
||||
float start duration
|
||||
coproc cat
|
||||
|
||||
_async_job print hi >/dev/null &
|
||||
job=$!
|
||||
start=$EPOCHREALTIME
|
||||
{
|
||||
sleep 0.1
|
||||
print -n -p t
|
||||
} &
|
||||
|
||||
wait $job
|
||||
|
||||
coproc exit
|
||||
|
||||
duration=$(( EPOCHREALTIME - start ))
|
||||
# Fail if the execution time was faster than 0.1 seconds.
|
||||
(( duration >= 0.1 )) || t_error "execution was too fast, want >= 0.1, got" $duration
|
||||
}
|
||||
|
||||
test__async_job_multiple_commands() {
|
||||
coproc cat
|
||||
print -n -p t
|
||||
|
||||
local line
|
||||
local -a out
|
||||
line="$(_async_job print '-n hi; for i in "1 2" 3 4; do print -n $i; done')"
|
||||
# Remove trailing null, parse, unquote and interpret as array.
|
||||
line=$line[1,$#line-1]
|
||||
out=("${(@Q)${(z)line}}")
|
||||
|
||||
coproc exit
|
||||
|
||||
# $out[1] here will be the entire string passed to _async_job()
|
||||
# ('print -n hi...') since proper command parsing is done by
|
||||
# the async worker.
|
||||
[[ $out[3] = "hi1 234" ]] || t_error "want output hi1 234, got " $out[3]
|
||||
}
|
||||
|
||||
test_async_start_stop_worker() {
|
||||
local out
|
||||
|
||||
async_start_worker test
|
||||
out=$(zpty -L)
|
||||
[[ $out =~ "test _async_worker" ]] || t_error "want zpty worker running, got ${(Vq-)out}"
|
||||
|
||||
async_stop_worker test || t_error "stop worker: want exit code 0, got $?"
|
||||
out=$(zpty -L)
|
||||
[[ -z $out ]] || t_error "want no zpty worker running, got ${(Vq-)out}"
|
||||
|
||||
async_stop_worker nonexistent && t_error "stop non-existent worker: want exit code 1, got $?"
|
||||
}
|
||||
|
||||
test_async_job_print_matches_input_exactly() {
|
||||
local -a result
|
||||
cb() { result=("$@") }
|
||||
|
||||
async_start_worker test
|
||||
t_defer async_stop_worker test
|
||||
|
||||
want='
|
||||
Hello world!
|
||||
Much *formatting*,
|
||||
many space\t...\n\n
|
||||
Such "quote", v '$'\'quote\'''
|
||||
'
|
||||
|
||||
async_job test print -r - "$want"
|
||||
while ! async_process_results test cb; do :; done
|
||||
|
||||
[[ $result[3] = $want ]] || t_error "output, want ${(Vqqqq)want}, got ${(Vqqqq)result[3]}"
|
||||
}
|
||||
|
||||
test_async_process_results() {
|
||||
local -a r
|
||||
cb() { r+=("$@") }
|
||||
|
||||
async_start_worker test
|
||||
t_defer async_stop_worker test
|
||||
|
||||
async_process_results test cb # No results.
|
||||
ret=$?
|
||||
(( ret == 1 )) || t_error "want exit code 1, got $ret"
|
||||
|
||||
async_job test print -n hi
|
||||
while ! async_process_results test cb; do :; done
|
||||
(( $#r == 6 )) || t_error "want one result, got $(( $#r % 6 ))"
|
||||
}
|
||||
|
||||
test_async_process_results_stress() {
|
||||
# NOTE: This stress test does not always pass properly on older versions of
|
||||
# zsh, sometimes writing to zpty can hang and other times reading can hang,
|
||||
# etc.
|
||||
local -a r
|
||||
cb() { r+=("$@") }
|
||||
|
||||
async_start_worker test
|
||||
t_defer async_stop_worker test
|
||||
|
||||
integer iter=40 timeout=5
|
||||
for i in {1..$iter}; do
|
||||
async_job test "print -n $i"
|
||||
|
||||
# TODO: Figure out how we can remove sleep & process here.
|
||||
|
||||
# If we do not sleep here, we end up losing some of the commands sent to
|
||||
# async_job (~90 get sent). This could possibly be due to the zpty
|
||||
# buffer being full (see below).
|
||||
sleep 0.00001
|
||||
# Without processing resuls we occasionally run into 'print -n 39'
|
||||
# failing due to the command name and exit status missing. Sample output
|
||||
# from processing for 39 (stdout, time, stderr):
|
||||
# $'39 0.0056798458 '
|
||||
# This is again, probably due to the zpty buffer being full, we only
|
||||
# need to ensure that not too many commands are run before we process.
|
||||
(( iter % 6 == 0 )) && async_process_results test cb
|
||||
done
|
||||
|
||||
float start=$EPOCHSECONDS
|
||||
|
||||
while (( $#r / 6 < iter )); do
|
||||
async_process_results test cb
|
||||
(( EPOCHSECONDS - start > timeout )) && {
|
||||
t_log "timed out after ${timeout}s"
|
||||
t_fatal "wanted $iter results, got $(( $#r / 6 ))"
|
||||
}
|
||||
done
|
||||
|
||||
local -a stdouts
|
||||
while (( $#r > 0 )); do
|
||||
[[ $r[1] = print ]] || t_error "want 'print', got ${(Vq-)r[1]}"
|
||||
[[ $r[2] = 0 ]] || t_error "want exit 0, got $r[2]"
|
||||
stdouts+=($r[3])
|
||||
[[ -z $r[5] ]] || t_error "want no stderr, got ${(Vq-)r[5]}"
|
||||
shift 6 r
|
||||
done
|
||||
|
||||
local got want
|
||||
# Check that we received all numbers.
|
||||
got=(${(on)stdouts})
|
||||
want=({1..$iter})
|
||||
[[ $want = $got ]] || t_error "want stdout: ${(Vq-)want}, got ${(Vq-)got}"
|
||||
|
||||
# Test with longer running commands (sleep, then print).
|
||||
iter=40
|
||||
for i in {1..$iter}; do
|
||||
async_job test "sleep 1 && print -n $i"
|
||||
sleep 0.00001
|
||||
(( iter % 6 == 0 )) && async_process_results test cb
|
||||
done
|
||||
|
||||
start=$EPOCHSECONDS
|
||||
|
||||
while (( $#r / 6 < iter )); do
|
||||
async_process_results test cb
|
||||
(( EPOCHSECONDS - start > timeout )) && {
|
||||
t_log "timed out after ${timeout}s"
|
||||
t_fatal "wanted $iter results, got $(( $#r / 6 ))"
|
||||
}
|
||||
done
|
||||
|
||||
stdouts=()
|
||||
while (( $#r > 0 )); do
|
||||
[[ $r[1] = sleep ]] || t_error "want 'sleep', got ${(Vq-)r[1]}"
|
||||
[[ $r[2] = 0 ]] || t_error "want exit 0, got $r[2]"
|
||||
stdouts+=($r[3])
|
||||
[[ -z $r[5] ]] || t_error "want no stderr, got ${(Vq-)r[5]}"
|
||||
shift 6 r
|
||||
done
|
||||
|
||||
# Check that we received all numbers.
|
||||
got=(${(on)stdouts})
|
||||
want=({1..$iter})
|
||||
[[ $want = $got ]] || t_error "want stdout: ${(Vq-)want}, got ${(Vq-)got}"
|
||||
}
|
||||
|
||||
test_async_job_multiple_commands_in_multiline_string() {
|
||||
local -a result
|
||||
cb() { result=("$@") }
|
||||
|
||||
async_start_worker test
|
||||
# Test multi-line (single string) command.
|
||||
async_job test 'print "hi\n 123 "'$'\nprint -n bye'
|
||||
while ! async_process_results test cb; do :; done
|
||||
async_stop_worker test
|
||||
|
||||
[[ $result[1] = print ]] || t_error "want command name: print, got" $result[1]
|
||||
local want=$'hi\n 123 \nbye'
|
||||
[[ $result[3] = $want ]] || t_error "want output: ${(Vq-)want}, got ${(Vq-)result[3]}"
|
||||
}
|
||||
|
||||
test_async_job_git_status() {
|
||||
local -a result
|
||||
cb() { result=("$@") }
|
||||
|
||||
async_start_worker test
|
||||
async_job test git status --porcelain
|
||||
while ! async_process_results test cb; do :; done
|
||||
async_stop_worker test
|
||||
|
||||
[[ $result[1] = git ]] || t_error "want command name: git, got" $result[1]
|
||||
[[ $result[2] = 0 ]] || t_error "want exit code: 0, got" $result[2]
|
||||
|
||||
want=$(git status --porcelain)
|
||||
got=$result[3]
|
||||
[[ $got = $want ]] || t_error "want ${(Vq-)want}, got ${(Vq-)got}"
|
||||
}
|
||||
|
||||
test_async_job_multiple_arguments_and_spaces() {
|
||||
local -a result
|
||||
cb() { result=("$@") }
|
||||
|
||||
async_start_worker test
|
||||
async_job test print "hello world"
|
||||
while ! async_process_results test cb; do :; done
|
||||
async_stop_worker test
|
||||
|
||||
[[ $result[1] = print ]] || t_error "want command name: print, got" $result[1]
|
||||
[[ $result[2] = 0 ]] || t_error "want exit code: 0, got" $result[2]
|
||||
|
||||
[[ $result[3] = "hello world" ]] || {
|
||||
t_error "want output: \"hello world\", got" ${(Vq-)result[3]}
|
||||
}
|
||||
}
|
||||
|
||||
test_async_job_unique_worker() {
|
||||
local -a result
|
||||
cb() {
|
||||
# Add to result so we can detect if it was called multiple times.
|
||||
result+=("$@")
|
||||
}
|
||||
helper() {
|
||||
sleep 0.1; print $1
|
||||
}
|
||||
|
||||
# Start a unique (job) worker.
|
||||
async_start_worker test -u
|
||||
|
||||
# Launch two jobs with the same name, the first one should be
|
||||
# allowed to complete whereas the second one is never run.
|
||||
async_job test helper one
|
||||
async_job test helper two
|
||||
|
||||
while ! async_process_results test cb; do :; done
|
||||
|
||||
# If both jobs were running but only one was complete,
|
||||
# async_process_results() could've returned true for
|
||||
# the first job, wait a little extra to make sure the
|
||||
# other didn't run.
|
||||
sleep 0.1
|
||||
async_process_results test cb
|
||||
|
||||
async_stop_worker test
|
||||
|
||||
# Ensure that cb was only called once with correc output.
|
||||
[[ ${#result} = 6 ]] || t_error "result: want 6 elements, got" ${#result}
|
||||
[[ $result[3] = one ]] || t_error "output: want 'one', got" ${(Vq-)result[3]}
|
||||
}
|
||||
|
||||
test_async_job_error_and_nonzero_exit() {
|
||||
local -a r
|
||||
cb() { r+=("$@") }
|
||||
error() {
|
||||
print "Errors!"
|
||||
12345
|
||||
54321
|
||||
print "Done!"
|
||||
exit 99
|
||||
}
|
||||
|
||||
async_start_worker test
|
||||
async_job test error
|
||||
|
||||
while ! async_process_results test cb; do :; done
|
||||
|
||||
[[ $r[1] = error ]] || t_error "want 'error', got ${(Vq-)r[1]}"
|
||||
[[ $r[2] = 99 ]] || t_error "want exit code 99, got $r[2]"
|
||||
|
||||
want=$'Errors!\nDone!'
|
||||
[[ $r[3] = $want ]] || t_error "want ${(Vq-)want}, got ${(Vq-)r[3]}"
|
||||
|
||||
want=$'.*command not found: 12345\n.*command not found: 54321'
|
||||
[[ $r[5] =~ $want ]] || t_error "want ${(Vq-)want}, got ${(Vq-)r[5]}"
|
||||
}
|
||||
|
||||
test_async_worker_notify_sigwinch() {
|
||||
local -a result
|
||||
cb() { result=("$@") }
|
||||
|
||||
ASYNC_USE_ZLE_HANDLER=0
|
||||
|
||||
async_start_worker test -n
|
||||
async_register_callback test cb
|
||||
|
||||
async_job test 'sleep 0.1; print hi'
|
||||
|
||||
while (( ! $#result )); do sleep 0.01; done
|
||||
|
||||
async_stop_worker test
|
||||
|
||||
[[ $result[3] = hi ]] || t_error "expected output: hi, got" $result[3]
|
||||
}
|
||||
|
||||
test_async_job_keeps_nulls() {
|
||||
local -a r
|
||||
cb() { r=("$@") }
|
||||
null_echo() {
|
||||
print Hello$'\0' with$'\0' nulls!
|
||||
print "Did we catch them all?"$'\0'
|
||||
print $'\0'"What about the errors?"$'\0' 1>&2
|
||||
}
|
||||
|
||||
async_start_worker test
|
||||
async_job test null_echo
|
||||
|
||||
while ! async_process_results test cb; do :; done
|
||||
|
||||
async_stop_worker test
|
||||
|
||||
local want
|
||||
want=$'Hello\0 with\0 nulls!\nDid we catch them all?\0'
|
||||
[[ $r[3] = $want ]] || t_error stdout: want ${(Vq-)want}, got ${(Vq-)r[3]}
|
||||
want=$'\0What about the errors?\0'
|
||||
[[ $r[5] = $want ]] || t_error stderr: want ${(Vq-)want}, got ${(Vq-)r[5]}
|
||||
}
|
||||
|
||||
test_async_flush_jobs() {
|
||||
local -a r
|
||||
cb() { r=+("$@") }
|
||||
|
||||
print_four() { print -n 4 }
|
||||
print_123_delayed_exit() {
|
||||
print -n 1
|
||||
{ sleep 0.25 && print -n 2 } &!
|
||||
{ sleep 0.3 && print -n 3 } &!
|
||||
}
|
||||
|
||||
async_start_worker test
|
||||
|
||||
# Start a job that prints 1 and starts two disowned child processes that
|
||||
# print 2 and 3, respectively, after a timeout. The job will not exit
|
||||
# immediately (and thus print 1) because the child processes are still
|
||||
# running.
|
||||
async_job test print_123_delayed_exit
|
||||
|
||||
# Check that the job is waiting for the child processes.
|
||||
sleep 0.05
|
||||
async_process_results test cb
|
||||
(( $#r == 0 )) || t_error "want no output, got ${(Vq-)r}"
|
||||
|
||||
# Start a job that prints four, it will produce
|
||||
# output but we will not process it.
|
||||
async_job test print_four
|
||||
sleep 0.2
|
||||
|
||||
# Flush jobs, this kills running jobs and discards unprocessed results.
|
||||
# TODO: Confirm that they no longer exist in the process tree.
|
||||
local output
|
||||
output="${(Q)$(ASYNC_DEBUG=1 async_flush_jobs test)}"
|
||||
[[ $output = *'print_four 0 4'* ]] || {
|
||||
t_error "want discarded output 'print_four 0 4' when ASYNC_DEBUG=1, got ${(Vq-)output}"
|
||||
}
|
||||
|
||||
# Check that the killed job did not produce output.
|
||||
sleep 0.1
|
||||
async_process_results test cb
|
||||
(( $#r == 0 )) || t_error "want no output, got ${(Vq-)r}"
|
||||
|
||||
async_stop_worker test
|
||||
}
|
||||
|
||||
test_async_worker_survives_termination_of_other_worker() {
|
||||
local -a result
|
||||
cb() { result+=("$@") }
|
||||
|
||||
async_start_worker test1
|
||||
t_defer async_stop_worker test1
|
||||
|
||||
# Start and stop a worker, will send SIGHUP to previous worker
|
||||
# (probably has to do with some shell inheritance).
|
||||
async_start_worker test2
|
||||
async_stop_worker test2
|
||||
|
||||
async_job test1 print hi
|
||||
|
||||
integer start=$EPOCHREALTIME
|
||||
while (( EPOCHREALTIME - start < 2.0 )); do
|
||||
async_process_results test1 cb && break
|
||||
done
|
||||
|
||||
(( $#result == 6 )) || t_error "wanted a result, got (${(@Vq)result})"
|
||||
}
|
||||
|
||||
setopt_helper() {
|
||||
setopt localoptions $1
|
||||
|
||||
# Make sure to test with multiple options
|
||||
local -a result
|
||||
cb() { result=("$@") }
|
||||
|
||||
async_start_worker test
|
||||
async_job test print "hello world"
|
||||
while ! async_process_results test cb; do :; done
|
||||
async_stop_worker test
|
||||
|
||||
# At this point, ksh arrays will only mess with the test.
|
||||
setopt noksharrays
|
||||
|
||||
[[ $result[1] = print ]] || t_fatal "$1 want command name: print, got" $result[1]
|
||||
[[ $result[2] = 0 ]] || t_fatal "$1 want exit code: 0, got" $result[2]
|
||||
|
||||
[[ $result[3] = "hello world" ]] || {
|
||||
t_fatal "$1 want output: \"hello world\", got" ${(Vq-)result[3]}
|
||||
}
|
||||
}
|
||||
|
||||
test_all_options() {
|
||||
local -a opts exclude
|
||||
|
||||
if [[ $ZSH_VERSION == 5.0.? ]]; then
|
||||
t_skip "Test is not reliable on zsh 5.0.X"
|
||||
fi
|
||||
|
||||
# Make sure worker is stopped, even if tests fail.
|
||||
t_defer async_stop_worker test
|
||||
|
||||
{ sleep 15 && t_fatal "timed out" } &
|
||||
local tpid=$!
|
||||
|
||||
opts=(${(k)options})
|
||||
|
||||
# These options can't be tested.
|
||||
exclude=(
|
||||
zle interactive restricted shinstdin stdin onecmd singlecommand
|
||||
warnnestedvar errreturn
|
||||
)
|
||||
|
||||
for opt in ${opts:|exclude}; do
|
||||
if [[ $options[$opt] = on ]]; then
|
||||
setopt_helper no$opt
|
||||
else
|
||||
setopt_helper $opt
|
||||
fi
|
||||
done 2>/dev/null # Remove redirect to see output.
|
||||
|
||||
kill $tpid # Stop timeout.
|
||||
}
|
||||
|
||||
test_async_job_with_rc_expand_param() {
|
||||
setopt localoptions rcexpandparam
|
||||
|
||||
# Make sure to test with multiple options
|
||||
local -a result
|
||||
cb() { result=("$@") }
|
||||
|
||||
async_start_worker test
|
||||
async_job test print "hello world"
|
||||
while ! async_process_results test cb; do :; done
|
||||
async_stop_worker test
|
||||
|
||||
[[ $result[1] = print ]] || t_error "want command name: print, got" $result[1]
|
||||
[[ $result[2] = 0 ]] || t_error "want exit code: 0, got" $result[2]
|
||||
|
||||
[[ $result[3] = "hello world" ]] || {
|
||||
t_error "want output: \"hello world\", got" ${(Vq-)result[3]}
|
||||
}
|
||||
}
|
||||
|
||||
zpty_init() {
|
||||
zmodload zsh/zpty
|
||||
|
||||
export PS1="<PROMPT>"
|
||||
zpty zsh 'zsh -f +Z'
|
||||
zpty -r zsh zpty_init1 "*<PROMPT>*" || {
|
||||
t_log "initial prompt missing"
|
||||
return 1
|
||||
}
|
||||
|
||||
zpty -w zsh "{ $@ }"
|
||||
zpty -r -m zsh zpty_init2 "*<PROMPT>*" || {
|
||||
t_log "prompt missing"
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
zpty_run() {
|
||||
zpty -w zsh "$*"
|
||||
zpty -r -m zsh zpty_run "*<PROMPT>*" || {
|
||||
t_log "prompt missing after ${(Vq-)*}"
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
zpty_deinit() {
|
||||
zpty -d zsh
|
||||
}
|
||||
|
||||
test_zle_watcher() {
|
||||
zpty_init '
|
||||
emulate -R zsh
|
||||
setopt zle
|
||||
stty 38400 columns 80 rows 24 tabs -icanon -iexten
|
||||
TERM=vt100
|
||||
|
||||
. "'$PWD'/async.zsh"
|
||||
async_init
|
||||
|
||||
print_result_cb() { print ${(Vq-)@} }
|
||||
async_start_worker test
|
||||
async_register_callback test print_result_cb
|
||||
' || {
|
||||
zpty_deinit
|
||||
t_fatal "failed to init zpty"
|
||||
}
|
||||
|
||||
t_defer zpty_deinit # Deinit after test completion.
|
||||
|
||||
zpty -w zsh "zle -F"
|
||||
zpty -r -m zsh result "*_async_zle_watcher*" || {
|
||||
t_fatal "want _async_zle_watcher to be registered as zle watcher, got output ${(Vq-)result}"
|
||||
}
|
||||
|
||||
zpty_run async_job test 'print hello world' || t_fatal "could not send async_job command"
|
||||
|
||||
zpty -r -m zsh result "*print 0 'hello world'*" || {
|
||||
t_fatal "want \"print 0 'hello world'\", got output ${(Vq-)result}"
|
||||
}
|
||||
}
|
||||
|
||||
test_main() {
|
||||
# Load zsh-async before running each test.
|
||||
zmodload zsh/datetime
|
||||
. ./async.zsh
|
||||
async_init
|
||||
}
|
263
.zprezto/modules/prompt/external/async/test.zsh
vendored
Executable file
263
.zprezto/modules/prompt/external/async/test.zsh
vendored
Executable file
@@ -0,0 +1,263 @@
|
||||
#!/usr/bin/env zsh
|
||||
#
|
||||
# zsh-async test runner.
|
||||
# Checks for test files named *_test.zsh or *_test.sh and runs all functions
|
||||
# named test_*.
|
||||
#
|
||||
emulate -R zsh
|
||||
|
||||
zmodload zsh/datetime
|
||||
zmodload zsh/parameter
|
||||
zmodload zsh/zutil
|
||||
zmodload zsh/system
|
||||
zmodload zsh/zselect
|
||||
|
||||
TEST_GLOB=.
|
||||
TEST_RUN=
|
||||
TEST_VERBOSE=0
|
||||
TEST_TRACE=1
|
||||
TEST_CODE_SKIP=100
|
||||
TEST_CODE_ERROR=101
|
||||
TEST_CODE_TIMEOUT=102
|
||||
|
||||
show_help() {
|
||||
print "usage: ./test.zsh [-v] [-x] [-run pattern] [search pattern]"
|
||||
}
|
||||
|
||||
parse_opts() {
|
||||
local -a verbose debug trace help run
|
||||
|
||||
local out
|
||||
zparseopts -E -D \
|
||||
v=verbose verbose=verbose -verbose=verbose \
|
||||
d=debug debug=debug -debug=debug \
|
||||
x=trace trace=trace -trace=trace \
|
||||
h=help -help=help \
|
||||
\?=help \
|
||||
run:=run -run:=run
|
||||
|
||||
(( $? )) || (( $+help[1] )) && show_help && exit 0
|
||||
|
||||
if (( $#@ > 1 )); then
|
||||
print -- "unknown arguments: $@"
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[[ -n $1 ]] && TEST_GLOB=$1
|
||||
TEST_VERBOSE=$+verbose[1]
|
||||
TEST_TRACE=$+trace[1]
|
||||
ZTEST_DEBUG=$+debug[1]
|
||||
(( $+run[2] )) && TEST_RUN=$run[2]
|
||||
}
|
||||
|
||||
t_runner_init() {
|
||||
emulate -L zsh
|
||||
|
||||
zmodload zsh/parameter
|
||||
|
||||
# _t_runner is the main loop that waits for tests,
|
||||
# used to abort test execution by exec.
|
||||
_t_runner() {
|
||||
local -a _test_defer_funcs
|
||||
integer _test_errors=0
|
||||
while read -r; do
|
||||
eval "$REPLY"
|
||||
done
|
||||
}
|
||||
|
||||
_t_log() {
|
||||
local trace=$1; shift
|
||||
local -a lines indent
|
||||
lines=("${(@f)@}")
|
||||
indent=($'\t\t'${^lines[2,$#lines]})
|
||||
print -u7 -lr - $'\t'"$trace: $lines[1]" ${(F)indent}
|
||||
}
|
||||
|
||||
# t_log is for printing log output, visible in verbose (-v) mode.
|
||||
t_log() {
|
||||
local line=$funcfiletrace[1]
|
||||
[[ ${line%:[0-9]*} = "" ]] && line=ztest:$functrace[1] # Not from a file.
|
||||
_t_log $line "$*"
|
||||
}
|
||||
|
||||
# t_skip is for skipping a test.
|
||||
t_skip() {
|
||||
_t_log $funcfiletrace[1] "$*"
|
||||
() { return 100 }
|
||||
t_done
|
||||
}
|
||||
|
||||
# t_error logs the error and fails the test without aborting.
|
||||
t_error() {
|
||||
(( _test_errors++ ))
|
||||
_t_log $funcfiletrace[1] "$*"
|
||||
}
|
||||
|
||||
# t_fatal fails the test and halts execution immediately.
|
||||
t_fatal() {
|
||||
_t_log $funcfiletrace[1] "$*"
|
||||
() { return 101 }
|
||||
t_done
|
||||
}
|
||||
|
||||
# t_defer takes a function (and optionally, arguments)
|
||||
# to be executed after the test has completed.
|
||||
t_defer() {
|
||||
_test_defer_funcs+=("$*")
|
||||
}
|
||||
|
||||
# t_done completes the test execution, called automatically after a test.
|
||||
# Can also be called manually when the test is done.
|
||||
t_done() {
|
||||
local ret=$? w=${1:-1}
|
||||
(( _test_errors )) && ret=101
|
||||
|
||||
(( w )) && wait # Wait for test children to exit.
|
||||
for d in $_test_defer_funcs; do
|
||||
eval "$d"
|
||||
done
|
||||
print -n -u8 $ret # Send exit code to ztest.
|
||||
exec _t_runner # Replace shell, wait for new test.
|
||||
}
|
||||
|
||||
source $1 # Load the test module.
|
||||
|
||||
# Send available test functions to main process.
|
||||
print -u7 ${(R)${(okM)functions:#test_*}:#test_main}
|
||||
|
||||
# Run test_main.
|
||||
if [[ -n $functions[test_main] ]]; then
|
||||
test_main
|
||||
fi
|
||||
|
||||
exec _t_runner # Wait for commands.
|
||||
}
|
||||
|
||||
# run_test_module runs all the tests from a test module (asynchronously).
|
||||
run_test_module() {
|
||||
local module=$1
|
||||
local -a tests
|
||||
float start module_time
|
||||
|
||||
# Create fd's for communication with test runner.
|
||||
integer run_pid cmdoutfd cmdinfd outfd infd doneoutfd doneinfd
|
||||
|
||||
coproc cat; exec {cmdoutfd}>&p; exec {cmdinfd}<&p
|
||||
coproc cat; exec {outfd}>&p; exec {infd}<&p
|
||||
coproc cat; exec {doneoutfd}>&p; exec {doneinfd}<&p
|
||||
|
||||
# No need to keep coproc (&p) open since we
|
||||
# have redirected the outputs and inputs.
|
||||
coproc exit
|
||||
|
||||
# Launch a new interactive zsh test runner. We don't capture stdout
|
||||
typeset -a run_args
|
||||
(( TEST_TRACE )) && run_args+=('-x')
|
||||
zsh -s $run_args <&$cmdinfd 7>&$outfd 8>&$doneoutfd &
|
||||
run_pid=$!
|
||||
|
||||
# Initialize by sending function body from t_runner_init
|
||||
# and immediately execute it as an anonymous function.
|
||||
syswrite -o $cmdoutfd "() { ${functions[t_runner_init]} } $module"$'\n'
|
||||
sysread -i $infd
|
||||
tests=(${(@)=REPLY})
|
||||
[[ -n $TEST_RUN ]] && tests=(${(M)tests:#*$TEST_RUN*})
|
||||
|
||||
integer mod_exit=0
|
||||
float mod_start mod_time
|
||||
|
||||
mod_start=$EPOCHREALTIME # Store the module start time.
|
||||
|
||||
# Run all tests.
|
||||
local test_out
|
||||
float test_start test_time
|
||||
integer text_exit
|
||||
|
||||
for test in $tests; do
|
||||
(( TEST_VERBOSE )) && print "=== RUN $test"
|
||||
|
||||
test_start=$EPOCHREALTIME # Store the test start time.
|
||||
|
||||
# Start the test.
|
||||
syswrite -o $cmdoutfd "$test; t_done"$'\n'
|
||||
|
||||
test_out=
|
||||
test_exit=-1
|
||||
while (( test_exit == -1 )); do
|
||||
# Block until there is data to be read.
|
||||
zselect -r $doneinfd -r $infd
|
||||
|
||||
if [[ $reply[2] = $doneinfd ]]; then
|
||||
sysread -i $doneinfd
|
||||
test_exit=$REPLY # Store reply from sysread
|
||||
# Store the test execution time.
|
||||
test_time=$(( EPOCHREALTIME - test_start ))
|
||||
fi
|
||||
|
||||
# Read all output from the test output channel.
|
||||
while sysread -i $infd -t 0; do
|
||||
test_out+=$REPLY
|
||||
unset REPLY
|
||||
done
|
||||
done
|
||||
|
||||
case $test_exit in
|
||||
(0|1) state=PASS;;
|
||||
(100) state=SKIP;;
|
||||
(101|102) state=FAIL; mod_exit=1;;
|
||||
*) state="????";;
|
||||
esac
|
||||
|
||||
if [[ $state = FAIL ]] || (( TEST_VERBOSE )); then
|
||||
printf -- "--- $state: $test (%.2fs)\n" $test_time
|
||||
print -n $test_out
|
||||
fi
|
||||
done
|
||||
|
||||
# Store module execution time.
|
||||
mod_time=$(( EPOCHREALTIME - mod_start ))
|
||||
|
||||
# Perform cleanup.
|
||||
kill -HUP $run_pid
|
||||
exec {outfd}>&-
|
||||
exec {infd}<&-
|
||||
exec {cmdinfd}>&-
|
||||
exec {cmdoutfd}<&-
|
||||
exec {doneinfd}<&-
|
||||
exec {doneoutfd}>&-
|
||||
|
||||
if (( mod_exit )); then
|
||||
print "FAIL"
|
||||
(( TEST_VERBOSE )) && print "exit code $mod_exit"
|
||||
printf "FAIL\t$module\t%.3fs\n" $mod_time
|
||||
else
|
||||
(( TEST_VERBOSE )) && print "PASS"
|
||||
printf "ok\t$module\t%.3fs\n" $mod_time
|
||||
fi
|
||||
|
||||
return $mod_exit
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
trap - HUP
|
||||
kill -HUP $$ 2>/dev/null
|
||||
kill -HUP -$$ 2>/dev/null
|
||||
}
|
||||
|
||||
trap cleanup EXIT INT HUP QUIT TERM USR1
|
||||
|
||||
# Parse command arguments.
|
||||
parse_opts $@
|
||||
|
||||
(( ZTEST_DEBUG )) && setopt xtrace
|
||||
|
||||
# Execute tests modules.
|
||||
failed=0
|
||||
for tf in ${~TEST_GLOB}/*_test.(zsh|sh); do
|
||||
run_test_module $tf &
|
||||
wait $!
|
||||
(( $? )) && failed=1
|
||||
done
|
||||
|
||||
exit $failed
|
1
.zprezto/modules/prompt/external/powerlevel9k/.git_backup
vendored
Normal file
1
.zprezto/modules/prompt/external/powerlevel9k/.git_backup
vendored
Normal file
@@ -0,0 +1 @@
|
||||
gitdir: ../../../../.git/modules/modules/prompt/external/powerlevel9k
|
35
.zprezto/modules/prompt/external/powerlevel9k/.github_backup/ISSUE_TEMPLATE.md
vendored
Normal file
35
.zprezto/modules/prompt/external/powerlevel9k/.github_backup/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
Thanks for opening an issue! For a project that deals with as many different things as P9k, debugging problems can be difficult. Please follow the guide, below, to create a bug report that will help us help you!
|
||||
|
||||
### Before Opening a Bug
|
||||
P9k is lovingly maintained by volunteers, and we are happy to help you! You can help us by first making sure your issue hasn't already been solved before opening a new one. Please check the [Troubleshooting Guide](https://github.com/bhilburn/powerlevel9k/wiki/Troubleshooting) first. Many issues are actually local configuration problems, which may have previously been solved by another user - be sure to also [search the existing issues](https://github.com/bhilburn/powerlevel9k/issues?utf8=%E2%9C%93&q=is%3Aissue) before opening a new one.
|
||||
|
||||
Once you've done these things, you can delete this section and proceed `=)`
|
||||
|
||||
-----
|
||||
|
||||
#### Describe Your Issue
|
||||
What is happening?
|
||||
|
||||
Most issues are best explained with a screenshot. Please share one if you can!
|
||||
|
||||
#### Have you tried to debug or fix it?
|
||||
|
||||
|
||||
Have you tinkered with your settings, and what happened when you did? Did you find a bit of code that you think might be the culprit? Let us know what you've done so far!
|
||||
|
||||
#### Environment Information
|
||||
This information will help us understand your configuration.
|
||||
|
||||
- What version of ZSH are you using? You can use `zsh --version` to see this.
|
||||
- Do you use a ZSH framework (e.g., Oh-My-ZSH, Antigen)?
|
||||
- How did you install P9k (cloning the repo, by tarball, a package from your OS, etc.,)?
|
||||
- What version of P9k are you using?
|
||||
- Which terminal emulator do you use?
|
||||
|
||||
#### Issues with Fonts & Icons
|
||||
You may delete this section if your issue is not font / icon related.
|
||||
|
||||
- Which font do you use?
|
||||
- Which [font configuration mode](https://github.com/bhilburn/powerlevel9k/wiki/About-Fonts) are you using? You can check this with (`echo $POWERLEVEL9K_MODE`).
|
||||
- Please share the contents of `$P9k/debug/font-issues.zsh`.
|
||||
- If this is an icon problem, does the output of `$ get_icon_names` look correct?
|
32
.zprezto/modules/prompt/external/powerlevel9k/.github_backup/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
32
.zprezto/modules/prompt/external/powerlevel9k/.github_backup/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
Thank you so much for opening a PR for P9k! Many of our best features and segments have come from the community, and we are excited to see your contribution.
|
||||
|
||||
To help you make the best PR, here are some guidelines:
|
||||
|
||||
- The `master` branch is our *stable* branch, and the `next` branch is our development branch. If you are submitting a bug fix, please file your PR against `master`. If it is a new feature, enhancement, segment, or something similar, please submit it against `next`. For more information, please see our [Developer's Guide](https://github.com/bhilburn/powerlevel9k/wiki/Developer's-Guide).
|
||||
- We maintain unit tests for segments and features in the `test` directory. Please add unit tests for anything new you have developed! If you aren't sure how to do this, go ahead and file your PR and ask for help!
|
||||
- For running manual tests in different environments, we have Vagrant and Docker configurations. Please see the [Test README](https://github.com/bhilburn/powerlevel9k/blob/next/TESTS.md) and make sure your new feature is working as expected!
|
||||
- If your PR requires user configuration, please make sure that it includes an update to the README describing this.
|
||||
- P9k maintains a lot of useful information in our [Wiki](https://github.com/bhilburn/powerlevel9k/wiki). Depending on the content of your PR, we might ask you to update the Wiki (or provide text for us to use) to document your work. Most PRs don't require this.
|
||||
- Please make your commit messages useful! Here is a [great short guide on useful commit messages](https://code.likeagirl.io/useful-tips-for-writing-better-git-commit-messages-808770609503).
|
||||
|
||||
Once you have submitted your PR, P9k core contributors will review the code and work with you to get it merged. During this process, we might request changes to your code and discuss different ways of doing things. This is all part of the open source process, and our goal is to help you create the best contribution possible for P9k `=)`.
|
||||
|
||||
Please follow this template for creating your PR:
|
||||
|
||||
#### Title
|
||||
Please make the title of your PR descriptive! If appropriate, please prefix the title with one of these tags:
|
||||
|
||||
- [Bugfix]
|
||||
- [New Segment]
|
||||
- [Docs]
|
||||
- [Enhancement]
|
||||
|
||||
#### Description
|
||||
Please describe the contribution your PR makes! Screenshots are especially helpful, here, if it's a new segment.
|
||||
|
||||
If your PR is addressing an issue, please reference the Issue number here.
|
||||
|
||||
#### Questions
|
||||
Is there something in your PR you're not sure about or need help with? Is there a particular piece of code you would like feedback on? Let us know here!
|
||||
|
||||
|
3
.zprezto/modules/prompt/external/powerlevel9k/.gitignore_backup
vendored
Normal file
3
.zprezto/modules/prompt/external/powerlevel9k/.gitignore_backup
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
test-vm/.vagrant
|
||||
*.swp
|
||||
.idea
|
3
.zprezto/modules/prompt/external/powerlevel9k/.gitmodules_backup
vendored
Normal file
3
.zprezto/modules/prompt/external/powerlevel9k/.gitmodules_backup
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "shunit2"]
|
||||
path = shunit2
|
||||
url = https://github.com/kward/shunit2.git
|
32
.zprezto/modules/prompt/external/powerlevel9k/.travis.yml_backup
vendored
Normal file
32
.zprezto/modules/prompt/external/powerlevel9k/.travis.yml_backup
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
sudo: true
|
||||
dist: trusty
|
||||
language: sh
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- build-essential
|
||||
|
||||
before_script:
|
||||
# Show the git version being used to test.
|
||||
- "git --version"
|
||||
# Show the zsh version being used to test.
|
||||
- "zsh --version"
|
||||
|
||||
install:
|
||||
- "sudo apt-get update -qq"
|
||||
- "sudo apt-get install -y zsh"
|
||||
- "sudo chsh -s $(which zsh)"
|
||||
- "sudo apt-get install -y git mercurial subversion jq node golang ruby python python-virtualenv"
|
||||
|
||||
script:
|
||||
- test/powerlevel9k.spec
|
||||
- test/functions/utilities.spec
|
||||
- test/functions/colors.spec
|
||||
- test/functions/icons.spec
|
||||
- test/segments/command_execution_time.spec
|
||||
- test/segments/dir.spec
|
||||
- test/segments/rust_version.spec
|
||||
- test/segments/go_version.spec
|
||||
- test/segments/vcs.spec
|
||||
- test/segments/kubecontext.spec
|
||||
- test/segments/laravel_version.spec
|
432
.zprezto/modules/prompt/external/powerlevel9k/CHANGELOG.md
vendored
Normal file
432
.zprezto/modules/prompt/external/powerlevel9k/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,432 @@
|
||||
## v0.6.5
|
||||
|
||||
- Multiple PRs: General fixes to README, improved documentation.
|
||||
- Multiple PRs: Improvements to icons / glyphs.
|
||||
- PR #777: now possible to always show the Ruby env segment.
|
||||
- PR #773: Fixed issue with home abbreviation in directory segment.
|
||||
- PR #789: Now properly working around some odd ZSH status return codes.
|
||||
- PR #716: Now possible to configure the colors of the VCS segment in rebase mode.
|
||||
- PR #722: Removed dependency on `bc` for `load` segment.
|
||||
- PR #686: Fixed issue where whitespaces in path occasionally broke `dir` segment.
|
||||
- PR #685: No longer accidentally invoking user `grep` aliases.
|
||||
- PR #680: Using env variable for `PYENV` properly, now.
|
||||
- PR #676, #611: Fixes for Kubernetes segment.
|
||||
- PR #667: Supporting multiple AWS profiles.
|
||||
- PR #660: Fixing directory parsing issue with PYTHONPATH.
|
||||
- PR #663: Fixed silly issues causing ZSH warnings.
|
||||
- PR #647: Fixing `public_ip` segment for macOS.
|
||||
- PR #643: Fixing `vpn_ip` segment naming.
|
||||
- PR #636: `context` segment now grabs user with command rather than env.
|
||||
- PR #618: Fix issue where `su -` didn't change context segment.
|
||||
- PR #608: Load average selection in `load` segment.
|
||||
|
||||
### New Segment: `laravel_version`
|
||||
|
||||
Displays the current laravel version.
|
||||
|
||||
## v0.6.4
|
||||
|
||||
- `load` segment now has configurable averages.
|
||||
- Update to `dir` segment to add `dir_writable` feature.
|
||||
- `status` segment can now display POSIX signal name of exit code.
|
||||
- Added `teardown` command to turn off P9k prompt.
|
||||
- Fixes for P9k in Cygwin and 32-bit systems.
|
||||
- Better colors in virtualization segments.
|
||||
- Added 'Gopher' icon to the `go_version` segment.
|
||||
- Improved detection in `nvm`
|
||||
- Added option to support command status reading from piped command sequences.
|
||||
- Fixed issue with visual artifacts with quick consecutive commands.
|
||||
- Updated 'ananconda' segment for more uniform styling.
|
||||
- `rvm` segment can now support usernames with dashes.
|
||||
- Fixed Python icon reference in some font configurations.
|
||||
- Vi mode indicator fixed.
|
||||
- Fixes for Docker segment.
|
||||
- Added new Docker-based testing system.
|
||||
- Significant enhancements to the `battery` segment. Check out the README to
|
||||
read more!
|
||||
- New truncation strategy that truncates until the path becomes unique.
|
||||
|
||||
### New Segments: `host` and `user`
|
||||
|
||||
Provides two separate segments for `host` and `user` in case you don't wont both
|
||||
in one (per the `context` segment).
|
||||
|
||||
### New Segment: `newline`
|
||||
|
||||
Allows you to split segments across multiple lines.
|
||||
|
||||
### New Segment: `kubecontext`
|
||||
|
||||
Shows the current context of your `kubectl` configuration.
|
||||
|
||||
### New Segment: `vpn`
|
||||
|
||||
Shows current `vpn` interface.
|
||||
|
||||
## v0.6.3
|
||||
|
||||
- Fixed susceptibility to [pw3nage exploit](https://github.com/njhartwell/pw3nage).
|
||||
- Added support for Android
|
||||
- The abbreviation for $HOME is now configurable (doesn't have to be `~`).
|
||||
- Fixed colorization of VCS segment in Subversion repos.
|
||||
- Improved handling of symlinks in installation paths.
|
||||
|
||||
## v0.6.2
|
||||
|
||||
- Fixed some issues with the new `nerdfont-fontconfig` option.
|
||||
- Fixed typo in README.
|
||||
- The `get_icon_names` function can now print sorted output, and show which
|
||||
icons users have overridden.
|
||||
- Added a FreeBSD VM for testing.
|
||||
|
||||
### Add debug script for iTerm2 issues
|
||||
|
||||
A new script `debug/iterm.zsh` was added for easier spotting problems with your iTerm2 configuration.
|
||||
|
||||
### Add debug script for font issues
|
||||
|
||||
A new script `debug/font-issues.zsh` was added, so that problems with your font could be spotted easier.
|
||||
|
||||
### `ram` changes
|
||||
|
||||
The `ram` segment now shows the available ram instead of free.
|
||||
|
||||
### Add new segments `host` and `user`
|
||||
|
||||
The user and host segments allow you to have different icons and colors for both the user and host segments
|
||||
depending on their state.
|
||||
|
||||
## v0.6.0
|
||||
|
||||
- Fixed a bug where the tag display was broken on detached HEADs.
|
||||
- Fixed a bug where SVN detection sometimes failed.
|
||||
- Fixed the `load` and `ram` segments for BSD.
|
||||
- Fixed code-points that changed in Awesome fonts.
|
||||
- Fixed display of "OK_ICON" in `status` segment in non-verbose mode.
|
||||
- Fixed an issue where dir name truncation that was very short sometimes failed.
|
||||
- Speed & accuracy improvements to the battery segment.
|
||||
- Added Github syntax highlighting to README.
|
||||
- Various documentation cleanup.
|
||||
|
||||
### New Font Option: nerd-fonts
|
||||
|
||||
There is now an option to use [nerd-fonts](https://github.com/ryanoasis/nerd-fonts) with P9k. Simply configure the `nerdfont-fontconfig`, and you'll be set!
|
||||
|
||||
### `vcs` changes
|
||||
|
||||
The VCS segment can now display icons for remote repo hosting services, including Github, Gitlab, and 'other'.
|
||||
|
||||
### `dir` changes
|
||||
|
||||
Added an option to configure the path separator. If you want something
|
||||
else than an ordinary slash, you could set
|
||||
`POWERLEVEL9K_DIR_PATH_SEPARATOR` to whatever you want.
|
||||
|
||||
#### `truncate_with_package_name` now searches for `composer.json` as well
|
||||
|
||||
Now `composer.json` files are searched as well. By default `package.json` still takes
|
||||
precedence. If you want to change that, set `POWERLEVEL9K_DIR_PACKAGE_FILES=(composer.json package.json)`.
|
||||
|
||||
### New segment `command_execution_time` added
|
||||
|
||||
Shows the duration a command needed to run. By default only durations over 3 seconds
|
||||
are shown (can be adjusted by setting POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD).
|
||||
|
||||
### New segment `dir_writable` added
|
||||
|
||||
This segment displays a lock icon if your user has no write permissions in the current folder.
|
||||
|
||||
### New segment `disk_usage` added
|
||||
|
||||
This segment will show the usage level of your current partition.
|
||||
|
||||
### New segment `public_ip` added
|
||||
|
||||
Fetches your Public IP (using ident.me) and displays it in your prompt.
|
||||
|
||||
### New segment `swift_version` added
|
||||
|
||||
This segment displays the version of Swift that is installed / in your path.
|
||||
|
||||
### New segment `detect_virt` added
|
||||
|
||||
Detects and reports if you are in a virtualized session using `systemd`.
|
||||
|
||||
## v0.5.0
|
||||
|
||||
### `load` and `ram` changes
|
||||
|
||||
These two segments now support BSD.
|
||||
|
||||
### `vcs` changes
|
||||
|
||||
- We implemented a huge speed improvement for this segment.
|
||||
- Now this segment supports Subversion repositories.
|
||||
- Add ability to hide tags by setting `POWERLEVEL9K_VCS_HIDE_TAGS` to true.
|
||||
|
||||
## `anaconda` changes
|
||||
|
||||
Speed improvements for `anaconda` segment.
|
||||
|
||||
## v0.4.0
|
||||
|
||||
### Development changes
|
||||
|
||||
From now on, development makes use of a CI system "travis".
|
||||
|
||||
### `vcs` changes
|
||||
|
||||
The default state was renamed to `clean`. If you overrode foreground
|
||||
or background color in the past, you need to rename your variables to:
|
||||
|
||||
```zsh
|
||||
POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'
|
||||
POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'
|
||||
```
|
||||
|
||||
Additionaly the vcs segment now has an `untracked` state which
|
||||
indicates that you have untracked files in your repository.
|
||||
|
||||
The foreground color of actionformat is now configurable via:
|
||||
```zsh
|
||||
POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND='green'
|
||||
```
|
||||
|
||||
Also, the vcs segment uses the foreground color it was configured to.
|
||||
That said, the variables `POWERLEVEL9K_VCS_FOREGROUND` and
|
||||
`POWERLEVEL9K_VCS_DARK_FOREGROUND` are no longer used. Instead use
|
||||
the proper variable `POWERLEVEL9K_VCS_<STATE>_FOREGROUND` to change
|
||||
foreground color.
|
||||
|
||||
### `dir` Shortening Strategies
|
||||
|
||||
There is now a path shortening strategy that will use the `package.json` file to
|
||||
shorten your directory path. See the documentation for the `dir` segment for more
|
||||
details.
|
||||
|
||||
Also, the shorten delimiter was changed to an unicode ellipsis. It is configurable
|
||||
via `POWERLEVEL9K_SHORTEN_DELIMITER`.
|
||||
|
||||
### `rbenv` changes
|
||||
|
||||
The `rbenv` segment now makes use of the full rbenv command, so the correct
|
||||
ruby version is now shown if it differs from the globally one.
|
||||
|
||||
### `node`, `nvm` Segments
|
||||
|
||||
Improvements to speed / reliability.
|
||||
|
||||
### `ram` changes
|
||||
|
||||
The `ram` segment was split up into `ram` and `swap`. The
|
||||
`POWERLEVEL9K_RAM_ELEMENTS` variable is obsolete.
|
||||
|
||||
### New segment `swap` added
|
||||
|
||||
Due to the split up of the ram segment, this one was created. It
|
||||
shows the currently used swap size.
|
||||
|
||||
### New segment `nodeenv` added
|
||||
|
||||
Added new `nodeenv` segment that shows the currently used node environment.
|
||||
|
||||
### New segment `aws_eb_env` added
|
||||
|
||||
This segment displays the current Elastic Beanstalk environment.
|
||||
|
||||
### New segment `chruby` added
|
||||
|
||||
Added new `chruby` segment to support this version manager.
|
||||
|
||||
### New segment `docker_machine` added
|
||||
|
||||
Added new `docker_machine` segment that will show your Docker machine.
|
||||
|
||||
### New segment `anaconda` added
|
||||
|
||||
A new segment `anaconda` was added that shows the current used
|
||||
anaconda environment.
|
||||
|
||||
## New segment `pyenv` added
|
||||
|
||||
This segment shows your active python version as reported by `pyenv`.
|
||||
|
||||
|
||||
## v0.3.2
|
||||
|
||||
### `vcs` changes
|
||||
|
||||
A new state `UNTRACKED` was added to the `vcs` segment. So we now
|
||||
have 3 states for repositories: `UNTRACKED`, `MODIFIED`, and the
|
||||
default state. The `UNTRACKED` state is active when there are files
|
||||
in the repository directory which have not been added to the repo
|
||||
(the same as when the `+` icon appears). The default color for the
|
||||
`UNTRACKED` state is now yellow, and the default color for the
|
||||
`MODIFIED` state is now read, but those colors can be changed by
|
||||
setting these variables, for example:
|
||||
|
||||
```zsh
|
||||
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='black'
|
||||
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='white'
|
||||
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='green'
|
||||
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='blue'
|
||||
```
|
||||
|
||||
## v0.3.1
|
||||
|
||||
### `dir` changes
|
||||
|
||||
A new state `HOME_SUBFOLDER` was added. So if you want to overwrite
|
||||
colors for this segment, also set this variables:
|
||||
```zsh
|
||||
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND='black'
|
||||
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND='white'
|
||||
```
|
||||
|
||||
### `background_jobs` changes
|
||||
Now displays the number of background jobs if there's more than 1.
|
||||
You can disable it by setting :
|
||||
```zsh
|
||||
POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
|
||||
```
|
||||
|
||||
## v0.3.0
|
||||
|
||||
### Introduced "visual identifiers" to the segments
|
||||
|
||||
Now almost every segment can have a visual identifier, which is an
|
||||
icon whose color could be adjusted by users.
|
||||
|
||||
### Added ability for "joined" segments
|
||||
|
||||
You can now merge segments together by suffixing the segment name with "_joined".
|
||||
For Developers: Be aware that the order of parameters in left/right_prompt_segment
|
||||
has changed. Now a boolean parameter must be set as second parameter (true if joined).
|
||||
|
||||
### `dir` changes
|
||||
|
||||
This segment now has "state", which means you now can change the colors seperatly
|
||||
depending if you are in your homefolder or not.
|
||||
Your variables for that should now look like:
|
||||
```zsh
|
||||
POWERLEVEL9K_DIR_HOME_BACKGROUND='green'
|
||||
POWERLEVEL9K_DIR_HOME_FOREGROUND='cyan'
|
||||
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red'
|
||||
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND='yellow'
|
||||
```
|
||||
|
||||
### `status` changes
|
||||
|
||||
The `status` segment was split up into three segments. `background_jobs` prints
|
||||
an icon if there are background jobs. `root_indicator` prints an icon if the user
|
||||
is root. The `status` segment focuses now on the status only.
|
||||
The `status` segment also now has "state". If you want to overwrite the colors,
|
||||
you have to add the state to your variables:
|
||||
```zsh
|
||||
POWERLEVEL9K_STATUS_ERROR_BACKGROUND='green'
|
||||
POWERLEVEL9K_STATUS_ERROR_FOREGROUND='cyan'
|
||||
POWERLEVEL9K_STATUS_OK_BACKGROUND='red'
|
||||
POWERLEVEL9K_STATUS_OK_FOREGROUND='yellow'
|
||||
```
|
||||
|
||||
### New segment `custom_command` added
|
||||
|
||||
A new segment that allows users to define a custom command was added.
|
||||
|
||||
### `virtualenv` changes
|
||||
|
||||
This segment now respects `VIRTUAL_ENV_DISABLE_PROMPT`. If this variable is set
|
||||
to `true`, the segments does not get rendered.
|
||||
|
||||
### `load` changes
|
||||
|
||||
The `load` segement was split and a new segment `ram` was extracted. This new
|
||||
segment is able to show the free ram and used swap.
|
||||
|
||||
### `vcs` changes
|
||||
|
||||
This prompt uses the `VCS_INFO` subsystem by ZSH. From now on this subsystem
|
||||
is only invoked if a `vcs` segment was configured.
|
||||
|
||||
### `rvm` changes
|
||||
|
||||
This segment now does not invoke RVM directly anymore. Instead, is relys on the
|
||||
circumstance that RVM was invoked beforehand and just reads the environment
|
||||
variables '$GEM_HOME' and '$MY_RUBY_HOME'. It also now displays the used gemset.
|
||||
|
||||
### New segment `battery` added
|
||||
|
||||
A new segment that shows the battery status of your laptop was added.
|
||||
|
||||
### New segment `go_version` added
|
||||
|
||||
This segment shows the GO version.
|
||||
|
||||
### New segment `nvm` added
|
||||
|
||||
This segment shows your NodeJS version by using NVM (and if it is not 'default').
|
||||
|
||||
### New segment `todo` added
|
||||
|
||||
This segment shows your ToDos from [todo.sh](http://todotxt.com/).
|
||||
|
||||
### New segment `rust_version` added
|
||||
|
||||
This segment shows your local rust version.
|
||||
|
||||
## v0.2.0
|
||||
|
||||
### `longstatus` is now `status`
|
||||
|
||||
The segments got merged together. To show the segment only if an error occurred,
|
||||
set `POWERLEVEL9K_STATUS_VERBOSE=false` (this is the same behavior as the old
|
||||
`status` segment.
|
||||
|
||||
### Icon overriding mechanism added
|
||||
|
||||
All icons can now be overridden by setting a variable named by the internal icon
|
||||
name. You can get a full list of icon name by calling `get_icon_names`.
|
||||
|
||||
### Same color segements get visual separator
|
||||
|
||||
This separator can be controlled by setting `POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR`
|
||||
or `POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR`. By default this separator is
|
||||
printed in the foreground color.
|
||||
|
||||
### `dir` segment has different strategies for truncation
|
||||
|
||||
Now you can choose between `truncate_middle` or `truncate_from_right` by setting
|
||||
`POWERLEVEL9K_SHORTEN_STRATEGY`. Default behavior is unchanged (truncate whole
|
||||
directories). `POWERLEVEL9K_SHORTEN_DIR_LENGTH` can be used to influence how
|
||||
much will be truncated (either direcories or chars).
|
||||
|
||||
### New segment `ip` added
|
||||
|
||||
This segment shows your internal IP address. You can define which interfaces IP
|
||||
will be shown by specifying it via `POWERLEVEL9K_IP_INTERFACE`.
|
||||
|
||||
### New segment `load` added
|
||||
|
||||
This segment shows your computers 5min load average.
|
||||
|
||||
### New segment `os_icon` added
|
||||
|
||||
This segment shows a little indicator which OS you are running.
|
||||
|
||||
### New segment `php_version` added
|
||||
|
||||
This segment shows your PHP version.
|
||||
|
||||
### New segment `vi_mode` added
|
||||
|
||||
This segment gives you a hint in which VI-mode you currently are. This
|
||||
segment requires a proper configured VI-mode.
|
||||
|
||||
### Added the ability to have empty left or right prompts
|
||||
|
||||
By setting the according variable to an empty array, the left or right
|
||||
prompt will be empty.
|
||||
|
||||
## v0.1.0
|
||||
|
||||
This is the first release
|
46
.zprezto/modules/prompt/external/powerlevel9k/CODE_OF_CONDUCT.md
vendored
Normal file
46
.zprezto/modules/prompt/external/powerlevel9k/CODE_OF_CONDUCT.md
vendored
Normal file
@@ -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/
|
20
.zprezto/modules/prompt/external/powerlevel9k/LICENSE
vendored
Normal file
20
.zprezto/modules/prompt/external/powerlevel9k/LICENSE
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2014-2017 Ben Hilburn <bhilburn@gmail.com>
|
||||
|
||||
MIT LICENSE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
739
.zprezto/modules/prompt/external/powerlevel9k/README.md
vendored
Normal file
739
.zprezto/modules/prompt/external/powerlevel9k/README.md
vendored
Normal file
@@ -0,0 +1,739 @@
|
||||

|
||||
---
|
||||
[](https://travis-ci.org/bhilburn/powerlevel9k)
|
||||
[](https://gitter.im/bhilburn/powerlevel9k?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
Powerlevel9k is a theme for ZSH which uses [Powerline
|
||||
Fonts](https://github.com/powerline/fonts). It can be used with vanilla ZSH or
|
||||
ZSH frameworks such as [Oh-My-Zsh](https://github.com/robbyrussell/oh-my-zsh),
|
||||
[Prezto](https://github.com/sorin-ionescu/prezto),
|
||||
[Antigen](https://github.com/zsh-users/antigen), and [many
|
||||
others](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions).
|
||||
|
||||
Get more out of your terminal. Be a badass. Impress everyone in 'Screenshot Your
|
||||
Desktop' threads. Use powerlevel9k.
|
||||
|
||||

|
||||
|
||||
You can check out some other users' configurations in our wiki: [Show Off Your
|
||||
Config](https://github.com/bhilburn/powerlevel9k/wiki/Show-Off-Your-Config).
|
||||
|
||||
There are a number of Powerline ZSH themes available, now. The developers of
|
||||
this theme focus on four primary goals:
|
||||
|
||||
1. Give users a great out-of-the-box configuration with no additional
|
||||
configuration required.
|
||||
2. Make customization easy for users who do want to tweak their prompt.
|
||||
3. Provide useful segments that you can enable to make your prompt even more
|
||||
effective and helpful. We have prompt segments for everything from unit test
|
||||
coverage to your AWS instance.
|
||||
4. Optimize the code for execution speed as much as possible. A snappy terminal
|
||||
is a happy terminal.
|
||||
|
||||
Powerlevel9k can be used to create both very useful and beautiful terminal environments:
|
||||
|
||||

|
||||
|
||||
### Table of Contents
|
||||
|
||||
1. [Installation](#installation)
|
||||
2. [Customization](#prompt-customization)
|
||||
1. [Stylizing Your Prompt](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt)
|
||||
2. [Customizing Prompt Segments](#customizing-prompt-segments)
|
||||
3. [Available Prompt Segments](#available-prompt-segments)
|
||||
3. [Troubleshooting](https://github.com/bhilburn/powerlevel9k/wiki/Troubleshooting)
|
||||
|
||||
Be sure to also [check out the Wiki](https://github.com/bhilburn/powerlevel9k/wiki)!
|
||||
|
||||
### Installation
|
||||
There are two installation steps to go from a vanilla terminal to a PL9k
|
||||
terminal. Once you are done, you can optionally customize your prompt.
|
||||
|
||||
[Installation Instructions](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions)
|
||||
|
||||
1. [Install the Powerlevel9k Theme](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions#step-1-install-powerlevel9k)
|
||||
2. [Install Powerline Fonts](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions#step-2-install-a-powerline-font)
|
||||
|
||||
No configuration is necessary post-installation if you like the default
|
||||
settings, but there are plenty of segment customization options available if you
|
||||
are interested.
|
||||
|
||||
### Prompt Customization
|
||||
|
||||
Be sure to check out the wiki page on the additional prompt customization
|
||||
options, including color and icon settings: [Stylizing Your Prompt](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt)
|
||||
|
||||
#### Customizing Prompt Segments
|
||||
Customizing your prompt is easy! Select the segments you want to have displayed,
|
||||
and then assign them to either the left or right prompt by adding the following
|
||||
variables to your `~/.zshrc`.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_LEFT_PROMPT_ELEMENTS`|`(context dir rbenv vcs)`|Segment list for left prompt|
|
||||
|`POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS`|`(status root_indicator background_jobs history time)`|Segment list for right prompt|
|
||||
|
||||
|
||||
The table above shows the default values, so if you wanted to set these
|
||||
variables manually, you would put the following in
|
||||
your `~/.zshrc`:
|
||||
```zsh
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
|
||||
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time)
|
||||
```
|
||||
#### Available Prompt Segments
|
||||
The segments that are currently available are:
|
||||
|
||||
**System Status Segments:**
|
||||
* [`background_jobs`](#background_jobs) - Indicator for background jobs.
|
||||
* [`battery`](#battery) - Current battery status.
|
||||
* [`context`](#context) - Your username and host, conditionalized based on $USER and SSH status.
|
||||
* [`date`](#date) - System date.
|
||||
* [`dir`](#dir) - Your current working directory.
|
||||
* `dir_writable` - Displays a lock icon, if you do not have write permissions on the current folder.
|
||||
* [`disk_usage`](#disk_usage) - Disk usage of your current partition.
|
||||
* `history` - The command number for the current line.
|
||||
* [`host`](#host) - Your current host name
|
||||
* [`ip`](#ip) - Shows the current IP address.
|
||||
* [`vpn_ip`](#vpn_ip) - Shows the current VPN IP address.
|
||||
* [`public_ip`](#public_ip) - Shows your public IP address.
|
||||
* [`load`](#load) - Your machine's load averages.
|
||||
* `os_icon` - Display a nice little icon, depending on your operating system.
|
||||
* `ram` - Show free RAM.
|
||||
* `root_indicator` - An indicator if the user has superuser status.
|
||||
* [`status`](#status) - The return code of the previous command.
|
||||
* `swap` - Prints the current swap size.
|
||||
* [`time`](#time) - System time.
|
||||
* [`user`](#user) - Your current username
|
||||
* [`vi_mode`](#vi_mode)- Your prompt's Vi editing mode (NORMAL|INSERT).
|
||||
* `ssh` - Indicates whether or not you are in an SSH session.
|
||||
|
||||
**Development Environment Segments:**
|
||||
* [`vcs`](#vcs) - Information about this `git` or `hg` repository (if you are in one).
|
||||
|
||||
**Language Segments:**
|
||||
* **GoLang Segments:**
|
||||
* `go_version` - Show the current GO version.
|
||||
* **Javascript / Node.js Segments:**
|
||||
* `node_version` - Show the version number of the installed Node.js.
|
||||
* `nodeenv` - [nodeenv](https://github.com/ekalinin/nodeenv) prompt for displaying node version and environment name.
|
||||
* `nvm` - Show the version of Node that is currently active, if it differs from the version used by NVM
|
||||
* **PHP Segments:**
|
||||
* `php_version` - Show the current PHP version.
|
||||
* `laravel_version` - Show the current Laravel version.
|
||||
* [`symfony2_tests`](#symfony2_tests) - Show a ratio of test classes vs code classes for Symfony2.
|
||||
* `symfony2_version` - Show the current Symfony2 version, if you are in a Symfony2-Project dir.
|
||||
* **Python Segments:**
|
||||
* `virtualenv` - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/).
|
||||
* [`anaconda`](#anaconda) - Your active [Anaconda](https://www.continuum.io/why-anaconda) environment.
|
||||
* `pyenv` - Your active python version as reported by the first word of [`pyenv version`](https://github.com/yyuu/pyenv). Note that the segment is not displayed if that word is _system_ i.e. the segment is inactive if you are using system python.
|
||||
* **Ruby Segments:**
|
||||
* [`chruby`](#chruby) - Ruby environment information using `chruby` (if one is active).
|
||||
* [`rbenv`](#rbenv) - Ruby environment information using `rbenv` (if one is active).
|
||||
* [`rspec_stats`](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec.
|
||||
* `rvm` - Ruby environment information using `$GEM_HOME` and `$MY_RUBY_HOME` (if one is active).
|
||||
* **Rust Segments:**
|
||||
* `rust_version` - Display the current rust version and [logo](https://www.rust-lang.org/logos/rust-logo-blk.svg).
|
||||
* **Swift Segments:**
|
||||
* `swift_version` - Show the version number of the installed Swift.
|
||||
* **Java Segments:**
|
||||
* `java_version` - Show the current Java version.
|
||||
|
||||
**Cloud Segments:**
|
||||
* **AWS Segments:**
|
||||
* [`aws`](#aws) - The current AWS profile, if active.
|
||||
* `aws_eb_env` - The current Elastic Beanstalk Environment.
|
||||
* `docker_machine` - The current Docker Machine.
|
||||
* `kubecontext` - The current context of your `kubectl` configuration.
|
||||
* `dropbox` - Indicates Dropbox directory and syncing status using `dropbox-cli`
|
||||
|
||||
**Other:**
|
||||
* [`custom_command`](#custom_command) - Create a custom segment to display the
|
||||
output of an arbitrary command.
|
||||
* [`command_execution_time`](#command_execution_time) - Display the time the current command took to execute.
|
||||
* [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file.
|
||||
* `detect_virt` - Virtualization detection with systemd
|
||||
* `newline` - Continues the prompt on a new line.
|
||||
* `openfoam` - Shows the currently sourced [OpenFOAM](https://openfoam.org/) environment.
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
##### anaconda
|
||||
|
||||
This segment shows your active anaconda environment. It relies on either the
|
||||
`CONDA_ENV_PATH` or the `CONDA_PREFIX` (depending on the `conda` version)
|
||||
environment variable to be set which happens when you properly `source
|
||||
activate` an environment.
|
||||
|
||||
Special configuration variables:
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_ANACONDA_LEFT_DELIMITER`|"("|The left delimiter just before the environment name.|
|
||||
|`POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER`|")"|The right delimiter just after the environment name.|
|
||||
|
||||
Additionally the following segment specific parameters can be used to customize
|
||||
it: `POWERLEVEL9K_PYTHON_ICON`, `POWERLEVEL9K_ANACONDA_BACKGROUND`, and
|
||||
`POWERLEVEL9K_ANACONDA_FOREGROUND`.
|
||||
|
||||
##### aws
|
||||
|
||||
If you would like to display the [current AWS
|
||||
profile](http://docs.aws.amazon.com/cli/latest/userguide/installing.html), add
|
||||
the `aws` segment to one of the prompts, and define `AWS_DEFAULT_PROFILE` in
|
||||
your `~/.zshrc`:
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`AWS_DEFAULT_PROFILE`|None|Your AWS profile name|
|
||||
|
||||
##### background_jobs
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE`|`true`|If there is more than one background job, this segment will show the number of jobs. Set this to `false` to turn this feature off.|
|
||||
`POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS`|`false`|Always show the jobs count (even if it's zero).|
|
||||
|
||||
##### battery
|
||||
|
||||
The default settings for this segment will display your current battery status (fails gracefully on
|
||||
systems without a battery). It is supported on both OSX and Linux (note that it requires `acpi` on Linux).
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_BATTERY_CHARGING`|`"yellow"`|Color to indicate a charging battery.|
|
||||
|`POWERLEVEL9K_BATTERY_CHARGED`|`"green"`|Color to indicate a charged battery.|
|
||||
|`POWERLEVEL9K_BATTERY_DISCONNECTED`|`$DEFAULT_COLOR`|Color to indicate absence of battery.|
|
||||
|`POWERLEVEL9K_BATTERY_LOW_THRESHOLD`|`10`|Threshold to consider battery level critical.|
|
||||
|`POWERLEVEL9K_BATTERY_LOW_COLOR`|`"red"`|Color to indicate critically low charge level.|
|
||||
|`POWERLEVEL9K_BATTERY_VERBOSE`|`true`|Display time remaining next to battery level.|
|
||||
|
||||
Note that you can [modify the `_FOREGROUND`
|
||||
color](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#segment-color-customization)
|
||||
without affecting the icon color.
|
||||
|
||||
You can also change the battery icon automatically depending on the battery
|
||||
level. This will override the default battery icon. In order to do this, you
|
||||
need to define the `POWERLEVEL9k_BATTERY_STAGES` variable.
|
||||
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|-------------------------------|---------------|---------------------------------------------------------------|
|
||||
| `POWERLEVEL9K_BATTERY_STAGES` | Unset | A string or array, which each index indicates a charge level. |
|
||||
|
||||
Powerlevel9k will use each index of the string or array as a stage to indicate battery
|
||||
charge level, progressing from left to right. You can provide any number of
|
||||
stages. The setting below, for example, provides 8 stages for Powerlevel9k to use.
|
||||
```zsh
|
||||
POWERLEVEL9K_BATTERY_STAGES="▁▂▃▄▅▆▇█"
|
||||
```
|
||||
|
||||
If you require extra spacing after the icon, you will have to set it as an array,
|
||||
since spaces in the string will be used as one of the stages and you will get a
|
||||
missing icon. To do this, declare the variable as follows:
|
||||
```zsh
|
||||
POWERLEVEL9K_BATTERY_STAGES=($'\u2581 ' $'\u2582 ' $'\u2583 ' $'\u2584 ' $'\u2585 ' $'\u2586 ' $'\u2587 ' $'\u2588 ')
|
||||
```
|
||||
|
||||
Using the array syntax, you can create stages comprised of multiple characters.
|
||||
The below setting provides 40 battery stages.
|
||||
```zsh
|
||||
POWERLEVEL9K_BATTERY_STAGES=(
|
||||
$'▏ ▏' $'▎ ▏' $'▍ ▏' $'▌ ▏' $'▋ ▏' $'▊ ▏' $'▉ ▏' $'█ ▏'
|
||||
$'█▏ ▏' $'█▎ ▏' $'█▍ ▏' $'█▌ ▏' $'█▋ ▏' $'█▊ ▏' $'█▉ ▏' $'██ ▏'
|
||||
$'██ ▏' $'██▎ ▏' $'██▍ ▏' $'██▌ ▏' $'██▋ ▏' $'██▊ ▏' $'██▉ ▏' $'███ ▏'
|
||||
$'███ ▏' $'███▎ ▏' $'███▍ ▏' $'███▌ ▏' $'███▋ ▏' $'███▊ ▏' $'███▉ ▏' $'████ ▏'
|
||||
$'████ ▏' $'████▎▏' $'████▍▏' $'████▌▏' $'████▋▏' $'████▊▏' $'████▉▏' $'█████▏' )
|
||||
```
|
||||
|
||||
You can also change the background of the segment automatically depending on the
|
||||
battery level. This will override the following variables:
|
||||
`POWERLEVEL9K_BATTERY_CHARGING`, `POWERLEVEL9K_BATTERY_CHARGED`,
|
||||
`POWERLEVEL9K_BATTERY_DISCONNECTED`, and `POWERLEVEL9K_BATTERY_LOW_COLOR`. In
|
||||
order to do this, define a color array, from low to high, as shown below:
|
||||
```zsh
|
||||
POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND=(red1 orangered1 darkorange orange1 gold1 yellow1 yellow2 greenyellow chartreuse1 chartreuse2 green1)
|
||||
```
|
||||
|
||||
As with the battery stages, you can use any number of colors and Powerlevel9k
|
||||
will automatically use all of them appropriately.
|
||||
|
||||
Some example settings:
|
||||
|
||||
| Brightness | Possible Array |
|
||||
|----------------|---------------------------------------------------------------------------------------------------------------|
|
||||
| Bright Colors | `(red1 orangered1 darkorange orange1 gold1 yellow1 yellow2 greenyellow chartreuse1 chartreuse2 green1)` |
|
||||
| Normal Colors | `(red3 darkorange3 darkgoldenrod gold3 yellow3 chartreuse2 mediumspringgreen green3 green3 green4 darkgreen)` |
|
||||
| Subdued Colors | `(darkred orange4 yellow4 yellow4 chartreuse3 green3 green4 darkgreen)` |
|
||||
|
||||
##### chruby
|
||||
|
||||
This segment shows the version of Ruby being used when using `chruby` to change your current Ruby stack.
|
||||
|
||||
It uses `$RUBY_ENGINE` and `$RUBY_VERSION` as set by `chruby`.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_CHRUBY_SHOW_ENGINE`|true|Show the currently selected Ruby engine (e.g. `ruby`, `jruby`, `rbx`, etc)
|
||||
|`POWERLEVEL9K_CHRUBY_SHOW_VERSION`|true|Shows the currently selected engine's version (e.g. `2.5.1`)
|
||||
|
||||
##### command_execution_time
|
||||
|
||||
Display the time the previous command took to execute if the time is above
|
||||
`POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD`. The time is formatted to be
|
||||
"human readable", and so scales the units based on the length of execution time.
|
||||
If you want more precision, just set the
|
||||
`POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION` field.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD`|3|Threshold above which to print this segment. Can be set to `0` to always print.|
|
||||
|`POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION`|2|Number of digits to use in the fractional part of the time value.|
|
||||
|
||||
##### custom_command
|
||||
|
||||
The `custom_...` segment allows you to turn the output of a custom command into
|
||||
a prompt segment. As an example, if you wanted to create a custom segment to
|
||||
display your WiFi signal strength, you might define a custom segment called
|
||||
`custom_wifi_signal` like this:
|
||||
```zsh
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)
|
||||
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="echo signal: \$(nmcli device wifi | grep yes | awk '{print \$8}')"
|
||||
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_BACKGROUND="blue"
|
||||
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_FOREGROUND="yellow"
|
||||
```
|
||||
If you prefer, you can also define the function in your `.zshrc` rather than
|
||||
putting it in-line with the variable export, as shown above. Just don't forget
|
||||
to invoke your function from your segment! Example code that achieves the same
|
||||
result as the above:
|
||||
```zsh
|
||||
zsh_wifi_signal(){
|
||||
local signal=$(nmcli device wifi | grep yes | awk '{print $8}')
|
||||
local color='%F{yellow}'
|
||||
[[ $signal -gt 75 ]] && color='%F{green}'
|
||||
[[ $signal -lt 50 ]] && color='%F{red}'
|
||||
echo -n "%{$color%}\uf230 $signal%{%f%}" # \uf230 is
|
||||
}
|
||||
|
||||
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="zsh_wifi_signal"
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)
|
||||
```
|
||||
The command, above, gives you the wireless signal segment shown below:
|
||||
|
||||

|
||||
|
||||
You can define as many custom segments as you wish. If you think you have
|
||||
a segment that others would find useful, please consider upstreaming it to the
|
||||
main theme distribution so that everyone can use it!
|
||||
|
||||
##### context
|
||||
|
||||
The `context` segment (user@host string) is conditional. By default, it will
|
||||
only print if you are not your 'normal' user (including if you are root), or if
|
||||
you are SSH'd to a remote host. `SUDO` and `REMOTE_SUDO` states are also available to show whether the current user or remote user has superuser privileges.
|
||||
|
||||
To use this feature, make sure the `context` segment is enabled in your prompt
|
||||
elements (it is by default), and define a `DEFAULT_USER` in your `~/.zshrc`.
|
||||
|
||||
You can customize the `context` segment. For example, you can make it to print the
|
||||
full hostname by setting
|
||||
|
||||
```
|
||||
POWERLEVEL9K_CONTEXT_TEMPLATE="%n@`hostname -f`"
|
||||
```
|
||||
|
||||
You can set the `POWERLEVEL9K_CONTEXT_HOST_DEPTH` variable to change how the
|
||||
hostname is displayed. See [ZSH Manual](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Login-information)
|
||||
for details. The default is set to %m which will show the hostname up to the first ‘.’
|
||||
You can set it to %{N}m where N is an integer to show that many segments of system
|
||||
hostname. Setting N to a negative integer will show that many segments from the
|
||||
end of the hostname.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`DEFAULT_USER`|None|Username to consider a "default context" (you can also set `$USER`).|
|
||||
|`POWERLEVEL9K_ALWAYS_SHOW_CONTEXT`|false|Always show this segment, including $USER and hostname.|
|
||||
|`POWERLEVEL9K_ALWAYS_SHOW_USER`|false|Always show the username, but conditionalize the hostname.|
|
||||
|`POWERLEVEL9K_CONTEXT_TEMPLATE`|%n@%m|Default context prompt (username@machine). Refer to the [ZSH Documentation](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html) for all possible expansions, including deeper host depths.|
|
||||
|
||||
##### date
|
||||
|
||||
The `date` segment shows the current system date.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_DATE_FORMAT`|`%D{%d.%m.%y}`|[ZSH time format](http://zsh.sourceforge.net/Doc/Release Prompt-Expansion.html) to use in this segment.|
|
||||
|
||||
##### dir
|
||||
|
||||
The `dir` segment shows the current working directory. When using the "Awesome
|
||||
Powerline" fonts, there are additional glyphs, as well:
|
||||
|
||||
| `Compatible` | `Powerline` | `Awesome Powerline` | Situation
|
||||
|------------|-----------|-------------------|----------------------------
|
||||
| None | None |  | At the root of your home folder |
|
||||
| None | None |  | Within a subfolder of your home directory |
|
||||
| None | None |  | Outside of your home folder |
|
||||
|
||||
To turn off these icons you could set these variables to an empty string.
|
||||
```zsh
|
||||
POWERLEVEL9K_HOME_ICON=''
|
||||
POWERLEVEL9K_HOME_SUB_ICON=''
|
||||
POWERLEVEL9K_FOLDER_ICON=''
|
||||
```
|
||||
You can limit the output to a certain length by truncating long paths.
|
||||
Customizations available are:
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_DIR_PATH_ABSOLUTE`|None|If set to `true`, will use absolute paths instead of home folder abbreviation `~`|
|
||||
|`POWERLEVEL9K_SHORTEN_DIR_LENGTH`|`2`|If your shorten strategy, below, is entire directories, this field determines how many directories to leave at the end. If your shorten strategy is by character count, this field determines how many characters to allow per directory string.|
|
||||
|`POWERLEVEL9K_SHORTEN_STRATEGY`|None|How the directory strings should be truncated. See the table below for more informations.|
|
||||
|`POWERLEVEL9K_SHORTEN_DELIMITER`|`..`|Delimiter to use in truncated strings. This can be any string you choose, including an empty string if you wish to have no delimiter.|
|
||||
|
||||
| Strategy Name | Description |
|
||||
|---------------|-------------|
|
||||
|Default|Truncate whole directories from left. How many is defined by `POWERLEVEL9K_SHORTEN_DIR_LENGTH`|
|
||||
|`truncate_absolute_chars`|Truncates an absolute number of characters from the left such that the number of characters that your path displays (with or without `POWERLEVEL9K_SHORTEN_DELIMITER`) is no more than `POWERLEVEL9K_SHORTEN_DIR_LENGTH` + the length of `POWERLEVEL9K_SHORTEN_DELIMITER` |
|
||||
|`truncate_middle`|Truncates the middle part of a folder. E.g. you are in a folder named `~/MySuperProjects/AwesomeFiles/BoringOffice`, then it will truncated to `~/MyS..cts/Awe..les/BoringOffice`, if `POWERLEVEL9K_SHORTEN_DIR_LENGTH=3` is also set (controls the amount of characters to be left).|
|
||||
|`truncate_from_right`|Just leaves the beginning of a folder name untouched. E.g. your folders will be truncated like so: "/ro../Pr../office". How many characters will be untouched is controlled by `POWERLEVEL9K_SHORTEN_DIR_LENGTH`.|
|
||||
|`truncate_absolute`|Truncates everything exept the last few characters in the path. E.g. if you are in a folder named "~/Projects/powerlevel9k" and you have set `POWERLEVEL9K_SHORTEN_DIR_LENGTH=3`, you will get "..l9k".|
|
||||
|`truncate_to_last`|Truncates everything before the last folder in the path.|
|
||||
|`truncate_to_first_and_last|Truncate middle directories from the path. How many directories will be untouched is controlled by POWERLEVEL9K_SHORTER_DIR_LENGTH. E.g. if you are in a folder named "~/Projects/powerlevel9k" and you have set `POWERLEVEL9K_SHORTEN_DIR_LENGTH=1`, you will get "~/../powerlevel9k".||
|
||||
|`truncate_to_unique`|Parse all parent path components and truncate them to the shortest unique length. If you copy & paste the result to a shell, after hitting `TAB` it should expand to the original path unambiguously.|
|
||||
|`truncate_with_package_name`|Search for a `package.json` or `composer.json` and prints the `name` field to abbreviate the directory path. The precedence and/or files could be set by `POWERLEVEL9K_DIR_PACKAGE_FILES=(package.json composer.json)`. If you have [jq](https://stedolan.github.io/jq/) installed, it will dramatically improve the speed of this strategy.|
|
||||
|`truncate_with_folder_marker`|Search for a file that is specified by `POWERLEVEL9K_SHORTEN_FOLDER_MARKER` and truncate everything before that (if found, otherwise stop on $HOME and ROOT).|
|
||||
|
||||
For example, if you wanted the truncation behavior of the `fish` shell, which
|
||||
truncates `/usr/share/plasma` to `/u/s/plasma`, you would use the following:
|
||||
```zsh
|
||||
POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
|
||||
POWERLEVEL9K_SHORTEN_DELIMITER=""
|
||||
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right"
|
||||
```
|
||||
In each case you have to specify the length you want to shorten the directory
|
||||
to. So in some cases `POWERLEVEL9K_SHORTEN_DIR_LENGTH` means characters, in
|
||||
others whole directories.
|
||||
|
||||
The `truncate_with_package_name` strategy gives your directory path relative to the root of your project. For example, if you have a project inside `$HOME/projects/my-project` with a `package.json` that looks like:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-cool-project"
|
||||
}
|
||||
```
|
||||
|
||||
The path shown would be `my-cool-project`. If you navigate to `$HOME/projects/my-project/src`, then the path shown would be `my-cool-project/src`. Please note that this currently looks for `.git` directory to determine the root of the project.
|
||||
|
||||
If you want to customize the directory separator, you could set:
|
||||
```zsh
|
||||
# Double quotes are important here!
|
||||
POWERLEVEL9K_DIR_PATH_SEPARATOR="%F{red} $(print_icon 'LEFT_SUBSEGMENT_SEPARATOR') %F{black}"
|
||||
```
|
||||
To omit the first character (usually a slash that gets replaced if you set `POWERLEVEL9K_DIR_PATH_SEPARATOR`),
|
||||
you could set `POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true`.
|
||||
|
||||
You can also customize the leading tilde character when you are in `$HOME` using:
|
||||
```zsh
|
||||
# Double quotes are important here!
|
||||
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION="%F{red} $(print_icon 'HOME_ICON') %F{black}"
|
||||
```
|
||||
You can also configure the `dir` segment to show when you are in a directory without write permissions, using the variable below.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_DIR_SHOW_WRITABLE`|`false`|If set to `true` and you are in a directory that you do not have write permissions for, this segment will display a lock icon and enter the `NOT_WRITABLE` state (which can be customized per [our usual process](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#segment-color-customization)). Note that this functionality is also available in a separate segment, `dir_writable`.|
|
||||
|
||||
If you want to customize the last directory of the path, you can now set `POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND` to a custom color and/or `POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true` to display that part in bold.
|
||||
|
||||
You can also color the separator separately by setting the color using `POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND`.
|
||||
|
||||
##### disk_usage
|
||||
|
||||
The `disk_usage` segment will show the usage level of the partition that your current working directory resides in. It can be configured with the following variables.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|POWERLEVEL9K_DISK_USAGE_ONLY_WARNING|false|Hide the segment except when usage levels have hit warning or critical levels.|
|
||||
|POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL|90|The usage level that triggers a warning state.|
|
||||
|POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL|95|The usage level that triggers a critical state.|
|
||||
|
||||
##### host
|
||||
|
||||
The `host` segment will print the hostname.
|
||||
|
||||
You can set the `POWERLEVEL9K_HOST_TEMPLATE` variable to change how the hostname
|
||||
is displayed. See (ZSH Manual)[http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Login-information]
|
||||
for details. The default is set to `%m` which will show the hostname up to the
|
||||
first `.`. You can set it to `%{N}m` where N is an integer to show that many
|
||||
segments of system hostname. Setting `N` to a negative integer will show that many
|
||||
segments from the end of the hostname.
|
||||
|
||||
```
|
||||
POWERLEVEL9K_HOST_TEMPLATE="%2m"
|
||||
```
|
||||
|
||||
By default, LOCAL hosts will show the host icon and remote hosts will show the SSH icon. You can override them by setting
|
||||
```
|
||||
POWERLEVEL9K_HOST_ICON="\uF109 "
|
||||
POWERLEVEL9K_SSH_ICON="\uF489 "
|
||||
```
|
||||
|
||||
|
||||
##### ip
|
||||
|
||||
This segment tries to examine all currently used network interfaces and prints
|
||||
the first address it finds. In the case that this is not the right NIC, you can
|
||||
specify the correct network interface by setting:
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_IP_INTERFACE`|None|The NIC for which you wish to display the IP address. Example: `eth0`.|
|
||||
|
||||
##### vpn_ip
|
||||
|
||||
This segment tries to extract the VPN related IP addresses from nmcli, based on the NIC type:
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_VPN_IP_INTERFACE`|`tun`|The VPN interface.|
|
||||
|
||||
##### public_ip
|
||||
|
||||
This segment will display your public IP address. There are several methods of obtaining this
|
||||
information and by default it will try all of them starting with the most efficient. You can
|
||||
also specify which method you would like it to use. The methods available are dig using opendns,
|
||||
curl, or wget. The host used for wget and curl is http://ident.me by default but can be set to
|
||||
another host if you prefer.
|
||||
|
||||
If you activate a VPN, the icon for this segment will change to the defined VPN icon.
|
||||
|
||||
The public_ip segment will attempt to update your public IP address every 5 minutes by default(also
|
||||
configurable by the user). If you lose connection your cached IP address will be displayed until
|
||||
your timeout expires at which point every time your prompt is generated a new attempt will be made.
|
||||
Until an IP is successfully pulled the value of $POWERLEVEL9K_PUBLIC_IP_NONE will be displayed for
|
||||
this segment. If this value is empty(the default)and $POWERLEVEL9K_PUBLIC_IP_FILE is empty the
|
||||
segment will not be displayed.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_PUBLIC_IP_FILE`|'/tmp/p9k_public_ip'|This is the file your public IP is cached in.|
|
||||
|`POWERLEVEL9K_PUBLIC_IP_HOST`|'http://ident.me'|This is the default host to get your public IP.|
|
||||
|`POWERLEVEL9K_PUBLIC_IP_TIMEOUT`|300|The amount of time in seconds between refreshing your cached IP.|
|
||||
|`POWERLEVEL9K_PUBLIC_IP_METHODS`|(dig curl wget)| These methods in that order are used to refresh your IP.|
|
||||
|`POWERLEVEL9K_PUBLIC_IP_NONE`|None|The string displayed when an IP was not obtained|
|
||||
|
||||
##### load
|
||||
|
||||
Displays one of your load averages with appropriate state coloring. The thresholds are:
|
||||
- `0.7 * NUM_CORES <`: critical
|
||||
- `0.5 * NUM_CORES <`: warning
|
||||
- `less`: normal
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_LOAD_WHICH`|5|Which average to show. Possible values: 1, 5 or 15|
|
||||
|
||||
##### newline
|
||||
|
||||
Puts a newline in your prompt so you can continue using segments on the next
|
||||
line. This allows you to use segments on both lines, unlike
|
||||
`POWERLEVEL9K_PROMPT_ON_NEWLINE`, which simply separates segments from the
|
||||
prompt itself.
|
||||
|
||||
This only works on the left side. On the right side it does nothing.
|
||||
|
||||
##### rbenv
|
||||
|
||||
This segment shows the version of Ruby being used when using `rbenv` to change your current Ruby stack.
|
||||
|
||||
It figures out the version being used by taking the output of the `rbenv version-name` command.
|
||||
|
||||
* If `rbenv` is not in $PATH, nothing will be shown.
|
||||
* By default, if the current local Ruby version is the same as the global Ruby version, nothing will be shown. See the configuration variable, below, to modify this behavior.
|
||||
|
||||
Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_RBENV_ALWAYS`|'false'|Always show the `rbenv` segment, even if the local version matches the global.|
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW`|`false`|Set to true if you wish to show the rbenv segment even if the current Ruby version is the same as the global Ruby version|
|
||||
|
||||
##### rspec_stats
|
||||
|
||||
See [Unit Test Ratios](#unit-test-ratios), below.
|
||||
|
||||
##### status
|
||||
|
||||
This segment shows the return code of the last command.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_STATUS_CROSS`|`false`|Set to true if you wish not to show the error code when the last command returned an error and optionally hide this segment when the last command completed successfully by setting `POWERLEVEL9K_STATUS_OK` to false.|
|
||||
|`POWERLEVEL9K_STATUS_OK`|`true`|Set to true if you wish to show this segment when the last command completed successfully, false to hide it.|
|
||||
|`POWERLEVEL9K_STATUS_SHOW_PIPESTATUS`|`true`|Set to true if you wish to show the exit status for all piped commands.|
|
||||
|`POWERLEVEL9K_STATUS_HIDE_SIGNAME`|`false`|Set to true return the raw exit code (`1-255`). When set to false, values over 128 are shown as `SIGNAME(-n)` (e.g. `KILL(-9)`)|
|
||||
|
||||
##### ram
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_RAM_ELEMENTS`|Both|Specify `ram_free` or `swap_used` to only show one or the other rather than both.|
|
||||
|
||||
##### symfony2_tests
|
||||
|
||||
See [Unit Test Ratios](#unit-test-ratios), below.
|
||||
|
||||
##### time
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_TIME_FORMAT`|`'H:M:S'`|ZSH time format to use in this segment.|
|
||||
|
||||
As an example, if you wanted a reversed time format, you would use this:
|
||||
```zsh
|
||||
# Reversed time format
|
||||
POWERLEVEL9K_TIME_FORMAT='%D{%S:%M:%H}'
|
||||
```
|
||||
If you are using an "Awesome Powerline Font", you can add a time symbol to this
|
||||
segment, as well:
|
||||
```zsh
|
||||
# Output time, date, and a symbol from the "Awesome Powerline Font" set
|
||||
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M:%S \uE868 %d.%m.%y}"
|
||||
```
|
||||
##### user
|
||||
|
||||
The `user` segment will print the username.
|
||||
|
||||
You can also override the icons by setting:
|
||||
|
||||
```
|
||||
POWERLEVEL9K_USER_ICON="\uF415" #
|
||||
POWERLEVEL9K_ROOT_ICON="#"
|
||||
POWERLEVEL9K_SUDO_ICON=$'\uF09C' #
|
||||
```
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`DEFAULT_USER`|None|Username to consider a "default context".|
|
||||
|`POWERLEVEL9K_ALWAYS_SHOW_USER`|`false`|Always print this segment.|
|
||||
|`POWERLEVEL9K_USER_TEMPLATE`|`%n`|Default username prompt. Refer to the [ZSH Documentation](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html) for all possible expansions|
|
||||
|
||||
##### vcs
|
||||
|
||||
By default, the `vcs` segment will provide quite a bit of information. Further
|
||||
customization is provided via:
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_HIDE_BRANCH_ICON`|`false`|Set to `true` to hide the branch icon from the segment.|
|
||||
|`POWERLEVEL9K_SHOW_CHANGESET`|`false`|Set to `true` to display the hash / changeset in the segment.|
|
||||
|`POWERLEVEL9K_CHANGESET_HASH_LENGTH`|`12`|How many characters of the hash / changeset to display in the segment.|
|
||||
|`POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY`|`true`|Set to `false` to not reflect submodule status in the top-level repository prompt.|
|
||||
|`POWERLEVEL9K_VCS_HIDE_TAGS`|`false`|Set to `true` to stop tags being displayed in the segment.|
|
||||
|`POWERLEVEL9K_VCS_GIT_HOOKS`|`(vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname)`|Layout of the segment for git repositories.|
|
||||
|`POWERLEVEL9K_VCS_HG_HOOKS`|`(vcs-detect-changes)`|Layout of the segment for Mercurial repositories.|
|
||||
|`POWERLEVEL9K_VCS_SVN_HOOKS`|`(vcs-detect-changes svn-detect-changes)`|Layout of the segment for SVN repositories.|
|
||||
|`POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND`|`red`|The color of the foreground font during actions (e.g., `REBASE`).|
|
||||
|
||||
|
||||
##### vcs symbols
|
||||
|
||||
The `vcs` segment uses various symbols to tell you the state of your repository.
|
||||
These symbols depend on your installed font and selected `POWERLEVEL9K_MODE`
|
||||
from the [Installation](#Installation) section above.
|
||||
|
||||
| `Compatible` | `Powerline` | `Awesome Powerline` | Explanation
|
||||
|--------------|---------------------|-------------------|--------------------------
|
||||
| `↑4` | `↑4` | 4 | Number of commits your repository is ahead of your remote branch
|
||||
| `↓5` | `↓5` | 5 | Number of commits your repository is behind of your remote branch
|
||||
| `⍟3` | `⍟3` | 3 | Number of stashes, here 3.
|
||||
| `●` | `●` |  | There are unstaged changes in your working copy
|
||||
| `✚` | `✚` |  | There are staged changes in your working copy
|
||||
| `?` | `?` |  | There are files in your working copy, that are unknown to your repository
|
||||
| `→` | `→` |  | The name of your branch differs from its tracking branch.
|
||||
| `☿` | `☿` |  | A mercurial bookmark is active.
|
||||
| `@` |  |  | Branch Icon
|
||||
| None | None | 2c3705 | The current commit hash. Here "2c3705"
|
||||
| None | None |  | Repository is a git repository
|
||||
| None | None |  | Repository is a Mercurial repository
|
||||
|
||||
##### vcs truncation
|
||||
|
||||
You can limit the branch name to a certain length by truncating long names.
|
||||
Customizations available are:
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_VCS_SHORTEN_LENGTH`|None|This field determines how many characters to show.|
|
||||
|`POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH`|None|This field determines minimum branch length. Branch name will be truncated if its length greater than this field.|
|
||||
|`POWERLEVEL9K_VCS_SHORTEN_STRATEGY`|None|This field determines how branch name should be truncated. See the table below for more information.|
|
||||
|`POWERLEVEL9K_SHORTEN_DELIMITER`|`...`|Delimiter to use in truncated strings. This can be any string you choose, including an empty string if you wish to have no delimiter.|
|
||||
|
||||
| Strategy Name | Description |
|
||||
|---------------|-------------|
|
||||
|`truncate_middle`|Truncates the middle part of a branch. E.g. branch name is `1234-super_super_long_branch_name`, then it will truncated to `1234-..._name`, if `POWERLEVEL9K_VCS_SHORTEN_LENGTH=5` is also set (controls the amount of characters to be left).|
|
||||
|`truncate_from_right`|Just leaves the beginning of a branch name untouched. E.g. branch name will be truncated like so: `1234-...`. How many characters will be untouched is controlled by `POWERLEVEL9K_VCS_SHORTEN_LENGTH`.|
|
||||
|
||||
For example, if you want to truncate `1234-super_super_long_branch_name` to `1234-..` and don't do it with `development`:
|
||||
```zsh
|
||||
POWERLEVEL9K_VCS_SHORTEN_LENGTH=4
|
||||
POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=11
|
||||
POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_from_right"
|
||||
POWERLEVEL9K_VCS_SHORTEN_DELIMITER=".."
|
||||
```
|
||||
|
||||
##### vi_mode
|
||||
|
||||
This segment shows ZSH's current input mode. Note that this is only useful if
|
||||
you are using the [ZSH Line Editor](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html)
|
||||
(VI mode). You can enable this either by `.zshrc` configuration or using a plugin, like
|
||||
[Oh-My-Zsh's vi-mode plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/vi-mode/vi-mode.plugin.zsh).
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
|----------|---------------|-------------|
|
||||
|`POWERLEVEL9K_VI_INSERT_MODE_STRING`|`"INSERT"`|String to display while in 'Insert' mode.|
|
||||
|`POWERLEVEL9K_VI_COMMAND_MODE_STRING`|`"NORMAL"`|String to display while in 'Command' mode.|
|
||||
|
||||
To hide the segment entirely when in `INSERT` mode, set `POWERLEVEL9K_VI_INSERT_MODE_STRING=''`
|
||||
|
||||
#### Unit Test Ratios
|
||||
|
||||
The `symfony2_tests` and `rspec_stats` segments both show a ratio of "real"
|
||||
classes vs test classes in your source code. This is just a very simple ratio,
|
||||
and does not show your code coverage or any sophisticated stats. All this does
|
||||
is count your source files and test files, and calculate the ratio between them.
|
||||
Just enough to give you a quick overview about the test situation of the project
|
||||
you are dealing with.
|
||||
|
||||
### Disabling / Enabling Powerlevel9k
|
||||
|
||||
You can disable P9k and return to a very basic prompt at any time simply by
|
||||
calling:
|
||||
|
||||
```zsh
|
||||
$ prompt_powerlevel9k_teardown
|
||||
```
|
||||
|
||||
You can then re-enable it by calling:
|
||||
|
||||
```zsh
|
||||
$ prompt_powerlevel9k_setup
|
||||
```
|
||||
|
||||
### tl; dr
|
||||
|
||||
Want to just get a quick start? Check out the [Show Off Your
|
||||
Config](https://github.com/bhilburn/powerlevel9k/wiki/Show-Off-Your-Config)
|
||||
portion of the wiki to get going.
|
||||
|
||||
[The Wiki also has a ton of other useful
|
||||
information!](https://github.com/bhilburn/powerlevel9k/wiki)
|
||||
|
||||
### License
|
||||
|
||||
Project: MIT
|
||||
|
||||
Logo: CC-BY-SA. Source repository: https://github.com/bhilburn/powerlevel9k-logo
|
49
.zprezto/modules/prompt/external/powerlevel9k/TESTS.md
vendored
Normal file
49
.zprezto/modules/prompt/external/powerlevel9k/TESTS.md
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# Structure
|
||||
|
||||
The Unit-Tests do not follow exactly the file structure of Powerlevel9k itself.
|
||||
|
||||
## Basic Tests
|
||||
|
||||
Basic Tests belong in `test/powerlevel9k.spec` if they test basic functionality of
|
||||
Powerlevel9k itself. Basic functions from the `functions` directory have their
|
||||
Tests in separate files under `test/functions`.
|
||||
|
||||
## Segment Tests
|
||||
|
||||
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`.
|
||||
|
||||
# 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 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).
|
182
.zprezto/modules/prompt/external/powerlevel9k/debug/font-issues.zsh
vendored
Executable file
182
.zprezto/modules/prompt/external/powerlevel9k/debug/font-issues.zsh
vendored
Executable file
@@ -0,0 +1,182 @@
|
||||
#!/usr/bin/env zsh
|
||||
#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
|
||||
|
||||
# Taken from NeoFetch (slightly modified)
|
||||
get_term() {
|
||||
local term
|
||||
# If function was run, stop here.
|
||||
#((term_run == 1)) && return
|
||||
|
||||
# Workaround for macOS systems that
|
||||
# don't support the block below.
|
||||
case "$TERM_PROGRAM" in
|
||||
"iTerm.app") term="iTerm2" ;;
|
||||
"Terminal.app") term="Apple Terminal" ;;
|
||||
"Hyper") term="HyperTerm" ;;
|
||||
*) term="${TERM_PROGRAM/\.app}" ;;
|
||||
esac
|
||||
|
||||
# Check $PPID for terminal emulator.
|
||||
while [[ -z "$term" ]]; do
|
||||
parent="$(get_ppid "$parent")"
|
||||
name="$(get_process_name "$parent")"
|
||||
|
||||
case "${name// }" in
|
||||
"${SHELL/*\/}" | *"sh" | "tmux"* | "screen" | "su"*) ;;
|
||||
"login"* | *"Login"* | "init" | "(init)") term="$(tty)" ;;
|
||||
"ruby" | "1" | "systemd" | "sshd"* | "python"* | "USER"*"PID"*) break ;;
|
||||
"gnome-terminal-") term="gnome-terminal" ;;
|
||||
*) term="${name##*/}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Log that the function was run.
|
||||
#term_run=1
|
||||
|
||||
echo "${term}"
|
||||
}
|
||||
|
||||
get_term_font() {
|
||||
local term="${1}"
|
||||
#((term_run != 1)) && get_term
|
||||
|
||||
case "$term" in
|
||||
"alacritty"*)
|
||||
term_font="$(awk -F ':|#' '/normal:/ {getline; print}' "${XDG_CONFIG_HOME}/alacritty/alacritty.yml")"
|
||||
term_font="${term_font/*family:}"
|
||||
term_font="${term_font/$'\n'*}"
|
||||
term_font="${term_font/\#*}"
|
||||
;;
|
||||
|
||||
"Apple_Terminal")
|
||||
term_font="$(osascript -e 'tell application "Terminal" to font name of window frontmost')"
|
||||
;;
|
||||
"iTerm2")
|
||||
# Unfortunately the profile name is not unique, but it seems to be the only thing
|
||||
# that identifies an active profile. There is the "id of current session of current window"
|
||||
# thou, but that does not match to a guid in the plist.
|
||||
# So, be warned! Collisions may occur!
|
||||
# See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg
|
||||
# and: https://gitlab.com/gnachman/iterm2/issues/5586
|
||||
local currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window')
|
||||
|
||||
# Warning: Dynamic profiles are not taken into account here!
|
||||
# https://www.iterm2.com/documentation-dynamic-profiles.html
|
||||
|
||||
local nonAsciiFont
|
||||
|
||||
# Count Guids in "New Bookmarks"; they should be unique
|
||||
local profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep -c "Guid")
|
||||
for idx in $(seq 0 "${profilesCount}"); do
|
||||
local profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null)
|
||||
if [[ "${profileName}" == "${currentProfileName}" ]]; then
|
||||
# "Normal Font"
|
||||
term_font=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
|
||||
# Font for non-ascii characters
|
||||
# Only check for a different non-ascii font, if the user checked
|
||||
# the "use a different font for non-ascii text" switch.
|
||||
local useDifferentFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
if [[ "$useDifferentFont" == "true" ]]; then
|
||||
local nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
if [[ "$term_font" != "$nonAsciiFont" ]]; then
|
||||
term_font="$term_font (normal) / $nonAsciiFont (non-ascii)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
"deepin-terminal"*)
|
||||
term_font="$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END{print a " " b}' "${XDG_CONFIG_HOME}/deepin/deepin-terminal/config.conf")"
|
||||
;;
|
||||
|
||||
"Hyper"*)
|
||||
term_font="$(awk -F "," '/fontFamily/ {a=$1} END{print a}' "${HOME}/.hyper.js" | awk -F "'" '{a=$2} END{print a}')"
|
||||
;;
|
||||
|
||||
"konsole"*)
|
||||
# Get Process ID of current konsole window / tab
|
||||
child="$(get_ppid "$$")"
|
||||
|
||||
konsole_instances=($(qdbus | grep 'org.kde.konsole'))
|
||||
|
||||
for i in "${konsole_instances[@]}"; do
|
||||
konsole_sessions=($(qdbus "${i}" | grep '/Sessions/'))
|
||||
for session in "${konsole_sessions[@]}"; do
|
||||
if ((child == "$(qdbus "${i}" "${session}" processId)")); then
|
||||
profile="$(qdbus "${i}" "${session}" environment | awk -F '=' '/KONSOLE_PROFILE_NAME/ {print $2}')"
|
||||
break
|
||||
fi
|
||||
done
|
||||
[[ "$profile" ]] && break
|
||||
done
|
||||
|
||||
# We could have two profile files for the same profile name, take first match
|
||||
profile_filename="$(grep -l "Name=${profile}" "${HOME}"/.local/share/konsole/*.profile)"
|
||||
profile_filename="${profile_filename/$'\n'*}"
|
||||
[[ "$profile_filename" ]] && term_font="$(awk -F '=|,' '/Font=/ {print $2 " " $3}' "$profile_filename")"
|
||||
;;
|
||||
|
||||
"mintty")
|
||||
term_font="$(awk -F '=' '!/^($|#)/ && /Font/ {printf $2; exit}' "${HOME}/.minttyrc")"
|
||||
;;
|
||||
|
||||
"pantheon"*)
|
||||
term_font="$(gsettings get org.pantheon.terminal.settings font)"
|
||||
[[ -z "${term_font//\'}" ]] && term_font="$(gsettings get org.gnome.desktop.interface monospace-font-name)"
|
||||
term_font="$(trim_quotes "$term_font")"
|
||||
;;
|
||||
|
||||
"sakura"*)
|
||||
term_font="$(awk -F '=' '/^font=/ {a=$2} END{print a}' "${XDG_CONFIG_HOME}/sakura/sakura.conf")"
|
||||
;;
|
||||
|
||||
"terminology")
|
||||
term_font="$(strings "${XDG_CONFIG_HOME}/terminology/config/standard/base.cfg" | awk '/^font\.name$/{print a}{a=$0}')"
|
||||
term_font="${term_font/.pcf}"
|
||||
term_font="${term_font/:*}"
|
||||
;;
|
||||
|
||||
"termite")
|
||||
[[ -f "${XDG_CONFIG_HOME}/termite/config" ]] && termite_config="${XDG_CONFIG_HOME}/termite/config"
|
||||
term_font="$(awk -F '= ' '/\[options\]/ {opt=1} /^font/ {if(opt==1) a=$2; opt=0} END{print a}' "/etc/xdg/termite/config" "$termite_config")"
|
||||
;;
|
||||
|
||||
"urxvt" | "urxvtd" | "rxvt-unicode" | "xterm")
|
||||
term_font="$(grep -i -F "${term/d}*font" < <(xrdb -query))"
|
||||
term_font="${term_font/*font:}"
|
||||
term_font="$(trim "$term_font")"
|
||||
|
||||
# Xresources has two different font formats, this checks which
|
||||
# one is in use and formats it accordingly.
|
||||
case "$term_font" in
|
||||
*"xft:"*)
|
||||
term_font="${term_font/xft:}"
|
||||
term_font="${term_font/:*}"
|
||||
;;
|
||||
|
||||
"-"*) term_font="$(awk -F '\\-' '{printf $3}' <<< "$term_font")" ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
"xfce4-terminal")
|
||||
term_font="$(awk -F '=' '/^FontName/ {a=$2} END{print a}' "${XDG_CONFIG_HOME}/xfce4/terminal/terminalrc")"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "${term_font}"
|
||||
}
|
||||
|
||||
local currentTerminal=$(get_term)
|
||||
local currentFont=$(get_term_font "${currentTerminal}")
|
||||
print -P "===== Font debugging ====="
|
||||
print -P "You are using %F{blue}${currentTerminal}%f with Font %F{blue}${currentFont}%f\n"
|
||||
|
||||
if [[ $(echo "${currentFont}" | grep -c -E "Powerline|Awesome|Nerd") -eq 0 ]]; then
|
||||
print -P "%F{yellow}WARNING%f It does not seem like you use an Powerline-enabled or Awesome Terminal Font!"
|
||||
print -P "Please make sure that your font settings are correct!"
|
||||
else
|
||||
print -P "Your font settings seem to be all right. If you still have issues,"
|
||||
print -P "it is more likely to be a font issue than a Powerlevel9k related one."
|
||||
fi
|
86
.zprezto/modules/prompt/external/powerlevel9k/debug/iterm.zsh
vendored
Executable file
86
.zprezto/modules/prompt/external/powerlevel9k/debug/iterm.zsh
vendored
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env zsh
|
||||
#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
|
||||
|
||||
if [[ "$TERM_PROGRAM" != "iTerm.app" ]]; then
|
||||
print "Your Terminal Emulator does not appear to be iTerm2!"
|
||||
print "This debug script is intended only for iTerm2 terminals."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -x "/usr/libexec/PlistBuddy" ]]; then
|
||||
print "To use this debug script, you need to install XCode!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
local normalFont
|
||||
local type
|
||||
local command
|
||||
local ambiguousDoubleWidth
|
||||
local minimumContrast
|
||||
local useDifferentFont
|
||||
|
||||
# Unfortunately the profile name is not unique, but it seems to be the only
|
||||
# thing that identifies an active profile. There is the "ID of current session
|
||||
# of current window" though, but that does not match to a `guid` in the plist.
|
||||
# So, be warned - collisions may occur!
|
||||
# See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg
|
||||
local currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window')
|
||||
|
||||
# Warning: Dynamic profiles are not taken into account here!
|
||||
# https://www.iterm2.com/documentation-dynamic-profiles.html
|
||||
|
||||
# Count `guids` in "New Bookmarks"; they should be unique
|
||||
local profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep -c "Guid")
|
||||
for idx in $(seq 0 "${profilesCount}"); do
|
||||
local profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null)
|
||||
if [[ "${profileName}" == "${currentProfileName}" ]]; then
|
||||
# "Normal Font"
|
||||
normalFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
type=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Terminal\ Type:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
command=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Command:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
ambiguousDoubleWidth=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Ambiguous\ Double\ Width:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
minimumContrast=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Minimum\ Contrast:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
|
||||
# Font for non-ascii characters
|
||||
# Only check for a different non-ASCII font, if the user checked
|
||||
# the "use a different font for non-ascii text" switch.
|
||||
useDifferentFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
if [[ "$useDifferentFont" == "true" ]]; then
|
||||
nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||
if [[ "$normalFont" != "$nonAsciiFont" ]]; then
|
||||
normalFont="$normalFont (normal) / $nonAsciiFont (non-ascii)"
|
||||
fi
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
print -P "You use %F{blue}iTerm2%f with the following settings:"
|
||||
print -P " Font: ${normalFont}"
|
||||
print -P " Terminal-Type: ${type}"
|
||||
print -P " Command: ${command}"
|
||||
|
||||
#############################
|
||||
# Analyse possible problems #
|
||||
#############################
|
||||
local problemsFound
|
||||
if [[ "${ambiguousDoubleWidth}" == "true" ]]; then
|
||||
problemsFound="${problemsFound}\n * Please uncheck 'Treat ambiguous characters as double-width'."
|
||||
fi
|
||||
if (( minimumContrast > 0 )); then
|
||||
problemsFound="${problemsFound}\n * Please set minimum contrast to zero."
|
||||
fi
|
||||
if [[ $(echo "${normalFont}" | grep -c -E "Powerline|Awesome|Nerd|Source Code Pro") -eq 0 ]]; then
|
||||
problemsFound="${problemsFound}\n * It does not seem like you use an Powerline-enabled or Awesome Terminal Font!"
|
||||
fi
|
||||
|
||||
#############################
|
||||
# Output problems #
|
||||
#############################
|
||||
if [[ -n "${problemsFound}" ]]; then
|
||||
print -P "\n"
|
||||
print -P "%F{yellow}Possible Problems found:%f"
|
||||
print -P "${problemsFound}"
|
||||
else
|
||||
print -P "%F{green}No Problems found%f. Yay!"
|
||||
fi
|
8
.zprezto/modules/prompt/external/powerlevel9k/docker/antibody/Dockerfile
vendored
Normal file
8
.zprezto/modules/prompt/external/powerlevel9k/docker/antibody/Dockerfile
vendored
Normal file
@@ -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
|
1
.zprezto/modules/prompt/external/powerlevel9k/docker/antibody/install.zsh
vendored
Normal file
1
.zprezto/modules/prompt/external/powerlevel9k/docker/antibody/install.zsh
vendored
Normal file
@@ -0,0 +1 @@
|
||||
curl -sL https://git.io/antibody | bash -s
|
2
.zprezto/modules/prompt/external/powerlevel9k/docker/antibody/zshrc
vendored
Normal file
2
.zprezto/modules/prompt/external/powerlevel9k/docker/antibody/zshrc
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
source <(antibody init)
|
||||
antibody bundle ~/p9k/
|
8
.zprezto/modules/prompt/external/powerlevel9k/docker/antigen/Dockerfile
vendored
Normal file
8
.zprezto/modules/prompt/external/powerlevel9k/docker/antigen/Dockerfile
vendored
Normal file
@@ -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
|
12
.zprezto/modules/prompt/external/powerlevel9k/docker/antigen/install.zsh
vendored
Normal file
12
.zprezto/modules/prompt/external/powerlevel9k/docker/antigen/install.zsh
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/zsh
|
||||
|
||||
mkdir ~/antigen
|
||||
|
||||
curl \
|
||||
-qLsSf \
|
||||
-o ~/antigen/antigen.zsh \
|
||||
https://git.io/antigen
|
||||
|
||||
source ~/antigen/antigen.zsh
|
||||
|
||||
# EOF
|
4
.zprezto/modules/prompt/external/powerlevel9k/docker/antigen/zshrc
vendored
Normal file
4
.zprezto/modules/prompt/external/powerlevel9k/docker/antigen/zshrc
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
source ~/antigen/antigen.zsh
|
||||
|
||||
antigen theme "${HOME}/p9k" powerlevel9k --no-local-clone
|
||||
antigen apply
|
31
.zprezto/modules/prompt/external/powerlevel9k/docker/base-4.3.11/Dockerfile
vendored
Normal file
31
.zprezto/modules/prompt/external/powerlevel9k/docker/base-4.3.11/Dockerfile
vendored
Normal file
@@ -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"]
|
33
.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.0.3/Dockerfile
vendored
Normal file
33
.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.0.3/Dockerfile
vendored
Normal file
@@ -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"]
|
35
.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.1.1/Dockerfile
vendored
Normal file
35
.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.1.1/Dockerfile
vendored
Normal file
@@ -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"]
|
35
.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.2/Dockerfile
vendored
Normal file
35
.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.2/Dockerfile
vendored
Normal file
@@ -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"]
|
5
.zprezto/modules/prompt/external/powerlevel9k/docker/dotfile/Dockerfile
vendored
Normal file
5
.zprezto/modules/prompt/external/powerlevel9k/docker/dotfile/Dockerfile
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
ARG base
|
||||
FROM p9k:${base}
|
||||
|
||||
COPY ./ p9k/
|
||||
COPY docker/dotfile/zshrc .zshrc
|
1
.zprezto/modules/prompt/external/powerlevel9k/docker/dotfile/zshrc
vendored
Normal file
1
.zprezto/modules/prompt/external/powerlevel9k/docker/dotfile/zshrc
vendored
Normal file
@@ -0,0 +1 @@
|
||||
source "${HOME}/p9k/prompt_powerlevel9k_setup"
|
2
.zprezto/modules/prompt/external/powerlevel9k/docker/fred-sudoers
vendored
Normal file
2
.zprezto/modules/prompt/external/powerlevel9k/docker/fred-sudoers
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
Defaults:fred !requiretty
|
||||
fred ALL=(ALL) NOPASSWD: ALL
|
8
.zprezto/modules/prompt/external/powerlevel9k/docker/omz/Dockerfile
vendored
Normal file
8
.zprezto/modules/prompt/external/powerlevel9k/docker/omz/Dockerfile
vendored
Normal file
@@ -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/
|
4
.zprezto/modules/prompt/external/powerlevel9k/docker/omz/install.zsh
vendored
Normal file
4
.zprezto/modules/prompt/external/powerlevel9k/docker/omz/install.zsh
vendored
Normal file
@@ -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
|
5
.zprezto/modules/prompt/external/powerlevel9k/docker/omz/zshrc
vendored
Normal file
5
.zprezto/modules/prompt/external/powerlevel9k/docker/omz/zshrc
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
ZSH_THEME="powerlevel9k/powerlevel9k"
|
||||
plugins=(git rake ruby)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
7
.zprezto/modules/prompt/external/powerlevel9k/docker/prezto/Dockerfile
vendored
Normal file
7
.zprezto/modules/prompt/external/powerlevel9k/docker/prezto/Dockerfile
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
ARG base
|
||||
FROM p9k:${base}
|
||||
|
||||
COPY docker/prezto/install.zsh /tmp/
|
||||
RUN zsh /tmp/install.zsh
|
||||
|
||||
COPY ./ p9k/
|
18
.zprezto/modules/prompt/external/powerlevel9k/docker/prezto/install.zsh
vendored
Normal file
18
.zprezto/modules/prompt/external/powerlevel9k/docker/prezto/install.zsh
vendored
Normal file
@@ -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
|
8
.zprezto/modules/prompt/external/powerlevel9k/docker/zgen/Dockerfile
vendored
Normal file
8
.zprezto/modules/prompt/external/powerlevel9k/docker/zgen/Dockerfile
vendored
Normal file
@@ -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
|
5
.zprezto/modules/prompt/external/powerlevel9k/docker/zgen/install.zsh
vendored
Normal file
5
.zprezto/modules/prompt/external/powerlevel9k/docker/zgen/install.zsh
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
git clone https://github.com/tarjoilija/zgen.git "${HOME}/.zgen"
|
||||
|
||||
# EOF
|
10
.zprezto/modules/prompt/external/powerlevel9k/docker/zgen/zshrc
vendored
Normal file
10
.zprezto/modules/prompt/external/powerlevel9k/docker/zgen/zshrc
vendored
Normal file
@@ -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
|
7
.zprezto/modules/prompt/external/powerlevel9k/docker/zim/Dockerfile
vendored
Normal file
7
.zprezto/modules/prompt/external/powerlevel9k/docker/zim/Dockerfile
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
ARG base
|
||||
FROM p9k:${base}
|
||||
|
||||
COPY docker/zim/install.zsh /tmp/
|
||||
RUN zsh /tmp/install.zsh
|
||||
|
||||
COPY ./ p9k/
|
21
.zprezto/modules/prompt/external/powerlevel9k/docker/zim/install.zsh
vendored
Normal file
21
.zprezto/modules/prompt/external/powerlevel9k/docker/zim/install.zsh
vendored
Normal file
@@ -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
|
8
.zprezto/modules/prompt/external/powerlevel9k/docker/zplug/Dockerfile
vendored
Normal file
8
.zprezto/modules/prompt/external/powerlevel9k/docker/zplug/Dockerfile
vendored
Normal file
@@ -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
|
5
.zprezto/modules/prompt/external/powerlevel9k/docker/zplug/install.zsh
vendored
Normal file
5
.zprezto/modules/prompt/external/powerlevel9k/docker/zplug/install.zsh
vendored
Normal file
@@ -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"
|
5
.zprezto/modules/prompt/external/powerlevel9k/docker/zplug/zshrc
vendored
Normal file
5
.zprezto/modules/prompt/external/powerlevel9k/docker/zplug/zshrc
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#!zsh
|
||||
|
||||
source ~/.zplug/init.zsh
|
||||
zplug "${HOME}/p9k", use:"powerlevel9k.zsh-theme", from:local, as:theme
|
||||
zplug load --verbose
|
8
.zprezto/modules/prompt/external/powerlevel9k/docker/zplugin/Dockerfile
vendored
Normal file
8
.zprezto/modules/prompt/external/powerlevel9k/docker/zplugin/Dockerfile
vendored
Normal file
@@ -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
|
12
.zprezto/modules/prompt/external/powerlevel9k/docker/zplugin/install.zsh
vendored
Normal file
12
.zprezto/modules/prompt/external/powerlevel9k/docker/zplugin/install.zsh
vendored
Normal file
@@ -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
|
5
.zprezto/modules/prompt/external/powerlevel9k/docker/zplugin/zshrc.plugins
vendored
Normal file
5
.zprezto/modules/prompt/external/powerlevel9k/docker/zplugin/zshrc.plugins
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#!zsh
|
||||
|
||||
zplugin load psprint zsh-navigation-tools
|
||||
zplugin load psprint---zprompts
|
||||
zplugin snippet ~/p9k/powerlevel9k.zsh-theme
|
8
.zprezto/modules/prompt/external/powerlevel9k/docker/zpm/Dockerfile
vendored
Normal file
8
.zprezto/modules/prompt/external/powerlevel9k/docker/zpm/Dockerfile
vendored
Normal file
@@ -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
|
6
.zprezto/modules/prompt/external/powerlevel9k/docker/zpm/install.zsh
vendored
Normal file
6
.zprezto/modules/prompt/external/powerlevel9k/docker/zpm/install.zsh
vendored
Normal file
@@ -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
|
3
.zprezto/modules/prompt/external/powerlevel9k/docker/zpm/zshrc
vendored
Normal file
3
.zprezto/modules/prompt/external/powerlevel9k/docker/zpm/zshrc
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
source ~/.zpm/zpm.zsh
|
||||
|
||||
zpm load powerlevel9k
|
7
.zprezto/modules/prompt/external/powerlevel9k/docker/zulu/Dockerfile
vendored
Normal file
7
.zprezto/modules/prompt/external/powerlevel9k/docker/zulu/Dockerfile
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
ARG base
|
||||
FROM p9k:${base}
|
||||
|
||||
COPY docker/zulu/install.zsh /tmp/
|
||||
RUN zsh /tmp/install.zsh
|
||||
|
||||
COPY ./ p9k/
|
10
.zprezto/modules/prompt/external/powerlevel9k/docker/zulu/install.zsh
vendored
Normal file
10
.zprezto/modules/prompt/external/powerlevel9k/docker/zulu/install.zsh
vendored
Normal file
@@ -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
|
377
.zprezto/modules/prompt/external/powerlevel9k/functions/colors.zsh
vendored
Executable file
377
.zprezto/modules/prompt/external/powerlevel9k/functions/colors.zsh
vendored
Executable file
@@ -0,0 +1,377 @@
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
|
||||
################################################################
|
||||
# Color functions
|
||||
# This file holds some color-functions for
|
||||
# the powerlevel9k-ZSH-theme
|
||||
# https://github.com/bhilburn/powerlevel9k
|
||||
################################################################
|
||||
|
||||
function termColors() {
|
||||
if [[ $POWERLEVEL9K_IGNORE_TERM_COLORS == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local term_colors
|
||||
|
||||
if which tput &>/dev/null; then
|
||||
term_colors=$(tput colors)
|
||||
else
|
||||
term_colors=$(echotc Co)
|
||||
fi
|
||||
if (( ! $? && ${term_colors:-0} < 256 )); then
|
||||
print -P "%F{red}WARNING!%f Your terminal appears to support fewer than 256 colors!"
|
||||
print -P "If your terminal supports 256 colors, please export the appropriate environment variable"
|
||||
print -P "_before_ loading this theme in your \~\/.zshrc. In most terminal emulators, putting"
|
||||
print -P "%F{blue}export TERM=\"xterm-256color\"%f at the top of your \~\/.zshrc is sufficient."
|
||||
fi
|
||||
}
|
||||
|
||||
# get the proper color code if it does not exist as a name.
|
||||
function getColor() {
|
||||
# no need to check numerical values
|
||||
if [[ "$1" = <-> ]]; then
|
||||
if [[ "$1" = <8-15> ]]; then
|
||||
1=$(($1 - 8))
|
||||
fi
|
||||
else
|
||||
# named color added to parameter expansion print -P to test if the name exists in terminal
|
||||
local named="%K{$1}"
|
||||
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
|
||||
local default="$'\033'\[49m"
|
||||
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
|
||||
local quoted=$(printf "%q" $(print -P "$named"))
|
||||
if [[ $quoted = "$'\033'\[49m" && $1 != "black" ]]; then
|
||||
# color not found, so try to get the code
|
||||
1=$(getColorCode $1)
|
||||
fi
|
||||
fi
|
||||
echo -n "$1"
|
||||
}
|
||||
|
||||
# empty paramenter resets (stops) background color
|
||||
function backgroundColor() {
|
||||
if [[ -z $1 ]]; then
|
||||
echo -n "%k"
|
||||
else
|
||||
echo -n "%K{$(getColor $1)}"
|
||||
fi
|
||||
}
|
||||
|
||||
# empty paramenter resets (stops) foreground color
|
||||
function foregroundColor() {
|
||||
if [[ -z $1 ]]; then
|
||||
echo -n "%f"
|
||||
else
|
||||
echo -n "%F{$(getColor $1)}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get numerical color codes. That way we translate ANSI codes
|
||||
# into ZSH-Style color codes.
|
||||
function getColorCode() {
|
||||
# Check if given value is already numerical
|
||||
if [[ "$1" = <-> ]]; then
|
||||
# ANSI color codes distinguish between "foreground"
|
||||
# and "background" colors. We don't need to do that,
|
||||
# as ZSH uses a 256 color space anyway.
|
||||
if [[ "$1" = <8-15> ]]; then
|
||||
echo -n $(($1 - 8))
|
||||
else
|
||||
echo -n "$1"
|
||||
fi
|
||||
else
|
||||
typeset -A codes
|
||||
# https://jonasjacek.github.io/colors/
|
||||
# use color names by default to allow dark/light themes to adjust colors based on names
|
||||
codes[black]=000
|
||||
codes[maroon]=001
|
||||
codes[green]=002
|
||||
codes[olive]=003
|
||||
codes[navy]=004
|
||||
codes[purple]=005
|
||||
codes[teal]=006
|
||||
codes[silver]=007
|
||||
codes[grey]=008
|
||||
codes[red]=009
|
||||
codes[lime]=010
|
||||
codes[yellow]=011
|
||||
codes[blue]=012
|
||||
codes[fuchsia]=013
|
||||
codes[aqua]=014
|
||||
codes[white]=015
|
||||
codes[grey0]=016
|
||||
codes[navyblue]=017
|
||||
codes[darkblue]=018
|
||||
codes[blue3]=019
|
||||
codes[blue3]=020
|
||||
codes[blue1]=021
|
||||
codes[darkgreen]=022
|
||||
codes[deepskyblue4]=023
|
||||
codes[deepskyblue4]=024
|
||||
codes[deepskyblue4]=025
|
||||
codes[dodgerblue3]=026
|
||||
codes[dodgerblue2]=027
|
||||
codes[green4]=028
|
||||
codes[springgreen4]=029
|
||||
codes[turquoise4]=030
|
||||
codes[deepskyblue3]=031
|
||||
codes[deepskyblue3]=032
|
||||
codes[dodgerblue1]=033
|
||||
codes[green3]=034
|
||||
codes[springgreen3]=035
|
||||
codes[darkcyan]=036
|
||||
codes[lightseagreen]=037
|
||||
codes[deepskyblue2]=038
|
||||
codes[deepskyblue1]=039
|
||||
codes[green3]=040
|
||||
codes[springgreen3]=041
|
||||
codes[springgreen2]=042
|
||||
codes[cyan3]=043
|
||||
codes[darkturquoise]=044
|
||||
codes[turquoise2]=045
|
||||
codes[green1]=046
|
||||
codes[springgreen2]=047
|
||||
codes[springgreen1]=048
|
||||
codes[mediumspringgreen]=049
|
||||
codes[cyan2]=050
|
||||
codes[cyan1]=051
|
||||
codes[darkred]=052
|
||||
codes[deeppink4]=053
|
||||
codes[purple4]=054
|
||||
codes[purple4]=055
|
||||
codes[purple3]=056
|
||||
codes[blueviolet]=057
|
||||
codes[orange4]=058
|
||||
codes[grey37]=059
|
||||
codes[mediumpurple4]=060
|
||||
codes[slateblue3]=061
|
||||
codes[slateblue3]=062
|
||||
codes[royalblue1]=063
|
||||
codes[chartreuse4]=064
|
||||
codes[darkseagreen4]=065
|
||||
codes[paleturquoise4]=066
|
||||
codes[steelblue]=067
|
||||
codes[steelblue3]=068
|
||||
codes[cornflowerblue]=069
|
||||
codes[chartreuse3]=070
|
||||
codes[darkseagreen4]=071
|
||||
codes[cadetblue]=072
|
||||
codes[cadetblue]=073
|
||||
codes[skyblue3]=074
|
||||
codes[steelblue1]=075
|
||||
codes[chartreuse3]=076
|
||||
codes[palegreen3]=077
|
||||
codes[seagreen3]=078
|
||||
codes[aquamarine3]=079
|
||||
codes[mediumturquoise]=080
|
||||
codes[steelblue1]=081
|
||||
codes[chartreuse2]=082
|
||||
codes[seagreen2]=083
|
||||
codes[seagreen1]=084
|
||||
codes[seagreen1]=085
|
||||
codes[aquamarine1]=086
|
||||
codes[darkslategray2]=087
|
||||
codes[darkred]=088
|
||||
codes[deeppink4]=089
|
||||
codes[darkmagenta]=090
|
||||
codes[darkmagenta]=091
|
||||
codes[darkviolet]=092
|
||||
codes[purple]=093
|
||||
codes[orange4]=094
|
||||
codes[lightpink4]=095
|
||||
codes[plum4]=096
|
||||
codes[mediumpurple3]=097
|
||||
codes[mediumpurple3]=098
|
||||
codes[slateblue1]=099
|
||||
codes[yellow4]=100
|
||||
codes[wheat4]=101
|
||||
codes[grey53]=102
|
||||
codes[lightslategrey]=103
|
||||
codes[mediumpurple]=104
|
||||
codes[lightslateblue]=105
|
||||
codes[yellow4]=106
|
||||
codes[darkolivegreen3]=107
|
||||
codes[darkseagreen]=108
|
||||
codes[lightskyblue3]=109
|
||||
codes[lightskyblue3]=110
|
||||
codes[skyblue2]=111
|
||||
codes[chartreuse2]=112
|
||||
codes[darkolivegreen3]=113
|
||||
codes[palegreen3]=114
|
||||
codes[darkseagreen3]=115
|
||||
codes[darkslategray3]=116
|
||||
codes[skyblue1]=117
|
||||
codes[chartreuse1]=118
|
||||
codes[lightgreen]=119
|
||||
codes[lightgreen]=120
|
||||
codes[palegreen1]=121
|
||||
codes[aquamarine1]=122
|
||||
codes[darkslategray1]=123
|
||||
codes[red3]=124
|
||||
codes[deeppink4]=125
|
||||
codes[mediumvioletred]=126
|
||||
codes[magenta3]=127
|
||||
codes[darkviolet]=128
|
||||
codes[purple]=129
|
||||
codes[darkorange3]=130
|
||||
codes[indianred]=131
|
||||
codes[hotpink3]=132
|
||||
codes[mediumorchid3]=133
|
||||
codes[mediumorchid]=134
|
||||
codes[mediumpurple2]=135
|
||||
codes[darkgoldenrod]=136
|
||||
codes[lightsalmon3]=137
|
||||
codes[rosybrown]=138
|
||||
codes[grey63]=139
|
||||
codes[mediumpurple2]=140
|
||||
codes[mediumpurple1]=141
|
||||
codes[gold3]=142
|
||||
codes[darkkhaki]=143
|
||||
codes[navajowhite3]=144
|
||||
codes[grey69]=145
|
||||
codes[lightsteelblue3]=146
|
||||
codes[lightsteelblue]=147
|
||||
codes[yellow3]=148
|
||||
codes[darkolivegreen3]=149
|
||||
codes[darkseagreen3]=150
|
||||
codes[darkseagreen2]=151
|
||||
codes[lightcyan3]=152
|
||||
codes[lightskyblue1]=153
|
||||
codes[greenyellow]=154
|
||||
codes[darkolivegreen2]=155
|
||||
codes[palegreen1]=156
|
||||
codes[darkseagreen2]=157
|
||||
codes[darkseagreen1]=158
|
||||
codes[paleturquoise1]=159
|
||||
codes[red3]=160
|
||||
codes[deeppink3]=161
|
||||
codes[deeppink3]=162
|
||||
codes[magenta3]=163
|
||||
codes[magenta3]=164
|
||||
codes[magenta2]=165
|
||||
codes[darkorange3]=166
|
||||
codes[indianred]=167
|
||||
codes[hotpink3]=168
|
||||
codes[hotpink2]=169
|
||||
codes[orchid]=170
|
||||
codes[mediumorchid1]=171
|
||||
codes[orange3]=172
|
||||
codes[lightsalmon3]=173
|
||||
codes[lightpink3]=174
|
||||
codes[pink3]=175
|
||||
codes[plum3]=176
|
||||
codes[violet]=177
|
||||
codes[gold3]=178
|
||||
codes[lightgoldenrod3]=179
|
||||
codes[tan]=180
|
||||
codes[mistyrose3]=181
|
||||
codes[thistle3]=182
|
||||
codes[plum2]=183
|
||||
codes[yellow3]=184
|
||||
codes[khaki3]=185
|
||||
codes[lightgoldenrod2]=186
|
||||
codes[lightyellow3]=187
|
||||
codes[grey84]=188
|
||||
codes[lightsteelblue1]=189
|
||||
codes[yellow2]=190
|
||||
codes[darkolivegreen1]=191
|
||||
codes[darkolivegreen1]=192
|
||||
codes[darkseagreen1]=193
|
||||
codes[honeydew2]=194
|
||||
codes[lightcyan1]=195
|
||||
codes[red1]=196
|
||||
codes[deeppink2]=197
|
||||
codes[deeppink1]=198
|
||||
codes[deeppink1]=199
|
||||
codes[magenta2]=200
|
||||
codes[magenta1]=201
|
||||
codes[orangered1]=202
|
||||
codes[indianred1]=203
|
||||
codes[indianred1]=204
|
||||
codes[hotpink]=205
|
||||
codes[hotpink]=206
|
||||
codes[mediumorchid1]=207
|
||||
codes[darkorange]=208
|
||||
codes[salmon1]=209
|
||||
codes[lightcoral]=210
|
||||
codes[palevioletred1]=211
|
||||
codes[orchid2]=212
|
||||
codes[orchid1]=213
|
||||
codes[orange1]=214
|
||||
codes[sandybrown]=215
|
||||
codes[lightsalmon1]=216
|
||||
codes[lightpink1]=217
|
||||
codes[pink1]=218
|
||||
codes[plum1]=219
|
||||
codes[gold1]=220
|
||||
codes[lightgoldenrod2]=221
|
||||
codes[lightgoldenrod2]=222
|
||||
codes[navajowhite1]=223
|
||||
codes[mistyrose1]=224
|
||||
codes[thistle1]=225
|
||||
codes[yellow1]=226
|
||||
codes[lightgoldenrod1]=227
|
||||
codes[khaki1]=228
|
||||
codes[wheat1]=229
|
||||
codes[cornsilk1]=230
|
||||
codes[grey100]=231
|
||||
codes[grey3]=232
|
||||
codes[grey7]=233
|
||||
codes[grey11]=234
|
||||
codes[grey15]=235
|
||||
codes[grey19]=236
|
||||
codes[grey23]=237
|
||||
codes[grey27]=238
|
||||
codes[grey30]=239
|
||||
codes[grey35]=240
|
||||
codes[grey39]=241
|
||||
codes[grey42]=242
|
||||
codes[grey46]=243
|
||||
codes[grey50]=244
|
||||
codes[grey54]=245
|
||||
codes[grey58]=246
|
||||
codes[grey62]=247
|
||||
codes[grey66]=248
|
||||
codes[grey70]=249
|
||||
codes[grey74]=250
|
||||
codes[grey78]=251
|
||||
codes[grey82]=252
|
||||
codes[grey85]=253
|
||||
codes[grey89]=254
|
||||
codes[grey93]=255
|
||||
|
||||
# for testing purposes in terminal
|
||||
if [[ "$1" == "foreground" ]]; then
|
||||
# call via `getColorCode foreground`
|
||||
for i in "${(k@)codes}"; do
|
||||
print -P "$(foregroundColor $i)$(getColor $i) - $i$(foregroundColor)"
|
||||
done
|
||||
elif [[ "$1" == "background" ]]; then
|
||||
# call via `getColorCode background`
|
||||
for i in "${(k@)codes}"; do
|
||||
print -P "$(backgroundColor $i)$(getColor $i) - $i$(backgroundColor)"
|
||||
done
|
||||
else
|
||||
#[[ -n "$1" ]] bg="%K{$1}" || bg="%k"
|
||||
# Strip eventual "bg-" prefixes
|
||||
1=${1#bg-}
|
||||
# Strip eventual "fg-" prefixes
|
||||
1=${1#fg-}
|
||||
# Strip eventual "br" prefixes ("bright" colors)
|
||||
1=${1#br}
|
||||
echo -n $codes[$1]
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if two colors are equal, even if one is specified as ANSI code.
|
||||
function isSameColor() {
|
||||
if [[ "$1" == "NONE" || "$2" == "NONE" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local color1=$(getColorCode "$1")
|
||||
local color2=$(getColorCode "$2")
|
||||
|
||||
return $(( color1 != color2 ))
|
||||
}
|
560
.zprezto/modules/prompt/external/powerlevel9k/functions/icons.zsh
vendored
Executable file
560
.zprezto/modules/prompt/external/powerlevel9k/functions/icons.zsh
vendored
Executable file
@@ -0,0 +1,560 @@
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
|
||||
################################################################
|
||||
# icons
|
||||
# This file holds the icon definitions and
|
||||
# icon-functions for the powerlevel9k-ZSH-theme
|
||||
# https://github.com/bhilburn/powerlevel9k
|
||||
################################################################
|
||||
|
||||
# These characters require the Powerline fonts to work properly. If you see
|
||||
# boxes or bizarre characters below, your fonts are not correctly installed. If
|
||||
# you do not want to install a special font, you can set `POWERLEVEL9K_MODE` to
|
||||
# `compatible`. This shows all icons in regular symbols.
|
||||
|
||||
# Initialize the icon list according to the user's `POWERLEVEL9K_MODE`.
|
||||
typeset -gAH icons
|
||||
case $POWERLEVEL9K_MODE in
|
||||
'flat'|'awesome-patched')
|
||||
# Awesome-Patched Font required! See:
|
||||
# https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched
|
||||
# Set the right locale to protect special characters
|
||||
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
|
||||
icons=(
|
||||
LEFT_SEGMENT_SEPARATOR $'\uE0B0' #
|
||||
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' #
|
||||
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
|
||||
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' #
|
||||
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' #
|
||||
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
|
||||
ROOT_ICON $'\uE801' #
|
||||
SUDO_ICON $'\uF09C' #
|
||||
RUBY_ICON $'\uE847 ' #
|
||||
AWS_ICON $'\uE895' #
|
||||
AWS_EB_ICON $'\U1F331 ' # 🌱
|
||||
BACKGROUND_JOBS_ICON $'\uE82F ' #
|
||||
TEST_ICON $'\uE891' #
|
||||
TODO_ICON $'\u2611' # ☑
|
||||
BATTERY_ICON $'\uE894' #
|
||||
DISK_ICON $'\uE1AE ' #
|
||||
OK_ICON $'\u2714' # ✔
|
||||
FAIL_ICON $'\u2718' # ✘
|
||||
SYMFONY_ICON 'SF'
|
||||
NODE_ICON $'\u2B22' # ⬢
|
||||
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
|
||||
MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─
|
||||
MULTILINE_LAST_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
|
||||
APPLE_ICON $'\uE26E' #
|
||||
WINDOWS_ICON $'\uE26F' #
|
||||
FREEBSD_ICON $'\U1F608 ' # 😈
|
||||
ANDROID_ICON $'\uE270' #
|
||||
LINUX_ICON $'\uE271' #
|
||||
LINUX_ARCH_ICON 'Arc'
|
||||
LINUX_DEBIAN_ICON 'Deb'
|
||||
LINUX_UBUNTU_ICON 'Ubu'
|
||||
LINUX_CENTOS_ICON 'Cen'
|
||||
LINUX_COREOS_ICON 'Cor'
|
||||
LINUX_ELEMENTARY_ICON 'Elm'
|
||||
LINUX_MINT_ICON 'LMi'
|
||||
LINUX_FEDORA_ICON 'Fed'
|
||||
LINUX_GENTOO_ICON 'Gen'
|
||||
LINUX_MAGEIA_ICON 'Mag'
|
||||
LINUX_NIXOS_ICON 'Nix'
|
||||
LINUX_MANJARO_ICON 'Man'
|
||||
LINUX_DEVUAN_ICON 'Dev'
|
||||
LINUX_ALPINE_ICON 'Alp'
|
||||
LINUX_AOSC_ICON 'Aos'
|
||||
LINUX_OPENSUSE_ICON 'OSu'
|
||||
LINUX_SABAYON_ICON 'Sab'
|
||||
LINUX_SLACKWARE_ICON 'Sla'
|
||||
SUNOS_ICON $'\U1F31E ' # 🌞
|
||||
HOME_ICON $'\uE12C' #
|
||||
HOME_SUB_ICON $'\uE18D' #
|
||||
FOLDER_ICON $'\uE818' #
|
||||
NETWORK_ICON $'\uE1AD' #
|
||||
ETC_ICON $'\uE82F' #
|
||||
LOAD_ICON $'\uE190 ' #
|
||||
SWAP_ICON $'\uE87D' #
|
||||
RAM_ICON $'\uE1E2 ' #
|
||||
SERVER_ICON $'\uE895' #
|
||||
VCS_UNTRACKED_ICON $'\uE16C' #
|
||||
VCS_UNSTAGED_ICON $'\uE17C' #
|
||||
VCS_STAGED_ICON $'\uE168' #
|
||||
VCS_STASH_ICON $'\uE133 ' #
|
||||
#VCS_INCOMING_CHANGES_ICON $'\uE1EB ' #
|
||||
#VCS_INCOMING_CHANGES_ICON $'\uE80D ' #
|
||||
VCS_INCOMING_CHANGES_ICON $'\uE131 ' #
|
||||
#VCS_OUTGOING_CHANGES_ICON $'\uE1EC ' #
|
||||
#VCS_OUTGOING_CHANGES_ICON $'\uE80E ' #
|
||||
VCS_OUTGOING_CHANGES_ICON $'\uE132 ' #
|
||||
VCS_TAG_ICON $'\uE817 ' #
|
||||
VCS_BOOKMARK_ICON $'\uE87B' #
|
||||
VCS_COMMIT_ICON $'\uE821 ' #
|
||||
VCS_BRANCH_ICON $'\uE220 ' #
|
||||
VCS_REMOTE_BRANCH_ICON $'\u2192' # →
|
||||
VCS_GIT_ICON $'\uE20E ' #
|
||||
VCS_GIT_GITHUB_ICON $'\uE20E ' #
|
||||
VCS_GIT_BITBUCKET_ICON $'\uE20E ' #
|
||||
VCS_GIT_GITLAB_ICON $'\uE20E ' #
|
||||
VCS_HG_ICON $'\uE1C3 ' #
|
||||
VCS_SVN_ICON '(svn) '
|
||||
RUST_ICON '(rust)'
|
||||
PYTHON_ICON $'\ue63c' #
|
||||
SWIFT_ICON ''
|
||||
GO_ICON ''
|
||||
PUBLIC_IP_ICON ''
|
||||
LOCK_ICON $'\UE138' #
|
||||
EXECUTION_TIME_ICON $'\UE89C' #
|
||||
SSH_ICON '(ssh)'
|
||||
VPN_ICON '(vpn)'
|
||||
KUBERNETES_ICON $'\U2388' # ⎈
|
||||
DROPBOX_ICON $'\UF16B' #
|
||||
DATE_ICON $'\uE184' #
|
||||
TIME_ICON $'\uE12E' #
|
||||
JAVA_ICON $'\U2615' # ☕︎
|
||||
LARAVEL_ICON ''
|
||||
)
|
||||
;;
|
||||
'awesome-fontconfig')
|
||||
# fontconfig with awesome-font required! See
|
||||
# https://github.com/gabrielelana/awesome-terminal-fonts
|
||||
# Set the right locale to protect special characters
|
||||
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
|
||||
icons=(
|
||||
LEFT_SEGMENT_SEPARATOR $'\uE0B0' #
|
||||
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' #
|
||||
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
|
||||
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' #
|
||||
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' #
|
||||
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
|
||||
ROOT_ICON $'\uF201' #
|
||||
SUDO_ICON $'\uF09C' #
|
||||
RUBY_ICON $'\uF219 ' #
|
||||
AWS_ICON $'\uF270' #
|
||||
AWS_EB_ICON $'\U1F331 ' # 🌱
|
||||
BACKGROUND_JOBS_ICON $'\uF013 ' #
|
||||
TEST_ICON $'\uF291' #
|
||||
TODO_ICON $'\u2611' # ☑
|
||||
BATTERY_ICON $'\U1F50B' # 🔋
|
||||
DISK_ICON $'\uF0A0 ' #
|
||||
OK_ICON $'\u2714' # ✔
|
||||
FAIL_ICON $'\u2718' # ✘
|
||||
SYMFONY_ICON 'SF'
|
||||
NODE_ICON $'\u2B22' # ⬢
|
||||
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
|
||||
MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─
|
||||
MULTILINE_LAST_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
|
||||
APPLE_ICON $'\uF179' #
|
||||
WINDOWS_ICON $'\uF17A' #
|
||||
FREEBSD_ICON $'\U1F608 ' # 😈
|
||||
ANDROID_ICON $'\uE17B' #
|
||||
LINUX_ICON $'\uF17C' #
|
||||
LINUX_ARCH_ICON 'Arc'
|
||||
LINUX_DEBIAN_ICON 'Deb'
|
||||
LINUX_UBUNTU_ICON 'Ubu'
|
||||
LINUX_CENTOS_ICON 'Cen'
|
||||
LINUX_COREOS_ICON 'Cor'
|
||||
LINUX_ELEMENTARY_ICON 'Elm'
|
||||
LINUX_MINT_ICON 'LMi'
|
||||
LINUX_FEDORA_ICON 'Fed'
|
||||
LINUX_GENTOO_ICON 'Gen'
|
||||
LINUX_MAGEIA_ICON 'Mag'
|
||||
LINUX_NIXOS_ICON 'Nix'
|
||||
LINUX_MANJARO_ICON 'Man'
|
||||
LINUX_DEVUAN_ICON 'Dev'
|
||||
LINUX_ALPINE_ICON 'Alp'
|
||||
LINUX_AOSC_ICON 'Aos'
|
||||
LINUX_OPENSUSE_ICON 'OSu'
|
||||
LINUX_SABAYON_ICON 'Sab'
|
||||
LINUX_SLACKWARE_ICON 'Sla'
|
||||
SUNOS_ICON $'\uF185 ' #
|
||||
HOME_ICON $'\uF015' #
|
||||
HOME_SUB_ICON $'\uF07C' #
|
||||
FOLDER_ICON $'\uF115' #
|
||||
ETC_ICON $'\uF013 ' #
|
||||
NETWORK_ICON $'\uF09E' #
|
||||
LOAD_ICON $'\uF080 ' #
|
||||
SWAP_ICON $'\uF0E4' #
|
||||
RAM_ICON $'\uF0E4' #
|
||||
SERVER_ICON $'\uF233' #
|
||||
VCS_UNTRACKED_ICON $'\uF059' #
|
||||
VCS_UNSTAGED_ICON $'\uF06A' #
|
||||
VCS_STAGED_ICON $'\uF055' #
|
||||
VCS_STASH_ICON $'\uF01C ' #
|
||||
VCS_INCOMING_CHANGES_ICON $'\uF01A ' #
|
||||
VCS_OUTGOING_CHANGES_ICON $'\uF01B ' #
|
||||
VCS_TAG_ICON $'\uF217 ' #
|
||||
VCS_BOOKMARK_ICON $'\uF27B' #
|
||||
VCS_COMMIT_ICON $'\uF221 ' #
|
||||
VCS_BRANCH_ICON $'\uF126 ' #
|
||||
VCS_REMOTE_BRANCH_ICON $'\u2192' # →
|
||||
VCS_GIT_ICON $'\uF1D3 ' #
|
||||
VCS_GIT_GITHUB_ICON $'\uF113 ' #
|
||||
VCS_GIT_BITBUCKET_ICON $'\uF171 ' #
|
||||
VCS_GIT_GITLAB_ICON $'\uF296 ' #
|
||||
VCS_HG_ICON $'\uF0C3 ' #
|
||||
VCS_SVN_ICON '(svn) '
|
||||
RUST_ICON $'\uE6A8' #
|
||||
PYTHON_ICON $'\ue63c' #
|
||||
SWIFT_ICON ''
|
||||
GO_ICON ''
|
||||
PUBLIC_IP_ICON ''
|
||||
LOCK_ICON $'\UF023' #
|
||||
EXECUTION_TIME_ICON $'\uF253'
|
||||
SSH_ICON '(ssh)'
|
||||
VPN_ICON $'\uF023'
|
||||
KUBERNETES_ICON $'\U2388' # ⎈
|
||||
DROPBOX_ICON $'\UF16B' #
|
||||
DATE_ICON $'\uF073 ' #
|
||||
TIME_ICON $'\uF017 ' #
|
||||
JAVA_ICON $'\U2615' # ☕︎
|
||||
LARAVEL_ICON ''
|
||||
)
|
||||
;;
|
||||
'awesome-mapped-fontconfig')
|
||||
# mapped fontconfig with awesome-font required! See
|
||||
# https://github.com/gabrielelana/awesome-terminal-fonts
|
||||
# don't forget to source the font maps in your startup script
|
||||
# Set the right locale to protect special characters
|
||||
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
|
||||
|
||||
if [ -z "$AWESOME_GLYPHS_LOADED" ]; then
|
||||
echo "Powerlevel9k warning: Awesome-Font mappings have not been loaded.
|
||||
Source a font mapping in your shell config, per the Awesome-Font docs
|
||||
(https://github.com/gabrielelana/awesome-terminal-fonts),
|
||||
Or use a different Powerlevel9k font configuration.";
|
||||
fi
|
||||
|
||||
icons=(
|
||||
LEFT_SEGMENT_SEPARATOR $'\uE0B0' #
|
||||
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' #
|
||||
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
|
||||
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' #
|
||||
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' #
|
||||
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
|
||||
ROOT_ICON '\u'$CODEPOINT_OF_OCTICONS_ZAP #
|
||||
SUDO_ICON '\u'$CODEPOINT_OF_AWESOME_UNLOCK #
|
||||
RUBY_ICON '\u'$CODEPOINT_OF_OCTICONS_RUBY' ' #
|
||||
AWS_ICON '\u'$CODEPOINT_OF_AWESOME_SERVER #
|
||||
AWS_EB_ICON $'\U1F331 ' # 🌱
|
||||
BACKGROUND_JOBS_ICON '\u'$CODEPOINT_OF_AWESOME_COG' ' #
|
||||
TEST_ICON '\u'$CODEPOINT_OF_AWESOME_BUG #
|
||||
TODO_ICON '\u'$CODEPOINT_OF_AWESOME_CHECK_SQUARE_O #
|
||||
BATTERY_ICON '\U'$CODEPOINT_OF_AWESOME_BATTERY_FULL #
|
||||
DISK_ICON '\u'$CODEPOINT_OF_AWESOME_HDD_O' ' #
|
||||
OK_ICON '\u'$CODEPOINT_OF_AWESOME_CHECK #
|
||||
FAIL_ICON '\u'$CODEPOINT_OF_AWESOME_TIMES #
|
||||
SYMFONY_ICON 'SF'
|
||||
NODE_ICON $'\u2B22' # ⬢
|
||||
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
|
||||
MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
|
||||
APPLE_ICON '\u'$CODEPOINT_OF_AWESOME_APPLE #
|
||||
FREEBSD_ICON $'\U1F608 ' # 😈
|
||||
LINUX_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #
|
||||
LINUX_ARCH_ICON 'Arc'
|
||||
LINUX_DEBIAN_ICON 'Deb'
|
||||
LINUX_UBUNTU_ICON 'Ubu'
|
||||
LINUX_CENTOS_ICON 'Cen'
|
||||
LINUX_COREOS_ICON 'Cor'
|
||||
LINUX_ELEMENTARY_ICON 'Elm'
|
||||
LINUX_MINT_ICON 'LMi'
|
||||
LINUX_FEDORA_ICON 'Fed'
|
||||
LINUX_GENTOO_ICON 'Gen'
|
||||
LINUX_MAGEIA_ICON 'Mag'
|
||||
LINUX_NIXOS_ICON 'Nix'
|
||||
LINUX_MANJARO_ICON 'Man'
|
||||
LINUX_DEVUAN_ICON 'Dev'
|
||||
LINUX_ALPINE_ICON 'Alp'
|
||||
LINUX_AOSC_ICON 'Aos'
|
||||
LINUX_OPENSUSE_ICON 'OSu'
|
||||
LINUX_SABAYON_ICON 'Sab'
|
||||
LINUX_SLACKWARE_ICON 'Sla'
|
||||
SUNOS_ICON '\u'$CODEPOINT_OF_AWESOME_SUN_O' ' #
|
||||
HOME_ICON '\u'$CODEPOINT_OF_AWESOME_HOME #
|
||||
HOME_SUB_ICON '\u'$CODEPOINT_OF_AWESOME_FOLDER_OPEN #
|
||||
FOLDER_ICON '\u'$CODEPOINT_OF_AWESOME_FOLDER_O #
|
||||
ETC_ICON '\u'$CODEPOINT_OF_AWESOME_COG' ' #
|
||||
NETWORK_ICON '\u'$CODEPOINT_OF_AWESOME_RSS #
|
||||
LOAD_ICON '\u'$CODEPOINT_OF_AWESOME_BAR_CHART' ' #
|
||||
SWAP_ICON '\u'$CODEPOINT_OF_AWESOME_DASHBOARD #
|
||||
RAM_ICON '\u'$CODEPOINT_OF_AWESOME_DASHBOARD #
|
||||
SERVER_ICON '\u'$CODEPOINT_OF_AWESOME_SERVER #
|
||||
VCS_UNTRACKED_ICON '\u'$CODEPOINT_OF_AWESOME_QUESTION_CIRCLE #
|
||||
VCS_UNSTAGED_ICON '\u'$CODEPOINT_OF_AWESOME_EXCLAMATION_CIRCLE #
|
||||
VCS_STAGED_ICON '\u'$CODEPOINT_OF_AWESOME_PLUS_CIRCLE #
|
||||
VCS_STASH_ICON '\u'$CODEPOINT_OF_AWESOME_INBOX' ' #
|
||||
VCS_INCOMING_CHANGES_ICON '\u'$CODEPOINT_OF_AWESOME_ARROW_CIRCLE_DOWN' ' #
|
||||
VCS_OUTGOING_CHANGES_ICON '\u'$CODEPOINT_OF_AWESOME_ARROW_CIRCLE_UP' ' #
|
||||
VCS_TAG_ICON '\u'$CODEPOINT_OF_AWESOME_TAG' ' #
|
||||
VCS_BOOKMARK_ICON '\u'$CODEPOINT_OF_OCTICONS_BOOKMARK #
|
||||
VCS_COMMIT_ICON '\u'$CODEPOINT_OF_OCTICONS_GIT_COMMIT' ' #
|
||||
VCS_BRANCH_ICON '\u'$CODEPOINT_OF_OCTICONS_GIT_BRANCH' ' #
|
||||
VCS_REMOTE_BRANCH_ICON '\u'$CODEPOINT_OF_OCTICONS_REPO_PUSH #
|
||||
VCS_GIT_ICON '\u'$CODEPOINT_OF_AWESOME_GIT' ' #
|
||||
VCS_GIT_GITHUB_ICON '\u'$CODEPOINT_OF_AWESOME_GITHUB_ALT' ' #
|
||||
VCS_GIT_BITBUCKET_ICON '\u'$CODEPOINT_OF_AWESOME_BITBUCKET' ' #
|
||||
VCS_GIT_GITLAB_ICON '\u'$CODEPOINT_OF_AWESOME_GITLAB' ' #
|
||||
VCS_HG_ICON '\u'$CODEPOINT_OF_AWESOME_FLASK' ' #
|
||||
VCS_SVN_ICON '(svn) '
|
||||
RUST_ICON $'\uE6A8' #
|
||||
PYTHON_ICON $'\U1F40D' # 🐍
|
||||
SWIFT_ICON $'\uE655' #
|
||||
PUBLIC_IP_ICON '\u'$CODEPOINT_OF_AWESOME_GLOBE #
|
||||
LOCK_ICON '\u'$CODEPOINT_OF_AWESOME_LOCK #
|
||||
EXECUTION_TIME_ICON '\u'$CODEPOINT_OF_AWESOME_HOURGLASS_END #
|
||||
SSH_ICON '(ssh)'
|
||||
VPN_ICON '\u'$CODEPOINT_OF_AWESOME_LOCK
|
||||
KUBERNETES_ICON $'\U2388' # ⎈
|
||||
DROPBOX_ICON '\u'$CODEPOINT_OF_AWESOME_DROPBOX #
|
||||
DATE_ICON $'\uF073 ' #
|
||||
TIME_ICON $'\uF017 ' #
|
||||
JAVA_ICON $'\U2615' # ☕︎
|
||||
LARAVEL_ICON ''
|
||||
)
|
||||
;;
|
||||
'nerdfont-complete'|'nerdfont-fontconfig')
|
||||
# nerd-font patched (complete) font required! See
|
||||
# https://github.com/ryanoasis/nerd-fonts
|
||||
# http://nerdfonts.com/#cheat-sheet
|
||||
# Set the right locale to protect special characters
|
||||
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
|
||||
icons=(
|
||||
LEFT_SEGMENT_SEPARATOR $'\uE0B0' #
|
||||
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' #
|
||||
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
|
||||
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' #
|
||||
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' #
|
||||
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
|
||||
ROOT_ICON $'\uE614 ' #
|
||||
SUDO_ICON $'\uF09C' #
|
||||
RUBY_ICON $'\uF219 ' #
|
||||
AWS_ICON $'\uF270' #
|
||||
AWS_EB_ICON $'\UF1BD ' #
|
||||
BACKGROUND_JOBS_ICON $'\uF013 ' #
|
||||
TEST_ICON $'\uF188' #
|
||||
TODO_ICON $'\uF133' #
|
||||
BATTERY_ICON $'\UF240 ' #
|
||||
DISK_ICON $'\uF0A0' #
|
||||
OK_ICON $'\uF00C' #
|
||||
FAIL_ICON $'\uF00D' #
|
||||
SYMFONY_ICON $'\uE757' #
|
||||
NODE_ICON $'\uE617 ' #
|
||||
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
|
||||
MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─
|
||||
MULTILINE_LAST_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
|
||||
APPLE_ICON $'\uF179' #
|
||||
WINDOWS_ICON $'\uF17A' #
|
||||
FREEBSD_ICON $'\UF30C ' #
|
||||
ANDROID_ICON $'\uF17B' #
|
||||
LINUX_ARCH_ICON $'\uF303' #
|
||||
LINUX_CENTOS_ICON $'\uF304' #
|
||||
LINUX_COREOS_ICON $'\uF305' #
|
||||
LINUX_DEBIAN_ICON $'\uF306' #
|
||||
LINUX_ELEMENTARY_ICON $'\uF309' #
|
||||
LINUX_FEDORA_ICON $'\uF30a' #
|
||||
LINUX_GENTOO_ICON $'\uF30d' #
|
||||
LINUX_MAGEIA_ICON $'\uF310' #
|
||||
LINUX_MINT_ICON $'\uF30e' #
|
||||
LINUX_NIXOS_ICON $'\uF313' #
|
||||
LINUX_MANJARO_ICON $'\uF312' #
|
||||
LINUX_DEVUAN_ICON $'\uF307' #
|
||||
LINUX_ALPINE_ICON $'\uF300' #
|
||||
LINUX_AOSC_ICON $'\uF301' #
|
||||
LINUX_OPENSUSE_ICON $'\uF314' #
|
||||
LINUX_SABAYON_ICON $'\uF317' #
|
||||
LINUX_SLACKWARE_ICON $'\uF319' #
|
||||
LINUX_UBUNTU_ICON $'\uF31b' #
|
||||
LINUX_ICON $'\uF17C' #
|
||||
SUNOS_ICON $'\uF185 ' #
|
||||
HOME_ICON $'\uF015' #
|
||||
HOME_SUB_ICON $'\uF07C' #
|
||||
FOLDER_ICON $'\uF115' #
|
||||
ETC_ICON $'\uF013' #
|
||||
NETWORK_ICON $'\uF1EB' #
|
||||
LOAD_ICON $'\uF080 ' #
|
||||
SWAP_ICON $'\uF464' #
|
||||
RAM_ICON $'\uF0E4' #
|
||||
SERVER_ICON $'\uF0AE' #
|
||||
VCS_UNTRACKED_ICON $'\uF059' #
|
||||
VCS_UNSTAGED_ICON $'\uF06A' #
|
||||
VCS_STAGED_ICON $'\uF055' #
|
||||
VCS_STASH_ICON $'\uF01C ' #
|
||||
VCS_INCOMING_CHANGES_ICON $'\uF01A ' #
|
||||
VCS_OUTGOING_CHANGES_ICON $'\uF01B ' #
|
||||
VCS_TAG_ICON $'\uF02B ' #
|
||||
VCS_BOOKMARK_ICON $'\uF461 ' #
|
||||
VCS_COMMIT_ICON $'\uE729 ' #
|
||||
VCS_BRANCH_ICON $'\uF126 ' #
|
||||
VCS_REMOTE_BRANCH_ICON $'\uE728 ' #
|
||||
VCS_GIT_ICON $'\uF1D3 ' #
|
||||
VCS_GIT_GITHUB_ICON $'\uF113 ' #
|
||||
VCS_GIT_BITBUCKET_ICON $'\uE703 ' #
|
||||
VCS_GIT_GITLAB_ICON $'\uF296 ' #
|
||||
VCS_HG_ICON $'\uF0C3 ' #
|
||||
VCS_SVN_ICON $'\uE72D ' #
|
||||
RUST_ICON $'\uE7A8 ' #
|
||||
PYTHON_ICON $'\UE73C ' #
|
||||
SWIFT_ICON $'\uE755' #
|
||||
GO_ICON $'\uE626' #
|
||||
PUBLIC_IP_ICON $'\UF0AC' #
|
||||
LOCK_ICON $'\UF023' #
|
||||
EXECUTION_TIME_ICON $'\uF252' #
|
||||
SSH_ICON $'\uF489' #
|
||||
VPN_ICON '(vpn)'
|
||||
KUBERNETES_ICON $'\U2388' # ⎈
|
||||
DROPBOX_ICON $'\UF16B' #
|
||||
DATE_ICON $'\uF073 ' #
|
||||
TIME_ICON $'\uF017 ' #
|
||||
JAVA_ICON $'\U2615' # ☕︎
|
||||
LARAVEL_ICON $'\ue73f ' #
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# Powerline-Patched Font required!
|
||||
# See https://github.com/Lokaltog/powerline-fonts
|
||||
# Set the right locale to protect special characters
|
||||
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
|
||||
icons=(
|
||||
LEFT_SEGMENT_SEPARATOR $'\uE0B0' #
|
||||
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' #
|
||||
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
|
||||
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' #
|
||||
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' #
|
||||
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
|
||||
ROOT_ICON $'\u26A1' # ⚡
|
||||
SUDO_ICON $'\uE0A2' #
|
||||
RUBY_ICON ''
|
||||
AWS_ICON 'AWS:'
|
||||
AWS_EB_ICON $'\U1F331 ' # 🌱
|
||||
BACKGROUND_JOBS_ICON $'\u2699' # ⚙
|
||||
TEST_ICON ''
|
||||
TODO_ICON $'\u2611' # ☑
|
||||
BATTERY_ICON $'\U1F50B' # 🔋
|
||||
DISK_ICON $'hdd '
|
||||
OK_ICON $'\u2714' # ✔
|
||||
FAIL_ICON $'\u2718' # ✘
|
||||
SYMFONY_ICON 'SF'
|
||||
NODE_ICON $'\u2B22' # ⬢
|
||||
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
|
||||
MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─
|
||||
MULTILINE_LAST_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
|
||||
APPLE_ICON 'OSX'
|
||||
WINDOWS_ICON 'WIN'
|
||||
FREEBSD_ICON 'BSD'
|
||||
ANDROID_ICON 'And'
|
||||
LINUX_ICON 'Lx'
|
||||
LINUX_ARCH_ICON 'Arc'
|
||||
LINUX_DEBIAN_ICON 'Deb'
|
||||
LINUX_UBUNTU_ICON 'Ubu'
|
||||
LINUX_CENTOS_ICON 'Cen'
|
||||
LINUX_COREOS_ICON 'Cor'
|
||||
LINUX_ELEMENTARY_ICON 'Elm'
|
||||
LINUX_MINT_ICON 'LMi'
|
||||
LINUX_FEDORA_ICON 'Fed'
|
||||
LINUX_GENTOO_ICON 'Gen'
|
||||
LINUX_MAGEIA_ICON 'Mag'
|
||||
LINUX_NIXOS_ICON 'Nix'
|
||||
LINUX_MANJARO_ICON 'Man'
|
||||
LINUX_DEVUAN_ICON 'Dev'
|
||||
LINUX_ALPINE_ICON 'Alp'
|
||||
LINUX_AOSC_ICON 'Aos'
|
||||
LINUX_OPENSUSE_ICON 'OSu'
|
||||
LINUX_SABAYON_ICON 'Sab'
|
||||
LINUX_SLACKWARE_ICON 'Sla'
|
||||
SUNOS_ICON 'Sun'
|
||||
HOME_ICON ''
|
||||
HOME_SUB_ICON ''
|
||||
FOLDER_ICON ''
|
||||
ETC_ICON $'\u2699' # ⚙
|
||||
NETWORK_ICON 'IP'
|
||||
LOAD_ICON 'L'
|
||||
SWAP_ICON 'SWP'
|
||||
RAM_ICON 'RAM'
|
||||
SERVER_ICON ''
|
||||
VCS_UNTRACKED_ICON '?'
|
||||
VCS_UNSTAGED_ICON $'\u25CF' # ●
|
||||
VCS_STAGED_ICON $'\u271A' # ✚
|
||||
VCS_STASH_ICON $'\u235F' # ⍟
|
||||
VCS_INCOMING_CHANGES_ICON $'\u2193' # ↓
|
||||
VCS_OUTGOING_CHANGES_ICON $'\u2191' # ↑
|
||||
VCS_TAG_ICON ''
|
||||
VCS_BOOKMARK_ICON $'\u263F' # ☿
|
||||
VCS_COMMIT_ICON ''
|
||||
VCS_BRANCH_ICON $'\uE0A0 ' #
|
||||
VCS_REMOTE_BRANCH_ICON $'\u2192' # →
|
||||
VCS_GIT_ICON ''
|
||||
VCS_GIT_GITHUB_ICON ''
|
||||
VCS_GIT_BITBUCKET_ICON ''
|
||||
VCS_GIT_GITLAB_ICON ''
|
||||
VCS_HG_ICON ''
|
||||
VCS_SVN_ICON ''
|
||||
RUST_ICON 'Rust'
|
||||
PYTHON_ICON ''
|
||||
SWIFT_ICON 'Swift'
|
||||
GO_ICON 'Go'
|
||||
PUBLIC_IP_ICON ''
|
||||
LOCK_ICON $'\UE0A2'
|
||||
EXECUTION_TIME_ICON 'Dur'
|
||||
SSH_ICON '(ssh)'
|
||||
VPN_ICON '(vpn)'
|
||||
KUBERNETES_ICON $'\U2388' # ⎈
|
||||
DROPBOX_ICON 'Dropbox'
|
||||
DATE_ICON ''
|
||||
TIME_ICON ''
|
||||
JAVA_ICON $'\U2615' # ☕︎
|
||||
LARAVEL_ICON ''
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Override the above icon settings with any user-defined variables.
|
||||
case $POWERLEVEL9K_MODE in
|
||||
'flat')
|
||||
# Set the right locale to protect special characters
|
||||
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
|
||||
icons[LEFT_SEGMENT_SEPARATOR]=''
|
||||
icons[RIGHT_SEGMENT_SEPARATOR]=''
|
||||
icons[LEFT_SUBSEGMENT_SEPARATOR]='|'
|
||||
icons[RIGHT_SUBSEGMENT_SEPARATOR]='|'
|
||||
;;
|
||||
'compatible')
|
||||
# Set the right locale to protect special characters
|
||||
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
|
||||
icons[LEFT_SEGMENT_SEPARATOR]=$'\u2B80' # ⮀
|
||||
icons[RIGHT_SEGMENT_SEPARATOR]=$'\u2B82' # ⮂
|
||||
icons[VCS_BRANCH_ICON]='@'
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then
|
||||
icons[VCS_BRANCH_ICON]=''
|
||||
fi
|
||||
|
||||
# Safety function for printing icons
|
||||
# Prints the named icon, or if that icon is undefined, the string name.
|
||||
function print_icon() {
|
||||
local icon_name=$1
|
||||
local ICON_USER_VARIABLE=POWERLEVEL9K_${icon_name}
|
||||
if defined "$ICON_USER_VARIABLE"; then
|
||||
echo -n "${(P)ICON_USER_VARIABLE}"
|
||||
else
|
||||
echo -n "${icons[$icon_name]}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get a list of configured icons
|
||||
# * $1 string - If "original", then the original icons are printed,
|
||||
# otherwise "print_icon" is used, which takes the users
|
||||
# overrides into account.
|
||||
get_icon_names() {
|
||||
# Iterate over a ordered list of keys of the icons array
|
||||
for key in ${(@kon)icons}; do
|
||||
echo -n "POWERLEVEL9K_$key: "
|
||||
if [[ "${1}" == "original" ]]; then
|
||||
# print the original icons as they are defined in the array above
|
||||
echo "${icons[$key]}"
|
||||
else
|
||||
# print the icons as they are configured by the user
|
||||
echo "$(print_icon "$key")"
|
||||
fi
|
||||
done
|
||||
}
|
375
.zprezto/modules/prompt/external/powerlevel9k/functions/utilities.zsh
vendored
Executable file
375
.zprezto/modules/prompt/external/powerlevel9k/functions/utilities.zsh
vendored
Executable file
@@ -0,0 +1,375 @@
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
|
||||
################################################################
|
||||
# Utility functions
|
||||
# This file holds some utility-functions for
|
||||
# the powerlevel9k-ZSH-theme
|
||||
# https://github.com/bhilburn/powerlevel9k
|
||||
################################################################
|
||||
|
||||
# Exits with 0 if a variable has been previously defined (even if empty)
|
||||
# Takes the name of a variable that should be checked.
|
||||
function defined() {
|
||||
local varname="$1"
|
||||
|
||||
typeset -p "$varname" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# Given the name of a variable and a default value, sets the variable
|
||||
# value to the default only if it has not been defined.
|
||||
#
|
||||
# Typeset cannot set the value for an array, so this will only work
|
||||
# for scalar values.
|
||||
function set_default() {
|
||||
local varname="$1"
|
||||
local default_value="$2"
|
||||
|
||||
defined "$varname" || typeset -g "$varname"="$default_value"
|
||||
}
|
||||
|
||||
# Converts large memory values into a human-readable unit (e.g., bytes --> GB)
|
||||
# Takes two arguments:
|
||||
# * $size - The number which should be prettified
|
||||
# * $base - The base of the number (default Bytes)
|
||||
printSizeHumanReadable() {
|
||||
typeset -F 2 size
|
||||
size="$1"+0.00001
|
||||
local extension
|
||||
extension=('B' 'K' 'M' 'G' 'T' 'P' 'E' 'Z' 'Y')
|
||||
local index=1
|
||||
|
||||
# if the base is not Bytes
|
||||
if [[ -n $2 ]]; then
|
||||
local idx
|
||||
for idx in "${extension[@]}"; do
|
||||
if [[ "$2" == "$idx" ]]; then
|
||||
break
|
||||
fi
|
||||
index=$(( index + 1 ))
|
||||
done
|
||||
fi
|
||||
|
||||
while (( (size / 1024) > 0.1 )); do
|
||||
size=$(( size / 1024 ))
|
||||
index=$(( index + 1 ))
|
||||
done
|
||||
|
||||
echo "$size${extension[$index]}"
|
||||
}
|
||||
|
||||
# Gets the first value out of a list of items that is not empty.
|
||||
# The items are examined by a callback-function.
|
||||
# Takes two arguments:
|
||||
# * $list - A list of items
|
||||
# * $callback - A callback function to examine if the item is
|
||||
# worthy. The callback function has access to
|
||||
# the inner variable $item.
|
||||
function getRelevantItem() {
|
||||
local -a list
|
||||
local callback
|
||||
# Explicitly split the elements by whitespace.
|
||||
list=(${=1})
|
||||
callback=$2
|
||||
|
||||
for item in $list; do
|
||||
# The first non-empty item wins
|
||||
try=$(eval "$callback")
|
||||
if [[ -n "$try" ]]; then
|
||||
echo "$try"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# OS detection
|
||||
case $(uname) in
|
||||
Darwin)
|
||||
OS='OSX'
|
||||
OS_ICON=$(print_icon 'APPLE_ICON')
|
||||
;;
|
||||
CYGWIN_NT-* | MSYS_NT-*)
|
||||
OS='Windows'
|
||||
OS_ICON=$(print_icon 'WINDOWS_ICON')
|
||||
;;
|
||||
FreeBSD)
|
||||
OS='BSD'
|
||||
OS_ICON=$(print_icon 'FREEBSD_ICON')
|
||||
;;
|
||||
OpenBSD)
|
||||
OS='BSD'
|
||||
OS_ICON=$(print_icon 'FREEBSD_ICON')
|
||||
;;
|
||||
DragonFly)
|
||||
OS='BSD'
|
||||
OS_ICON=$(print_icon 'FREEBSD_ICON')
|
||||
;;
|
||||
Linux)
|
||||
OS='Linux'
|
||||
os_release_id="$(grep -E '^ID=([a-zA-Z]*)' /etc/os-release | cut -d '=' -f 2)"
|
||||
case "$os_release_id" in
|
||||
*arch*)
|
||||
OS_ICON=$(print_icon 'LINUX_ARCH_ICON')
|
||||
;;
|
||||
*debian*)
|
||||
OS_ICON=$(print_icon 'LINUX_DEBIAN_ICON')
|
||||
;;
|
||||
*ubuntu*)
|
||||
OS_ICON=$(print_icon 'LINUX_UBUNTU_ICON')
|
||||
;;
|
||||
*elementary*)
|
||||
OS_ICON=$(print_icon 'LINUX_ELEMENTARY_ICON')
|
||||
;;
|
||||
*fedora*)
|
||||
OS_ICON=$(print_icon 'LINUX_FEDORA_ICON')
|
||||
;;
|
||||
*coreos*)
|
||||
OS_ICON=$(print_icon 'LINUX_COREOS_ICON')
|
||||
;;
|
||||
*gentoo*)
|
||||
OS_ICON=$(print_icon 'LINUX_GENTOO_ICON')
|
||||
;;
|
||||
*mageia*)
|
||||
OS_ICON=$(print_icon 'LINUX_MAGEIA_ICON')
|
||||
;;
|
||||
*centos*)
|
||||
OS_ICON=$(print_icon 'LINUX_CENTOS_ICON')
|
||||
;;
|
||||
*opensuse*|*tumbleweed*)
|
||||
OS_ICON=$(print_icon 'LINUX_OPENSUSE_ICON')
|
||||
;;
|
||||
*sabayon*)
|
||||
OS_ICON=$(print_icon 'LINUX_SABAYON_ICON')
|
||||
;;
|
||||
*slackware*)
|
||||
OS_ICON=$(print_icon 'LINUX_SLACKWARE_ICON')
|
||||
;;
|
||||
*linuxmint*)
|
||||
OS_ICON=$(print_icon 'LINUX_MINT_ICON')
|
||||
;;
|
||||
*alpine*)
|
||||
OS_ICON=$(print_icon 'LINUX_ALPINE_ICON')
|
||||
;;
|
||||
*aosc*)
|
||||
OS_ICON=$(print_icon 'LINUX_AOSC_ICON')
|
||||
;;
|
||||
*nixos*)
|
||||
OS_ICON=$(print_icon 'LINUX_NIXOS_ICON')
|
||||
;;
|
||||
*devuan*)
|
||||
OS_ICON=$(print_icon 'LINUX_DEVUAN_ICON')
|
||||
;;
|
||||
*manjaro*)
|
||||
OS_ICON=$(print_icon 'LINUX_MANJARO_ICON')
|
||||
;;
|
||||
*)
|
||||
OS='Linux'
|
||||
OS_ICON=$(print_icon 'LINUX_ICON')
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check if we're running on Android
|
||||
case $(uname -o 2>/dev/null) in
|
||||
Android)
|
||||
OS='Android'
|
||||
OS_ICON=$(print_icon 'ANDROID_ICON')
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
SunOS)
|
||||
OS='Solaris'
|
||||
OS_ICON=$(print_icon 'SUNOS_ICON')
|
||||
;;
|
||||
*)
|
||||
OS=''
|
||||
OS_ICON=''
|
||||
;;
|
||||
esac
|
||||
|
||||
# Determine the correct sed parameter.
|
||||
#
|
||||
# `sed` is unfortunately not consistent across OSes when it comes to flags.
|
||||
SED_EXTENDED_REGEX_PARAMETER="-r"
|
||||
if [[ "$OS" == 'OSX' ]]; then
|
||||
local IS_BSD_SED="$(sed --version &>> /dev/null || echo "BSD sed")"
|
||||
if [[ -n "$IS_BSD_SED" ]]; then
|
||||
SED_EXTENDED_REGEX_PARAMETER="-E"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Determine if the passed segment is used in the prompt
|
||||
#
|
||||
# Pass the name of the segment to this function to test for its presence in
|
||||
# either the LEFT or RIGHT prompt arrays.
|
||||
# * $1: The segment to be tested.
|
||||
segment_in_use() {
|
||||
local key=$1
|
||||
if [[ -n "${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[(r)$key]}" ]] || [[ -n "${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[(r)$key]}" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Print a deprecation warning if an old segment is in use.
|
||||
# Takes the name of an associative array that contains the
|
||||
# deprecated segments as keys, the values contain the new
|
||||
# segment names.
|
||||
print_deprecation_warning() {
|
||||
typeset -AH raw_deprecated_segments
|
||||
raw_deprecated_segments=(${(kvP@)1})
|
||||
|
||||
for key in ${(@k)raw_deprecated_segments}; do
|
||||
if segment_in_use $key; then
|
||||
# segment is deprecated
|
||||
print -P "%F{yellow}Warning!%f The '$key' segment is deprecated. Use '%F{blue}${raw_deprecated_segments[$key]}%f' instead. For more informations, have a look at the CHANGELOG.md."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# A helper function to determine if a segment should be
|
||||
# joined or promoted to a full one.
|
||||
# Takes three arguments:
|
||||
# * $1: The array index of the current segment
|
||||
# * $2: The array index of the last printed segment
|
||||
# * $3: The array of segments of the left or right prompt
|
||||
function segmentShouldBeJoined() {
|
||||
local current_index=$1
|
||||
local last_segment_index=$2
|
||||
# Explicitly split the elements by whitespace.
|
||||
local -a elements
|
||||
elements=(${=3})
|
||||
|
||||
local current_segment=${elements[$current_index]}
|
||||
local joined=false
|
||||
if [[ ${current_segment[-7,-1]} == '_joined' ]]; then
|
||||
joined=true
|
||||
# promote segment to a full one, if the predecessing full segment
|
||||
# was conditional. So this can only be the case for segments that
|
||||
# are not our direct predecessor.
|
||||
if (( $(($current_index - $last_segment_index)) > 1)); then
|
||||
# Now we have to examine every previous segment, until we reach
|
||||
# the last printed one (found by its index). This is relevant if
|
||||
# all previous segments are joined. Then we want to join our
|
||||
# segment as well.
|
||||
local examined_index=$((current_index - 1))
|
||||
while (( $examined_index > $last_segment_index )); do
|
||||
local previous_segment=${elements[$examined_index]}
|
||||
# If one of the examined segments is not joined, then we know
|
||||
# that the current segment should not be joined, as the target
|
||||
# segment is the wrong one.
|
||||
if [[ ${previous_segment[-7,-1]} != '_joined' ]]; then
|
||||
joined=false
|
||||
break
|
||||
fi
|
||||
examined_index=$((examined_index - 1))
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Return 1 means error; return 0 means no error. So we have
|
||||
# to invert $joined
|
||||
if [[ "$joined" == "true" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Given a directory path, truncate it according to the settings.
|
||||
# Parameters:
|
||||
# * $1 Path: string - the directory path to be truncated
|
||||
# * $2 Length: integer - length to truncate to
|
||||
# * $3 Delimiter: string - the delimiter to use
|
||||
# * $4 From: string - "right" | "middle". If omited, assumes right.
|
||||
function truncatePath() {
|
||||
# if the current path is not 1 character long (e.g. "/" or "~")
|
||||
if (( ${#1} > 1 )); then
|
||||
# convert $2 from string to integer
|
||||
2=$(( $2 ))
|
||||
# set $3 to "" if not defined
|
||||
[[ -z $3 ]] && 3="" || 3=$(echo -n $3)
|
||||
# set $4 to "right" if not defined
|
||||
[[ -z $4 ]] && 4="right"
|
||||
# create a variable for the truncated path.
|
||||
local trunc_path
|
||||
# if the path is in the home folder, add "~/" to the start otherwise "/"
|
||||
[[ $1 == "~"* ]] && trunc_path='~/' || trunc_path='/'
|
||||
# split the path into an array using "/" as the delimiter
|
||||
local paths=$1
|
||||
paths=(${(s:/:)${paths//"~\/"/}})
|
||||
# declare locals for the directory being tested and its length
|
||||
local test_dir test_dir_length
|
||||
# do the needed truncation
|
||||
case $4 in
|
||||
right)
|
||||
# include the delimiter length in the threshhold
|
||||
local threshhold=$(( $2 + ${#3} ))
|
||||
# loop through the paths
|
||||
for (( i=1; i<${#paths}; i++ )); do
|
||||
# get the current directory value
|
||||
test_dir=$paths[$i]
|
||||
test_dir_length=${#test_dir}
|
||||
# only truncate if the resulting truncation will be shorter than
|
||||
# the truncation + delimiter length and at least 3 characters
|
||||
if (( $test_dir_length > $threshhold )) && (( $test_dir_length > 3 )); then
|
||||
# use the first $2 characters and the delimiter
|
||||
trunc_path+="${test_dir:0:$2}$3/"
|
||||
else
|
||||
# use the full path
|
||||
trunc_path+="${test_dir}/"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
middle)
|
||||
# we need double the length for start and end truncation + delimiter length
|
||||
local threshhold=$(( $2 * 2 ))
|
||||
# create a variable for the start of the end truncation
|
||||
local last_pos
|
||||
# loop through the paths
|
||||
for (( i=1; i<${#paths}; i++ )); do
|
||||
# get the current directory value
|
||||
test_dir=$paths[$i]
|
||||
test_dir_length=${#test_dir}
|
||||
# only truncate if the resulting truncation will be shorter than
|
||||
# the truncation + delimiter length
|
||||
if (( $test_dir_length > $threshhold )); then
|
||||
# use the first $2 characters, the delimiter and the last $2 characters
|
||||
last_pos=$(( $test_dir_length - $2 ))
|
||||
trunc_path+="${test_dir:0:$2}$3${test_dir:$last_pos:$test_dir_length}/"
|
||||
else
|
||||
# use the full path
|
||||
trunc_path+="${test_dir}/"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
# return the truncated path + the current directory
|
||||
echo $trunc_path${1:t}
|
||||
else # current path is 1 character long (e.g. "/" or "~")
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
||||
# Given a directory path, truncate it according to the settings for
|
||||
# `truncate_from_right`
|
||||
function truncatePathFromRight() {
|
||||
local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER:-1}
|
||||
echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER \
|
||||
"s@(([^/]{$((POWERLEVEL9K_SHORTEN_DIR_LENGTH))})([^/]{$delim_len}))[^/]+/@\2$POWERLEVEL9K_SHORTEN_DELIMITER/@g"
|
||||
}
|
||||
|
||||
# Search recursively in parent folders for given file.
|
||||
function upsearch () {
|
||||
if [[ "$PWD" == "$HOME" || "$PWD" == "/" ]]; then
|
||||
echo "$PWD"
|
||||
elif test -e "$1"; then
|
||||
pushd .. > /dev/null
|
||||
upsearch "$1"
|
||||
popd > /dev/null
|
||||
echo "$PWD"
|
||||
else
|
||||
pushd .. > /dev/null
|
||||
upsearch "$1"
|
||||
popd > /dev/null
|
||||
fi
|
||||
}
|
169
.zprezto/modules/prompt/external/powerlevel9k/functions/vcs.zsh
vendored
Executable file
169
.zprezto/modules/prompt/external/powerlevel9k/functions/vcs.zsh
vendored
Executable file
@@ -0,0 +1,169 @@
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
|
||||
################################################################
|
||||
# vcs
|
||||
# This file holds supplemental VCS functions
|
||||
# for the powerlevel9k-ZSH-theme
|
||||
# https://github.com/bhilburn/powerlevel9k
|
||||
################################################################
|
||||
|
||||
set_default POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY true
|
||||
function +vi-git-untracked() {
|
||||
# TODO: check git >= 1.7.2 - see function git_compare_version()
|
||||
local FLAGS
|
||||
FLAGS=('--porcelain')
|
||||
|
||||
if [[ "$POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY" == "false" ]]; then
|
||||
FLAGS+='--ignore-submodules=dirty'
|
||||
fi
|
||||
|
||||
if [[ $(command git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \
|
||||
-n $(command git status ${FLAGS} | \grep -E '^\?\?' 2> /dev/null | tail -n1) ]]; then
|
||||
hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')"
|
||||
VCS_WORKDIR_HALF_DIRTY=true
|
||||
else
|
||||
VCS_WORKDIR_HALF_DIRTY=false
|
||||
fi
|
||||
}
|
||||
|
||||
function +vi-git-aheadbehind() {
|
||||
local ahead behind branch_name
|
||||
local -a gitstatus
|
||||
|
||||
branch_name=$(command git symbolic-ref --short HEAD 2>/dev/null)
|
||||
|
||||
# for git prior to 1.7
|
||||
# ahead=$(command git rev-list origin/${branch_name}..HEAD | wc -l)
|
||||
ahead=$(command git rev-list "${branch_name}"@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
(( ahead )) && gitstatus+=( " $(print_icon 'VCS_OUTGOING_CHANGES_ICON')${ahead// /}" )
|
||||
|
||||
# for git prior to 1.7
|
||||
# behind=$(command git rev-list HEAD..origin/${branch_name} | wc -l)
|
||||
behind=$(command git rev-list HEAD.."${branch_name}"@{upstream} 2>/dev/null | wc -l)
|
||||
(( behind )) && gitstatus+=( " $(print_icon 'VCS_INCOMING_CHANGES_ICON')${behind// /}" )
|
||||
|
||||
hook_com[misc]+=${(j::)gitstatus}
|
||||
}
|
||||
|
||||
function +vi-git-remotebranch() {
|
||||
local remote branch_name
|
||||
|
||||
# Are we on a remote-tracking branch?
|
||||
remote=${$(command git rev-parse --verify HEAD@{upstream} --symbolic-full-name 2>/dev/null)/refs\/(remotes|heads)\/}
|
||||
branch_name=$(command git symbolic-ref --short HEAD 2>/dev/null)
|
||||
|
||||
if [[ -n "$POWERLEVEL9K_VCS_SHORTEN_LENGTH" ]] && [[ -n "$POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH" ]]; then
|
||||
set_default POWERLEVEL9K_VCS_SHORTEN_DELIMITER $'\U2026'
|
||||
|
||||
if [ ${#hook_com[branch]} -gt $POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH ] && [ ${#hook_com[branch]} -gt $POWERLEVEL9K_VCS_SHORTEN_LENGTH ]; then
|
||||
case "$POWERLEVEL9K_VCS_SHORTEN_STRATEGY" in
|
||||
truncate_middle)
|
||||
hook_com[branch]="$(echo "${branch_name:0:$POWERLEVEL9K_VCS_SHORTEN_LENGTH}")$POWERLEVEL9K_VCS_SHORTEN_DELIMITER$(echo "${branch_name: -$POWERLEVEL9K_VCS_SHORTEN_LENGTH}")"
|
||||
;;
|
||||
truncate_from_right)
|
||||
hook_com[branch]="$(echo "${branch_name:0:$POWERLEVEL9K_VCS_SHORTEN_LENGTH}")$POWERLEVEL9K_VCS_SHORTEN_DELIMITER"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${hook_com[branch]}"
|
||||
# Always show the remote
|
||||
#if [[ -n ${remote} ]] ; then
|
||||
# Only show the remote if it differs from the local
|
||||
if [[ -n ${remote} ]] && [[ "${remote#*/}" != "${branch_name}" ]] ; then
|
||||
hook_com[branch]+="$(print_icon 'VCS_REMOTE_BRANCH_ICON')${remote// /}"
|
||||
fi
|
||||
}
|
||||
|
||||
set_default POWERLEVEL9K_VCS_HIDE_TAGS false
|
||||
function +vi-git-tagname() {
|
||||
if [[ "$POWERLEVEL9K_VCS_HIDE_TAGS" == "false" ]]; then
|
||||
# If we are on a tag, append the tagname to the current branch string.
|
||||
local tag
|
||||
tag=$(command git describe --tags --exact-match HEAD 2>/dev/null)
|
||||
|
||||
if [[ -n "${tag}" ]] ; then
|
||||
# There is a tag that points to our current commit. Need to determine if we
|
||||
# are also on a branch, or are in a DETACHED_HEAD state.
|
||||
if [[ -z $(command git symbolic-ref HEAD 2>/dev/null) ]]; then
|
||||
# DETACHED_HEAD state. We want to append the tag name to the commit hash
|
||||
# and print it. Unfortunately, `vcs_info` blows away the hash when a tag
|
||||
# exists, so we have to manually retrieve it and clobber the branch
|
||||
# string.
|
||||
local revision
|
||||
revision=$(command git rev-list -n 1 --abbrev-commit --abbrev=${POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH} HEAD)
|
||||
hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}"
|
||||
else
|
||||
# We are on both a tag and a branch; print both by appending the tag name.
|
||||
hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Show count of stashed changes
|
||||
# Port from https://github.com/whiteinge/dotfiles/blob/5dfd08d30f7f2749cfc60bc55564c6ea239624d9/.zsh_shouse_prompt#L268
|
||||
function +vi-git-stash() {
|
||||
local -a stashes
|
||||
|
||||
if [[ -s $(command git rev-parse --git-dir)/refs/stash ]] ; then
|
||||
stashes=$(command git stash list 2>/dev/null | wc -l)
|
||||
hook_com[misc]+=" $(print_icon 'VCS_STASH_ICON')${stashes// /}"
|
||||
fi
|
||||
}
|
||||
|
||||
function +vi-hg-bookmarks() {
|
||||
if [[ -n "${hgbmarks[@]}" ]]; then
|
||||
hook_com[hg-bookmark-string]=" $(print_icon 'VCS_BOOKMARK_ICON')${hgbmarks[@]}"
|
||||
|
||||
# To signal that we want to use the sting we just generated, set the special
|
||||
# variable `ret' to something other than the default zero:
|
||||
ret=1
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function +vi-vcs-detect-changes() {
|
||||
if [[ "${hook_com[vcs]}" == "git" ]]; then
|
||||
|
||||
local remote=$(command git ls-remote --get-url 2> /dev/null)
|
||||
if [[ "$remote" =~ "github" ]] then
|
||||
vcs_visual_identifier='VCS_GIT_GITHUB_ICON'
|
||||
elif [[ "$remote" =~ "bitbucket" ]] then
|
||||
vcs_visual_identifier='VCS_GIT_BITBUCKET_ICON'
|
||||
elif [[ "$remote" =~ "stash" ]] then
|
||||
vcs_visual_identifier='VCS_GIT_BITBUCKET_ICON'
|
||||
elif [[ "$remote" =~ "gitlab" ]] then
|
||||
vcs_visual_identifier='VCS_GIT_GITLAB_ICON'
|
||||
else
|
||||
vcs_visual_identifier='VCS_GIT_ICON'
|
||||
fi
|
||||
|
||||
elif [[ "${hook_com[vcs]}" == "hg" ]]; then
|
||||
vcs_visual_identifier='VCS_HG_ICON'
|
||||
elif [[ "${hook_com[vcs]}" == "svn" ]]; then
|
||||
vcs_visual_identifier='VCS_SVN_ICON'
|
||||
fi
|
||||
|
||||
if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then
|
||||
VCS_WORKDIR_DIRTY=true
|
||||
else
|
||||
VCS_WORKDIR_DIRTY=false
|
||||
fi
|
||||
}
|
||||
|
||||
function +vi-svn-detect-changes() {
|
||||
local svn_status="$(svn status)"
|
||||
if [[ -n "$(echo "$svn_status" | \grep \^\?)" ]]; then
|
||||
hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')"
|
||||
VCS_WORKDIR_HALF_DIRTY=true
|
||||
fi
|
||||
if [[ -n "$(echo "$svn_status" | \grep \^\M)" ]]; then
|
||||
hook_com[unstaged]+=" $(print_icon 'VCS_UNSTAGED_ICON')"
|
||||
VCS_WORKDIR_DIRTY=true
|
||||
fi
|
||||
if [[ -n "$(echo "$svn_status" | \grep \^\A)" ]]; then
|
||||
hook_com[staged]+=" $(print_icon 'VCS_STAGED_ICON')"
|
||||
VCS_WORKDIR_DIRTY=true
|
||||
fi
|
||||
}
|
1912
.zprezto/modules/prompt/external/powerlevel9k/powerlevel9k.zsh-theme
vendored
Executable file
1912
.zprezto/modules/prompt/external/powerlevel9k/powerlevel9k.zsh-theme
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1912
.zprezto/modules/prompt/external/powerlevel9k/prompt_powerlevel9k_setup
vendored
Executable file
1912
.zprezto/modules/prompt/external/powerlevel9k/prompt_powerlevel9k_setup
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1
.zprezto/modules/prompt/external/powerlevel9k/shunit2/.git_backup
vendored
Normal file
1
.zprezto/modules/prompt/external/powerlevel9k/shunit2/.git_backup
vendored
Normal file
@@ -0,0 +1 @@
|
||||
gitdir: ../../../../../.git/modules/modules/prompt/external/powerlevel9k/modules/shunit2
|
89
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/Makefile
vendored
Normal file
89
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/Makefile
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
# $Id$
|
||||
|
||||
PROG=shunit2
|
||||
|
||||
BIN_DIR=$(PWD)/bin
|
||||
BUILD_DIR=$(PWD)/build
|
||||
DIST_DIR=$(PWD)/dist
|
||||
LIB_DIR=$(PWD)/lib
|
||||
SHARE_DIR=$(PWD)/share
|
||||
SRC_DIR=$(PWD)/src
|
||||
TEST_DIR=$(PWD)/test
|
||||
TMP_DIR=$(PWD)/tmp
|
||||
|
||||
DOCBOOK_BUILD_DIR=$(BUILD_DIR)/docbook
|
||||
DOCBOOK_SHARE_DIR=$(SHARE_DIR)/docbook
|
||||
|
||||
DOCBOOK_SRC_DIR=$(SRC_DIR)/docbook
|
||||
EXAMPLES_SRC_DIR=$(SRC_DIR)/examples
|
||||
SHELL_SRC_DIR=$(SRC_DIR)/shell
|
||||
TEST_SRC_DIR=$(SRC_DIR)/test
|
||||
|
||||
HTML_XSL=$(SHARE_DIR)/docbook/tldp-xsl/21MAR2004/html/tldp-one-page.xsl
|
||||
|
||||
all: build docs
|
||||
|
||||
build: build-prep
|
||||
cp -p $(SHELL_SRC_DIR)/$(PROG) $(BUILD_DIR)
|
||||
|
||||
build-clean:
|
||||
rm -fr $(BUILD_DIR)
|
||||
|
||||
build-prep:
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
|
||||
docs: docs-transform-shelldoc docs-transform-docbook
|
||||
|
||||
docs-prep:
|
||||
@mkdir -p $(DOCBOOK_BUILD_DIR)
|
||||
@echo "Preparing documentation for parsing"
|
||||
@isoDate=`date "+%Y-%m-%d"`; \
|
||||
find $(DOCBOOK_SRC_DIR) -name "*.xml" |\
|
||||
while read f; do \
|
||||
bn=`basename $$f`; \
|
||||
sed -e "s/@@ISO_DATE@@/$$isoDate/g" $$f >$(DOCBOOK_BUILD_DIR)/$$bn; \
|
||||
done
|
||||
|
||||
docs-extract-shelldoc: docs-prep
|
||||
@echo "Extracting the ShellDoc"
|
||||
@$(BIN_DIR)/extractDocs.pl $(SHELL_SRC_DIR)/$(PROG) >$(BUILD_DIR)/$(PROG)_shelldoc.xml
|
||||
|
||||
docs-transform-shelldoc: docs-prep docs-extract-shelldoc
|
||||
@echo "Parsing the extracted ShellDoc"
|
||||
@xsltproc $(SHARE_DIR)/resources/shelldoc.xslt $(BUILD_DIR)/$(PROG)_shelldoc.xml >$(DOCBOOK_BUILD_DIR)/functions.xml
|
||||
|
||||
docs-transform-docbook: docs-docbook-prep docs-prep
|
||||
@echo "Parsing the documentation with DocBook"
|
||||
@xsltproc $(HTML_XSL) $(DOCBOOK_BUILD_DIR)/$(PROG).xml >$(BUILD_DIR)/$(PROG).html
|
||||
|
||||
docs-docbook-prep:
|
||||
@if [ ! -d "$(DOCBOOK_SHARE_DIR)/docbook-xml" \
|
||||
-o ! -d "$(DOCBOOK_SHARE_DIR)/docbook-xsl" ]; \
|
||||
then \
|
||||
echo "Preparing DocBook structure"; \
|
||||
$(BIN_DIR)/docbookPrep.sh "$(DOCBOOK_SHARE_DIR)"; \
|
||||
fi
|
||||
|
||||
test: test-prep
|
||||
@echo "executing $(PROG) unit tests"
|
||||
( cd $(TEST_DIR); $(TEST_SRC_DIR)/run-test-suite )
|
||||
|
||||
test-clean:
|
||||
rm -fr $(TEST_DIR)
|
||||
|
||||
test-prep: build test-clean
|
||||
@mkdir -p $(TEST_DIR)
|
||||
cp -p $(TEST_SRC_DIR)/test* $(TEST_DIR)
|
||||
cp -p $(TEST_SRC_DIR)/run-test-suite $(TEST_DIR)
|
||||
cp -p $(BUILD_DIR)/$(PROG) $(TEST_DIR)
|
||||
|
||||
dist: dist-clean build docs
|
||||
@mkdir $(DIST_DIR)
|
||||
cp -p $(BUILD_DIR)/$(PROG) $(DIST_DIR)
|
||||
cp -p $(BUILD_DIR)/$(PROG).html $(DIST_DIR)
|
||||
|
||||
clean: build-clean test-clean
|
||||
rm -fr $(TMP_DIR)
|
||||
|
||||
dist-clean: clean
|
||||
rm -fr $(DIST_DIR)
|
97
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/docbookPrep.sh
vendored
Executable file
97
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/docbookPrep.sh
vendored
Executable file
@@ -0,0 +1,97 @@
|
||||
#! /bin/sh
|
||||
# $Id$
|
||||
|
||||
XML_VERSION='4.4'
|
||||
XML_FILE="docbook-xml-${XML_VERSION}"
|
||||
XML_URL="http://www.docbook.org/xml/${XML_VERSION}/${XML_FILE}.zip"
|
||||
|
||||
XSL_VERSION='1.72.0'
|
||||
XSL_FILE="docbook-xsl-${XSL_VERSION}"
|
||||
XSL_URL="http://downloads.sourceforge.net/docbook/${XSL_FILE}.tar.bz2"
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# do no edit below here
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
PATH="${PATH}:${MY_DIR}"
|
||||
PWD=${PWD:-`pwd`}
|
||||
|
||||
MY_BASE=`basename "$0"`
|
||||
MY_DIR=`dirname "$0"`
|
||||
|
||||
# load shlib
|
||||
. "${MY_DIR}/../lib/sh/shlib"
|
||||
|
||||
BASE_DIR=`shlib_relToAbsPath "${MY_DIR}/.."`
|
||||
DL_DIR="${BASE_DIR}/tmp"
|
||||
DOCBOOK_DIR="${BASE_DIR}/share/docbook"
|
||||
|
||||
CURL_OPTS='-C - -Os'
|
||||
WGET_OPTS='-cq'
|
||||
|
||||
METHOD_NONE=0
|
||||
METHOD_WGET=1
|
||||
METHOD_CURL=2
|
||||
|
||||
get_url()
|
||||
{
|
||||
url=$1
|
||||
case ${method} in
|
||||
${METHOD_CURL}) ${curl} ${CURL_OPTS} "${url}" ;;
|
||||
${METHOD_WGET}) ${wget} ${WGET_OPTS} "${url}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# determine method
|
||||
method=${METHOD_NONE}
|
||||
wget=`which wget`
|
||||
[ $? -eq 0 ] && method=${METHOD_WGET}
|
||||
curl=`which curl`
|
||||
[ $? -eq 0 -a ${method} -eq ${METHOD_NONE} ] && method=${METHOD_CURL}
|
||||
if [ ${method} -eq ${METHOD_NONE} ]; then
|
||||
echo "unable to locate wget or curl. cannot continue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# create download dir
|
||||
mkdir -p "${DL_DIR}"
|
||||
|
||||
# get the docbook xml files
|
||||
echo 'Docbook XML'
|
||||
echo ' downloading'
|
||||
cd ${DL_DIR}
|
||||
get_url "${XML_URL}"
|
||||
if [ -f "${DL_DIR}/${XML_FILE}.zip" ]; then
|
||||
echo ' extracting'
|
||||
xml_dir="${DOCBOOK_DIR}/docbook-xml/${XML_VERSION}"
|
||||
rm -fr "${xml_dir}"
|
||||
mkdir -p "${xml_dir}"
|
||||
cd "${xml_dir}"
|
||||
unzip -oq "${DL_DIR}/${XML_FILE}.zip"
|
||||
cd ..
|
||||
rm -f current
|
||||
ln -s "${XML_VERSION}" current
|
||||
else
|
||||
echo "error: unable to extract (${XML_FILE}.zip)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get the docbook xslt files
|
||||
echo 'Docbook XSLT'
|
||||
echo ' downloading'
|
||||
cd ${DL_DIR}
|
||||
get_url "${XSL_URL}"
|
||||
if [ -f "${DL_DIR}/${XSL_FILE}.tar.bz2" ]; then
|
||||
echo ' extracting'
|
||||
xsl_dir="${DOCBOOK_DIR}/docbook-xsl"
|
||||
mkdir -p "${xsl_dir}"
|
||||
cd "${xsl_dir}"
|
||||
rm -fr ${XSL_VERSION}
|
||||
bzip2 -dc "${DL_DIR}/${XSL_FILE}.tar.bz2" |tar xf -
|
||||
mv ${XSL_FILE} ${XSL_VERSION}
|
||||
rm -f current
|
||||
ln -s "${XSL_VERSION}" current
|
||||
else
|
||||
echo "error: unable to extract (${XSL_FILE}.tar.bz2)" >&2
|
||||
exit 1
|
||||
fi
|
40
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/extractDocs.pl
vendored
Executable file
40
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/extractDocs.pl
vendored
Executable file
@@ -0,0 +1,40 @@
|
||||
#! /usr/bin/perl
|
||||
# $Id$
|
||||
|
||||
if(@ARGV != 1) {
|
||||
print "usage: $0 sourceFile\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$sourceFile = $ARGV[0];
|
||||
|
||||
#
|
||||
# read in the source file
|
||||
#
|
||||
$rslt = open(FILE, $sourceFile)
|
||||
|| die "could not open file ($sourceFile)";
|
||||
|
||||
$inComment = 0;
|
||||
while(<FILE>) {
|
||||
next if /^[^#]/;
|
||||
s/^# //;
|
||||
s/^#//;
|
||||
|
||||
if(/^\/\*\*/) {
|
||||
$inComment = 1;
|
||||
next;
|
||||
}
|
||||
if(/\*\/$/) {
|
||||
$inComment = 0;
|
||||
next;
|
||||
}
|
||||
|
||||
if ($inComment == 1) { print $_ };
|
||||
if ($inComment == 0 && /\/\/\*/) {
|
||||
@line = split /\/\/\*/, $_, 2;
|
||||
$line[1] =~ s/^ //;
|
||||
print $line[1];
|
||||
}
|
||||
}
|
||||
|
||||
close(FILE);
|
36
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/which
vendored
Executable file
36
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/which
vendored
Executable file
@@ -0,0 +1,36 @@
|
||||
#! /bin/sh
|
||||
# $Id$
|
||||
#
|
||||
# This is a simple implementation of the 'which' command for those OSes that
|
||||
# don't have one.
|
||||
#
|
||||
|
||||
true; TRUE=$?
|
||||
false; FALSE=$?
|
||||
|
||||
showAll=${FALSE}
|
||||
|
||||
# process command line flags
|
||||
while getopts 'a' opt; do
|
||||
case ${opt} in
|
||||
a) showAll=${TRUE}
|
||||
esac
|
||||
done
|
||||
shift `expr ${OPTIND} - 1`
|
||||
|
||||
# exit if no arguments were given
|
||||
[ $# -eq 0 ] && exit 1
|
||||
|
||||
command=$1
|
||||
|
||||
# search for command
|
||||
out=`echo "${PATH}" |sed "s/:/\n/g" |\
|
||||
while read path; do
|
||||
fullPath="${path}/${command}"
|
||||
if [ -x "${fullPath}" ]; then
|
||||
echo "${fullPath}"
|
||||
[ ${showAll} -eq ${FALSE} ] && break
|
||||
fi
|
||||
done`
|
||||
[ -z "${out}" ] && exit 1
|
||||
echo "${out}"
|
68
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/CHANGES-2.0.txt
vendored
Normal file
68
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/CHANGES-2.0.txt
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
CHANGES WITH 2.0.4
|
||||
|
||||
Unset additional variables that were missed.
|
||||
|
||||
Fixed off-by-one in exit value for scripts caught by the trap handler.
|
||||
|
||||
The library did not fail gracefully when the 'od' command was not installed.
|
||||
|
||||
|
||||
CHANGES WITH 2.0.3
|
||||
|
||||
Back ported the Makefile from 2.1.1pre that included changes to the
|
||||
docs-docbook-prep target.
|
||||
|
||||
Changed the test in assertFalse() so that any non-zero value registers as
|
||||
false. (Credits to Bryan Larsen)
|
||||
|
||||
Updated the testPartyLikeItIs1999() function in the Quick Start documentation.
|
||||
The 'expected' and 'actual' values were swapped. (Credits to Richard Jensen)
|
||||
|
||||
It was pointed out that the simple 'failed' message for a failed assert was not
|
||||
only insufficient, it was nonstandard (when compared to JUnit) and didn't
|
||||
provide the user with an expected vs actual result. The code was revised
|
||||
somewhat to bring closer into alignment with JUnit (v4.3.1 specifically) so
|
||||
that it feels more "normal". (Credits to Richard Jensen)
|
||||
|
||||
As part of the JUnit realignment, it was noticed that fail*() functions in
|
||||
JUnit don't actually do any comparisons themselves. They only generate a
|
||||
failure message. Updated the code to match.
|
||||
|
||||
Added self-testing unit tests. Kinda horkey, but they did find bugs during the
|
||||
JUnit realignment.
|
||||
|
||||
Fixed the code for returning from asserts as the return was being called before
|
||||
the unsetting of variables occurred. (Credits to Mathias Goldau)
|
||||
|
||||
The assert(True|False)() functions now accept an integer value for a
|
||||
conditional test. A value of '0' is considered 'true', while any non-zero value
|
||||
is considered 'false'.
|
||||
|
||||
All public functions now fill use default values to work properly with the '-x'
|
||||
shell debugging flag.
|
||||
|
||||
Fixed the method of percent calculation for the report to get achieve better
|
||||
accuracy.
|
||||
|
||||
|
||||
CHANGES WITH 2.0.2
|
||||
|
||||
Fixed problem with fail(). The failure message was not properly printed.
|
||||
|
||||
Reworked the Makefile so that the DocBook XML and XSLT files are properly
|
||||
downloaded before parsing can continue.
|
||||
|
||||
|
||||
CHANGES WITH 2.0.1
|
||||
|
||||
Fixed some really stupid mistakes with the fail* functions. They were doing the
|
||||
exact opposite of what they were supposed to be doing.
|
||||
|
||||
|
||||
CHANGES WITH 2.0.0
|
||||
|
||||
Made the first stand-alone release!
|
||||
|
||||
|
||||
$Revision$
|
||||
vim:spell
|
504
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/LGPL-2.1
vendored
Normal file
504
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/LGPL-2.1
vendored
Normal file
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
153
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/README.txt
vendored
Normal file
153
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/README.txt
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# SourceForge
|
||||
#
|
||||
|
||||
This project is stored on SourceForge as http://sf.net/projects/shunit2. The
|
||||
source code can be accessed using the following information.
|
||||
|
||||
* Subversion
|
||||
$ svn co https://shunit2.svn.sourceforge.net/svnroot/shunit2/trunk/source shunit2
|
||||
|
||||
Subversion may also be browsed via a web browser at
|
||||
http://svn.sourceforge.net/shunit2
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Making a release
|
||||
#
|
||||
|
||||
For these steps, it is assumed we are working with release 2.0.0.
|
||||
|
||||
Steps:
|
||||
* write release notes
|
||||
* update version
|
||||
* finish changelog
|
||||
* check all the code in
|
||||
* tag the release
|
||||
* export the release
|
||||
* create tarball
|
||||
* md5sum the tarball and sign with gpg
|
||||
* update website
|
||||
* post to SourceForge and Freshmeat
|
||||
|
||||
WRITE RELEASE NOTES
|
||||
|
||||
This should be pretty self explainatory. Use one of the release notes from a
|
||||
previous release as an example.
|
||||
|
||||
To get the versions of the various shells, do the following:
|
||||
Cygwin
|
||||
bash: $ bash --version
|
||||
ksh: actually pdksh
|
||||
pdksh: look in the downloaded Cygwin directory
|
||||
Linux
|
||||
bash: $ bash --version
|
||||
dash: look at installed version
|
||||
ksh: $ ksh --version
|
||||
pdksh: $ strings /bin/pdksh |grep 'PD KSH'
|
||||
zsh: $ zsh --version
|
||||
Solaris 10
|
||||
sh: not possible
|
||||
bash: $ bash --version
|
||||
ksh: $ strings /usr/bin/ksh |grep 'Version'
|
||||
|
||||
UPDATE VERSION
|
||||
|
||||
Edit the shunit2 source code, and change the version number in the comment, as
|
||||
well as in the __SHUNIT_VERSION variable. Next, edit the
|
||||
src/docbook/shunit2.xml file, edit the version in the <title> element, and make
|
||||
sure there is a revision section for this release.
|
||||
|
||||
FINISH DOCUMENTATION
|
||||
|
||||
Make sure that any remaning changes get put into the CHANGES-X.X.txt file.
|
||||
|
||||
Finish writing the RELEASE_NOTES-X.X.X.txt. Once it is finished, run it through
|
||||
the 'fmt' command to make it pretty.
|
||||
|
||||
$ fmt -w 80 RELEASE_NOTES-2.0.0.txt >RELEASE_NOTES-2.0.0.txt.new
|
||||
$ mv RELEASE_NOTES-2.0.0.txt.new RELEASE_NOTES-2.0.0.txt
|
||||
|
||||
We want to have an up-to-date version of the documentation in the release, so
|
||||
we'd better build it.
|
||||
|
||||
$ pwd
|
||||
.../shunit2/source/2.0
|
||||
$ make docs
|
||||
...
|
||||
$ cp -p build/shunit2.html doc
|
||||
$ svn ci -m "" doc/shunit2.html
|
||||
|
||||
CHECK IN ALL THE CODE
|
||||
|
||||
This step is pretty self-explainatory
|
||||
|
||||
TAG THE RELEASE
|
||||
|
||||
$ pwd
|
||||
.../shunit2/source
|
||||
$ ls
|
||||
2.0 2.1
|
||||
$ svn cp -m "Release 2.0.0" \
|
||||
2.0 https://shunit2.svn.sourceforge.net/svnroot/shunit2/tags/source/2.0.0
|
||||
|
||||
EXPORT THE RELEASE
|
||||
|
||||
$ pwd
|
||||
.../shunit2/builds
|
||||
$ svn export \
|
||||
https://shunit2.svn.sourceforge.net/svnroot/shunit2/tags/source/2.0.0 \
|
||||
shunit2-2.0.0
|
||||
|
||||
CREATE TARBALL
|
||||
|
||||
$ tar cfz ../releases/shunit2-2.0.0.tgz shunit2-2.0.0
|
||||
|
||||
MD5SUM THE TARBALL AND SIGN WITH GPG
|
||||
|
||||
$ cd ../releases
|
||||
$ md5sum shunit2-2.0.0.tgz >shunit2-2.0.0.tgz.md5
|
||||
$ gpg --default-key kate.ward@forestent.com --detach-sign shunit2-2.0.0.tgz
|
||||
|
||||
UPDATE WEBSITE
|
||||
|
||||
Again, pretty self-explainatory. Make sure to copy the MD5 and GPG signature
|
||||
files. Once that is done, make sure to tag the website so we can go back in
|
||||
time if needed.
|
||||
|
||||
$ pwd
|
||||
.../shunit2
|
||||
$ ls
|
||||
source website
|
||||
$ svn cp -m "Release 2.0.0" \
|
||||
website https://shunit2.svn.sourceforge.net/svnroot/shunit2/tags/website/20060916
|
||||
|
||||
Now, update the website. It too is held in Subversion, so ssh into SourceForge
|
||||
and use 'svn up' to grab the latest version.
|
||||
|
||||
POST TO SOURCEFORGE AND FRESHMEAT
|
||||
|
||||
http://sourceforge.net/projects/shunit2/
|
||||
http://freshmeat.net/
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Related documentation
|
||||
#
|
||||
|
||||
Docbook XML
|
||||
docbook-xml-4.4.zip
|
||||
http://www.docbook.org/xml/4.4/docbook-xml-4.4.zip
|
||||
http://www.oasis-open.org/docbook/xml/4.4/docbook-xml-4.4.zip
|
||||
docbook-xml-4.5.zip
|
||||
http://www.docbook.org/xml/4.5/docbook-xml-4.5.zip
|
||||
|
||||
Docbook XSL
|
||||
docbook-xsl-1.71.0.tar.bz2
|
||||
http://prdownloads.sourceforge.net/docbook/docbook-xsl-1.71.0.tar.bz2?download
|
||||
docbook-xsl-1.71.1.tar.bz2
|
||||
http://downloads.sourceforge.net/docbook/docbook-xsl-1.71.1.tar.bz2?use_mirror=puzzle
|
||||
|
||||
JUnit
|
||||
http://www.junit.org
|
||||
|
||||
|
||||
$Revision$
|
71
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.0.txt
vendored
Normal file
71
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.0.txt
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
RELEASE NOTES FOR 2.0.0
|
||||
|
||||
This is the initial release of shunit2. It was originally included in log4sh
|
||||
1.3.5 [http://log4sh.sourceforge.net/] as a unit testing framework for that
|
||||
product. It has since grown table enough to warrant being released into the
|
||||
wild on its own.
|
||||
|
||||
|
||||
TESTED PLATFORMS
|
||||
|
||||
This list of platforms comes from the latest version of log4sh as shunit2 is
|
||||
used in the testing of log4sh on each of these platforms.
|
||||
|
||||
Cygwin
|
||||
+ bash 3.2.9(10)
|
||||
+ pdksh 5.2.14
|
||||
|
||||
Linux
|
||||
+ bash 3.1.17(1)
|
||||
+ dash 0.5.3
|
||||
+ ksh 1993-12-28
|
||||
+ pdksh 5.2.14
|
||||
+ zsh 4.3.2 (does not work)
|
||||
|
||||
Mac OS X 1.4.8 (Darwin 8.8)
|
||||
+ bash 2.05b.0(1)
|
||||
+ ksh 1993-12-28
|
||||
|
||||
Solaris 8 U3 (x86)
|
||||
+ /bin/sh
|
||||
+ bash 2.03.0(1)
|
||||
+ ksh M-11/16/88i
|
||||
|
||||
Solaris 10 U2 (sparc)
|
||||
+ /bin/sh
|
||||
+ bash 3.00.16(1)
|
||||
+ ksh M-11/16/88i
|
||||
|
||||
Solaris 10 U2 (x86)
|
||||
+ /bin/sh
|
||||
+ bash 3.00.16(1)
|
||||
+ ksh M-11/16/88i
|
||||
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
CHANGES AND ENHANCEMENTS
|
||||
|
||||
None.
|
||||
|
||||
|
||||
BUG FIXES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
DEPRECATED FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
KNOWN BUGS AND ISSUES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
$Revision$
|
||||
vim:spell
|
73
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.1.txt
vendored
Normal file
73
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.1.txt
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
RELEASE NOTES FOR 2.0.1
|
||||
|
||||
This release is mostly a brown-bag release. Not so nice for the second release
|
||||
ever of the product, but that's what I get for trying to get something out
|
||||
there that I hadn't fully looked through one last time.
|
||||
|
||||
|
||||
TESTED PLATFORMS
|
||||
|
||||
This list of platforms comes from the latest version of log4sh as shunit2 is
|
||||
used in the testing of log4sh on each of these platforms.
|
||||
|
||||
Cygwin
|
||||
+ bash 3.2.9(10)
|
||||
+ pdksh 5.2.14
|
||||
|
||||
Linux
|
||||
+ bash 3.1.17(1)
|
||||
+ dash 0.5.3
|
||||
+ ksh 1993-12-28
|
||||
+ pdksh 5.2.14
|
||||
+ zsh 4.3.2 (does not work)
|
||||
|
||||
Mac OS X 1.4.8 (Darwin 8.8)
|
||||
+ bash 2.05b.0(1)
|
||||
+ ksh 1993-12-28
|
||||
|
||||
Solaris 8 U3 (x86)
|
||||
+ /bin/sh
|
||||
+ bash 2.03.0(1)
|
||||
+ ksh M-11/16/88i
|
||||
|
||||
Solaris 10 U2 (sparc)
|
||||
+ /bin/sh
|
||||
+ bash 3.00.16(1)
|
||||
+ ksh M-11/16/88i
|
||||
|
||||
Solaris 10 U2 (x86)
|
||||
+ /bin/sh
|
||||
+ bash 3.00.16(1)
|
||||
+ ksh M-11/16/88i
|
||||
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
CHANGES AND ENHANCEMENTS
|
||||
|
||||
The documentation regarding the assertTrue() and assertFalse() functions was
|
||||
updated to reflect their proper usage. They are shell test condition evaluators
|
||||
(e.g. "[1 -eq 2]") rather than simple 0/1 comparators.
|
||||
|
||||
|
||||
BUG FIXES
|
||||
|
||||
The fail*() functions were doing the exact opposite of what they were supposed
|
||||
to be doing. They have been fixed.
|
||||
|
||||
|
||||
DEPRECATED FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
KNOWN BUGS AND ISSUES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
$Revision$
|
||||
vim:spell
|
71
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.2.txt
vendored
Normal file
71
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.2.txt
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
RELEASE NOTES FOR 2.0.2
|
||||
|
||||
This is solely a bug-fix release.
|
||||
|
||||
|
||||
TESTED PLATFORMS
|
||||
|
||||
This list of platforms comes from the latest version of log4sh as shUnit2 is
|
||||
used in the testing of log4sh on each of these platforms.
|
||||
|
||||
Cygwin
|
||||
+ bash 3.2.9(10)
|
||||
+ pdksh 5.2.14
|
||||
|
||||
Linux
|
||||
+ bash 3.1.17(1)
|
||||
+ dash 0.5.3
|
||||
+ ksh 1993-12-28
|
||||
+ pdksh 5.2.14
|
||||
+ zsh 4.3.2 (does not work)
|
||||
|
||||
Mac OS X 1.4.8 (Darwin 8.8)
|
||||
+ bash 2.05b.0(1)
|
||||
+ ksh 1993-12-28
|
||||
|
||||
Solaris 8 U3 (x86)
|
||||
+ /bin/sh
|
||||
+ bash 2.03.0(1)
|
||||
+ ksh M-11/16/88i
|
||||
|
||||
Solaris 10 U2 (sparc)
|
||||
+ /bin/sh
|
||||
+ bash 3.00.16(1)
|
||||
+ ksh M-11/16/88i
|
||||
|
||||
Solaris 10 U2 (x86)
|
||||
+ /bin/sh
|
||||
+ bash 3.00.16(1)
|
||||
+ ksh M-11/16/88i
|
||||
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
CHANGES AND ENHANCEMENTS
|
||||
|
||||
None.
|
||||
|
||||
|
||||
BUG FIXES
|
||||
|
||||
The fail() function did not output the optional failure message.
|
||||
|
||||
Fixed the Makefile so that the DocBook XML and XSLT files would be downloaded
|
||||
before parsing can continue.
|
||||
|
||||
|
||||
DEPRECATED FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
KNOWN BUGS AND ISSUES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
$Revision$
|
||||
vim:spell
|
60
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.3.txt
vendored
Normal file
60
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.3.txt
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
RELEASE NOTES FOR 2.0.3
|
||||
|
||||
This release incorporates a realignment with the JUnit 4 code. Asserts now
|
||||
provide better failure messages, and the failure functions no longer perform
|
||||
tests.
|
||||
|
||||
See the CHANGES-2.0.txt file for a full list of changes.
|
||||
|
||||
|
||||
TESTED PLATFORMS
|
||||
|
||||
This list of platforms comes from the latest version of log4sh as shUnit2 is
|
||||
used in the testing of log4sh on each of these platforms.
|
||||
|
||||
Cygwin -- untested
|
||||
|
||||
Linux
|
||||
- bash 3.2.13(1)
|
||||
- dash 0.5.3
|
||||
- ksh 1993-12-28
|
||||
- pdksh 5.2.14
|
||||
|
||||
Mac OS X -- untested
|
||||
Solaris 8 -- untested
|
||||
Solaris 10 -- untested
|
||||
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
CHANGES AND ENHANCEMENTS
|
||||
|
||||
The internal test in assertFalse() was changed so that any non-zero value is
|
||||
considered false, rather than any only values equal to 1.
|
||||
|
||||
The assertTrue() and assertFalse() functions now accept an integer value for a
|
||||
conditional test. A value of '0' is considered 'true', while any non-zero value
|
||||
is considered 'false'.
|
||||
|
||||
Self-testing unit tests were added.
|
||||
|
||||
|
||||
BUG FIXES
|
||||
|
||||
All asserts now properly unset their variables.
|
||||
|
||||
|
||||
DEPRECATED FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
KNOWN BUGS AND ISSUES
|
||||
|
||||
Functions do not properly test for an invalid number of arguments.
|
||||
|
||||
|
||||
vim:spell
|
51
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.4.txt
vendored
Normal file
51
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.4.txt
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
RELEASE NOTES FOR 2.0.4
|
||||
|
||||
This is a minor bugfix release.
|
||||
|
||||
See the CHANGES-2.0.txt file for a full list of changes.
|
||||
|
||||
|
||||
TESTED PLATFORMS
|
||||
|
||||
This list of platforms comes from the latest version of log4sh as shUnit2 is
|
||||
used in the testing of log4sh on each of these platforms.
|
||||
|
||||
Cygwin -- untested
|
||||
|
||||
Linux
|
||||
- bash 3.2.13(1)
|
||||
- dash 0.5.3
|
||||
- ksh 1993-12-28
|
||||
- pdksh 5.2.14
|
||||
|
||||
Mac OS X -- untested
|
||||
Solaris 8 -- untested
|
||||
Solaris 10 -- untested
|
||||
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
CHANGES AND ENHANCEMENTS
|
||||
|
||||
None.
|
||||
|
||||
|
||||
BUG FIXES
|
||||
|
||||
The library no longer fails when the 'od' command is not present.
|
||||
|
||||
|
||||
DEPRECATED FEATURES
|
||||
|
||||
None.
|
||||
|
||||
|
||||
KNOWN BUGS AND ISSUES
|
||||
|
||||
Functions do not properly test for an invalid number of arguments.
|
||||
|
||||
|
||||
vim:spell
|
5
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/TODO.txt
vendored
Normal file
5
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/TODO.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Make it possible to execute a single test by passing the name of the test on
|
||||
the command line
|
||||
|
||||
|
||||
$Revision$
|
10
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/contributors.txt
vendored
Normal file
10
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/contributors.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
The original author of shunit2 is Kate Ward. The following people have
|
||||
contributed in some way or another to shunit2.
|
||||
|
||||
Bryan Larsen
|
||||
Kevin Van Horn
|
||||
Mathias Goldau
|
||||
Richard Jensen
|
||||
Rob Holland
|
||||
|
||||
$Revision$
|
54
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/design_doc.txt
vendored
Normal file
54
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/design_doc.txt
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
Design Doc for shUnit2
|
||||
======================
|
||||
|
||||
shUnit is based upon JUnit. The initial ideas for the script came from the book
|
||||
"Pragmatic Unit Testing - In Java with JUnit" by Andrew Hunt and David Thomas.
|
||||
|
||||
The script was written to perform unit testing for log4sh. log4sh had grown
|
||||
enough that it was becoming difficult to easily test and and verify that the
|
||||
tests passed for the many different operating systems on which it was being
|
||||
used.
|
||||
|
||||
The functions in shUnit are meant to match those in JUnit as much as possible
|
||||
where shell allows. In the initial version, there will be no concept of
|
||||
exceptions (as normal POSIX shell has no concept of them) but attempts to trap
|
||||
problems will be done.
|
||||
|
||||
Programatic Standards
|
||||
---------------------
|
||||
|
||||
* SHUNIT_TRUE - public global constant
|
||||
* __SHUNIT_SHELL_FLAGS - private global constant
|
||||
* __shunit_oldShellFlags - private global variable
|
||||
|
||||
* assertEquals - public unit test function
|
||||
* shunit_publicFunc - public shUnit function; can be called from parent unit
|
||||
test script
|
||||
* _shunit_privateFunc - private shUnit function; should not be called from
|
||||
parent script. meant for internal use by shUnit
|
||||
|
||||
* _su_myVar - variable inside a public function. prefixing with '_su_' to
|
||||
reduce the chances that a variable outside of shUnit will be overridden.
|
||||
* _su__myVar - variable inside a private function. prefixing with '_su__' to
|
||||
reduce the chances that a variable in a shUnit public function, or a variable
|
||||
outside of shUnit will be overridden.
|
||||
|
||||
List of functions
|
||||
-----------------
|
||||
|
||||
assertTrue([message,] boolean)
|
||||
assertFalse([message,] boolean)
|
||||
fail([message])
|
||||
assertEquals([message,] expected, actual)
|
||||
#isEquals(expected, actual)
|
||||
#assertArrayEquals([message,] expecteds, actuals)
|
||||
#isArray(expected)
|
||||
assertNotNull([message,] object)
|
||||
assertNull([message,], object)
|
||||
assertSame([message,], expected, actual)
|
||||
assertNotSame([message,], unexpected, actual)
|
||||
failSame(message)
|
||||
failNotSame([message,] expected, actual)
|
||||
|
||||
.. $Revision$
|
||||
.. vim:syntax=rst
|
218
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/shunit2.html
vendored
Normal file
218
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/shunit2.html
vendored
Normal file
File diff suppressed because one or more lines are too long
33
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/style.css
vendored
Normal file
33
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/style.css
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/* $Id$ */
|
||||
/*
|
||||
style.css
|
||||
*/
|
||||
|
||||
|
||||
body {
|
||||
|
||||
/*
|
||||
Style the HMTL <body> tag with a sans-serif font and 6% margin.
|
||||
A sans-serif font makes documents easier to read when displayed on
|
||||
a computer screen. Whitespace surrounding the document should
|
||||
make it easier to read both on screen and on printed paper. The
|
||||
value of 6% was chosen because it closely approximates a one-half
|
||||
inch margin on a US letter (8.5" by 11") paper. Since the margin
|
||||
is expressed as a percentage it should scale well in a web browser
|
||||
window.
|
||||
*/
|
||||
|
||||
font-family: sans-serif;
|
||||
margin: 6%;
|
||||
}
|
||||
|
||||
/*
|
||||
table {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
*/
|
||||
|
||||
.toc {
|
||||
background: #f0f0f0;
|
||||
padding: 5px;
|
||||
}
|
23
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/lib/sh/shlib
vendored
Normal file
23
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/lib/sh/shlib
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# $Id$
|
||||
# vim:syntax=sh
|
||||
#
|
||||
# library of shell functions
|
||||
#
|
||||
|
||||
shlib_relToAbsPath()
|
||||
{
|
||||
_shlib_path=$1
|
||||
|
||||
# deal with paths that start with /
|
||||
echo "${_shlib_path}" |grep '^/' >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
_shlib_pwd=`pwd`
|
||||
_shlib_path="${_shlib_pwd}/${_shlib_path}"
|
||||
unset _shlib_pwd
|
||||
fi
|
||||
|
||||
# clean up the path
|
||||
echo "${_shlib_path}" |sed 's/[^/]*\/*\.\.\/*//g;s/\/\.\//\//'
|
||||
|
||||
unset _shlib_path
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:import href="../../../docbook-xsl/current/fo/docbook.xsl"/>
|
||||
|
||||
<!-- Number all sections in the style of 'CH.S1.S2 Section Title' where
|
||||
CH is the chapter number, S1 is the section number and S2 is the
|
||||
sub-section number. The lables are not limited to any particular
|
||||
depth and can go as far as there are sections. -->
|
||||
<xsl:param name="section.autolabel" select="1"></xsl:param>
|
||||
<xsl:param name="section.label.includes.component.label" select="0"></xsl:param>
|
||||
|
||||
<!-- Turn off the default 'full justify' and go with 'left justify'
|
||||
instead. This avoids the large gaps that can sometimes appear
|
||||
between words in fully-justified documents. -->
|
||||
<xsl:param name="alignment">start</xsl:param>
|
||||
|
||||
<!-- Shade Verbatim Sections such as programlisting and screen -->
|
||||
<xsl:param name="shade.verbatim" select="1"/>
|
||||
|
||||
<!-- Create bookmarks in .PDF files -->
|
||||
<xsl:param name="fop.extensions" select="1"/>
|
||||
|
||||
</xsl:stylesheet>
|
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<!-- This file contains parameters that are applicable to all of the
|
||||
tldp-*.xsl files in the html directory. -->
|
||||
|
||||
<!-- Create a link to a CSS stylesheet named 'style.css' in all html
|
||||
output so that pages can be beautified. Browsers not supporting
|
||||
CSS should safely ignore the link. -->
|
||||
<xsl:param name="html.stylesheet.type">text/css</xsl:param>
|
||||
<xsl:param name="html.stylesheet" select="'style.css'"></xsl:param>
|
||||
|
||||
<!-- Number all sections in the style of 'CH.S1.S2 Section Title' where
|
||||
CH is the chapter number, S1 is the section number and S2 is the
|
||||
sub-section number. The lables are not limited to any particular
|
||||
depth and can go as far as there are sections. -->
|
||||
<xsl:param name="section.autolabel" select="1"></xsl:param>
|
||||
<xsl:param name="section.label.includes.component.label" select="0"></xsl:param>
|
||||
|
||||
</xsl:stylesheet>
|
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:import href="../../../docbook-xsl/current/html/docbook.xsl"/>
|
||||
<xsl:import href="tldp-common.xsl"/>
|
||||
<xsl:output method="html" encoding="UTF-8" indent="no"/>
|
||||
|
||||
<!-- This set of customizations is used to generate the entire XML
|
||||
document on a single HTML page. -->
|
||||
|
||||
</xsl:stylesheet>
|
71
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/resources/shelldoc.xslt
vendored
Normal file
71
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/resources/shelldoc.xslt
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- $Id$ -->
|
||||
<!--
|
||||
example ways to process this xslt:
|
||||
$ java -cp xalan-2.6.0.jar \
|
||||
org.apache.xalan.xslt.Process -xml -in log4sh.xml -xsl shelldoc.xslt
|
||||
|
||||
$ xsltproc shelldoc.xslt log4sh.xml |xmllint -noblanks -
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:s="http://www.forestent.com/projects/shelldoc/xsl/2005.0">
|
||||
<xsl:output
|
||||
method="xml"
|
||||
version="1.0"
|
||||
encoding="UTF-8"
|
||||
indent="yes"/>
|
||||
<xsl:strip-space elements="*" />
|
||||
|
||||
<xsl:variable name="newline">
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:key name="groups" match="s:function" use="@group" />
|
||||
|
||||
<xsl:template match="/">
|
||||
<chapter id="shelldoc" lang="en-US"><title>Function Reference</title>
|
||||
<xsl:for-each select="//s:function[generate-id(.)=generate-id(key('groups', @group)[1])]">
|
||||
<xsl:sort select="@group" />
|
||||
|
||||
<section>
|
||||
<xsl:attribute name="id">shelldoc-section-<xsl:value-of select="@group" /></xsl:attribute>
|
||||
<title><xsl:value-of select="@group"/></title>
|
||||
<table>
|
||||
<xsl:attribute name="id">shelldoc-function-<xsl:value-of select="@group" /></xsl:attribute>
|
||||
<title><xsl:value-of select="@group"/></title>
|
||||
<tgroup cols="2"><tbody>
|
||||
<xsl:for-each select="key('groups', @group)">
|
||||
<!--<xsl:sort select="entry/funcsynopsis/funcprototype/funcdef/function" />-->
|
||||
<xsl:choose>
|
||||
<xsl:when test="@modifier">
|
||||
<xsl:if test="@modifier != 'private'">
|
||||
<row valign="top">
|
||||
<xsl:copy-of select="entry" />
|
||||
<!--<xsl:apply-templates select="entry" />-->
|
||||
</row>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<row valign="top">
|
||||
<xsl:copy-of select="entry" />
|
||||
<!--<xsl:apply-templates select="entry" />-->
|
||||
</row>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</tbody></tgroup>
|
||||
</table>
|
||||
</section>
|
||||
</xsl:for-each>
|
||||
</chapter>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="entry">
|
||||
<entry>
|
||||
<xsl:copy-of select="*" />
|
||||
</entry>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
14
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/functions.xml
vendored
Normal file
14
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/functions.xml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
$Id$
|
||||
vim:softtabstop=2 shiftwidth=2
|
||||
-->
|
||||
|
||||
<!-- =========================================================================
|
||||
Functions
|
||||
-->
|
||||
|
||||
<chapter id="functions">
|
||||
<title>Functions</title>
|
||||
<para>This XML file is a placeholder. It is meant to be overwritten with the dynamically generated XML document that is extracted from the source code.</para>
|
||||
</chapter>
|
50
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/introduction.xml
vendored
Normal file
50
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/introduction.xml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
$Id$
|
||||
vim:softtabstop=2 shiftwidth=2
|
||||
-->
|
||||
|
||||
<!-- =========================================================================
|
||||
Introduction
|
||||
-->
|
||||
|
||||
<chapter label="1" id="introduction">
|
||||
|
||||
<title>Introduction</title>
|
||||
<para>shUnit2 is a unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to <ulink url="http://www.junit.org/">JUnit</ulink>, <ulink url="http://pyunit.sourceforge.net/">PyUnit</ulink>, etc.</para>
|
||||
|
||||
<para>shUnit2 was originally developed to provide a consistent testing solution for <ulink url="http://log4sh.sourceforge.net/">log4sh</ulink>, a shell based logging framework similar to log4j. During the development of that product, the problem of having things work just fine under one shell (<filename>/bin/bash</filename> on Linux to be specific), and then not working under another shell (<filename>/bin/sh</filename> on Solaris), kept coming up. Although there were several simple tests ran, they were not adaquate and did not catch very many corner cases. The decision was finally made to write a proper unit test framework after after multiple brown-bag releases were made.</para>
|
||||
|
||||
<para><blockquote><title>Tested Operating Systems</title>
|
||||
<itemizedlist>
|
||||
<listitem><para><ulink url="http://www.cygwin.com/">Cygwin</ulink></para></listitem>
|
||||
<listitem><para><ulink url="http://www.freebsd.org/">FreeBSD</ulink> (user supported)</para></listitem>
|
||||
<listitem><para>Linux (<ulink url="http://www.gentoo.org/">Gentoo</ulink>, <ulink url="http://www.ubuntu.com/">Ubuntu</ulink>)</para></listitem>
|
||||
<listitem><para><ulink url="http://www.apple.com/macosx/">Mac OS X</ulink></para></listitem>
|
||||
<listitem><para><ulink url="http://www.sun.com/software/solaris/">Solaris</ulink> 8, 9, 10</para></listitem>
|
||||
</itemizedlist>
|
||||
</blockquote></para>
|
||||
|
||||
<para><blockquote><title>Tested Shells</title>
|
||||
<itemizedlist>
|
||||
<listitem><para>Bourne Shell (<command>sh</command>)</para></listitem>
|
||||
<listitem><para><ulink url="http://www.gnu.org/software/bash/">BASH</ulink> - GNU Bourne Again SHell (<command>bash</command>)</para></listitem>
|
||||
<listitem><para><ulink url="http://gondor.apana.org.au/~herbert/dash/">DASH</ulink> (<command>dash</command>)</para></listitem>
|
||||
<listitem><para><ulink url="http://www.kornshell.com/">Korn Shell</ulink> (<command>ksh</command>)</para></listitem>
|
||||
<listitem><para><ulink url="http://web.cs.mun.ca/~michael/pdksh/">pdksh</ulink> - Public Domain Korn Shell (<command>pdksh</command>)</para></listitem>
|
||||
</itemizedlist>
|
||||
</blockquote></para>
|
||||
|
||||
<para>See the appropriate Release Notes (<filename>doc/RELEASE_NOTES-X.X.X.txt</filename>) for this release for the actual versions tested.</para>
|
||||
|
||||
<!-- Give credit where credit is due...very important -->
|
||||
<section id="credits"><title>Credits / Contributors</title>
|
||||
<para>A list of contributors to shUnit2 can be found in the source archive as <filename>doc/contributors.txt</filename>. I want to personally thank all those who have contributed to make this a better tool.</para>
|
||||
</section>
|
||||
|
||||
<!-- Feedback -->
|
||||
<section id="feedback"><title>Feedback</title>
|
||||
<para>Feedback is most certainly welcome for this document. Send your additions, comments and criticisms to the following email address: <email>&myEmail;</email>.</para>
|
||||
</section>
|
||||
|
||||
</chapter>
|
86
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/quickstart.xml
vendored
Normal file
86
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/quickstart.xml
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
$Id: quickstart.xml 230 2006-08-19 22:32:02Z sfsetse $
|
||||
vim:softtabstop=2 shiftwidth=2
|
||||
-->
|
||||
|
||||
<!-- =========================================================================
|
||||
Quickstart
|
||||
-->
|
||||
<chapter id="quickstart">
|
||||
<title>Quickstart</title>
|
||||
|
||||
<para>This chapter will give a very quick start to running unit tests with shUnit2. More information is located in other chapters.</para>
|
||||
|
||||
<para>Here is a quick sample script to show how easy it is to write a unit test in shell. It expects that you have a copy of &shunit2; in the same directory as the script.</para>
|
||||
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
#! /bin/sh
|
||||
|
||||
testEquality()
|
||||
{
|
||||
assertEquals 1 1
|
||||
}
|
||||
|
||||
# load shunit2
|
||||
. ./shunit2
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
<para>Running the unit test should give results similar to the following.</para>
|
||||
|
||||
<screen>
|
||||
<![CDATA[
|
||||
#
|
||||
# Performing tests
|
||||
#
|
||||
testEquality
|
||||
|
||||
#
|
||||
# Test report
|
||||
#
|
||||
tests passed: 1
|
||||
tests failed: 0
|
||||
tests total: 1
|
||||
success rate: 100%
|
||||
]]>
|
||||
</screen>
|
||||
|
||||
<para>Wohoo! You've just run your first successful unit test. So, what just happened? Quite a bit really, and it all happened simply by sourcing the &shunit2; script. The basic functionality for the script above goes like this.</para>
|
||||
|
||||
<para>When shUnit2 is sourced, it first looks to see if a <function>suite()</function> function has been declared. If it exists, it is called as it is expected to contain a list of tests to be executed. If it doesn't exist (and it doesn't in the above example), shUnit2 will look on its own for any functions that start with the string <literal>test</literal>, and adds those to an internal list of tests to execute. Once a list of test functions to be run has been determined, shunit2 will go to work.</para>
|
||||
|
||||
<para>Before any tests are executed, shUnit2 again looks for a function, this time one named <function>oneTimeSetUp()</function>. If it exists, it will be run. This function is normally used to setup the environment for all tests to be run. Things like creating directories for output or setting environment variables are good to place here. Just so you know, you can also declare a corresponding function named <function>oneTimeTearDown()</function> function that does the same thing, but once all the tests have been completed. It is good for removing temporary directories, etc.</para>
|
||||
|
||||
<para>shUnit2 is now ready to run tests. Before doing so though, it again looks for another function that might be declared, one named <function>setUp()</function>. If the function exists, it will be run before each test. It is good for resetting the environment so that each test starts with a clean slate. At this stage, the first test is finally run. The success of the test is recorded for a report that will be generated later. After the test is run, shUnit2 looks for a final function that might be declared, one named <function>tearDown()</function>. If it exists, it will be run after each test. It is a good place for cleaning up after each test, maybe doing things like removing files that were created, or removing directories. This set of steps, setUp() > test() > tearDown(), is repeated for all of the available tests.</para>
|
||||
|
||||
<para>Once all the work is done, shUnit2 will generate the nice report you saw above. A summary of all the successes and failures will be given so that you know how well your code is doing.</para>
|
||||
|
||||
<para>We should now try adding a test that fails. Change your unit test to look like this.</para>
|
||||
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
#! /bin/sh
|
||||
|
||||
testEquality()
|
||||
{
|
||||
assertEquals 1 1
|
||||
}
|
||||
|
||||
testPartyLikeItIs1999()
|
||||
{
|
||||
year=`date '+%Y'`
|
||||
assertEquals "It's not 1999 :-( This is ${year}." \
|
||||
'1999' "${year}"
|
||||
}
|
||||
|
||||
# load shunit2
|
||||
. ./shunit2
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
<para>So, what did you get? I guess it told you that this isn't 1999. Bummer, eh? Hopefully, you noticed a couple of things that were different about the second test. First, we added an optional message that the user will see if the assert fails. Second, we did comparisons of strings instead of integers as in the first test. It doesn't matter whether you are testing for equality of strings or integers. Both work equally well with shUnit2.</para>
|
||||
|
||||
<para>Hopefully, this is enough to get you started with unit testing. If you want a ton more examples, take a look at the tests provided with <ulink url="http://log4sh.sourceforge.net/">log4sh</ulink>. Examples of much more advanced usage can be seen there. shUnit2 was after all written to help with the unit testing problems that log4sh had.</para>
|
||||
</chapter>
|
85
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/shunit2.xml
vendored
Normal file
85
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/shunit2.xml
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
$Id$
|
||||
vim: softtabstop=2 shiftwidth=2
|
||||
-->
|
||||
<!--
|
||||
|
||||
This document can be converted to HTML using the following commands:
|
||||
|
||||
$ java -cp xalan-2.6.0.jar \
|
||||
org.apache.xalan.xslt.Process -xml -in log4sh.xml -xsl tldp-one-page.xsl
|
||||
|
||||
$ xsltproc tldp-one-page.xsl log4sh.xml |xmllint -noblanks -
|
||||
|
||||
-->
|
||||
|
||||
<!DOCTYPE book
|
||||
PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
||||
|
||||
<!ENTITY functions SYSTEM "functions.xml">
|
||||
<!ENTITY introduction SYSTEM "introduction.xml">
|
||||
<!ENTITY quickstart SYSTEM "quickstart.xml">
|
||||
|
||||
<!ENTITY myEmail "kate.ward@forestent.com">
|
||||
<!ENTITY isoDate "@@ISO_DATE@@">
|
||||
|
||||
<!ENTITY shunit2 "<command>shunit2</command>">
|
||||
]>
|
||||
|
||||
<book id="shUnit2" lang="en-US"><title>shUnit2</title>
|
||||
<bookinfo>
|
||||
<title>shUnit2 version 2.0.3</title>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Kate</firstname><surname>Ward</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>&myEmail;</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<!-- All dates specified in ISO "YYYY-MM-DD" format -->
|
||||
<pubdate>&isoDate;</pubdate>
|
||||
|
||||
<!-- TODO flush out like bookinfo in docbook-tdg -->
|
||||
|
||||
<!-- Most recent revision goes at the top; list in descending order -->
|
||||
<revhistory>
|
||||
<revision>
|
||||
<revnumber>2.0.3</revnumber>
|
||||
<date>2007-07-12</date>
|
||||
<authorinitials>Kate Ward <&myEmail;></authorinitials>
|
||||
</revision>
|
||||
|
||||
<revision>
|
||||
<revnumber>2.0.2</revnumber>
|
||||
<date>2007-04-22</date>
|
||||
<authorinitials>Kate Ward <&myEmail;></authorinitials>
|
||||
</revision>
|
||||
|
||||
<revision>
|
||||
<revnumber>2.0.1</revnumber>
|
||||
<date>2007-02-21</date>
|
||||
<authorinitials>Kate Ward <&myEmail;></authorinitials>
|
||||
</revision>
|
||||
|
||||
<revision>
|
||||
<revnumber>2.0.0</revnumber>
|
||||
<date>2007-02-20</date>
|
||||
<authorinitials>Kate Ward <&myEmail;></authorinitials>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<!-- Provide a good abstract; a couple of sentences is sufficient -->
|
||||
<abstract>
|
||||
<para><ulink url="http://sourceforge.net/projects/shunit2">shUnit2</ulink> is a unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to <ulink url="http://www.junit.org/">JUnit</ulink>, <ulink url="http://pyunit.sourceforge.net/">PyUnit</ulink>, etc.</para>
|
||||
</abstract>
|
||||
</bookinfo>
|
||||
|
||||
&introduction;
|
||||
&quickstart;
|
||||
&functions;
|
||||
</book>
|
799
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/shell/shunit2
vendored
Normal file
799
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/shell/shunit2
vendored
Normal file
@@ -0,0 +1,799 @@
|
||||
# $Id$
|
||||
# vim:syntax=sh:sts=2
|
||||
# vim:foldmethod=marker:foldmarker=/**,*/
|
||||
#
|
||||
#/**
|
||||
# <?xml version="1.0" encoding="UTF-8"?>
|
||||
# <s:shelldoc xmlns:s="http://www.forestent.com/projects/shelldoc/xsl/2005.0">
|
||||
# <s:header>
|
||||
# shUnit 2.0.4
|
||||
# Shell Unit Test Framework
|
||||
#
|
||||
# http://code.google.com/p/shunit2/
|
||||
#
|
||||
# written by Kate Ward <kate.ward@forestent.com>
|
||||
# released under the LGPL
|
||||
#
|
||||
# this module implements a xUnit based unit test framework similar to JUnit
|
||||
# </s:header>
|
||||
#*/
|
||||
|
||||
# shell flags for shunit:
|
||||
# u - treat unset variables as an error when performing parameter expansion
|
||||
__SHUNIT_SHELL_FLAGS='u'
|
||||
|
||||
# save the current set of shell flags, and then set some for ourselves
|
||||
__shunit_oldShellFlags="$-"
|
||||
for _shunit_shellFlag in `echo "${__SHUNIT_SHELL_FLAGS}" |sed 's/\(.\)/\1 /g'`
|
||||
do
|
||||
set -${_shunit_shellFlag}
|
||||
done
|
||||
unset _shunit_shellFlag
|
||||
|
||||
# constants
|
||||
|
||||
__SHUNIT_VERSION='2.0.4pre'
|
||||
|
||||
__SHUNIT_TRUE=0
|
||||
__SHUNIT_FALSE=1
|
||||
__SHUNIT_ERROR=2
|
||||
|
||||
__SHUNIT_ASSERT_MSG_PREFIX='ASSERT:'
|
||||
|
||||
for _su_const in `set |grep "^__SHUNIT_" |cut -d= -f1`; do
|
||||
readonly ${_su_const}
|
||||
done
|
||||
unset _su_const
|
||||
|
||||
# variables
|
||||
__shunit_suite=''
|
||||
|
||||
__shunit_testsPassed=0
|
||||
__shunit_testsFailed=0
|
||||
__shunit_testsTotal=0
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# assert functions
|
||||
#
|
||||
|
||||
#/**
|
||||
# <s:function group="asserts">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>assertEquals</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# <paramdef>string <parameter>expected</parameter></paramdef>
|
||||
# <paramdef>string <parameter>actual</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Asserts that <emphasis>expected</emphasis> and
|
||||
# <emphasis>actual</emphasis> are equal to one another. The message is
|
||||
# optional.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
assertEquals()
|
||||
{
|
||||
_su_message=''
|
||||
if [ $# -eq 3 ]; then
|
||||
_su_message=$1
|
||||
shift
|
||||
fi
|
||||
_su_expected=${1:-}
|
||||
_su_actual=${2:-}
|
||||
|
||||
shunit_return=${__SHUNIT_TRUE}
|
||||
if [ "${_su_expected}" = "${_su_actual}" ]; then
|
||||
_shunit_testPassed
|
||||
else
|
||||
failNotEquals "${_su_message}" "${_su_expected}" "${_su_actual}"
|
||||
shunit_return=${__SHUNIT_FALSE}
|
||||
fi
|
||||
|
||||
unset _su_message _su_expected _su_actual
|
||||
return ${shunit_return}
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="asserts">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>assertNull</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# <paramdef>string <parameter>value</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Asserts that <emphasis>value</emphasis> is <literal>null</literal>,
|
||||
# or in shell terms a zero-length string. The message is optional.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
assertNull()
|
||||
{
|
||||
if [ $# -eq 2 ]; then
|
||||
assertTrue "$1" "[ -z '$2' ]"
|
||||
else
|
||||
assertTrue "[ -z '${1:-}' ]"
|
||||
fi
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="asserts">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>assertNotNull</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# <paramdef>string <parameter>value</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Asserts that <emphasis>value</emphasis> is <emphasis
|
||||
# role="strong">not</emphasis> <literal>null</literal>, or in shell terms not
|
||||
# a zero-length string. The message is optional.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
assertNotNull()
|
||||
{
|
||||
if [ $# -eq 2 ]; then
|
||||
assertTrue "$1" "[ -n '$2' ]"
|
||||
else
|
||||
assertTrue "[ -n '${1:-}' ]"
|
||||
fi
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="asserts">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>assertSame</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# <paramdef>string <parameter>expected</parameter></paramdef>
|
||||
# <paramdef>string <parameter>actual</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>This function is functionally equivalent to
|
||||
# <function>assertEquals</function>.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
assertSame()
|
||||
{
|
||||
assertEquals "${@:-}"
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="asserts">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>assertNotSame</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# <paramdef>string <parameter>unexpected</parameter></paramdef>
|
||||
# <paramdef>string <parameter>actual</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Asserts that <emphasis>unexpected</emphasis> and
|
||||
# <emphasis>actual</emphasis> are <emphasis role="strong">not</emphasis>
|
||||
# equal to one another. The message is optional.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
assertNotSame()
|
||||
{
|
||||
_su_message=''
|
||||
if [ $# -eq 3 ]; then
|
||||
_su_message=$1
|
||||
shift
|
||||
fi
|
||||
_su_unexpected=${1:-}
|
||||
_su_actual=${2:-}
|
||||
|
||||
shunit_return=${__SHUNIT_TRUE}
|
||||
if [ "${_su_unexpected}" != "${_su_actual}" ]; then
|
||||
_shunit_testPassed
|
||||
else
|
||||
failSame "${_su_message}"
|
||||
shunit_return=${__SHUNIT_FALSE}
|
||||
fi
|
||||
|
||||
unset _su_message _su_unexpected _su_actual
|
||||
return ${shunit_return}
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="asserts">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>assertTrue</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# <paramdef>string <parameter>condition</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Asserts that a given shell test condition is true. The message is
|
||||
# optional.</para>
|
||||
# <para>Testing whether something is true or false is easy enough by using
|
||||
# the assertEquals/assertNotSame functions. Shell supports much more
|
||||
# complicated tests though, and a means to support them was needed. As such,
|
||||
# this function tests that conditions are true or false through evaluation
|
||||
# rather than just looking for a true or false.</para>
|
||||
# <funcsynopsis>
|
||||
# The following test will succeed: <funcsynopsisinfo>assertTrue "[ 34 -gt 23 ]"</funcsynopsisinfo>
|
||||
# The folloing test will fail with a message: <funcsynopsisinfo>assertTrue "test failed" "[ -r '/non/existant/file' ]"</funcsynopsisinfo>
|
||||
# </funcsynopsis>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
assertTrue()
|
||||
{
|
||||
_su_message=''
|
||||
if [ $# -eq 2 ]; then
|
||||
_su_message=$1
|
||||
shift
|
||||
fi
|
||||
_su_condition=${1:-}
|
||||
|
||||
shunit_return=${__SHUNIT_TRUE}
|
||||
|
||||
# see if condition is an integer, i.e. a return value
|
||||
_su_match=`expr "${_su_condition}" : '\([0-9]*\)'`
|
||||
if [ -z "${_su_condition}" ]; then
|
||||
# null condition
|
||||
shunit_return=${__SHUNIT_FALSE}
|
||||
elif [ "${_su_condition}" = "${_su_match}" ]; then
|
||||
# possible return value. treating 0 as true, and non-zero as false.
|
||||
[ ${_su_condition} -ne 0 ] && shunit_return=${__SHUNIT_FALSE}
|
||||
else
|
||||
# (hopefully) a condition
|
||||
( eval ${_su_condition} ) >/dev/null 2>&1
|
||||
[ $? -ne 0 ] && shunit_return=${__SHUNIT_FALSE}
|
||||
fi
|
||||
|
||||
# record the test
|
||||
if [ ${shunit_return} -eq ${__SHUNIT_TRUE} ]; then
|
||||
_shunit_testPassed
|
||||
else
|
||||
_shunit_testFailed "${_su_message}"
|
||||
fi
|
||||
|
||||
unset _su_message _su_condition _su_match
|
||||
return ${shunit_return}
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="asserts">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>assertFalse</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# <paramdef>string <parameter>condition</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Asserts that a given shell test condition is false. The message is
|
||||
# optional.</para>
|
||||
# <para>Testing whether something is true or false is easy enough by using
|
||||
# the assertEquals/assertNotSame functions. Shell supports much more
|
||||
# complicated tests though, and a means to support them was needed. As such,
|
||||
# this function tests that conditions are true or false through evaluation
|
||||
# rather than just looking for a true or false.</para>
|
||||
# <funcsynopsis>
|
||||
# The following test will succeed: <funcsynopsisinfo>assertFalse "[ 'apples' = 'oranges' ]"</funcsynopsisinfo>
|
||||
# The folloing test will fail with a message: <funcsynopsisinfo>assertFalse "test failed" "[ 1 -eq 1 -a 2 -eq 2 ]"</funcsynopsisinfo>
|
||||
# </funcsynopsis>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
assertFalse()
|
||||
{
|
||||
_su_message=''
|
||||
if [ $# -eq 2 ]; then
|
||||
_su_message=$1
|
||||
shift
|
||||
fi
|
||||
_su_condition=${1:-}
|
||||
|
||||
shunit_return=${__SHUNIT_TRUE}
|
||||
|
||||
# see if condition is an integer, i.e. a return value
|
||||
_su_match=`expr "${_su_condition}" : '\([0-9]*\)'`
|
||||
if [ -z "${_su_condition}" ]; then
|
||||
# null condition
|
||||
shunit_return=${__SHUNIT_FALSE}
|
||||
elif [ "${_su_condition}" = "${_su_match}" ]; then
|
||||
# possible return value. treating 0 as true, and non-zero as false.
|
||||
[ ${_su_condition} -eq 0 ] && shunit_return=${__SHUNIT_FALSE}
|
||||
else
|
||||
# (hopefully) a condition
|
||||
( eval ${_su_condition} ) >/dev/null 2>&1
|
||||
[ $? -eq 0 ] && shunit_return=${__SHUNIT_FALSE}
|
||||
fi
|
||||
|
||||
# record the test
|
||||
if [ ${shunit_return} -eq ${__SHUNIT_TRUE} ]; then
|
||||
_shunit_testPassed
|
||||
else
|
||||
_shunit_testFailed "${_su_message}"
|
||||
fi
|
||||
|
||||
unset _su_message _su_condition _su_match
|
||||
return ${shunit_return}
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# failure functions
|
||||
#
|
||||
|
||||
#/**
|
||||
# <s:function group="failures">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>fail</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Fails the test immediately, with the optional message.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
fail()
|
||||
{
|
||||
_su_message=${1:-}
|
||||
|
||||
_shunit_testFailed "${_su_message}"
|
||||
|
||||
unset _su_message
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="failures">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>failNotEquals</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# <paramdef>string <parameter>unexpected</parameter></paramdef>
|
||||
# <paramdef>string <parameter>actual</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Fails the test if <emphasis>unexpected</emphasis> and
|
||||
# <emphasis>actual</emphasis> are <emphasis role="strong">not</emphasis>
|
||||
# equal to one another. The message is optional.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
failNotEquals()
|
||||
{
|
||||
_su_message=''
|
||||
if [ $# -eq 3 ]; then
|
||||
_su_message=$1
|
||||
shift
|
||||
fi
|
||||
_su_unexpected=${1:-}
|
||||
_su_actual=${2:-}
|
||||
|
||||
_shunit_testFailed "${_su_message:+${_su_message} }expected:<${_su_unexpected}> but was:<${_su_actual}>"
|
||||
|
||||
unset _su_message _su_unexpected _su_actual
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="failures">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>failSame</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Indicate test failure because arguments were not the same. The
|
||||
# message is optional.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
failSame()
|
||||
{
|
||||
_su_message=${1:-}
|
||||
|
||||
_shunit_testFailed "${_su_message:+${_su_message} }expected not same"
|
||||
|
||||
unset _su_message
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="failures">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>failNotSame</function></funcdef>
|
||||
# <paramdef>string <parameter>[message]</parameter></paramdef>
|
||||
# <paramdef>string <parameter>expected</parameter></paramdef>
|
||||
# <paramdef>string <parameter>actual</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>Fails the test if <emphasis>expected</emphasis> and
|
||||
# <emphasis>actual</emphasis> are equal to one another. The message is
|
||||
# optional.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
failNotSame()
|
||||
{
|
||||
failNotEquals "${@:-}"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite functions
|
||||
#
|
||||
|
||||
#/**
|
||||
# <s:function group="suites">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>suite</function></funcdef>
|
||||
# <paramdef />
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>This function can be optionally overridden by the user in their test
|
||||
# suite.</para>
|
||||
# <para>If this function exists, it will be called when
|
||||
# <command>shunit2</command> is sourced. If it does not exist, shUnit2 will
|
||||
# search the parent script for all functions beginning with the word
|
||||
# <literal>test</literal>, and they will be added dynamically to the test
|
||||
# suite.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
# Note: see _shunit_mktempFunc() for actual implementation
|
||||
# suite() { :; }
|
||||
|
||||
#/**
|
||||
# <s:function group="suites">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>suite_addTest</function></funcdef>
|
||||
# <paramdef>string <parameter>function</parameter></paramdef>
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>This function adds a function name to the list of tests scheduled for
|
||||
# execution as part of this test suite. This function should only be called
|
||||
# from within the <function>suite()</function> function.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
suite_addTest()
|
||||
{
|
||||
_su_func=${1:-}
|
||||
|
||||
__shunit_suite="${__shunit_suite:+${__shunit_suite} }${_su_func}"
|
||||
|
||||
unset _su_func
|
||||
}
|
||||
|
||||
#/**
|
||||
# <s:function group="suites">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>oneTimeSetUp</function></funcdef>
|
||||
# <paramdef />
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>This function can be be optionally overridden by the user in their
|
||||
# test suite.</para>
|
||||
# <para>If this function exists, it will be called once before any tests are
|
||||
# run. It is useful to prepare a common environment for all tests.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
# Note: see _shunit_mktempFunc() for actual implementation
|
||||
# oneTimeSetUp() { :; }
|
||||
|
||||
#/**
|
||||
# <s:function group="suites">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>oneTimeTearDown</function></funcdef>
|
||||
# <paramdef />
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>This function can be be optionally overridden by the user in their
|
||||
# test suite.</para>
|
||||
# <para>If this function exists, it will be called once after all tests are
|
||||
# completed. It is useful to clean up the environment after all tests.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
# Note: see _shunit_mktempFunc() for actual implementation
|
||||
# oneTimeTearDown() { :; }
|
||||
|
||||
#/**
|
||||
# <s:function group="suites">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>setUp</function></funcdef>
|
||||
# <paramdef />
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>This function can be be optionally overridden by the user in their
|
||||
# test suite.</para>
|
||||
# <para>If this function exists, it will be called before each test is run.
|
||||
# It is useful to reset the environment before each test.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
# Note: see _shunit_mktempFunc() for actual implementation
|
||||
# setUp() { :; }
|
||||
|
||||
#/**
|
||||
# <s:function group="suites">
|
||||
# <entry align="right">
|
||||
# <emphasis>void</emphasis>
|
||||
# </entry>
|
||||
# <entry>
|
||||
# <funcsynopsis>
|
||||
# <funcprototype>
|
||||
# <funcdef><function>tearDown</function></funcdef>
|
||||
# <paramdef />
|
||||
# </funcprototype>
|
||||
# </funcsynopsis>
|
||||
# <para>This function can be be optionally overridden by the user in their
|
||||
# test suite.</para>
|
||||
# <para>If this function exists, it will be called after each test completes.
|
||||
# It is useful to clean up the environment after each test.</para>
|
||||
# </entry>
|
||||
# </s:function>
|
||||
#*/
|
||||
# Note: see _shunit_mktempFunc() for actual implementation
|
||||
# tearDown() { :; }
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# internal shUnit2 functions
|
||||
#
|
||||
|
||||
_shunit_cleanup()
|
||||
{
|
||||
name=$1
|
||||
|
||||
case ${name} in
|
||||
EXIT) signal=0 ;;
|
||||
INT) signal=2 ;;
|
||||
TERM) signal=15 ;;
|
||||
esac
|
||||
|
||||
# do our work
|
||||
rm -fr "${__shunit_tmpDir}"
|
||||
|
||||
# exit for all non-EXIT signals
|
||||
if [ ${name} != 'EXIT' ]; then
|
||||
echo "trapped and now handling the ${name} signal" >&2
|
||||
_shunit_generateReport
|
||||
# disable EXIT trap
|
||||
trap 0
|
||||
# add 128 to signal and exit
|
||||
exit `expr ${signal} + 128`
|
||||
fi
|
||||
}
|
||||
|
||||
_shunit_execSuite()
|
||||
{
|
||||
echo '#'
|
||||
echo '# Performing tests'
|
||||
echo '#'
|
||||
for _su_func in ${__shunit_suite}; do
|
||||
# execute the per-test setup function
|
||||
setUp
|
||||
|
||||
# execute the test
|
||||
echo "${_su_func}"
|
||||
eval ${_su_func}
|
||||
|
||||
# execute the per-test tear-down function
|
||||
tearDown
|
||||
done
|
||||
|
||||
unset _su_func
|
||||
}
|
||||
|
||||
_shunit_functionExists()
|
||||
{
|
||||
_su__func=$1
|
||||
type ${_su__func} 2>/dev/null |grep "is a function$" >/dev/null
|
||||
_su__return=$?
|
||||
unset _su__func
|
||||
return ${_su__return}
|
||||
}
|
||||
|
||||
_shunit_generateReport()
|
||||
{
|
||||
_su__awkPercent='{printf("%0.0f%%", $1*100/$2)}'
|
||||
if [ ${__shunit_testsTotal} -gt 0 ]; then
|
||||
_su__success=`echo ${__shunit_testsPassed} ${__shunit_testsTotal} |\
|
||||
awk "${_su__awkPercent}"`
|
||||
else
|
||||
_su__success=0
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
|
||||
#
|
||||
# Test report
|
||||
#
|
||||
tests passed: ${__shunit_testsPassed}
|
||||
tests failed: ${__shunit_testsFailed}
|
||||
tests total: ${__shunit_testsTotal}
|
||||
success rate: ${_su__success}
|
||||
EOF
|
||||
|
||||
unset _su__success
|
||||
}
|
||||
|
||||
# this function is a cross-platform temporary directory creation tool. not all
|
||||
# OSes have the mktemp function, so one is included here.
|
||||
_shunit_mktempDir()
|
||||
{
|
||||
# try the standard mktemp function
|
||||
( exec mktemp -dqt shunit.XXXXXX 2>/dev/null ) && return
|
||||
|
||||
# the standard mktemp didn't work. doing our own.
|
||||
if [ -r '/dev/urandom' -a -x '/usr/bin/od' ]; then
|
||||
_su__random=`/usr/bin/od -vAn -N4 -tx4 </dev/urandom \
|
||||
|sed 's/^[^0-9a-f]*//'`
|
||||
elif [ -n "${RANDOM:-}" ]; then
|
||||
# $RANDOM works
|
||||
_su__random=${RANDOM}${RANDOM}${RANDOM}$$
|
||||
else
|
||||
# $RANDOM doesn't work
|
||||
_su__date=`date '+%Y%m%d%H%M%S'`
|
||||
_su__random=`expr ${_su__date} / $$`
|
||||
fi
|
||||
|
||||
_su__tmpDir="${TMPDIR-/tmp}/shunit.${_su__random}"
|
||||
( umask 077 && mkdir "${_su__tmpDir}" ) || {
|
||||
echo 'shUnit:FATAL could not create temporary directory! exiting' >&2
|
||||
return ${__SHUNIT_ERROR}
|
||||
}
|
||||
|
||||
echo ${_su__tmpDir}
|
||||
unset _su__date _su__random _su__tmpDir
|
||||
}
|
||||
|
||||
# this function is here to work around issues in Cygwin
|
||||
_shunit_mktempFunc()
|
||||
{
|
||||
for _su__func in oneTimeSetUp oneTimeTearDown setUp tearDown suite; do
|
||||
_su__file="${__shunit_tmpDir}/${_su__func}"
|
||||
cat <<EOF >"${_su__file}"
|
||||
#! /bin/sh
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x "${_su__file}"
|
||||
done
|
||||
|
||||
unset _su__file
|
||||
}
|
||||
|
||||
_shunit_testPassed()
|
||||
{
|
||||
__shunit_testsPassed=`expr ${__shunit_testsPassed} + 1`
|
||||
__shunit_testsTotal=`expr ${__shunit_testsTotal} + 1`
|
||||
}
|
||||
|
||||
_shunit_testFailed()
|
||||
{
|
||||
_su__msg=$1
|
||||
|
||||
__shunit_testsFailed=`expr ${__shunit_testsFailed} + 1`
|
||||
__shunit_testsTotal=`expr ${__shunit_testsTotal} + 1`
|
||||
echo "${__SHUNIT_ASSERT_MSG_PREFIX}${_su__msg}" >&2
|
||||
|
||||
unset _su__msg
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# main
|
||||
#
|
||||
|
||||
# create a temporary storage location
|
||||
__shunit_tmpDir=`_shunit_mktempDir` || exit ${__SHUNIT_ERROR}
|
||||
|
||||
# setup traps to clean up after ourselves
|
||||
trap '_shunit_cleanup EXIT' 0
|
||||
trap '_shunit_cleanup INT' 2
|
||||
trap '_shunit_cleanup TERM' 15
|
||||
|
||||
# create phantom functions to work around issues with Cygwin
|
||||
_shunit_mktempFunc
|
||||
PATH="${__shunit_tmpDir}:${PATH}"
|
||||
|
||||
# execute the oneTimeSetUp function (if it exists)
|
||||
#_shunit_functionExists oneTimeSetUp && oneTimeSetUp
|
||||
oneTimeSetUp
|
||||
|
||||
# deprecated: execute the suite function defined in the parent test script
|
||||
suite
|
||||
|
||||
# if no suite function was defined, dynamically build a list of functions
|
||||
if [ -z "${__shunit_suite}" ]; then
|
||||
funcs=`grep "^[ \t]*test[A-Za-z0-9_]* *()" $0 |sed 's/[^A-Za-z0-9_]//g'`
|
||||
for func in ${funcs}; do
|
||||
suite_addTest ${func}
|
||||
done
|
||||
fi
|
||||
|
||||
# execute the tests
|
||||
_shunit_execSuite
|
||||
|
||||
# execute the oneTimeTearDown function (if it exists)
|
||||
oneTimeTearDown
|
||||
|
||||
# generate report
|
||||
_shunit_generateReport
|
||||
|
||||
# restore the previous set of shell flags
|
||||
for _shunit_shellFlag in ${__SHUNIT_SHELL_FLAGS}; do
|
||||
echo ${__shunit_oldShellFlags} |grep ${_shunit_shellFlag} >/dev/null \
|
||||
|| set +${_shunit_shellFlag}
|
||||
done
|
||||
unset _shunit_shellFlag
|
||||
|
||||
#/**
|
||||
# </s:shelldoc>
|
||||
#*/
|
116
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/run-test-suite
vendored
Executable file
116
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/run-test-suite
vendored
Executable file
@@ -0,0 +1,116 @@
|
||||
#! /bin/sh
|
||||
# $Id: run-test-suite 432 2007-01-05 14:58:37Z sfsetse $
|
||||
|
||||
MY_NAME=`basename $0`
|
||||
MY_PATH=`dirname $0`
|
||||
|
||||
SHELLS='/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh'
|
||||
for f in test[A-Z]*; do
|
||||
[ -x "${f}" ] && TESTS="${TESTS:+${TESTS} }${f}"
|
||||
done
|
||||
|
||||
# load common unit test functions
|
||||
. "${MY_PATH}/test-functions.inc"
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "usage: ${MY_NAME} [-e key=val ...] [-s shell(s)] [-t test(s)]"
|
||||
}
|
||||
|
||||
# process command line flags
|
||||
while getopts 'e:hs:t:' opt; do
|
||||
case ${opt} in
|
||||
e)
|
||||
key=`expr "${OPTARG}" : '\([^=]*\)='`
|
||||
val=`expr "${OPTARG}" : '[^=]*=\(.*\)'`
|
||||
if [ -z "${key}" -o -z "${val}" ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
eval "${key}='${val}'"
|
||||
export ${key}
|
||||
env="${env:+${env} }${key}"
|
||||
;;
|
||||
h) usage; exit 0 ;;
|
||||
s) shells=${OPTARG} ;;
|
||||
t) tests=${OPTARG} ;;
|
||||
*) usage; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
shift `expr ${OPTIND} - 1`
|
||||
|
||||
# fill shells and/or tests
|
||||
shells=${shells:-${SHELLS}}
|
||||
tests=${tests:-${TESTS}}
|
||||
|
||||
# error checking
|
||||
if [ -z "${tests}" ]; then
|
||||
tf_error 'no tests found to run; exiting'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
#------------------------------------------------------------------------------
|
||||
# System data
|
||||
#
|
||||
|
||||
# test run info
|
||||
shells="${shells}"
|
||||
tests="${tests}"
|
||||
EOF
|
||||
for key in ${env}; do
|
||||
eval "echo \"${key}=\$${key}\""
|
||||
done
|
||||
echo
|
||||
|
||||
# output system data
|
||||
echo "# system info"
|
||||
echo "$ date"
|
||||
date
|
||||
|
||||
echo "$ uname -mprsv"
|
||||
uname -mprsv
|
||||
|
||||
#
|
||||
# run tests
|
||||
#
|
||||
|
||||
for shell in ${shells}; do
|
||||
echo
|
||||
|
||||
# check for existance of shell
|
||||
if [ ! -x ${shell} ]; then
|
||||
tf_warn "unable to run tests with the ${shell} shell"
|
||||
continue
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Running the test suite with ${shell}
|
||||
#
|
||||
EOF
|
||||
|
||||
case `basename ${shell}` in
|
||||
bash) echo; ${shell} --version; ;;
|
||||
dash) ;;
|
||||
ksh)
|
||||
version=`${shell} --version exit 2>&1`
|
||||
exitVal=$?
|
||||
if [ ${exitVal} -eq 2 ]; then
|
||||
echo
|
||||
echo "${version}"
|
||||
fi
|
||||
;;
|
||||
pdksh) ;;
|
||||
zsh) ;;
|
||||
esac
|
||||
|
||||
# execute the tests
|
||||
for suite in ${tests}; do
|
||||
suiteName=`expr "${suite}" : 'test\(.*\)'`
|
||||
echo
|
||||
echo "--- Executing the '${suiteName}' test suite ---" >&2
|
||||
( exec ${shell} ./${suite}; )
|
||||
done
|
||||
done
|
84
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/test-functions.inc
vendored
Normal file
84
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/test-functions.inc
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
# $Id: test-functions.inc 416 2007-01-04 00:50:14Z sfsetse $
|
||||
# vim:syntax=sh:sts=2
|
||||
|
||||
#
|
||||
# constants
|
||||
#
|
||||
|
||||
# configure debugging. set the DEBUG environment variable to any
|
||||
# non-empty value to enable debug output, or TRACE to enable trace
|
||||
# output.
|
||||
TRACE=${TRACE:+'tf_trace '}
|
||||
[ -n "${TRACE}" ] && DEBUG=1
|
||||
[ -z "${TRACE}" ] && TRACE=':'
|
||||
|
||||
DEBUG=${DEBUG:+'tf_debug '}
|
||||
[ -z "${DEBUG}" ] && DEBUG=':'
|
||||
|
||||
#
|
||||
# variables
|
||||
#
|
||||
|
||||
tf_RANDOM=0
|
||||
|
||||
#
|
||||
# functions
|
||||
#
|
||||
|
||||
# message functions
|
||||
tf_trace() { echo "${MY_NAME}:TRACE $@" >&2; }
|
||||
tf_debug() { echo "${MY_NAME}:DEBUG $@" >&2; }
|
||||
tf_info() { echo "${MY_NAME}:INFO $@" >&2; }
|
||||
tf_warn() { echo "${MY_NAME}:WARN $@" >&2; }
|
||||
tf_error() { echo "${MY_NAME}:ERROR $@" >&2; }
|
||||
tf_fatal() { echo "${MY_NAME}:FATAL $@" >&2; }
|
||||
|
||||
# generate a random number
|
||||
tf_generateRandom()
|
||||
{
|
||||
tfgr_random=${tf_RANDOM}
|
||||
|
||||
while [ "${tfgr_random}" = "${tf_RANDOM}" ]; do
|
||||
if [ -n "${RANDOM:-}" ]; then
|
||||
# $RANDOM works
|
||||
tfgr_random=${RANDOM}${RANDOM}${RANDOM}$$
|
||||
elif [ -r '/dev/urandom' ]; then
|
||||
tfgr_random=`od -vAn -N4 -tu4 </dev/urandom |sed 's/^[^0-9]*//'`
|
||||
else
|
||||
tfgr_date=`date '+%H%M%S'`
|
||||
tfgr_random=`expr ${tfgr_date} \* $$`
|
||||
unset tfgr_date
|
||||
fi
|
||||
[ "${tfgr_random}" = "${tf_RANDOM}" ] && sleep 1
|
||||
done
|
||||
|
||||
tf_RANDOM=${tfgr_random}
|
||||
unset tfgr_random
|
||||
}
|
||||
|
||||
# this section returns the data section from the specified section of a file. a
|
||||
# datasection is defined by a [header], one or more lines of data, and then a
|
||||
# blank line.
|
||||
tf_getDataSect()
|
||||
{
|
||||
tf_sgrep "\\[$1\\]" "$2" |sed '1d'
|
||||
}
|
||||
|
||||
# this function greps a section from a file. a section is defined as a group of
|
||||
# lines preceeded and followed by blank lines.
|
||||
tf_sgrep()
|
||||
{
|
||||
tf_pattern=$1
|
||||
shift
|
||||
|
||||
sed -e '/./{H;$!d;}' -e "x;/${tf_pattern}/"'!d;' $@ |sed '1d'
|
||||
|
||||
unset tf_pattern
|
||||
}
|
||||
|
||||
#
|
||||
# main
|
||||
#
|
||||
|
||||
${TRACE} 'trace output enabled'
|
||||
${DEBUG} 'debug output enabled'
|
242
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testAsserts
vendored
Executable file
242
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testAsserts
vendored
Executable file
@@ -0,0 +1,242 @@
|
||||
#! /bin/sh
|
||||
# $Id$
|
||||
# vim: expandtab
|
||||
# author: Kate Ward <kate.ward@forestent.com>
|
||||
#
|
||||
# Self-testing unit tests for shUnit2 asserts
|
||||
#
|
||||
|
||||
MSG='This is a test message'
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite tests
|
||||
#
|
||||
|
||||
commonEqualsSame()
|
||||
{
|
||||
fn=$1
|
||||
|
||||
msg='same, with message'
|
||||
rslt=`${fn} "${MSG}" 'x' 'x' 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='same'
|
||||
rslt=`${fn} 'x' 'x' 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='not same'
|
||||
rslt=`${fn} 'x' 'y' 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='null values'
|
||||
rslt=`${fn} '' '' 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='too few arguments'
|
||||
rslt=`${fn} 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
}
|
||||
|
||||
testAssertEquals()
|
||||
{
|
||||
commonEqualsSame 'assertEquals'
|
||||
}
|
||||
|
||||
testAssertSame()
|
||||
{
|
||||
commonEqualsSame 'assertSame'
|
||||
}
|
||||
|
||||
testAssertNotSame()
|
||||
{
|
||||
msg='not same, with message'
|
||||
rslt=`assertNotSame "${MSG}" 'x' 'y' 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='not same'
|
||||
rslt=`assertNotSame 'x' 'y' 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='same'
|
||||
rslt=`assertNotSame 'x' 'x' 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='null values'
|
||||
rslt=`assertNotSame '' '' 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='too few arguments'
|
||||
rslt=`assertNotSame 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
}
|
||||
|
||||
testAssertNull()
|
||||
{
|
||||
msg='null, with message'
|
||||
rslt=`assertNull "${MSG}" '' 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='null'
|
||||
rslt=`assertNull '' 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='not null'
|
||||
rslt=`assertNull 'x' 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='too few arguments'
|
||||
rslt=`assertNull 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
}
|
||||
|
||||
testAssertNotNull()
|
||||
{
|
||||
msg='not null, with message'
|
||||
rslt=`assertNotNull "${MSG}" 'x' 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='not null'
|
||||
rslt=`assertNotNull 'x' 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='null'
|
||||
rslt=`assertNotNull '' 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='too few arguments'
|
||||
rslt=`assertNotNull 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
}
|
||||
|
||||
testAssertTrue()
|
||||
{
|
||||
msg='true, with message'
|
||||
rslt=`assertTrue "${MSG}" 0 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='true'
|
||||
rslt=`assertTrue 0 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='true condition'
|
||||
rslt=`assertTrue "[ 0 -eq 0 ]" 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='false'
|
||||
rslt=`assertTrue 1 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='false condition'
|
||||
rslt=`assertTrue "[ 0 -eq 1 ]" 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='null value'
|
||||
rslt=`assertTrue '' 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='too few arguments'
|
||||
rslt=`assertTrue 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
}
|
||||
|
||||
testAssertFalse()
|
||||
{
|
||||
msg='false, with message'
|
||||
rslt=`assertFalse "${MSG}" 1 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='false'
|
||||
rslt=`assertFalse 1 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='false condition'
|
||||
rslt=`assertFalse "[ 0 -eq 1 ]" 2>&1`
|
||||
rtrn=$?
|
||||
assertSame "${msg}" '' "${rslt}"
|
||||
assertTrue "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='true'
|
||||
rslt=`assertFalse 0 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='true condition'
|
||||
rslt=`assertFalse "[ 0 -eq 0 ]" 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='null value'
|
||||
rslt=`assertFalse '' 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
|
||||
msg='too few arguments'
|
||||
rslt=`assertFalse 2>&1`
|
||||
rtrn=$?
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
assertFalse "${msg}; failure" ${rtrn}
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite functions
|
||||
#
|
||||
|
||||
# load and run shUnit2
|
||||
. ./shunit2
|
89
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testFailures
vendored
Executable file
89
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testFailures
vendored
Executable file
@@ -0,0 +1,89 @@
|
||||
#! /bin/sh
|
||||
# $Id$
|
||||
# vim: expandtab
|
||||
# author: Kate Ward <kate.ward@forestent.com>
|
||||
#
|
||||
# Self-testing unit tests for shUnit2 failures
|
||||
#
|
||||
|
||||
MSG='This is a test message'
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite tests
|
||||
#
|
||||
|
||||
commonNotEqualsSame()
|
||||
{
|
||||
fn=$1
|
||||
|
||||
msg='same, with message'
|
||||
rslt=`${fn} "${MSG}" 'x' 'x' 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
|
||||
msg='same'
|
||||
rslt=`${fn} 'x' 'x' 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
|
||||
msg='not same'
|
||||
rslt=`${fn} 'x' 'y' 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
|
||||
msg='null values'
|
||||
rslt=`${fn} '' '' 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
|
||||
msg='too few arguments'
|
||||
rslt=`${fn} 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
}
|
||||
|
||||
testFail()
|
||||
{
|
||||
msg='with message'
|
||||
rslt=`fail "${MSG}" 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
|
||||
msg='without message'
|
||||
rslt=`fail 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
}
|
||||
|
||||
testFailNotEquals()
|
||||
{
|
||||
commonNotEqualsSame 'failNotEquals'
|
||||
}
|
||||
|
||||
testFailSame()
|
||||
{
|
||||
msg='same, with message'
|
||||
rslt=`failSame "${MSG}" 'x' 'x' 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
|
||||
msg='same'
|
||||
rslt=`failSame 'x' 'x' 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
|
||||
msg='not same'
|
||||
rslt=`failSame 'x' 'y' 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
|
||||
msg='null values'
|
||||
rslt=`failSame '' '' 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
|
||||
msg='too few arguments'
|
||||
rslt=`failSame 2>&1`
|
||||
assertNotSame "${msg}" '' "${rslt}"
|
||||
}
|
||||
|
||||
testFailNotSame()
|
||||
{
|
||||
commonNotEqualsSame 'failNotSame'
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite functions
|
||||
#
|
||||
|
||||
# load and run shUnit2
|
||||
. ./shunit2
|
23
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testInternalFx
vendored
Executable file
23
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testInternalFx
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
#! /bin/sh
|
||||
# $Id$
|
||||
# vim: expandtab
|
||||
# author: Kate Ward <kate.ward@forestent.com>
|
||||
#
|
||||
# Self-testing unit tests for shUnit2 internal functions
|
||||
#
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite tests
|
||||
#
|
||||
|
||||
testGenerateReport()
|
||||
{
|
||||
:
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite functions
|
||||
#
|
||||
|
||||
# load and run shUnit2
|
||||
. ./shunit2
|
23
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testSuiteFx
vendored
Executable file
23
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testSuiteFx
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
#! /bin/sh
|
||||
# $Id$
|
||||
# vim: expandtab
|
||||
# author: Kate Ward <kate.ward@forestent.com>
|
||||
#
|
||||
# Self-testing unit tests for shUnit2 suite functions
|
||||
#
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite tests
|
||||
#
|
||||
|
||||
testAddTest()
|
||||
{
|
||||
:
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite functions
|
||||
#
|
||||
|
||||
# load and run shUnit2
|
||||
. ./shunit2
|
12
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/gen_test_results.flags
vendored
Normal file
12
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/gen_test_results.flags
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# $Id: gen_test_results.flags 145 2011-06-10 11:45:17Z kate.ward@forestent.com $
|
||||
# vim:et:ft=sh:sts=2:sw=2
|
||||
#
|
||||
# Copyright 2011 Kate Ward. All Rights Reserved.
|
||||
# Released under the LGPL (GNU Lesser General Public License)
|
||||
#
|
||||
# Author: kate.ward@forestent.com (Kate Ward)
|
||||
#
|
||||
# Flag definition overrides for the gen_test_results.sh script.
|
||||
#
|
||||
|
||||
DEFINE_string suite 'shunit2_test.sh' 'unit test suite' s
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user