diff --git a/.zprezto/README.md b/.zprezto/README.md index 2f94cd6..552784b 100644 --- a/.zprezto/README.md +++ b/.zprezto/README.md @@ -33,10 +33,11 @@ version is 4.3.11. done ``` - Note: If you already have any of the given config files, ln will error. In - simple cases you can add `source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"` to - the bottom of your `.zshrc` to load prezto but keep your config intact. For - more complicated setups, it is recommended that you back up your original + Note: If you already have any of the given configuration files, `ln` will + cause error. In simple cases you can load prezto by adding the line + `source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"` to the bottom of your + `.zshrc` and keep the rest of your Zsh configuration intact. For more + complicated setups, it is recommended that you back up your original configs and replace them with the provided prezto runcoms. 4. Set Zsh as your default shell: @@ -89,6 +90,10 @@ accompanying README files to learn of what is available. window or tab. ![sorin theme][2] + Note that the 'git' module may be required for special symbols to appear, + such as those on the right of the above image. Add `'git'` to the `pmodule` + list (under `zstyle ':prezto:load' pmodule \` in your *~/.zpreztorc*) to + enable this module. ### External Modules @@ -99,7 +104,7 @@ accompanying README files to learn of what is available. Note that module names need to be unique or they will cause an error when loading. - ```console + ```sh zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib ``` diff --git a/.zprezto/modules/archive/README.md b/.zprezto/modules/archive/README.md index 600ff15..c9806ea 100644 --- a/.zprezto/modules/archive/README.md +++ b/.zprezto/modules/archive/README.md @@ -31,9 +31,9 @@ installed: - *.7z* requires `7za`. - *.deb* requires `ar`, `tar`. -Additionally, if `pigz` and/or `pbzip2` are installed, `archive` will use them over -their traditional counterparts, `gzip` and `bzip2` respectively, to take full advantage -of all available CPU cores for compression. +Additionally, if `pigz` and/or `pbzip2` are installed, `archive` will use them +over their traditional counterparts, `gzip` and `bzip2` respectively, to take +full advantage of all available CPU cores for compression. Alternatives ------------ diff --git a/.zprezto/modules/autosuggestions/README.md b/.zprezto/modules/autosuggestions/README.md index c3e90a4..48f9852 100644 --- a/.zprezto/modules/autosuggestions/README.md +++ b/.zprezto/modules/autosuggestions/README.md @@ -1,8 +1,3 @@ -Autosuggestions ---------------- - -Integrates zsh-autosuggestions into Prezto. - Autosuggestions =============== diff --git a/.zprezto/modules/command-not-found/README.md b/.zprezto/modules/command-not-found/README.md index 7775c92..ee5a94d 100644 --- a/.zprezto/modules/command-not-found/README.md +++ b/.zprezto/modules/command-not-found/README.md @@ -3,11 +3,12 @@ Command-Not-Found When you try to use a command that is not available locally, searches the package manager for a package offering that command and suggests -the proper install command. +the proper install command. -Debian-based and Arch Linux-based distributions use the [`command-not-found`][1] tool. +Debian and Arch Linux based distributions use the [`command-not-found`][1] tool. -macOS uses Homebrew's [`command-not-found` clone][2]. Note that you also need to [follow the instructions to tap the `command-not-found` homebrew repository][3]. +macOS uses Homebrew's [`command-not-found` clone][2]. Note that you also need to +[follow the instructions][3] to tap the `command-not-found` homebrew repository. Authors diff --git a/.zprezto/modules/completion/README.md b/.zprezto/modules/completion/README.md index 7efb3d9..dc2b9b8 100644 --- a/.zprezto/modules/completion/README.md +++ b/.zprezto/modules/completion/README.md @@ -6,6 +6,19 @@ the [zsh-completions][1] project. This module must be loaded **after** the *utility* module. +Options +------- + + - `COMPLETE_IN_WORD` complete from both ends of a word. + - `ALWAYS_TO_END` move cursor to the end of a completed word. + - `PATH_DIRS` perform path search even on command names with slashes. + - `AUTO_MENU` show completion menu on a successive tab press. + - `AUTO_LIST` automatically list choices on ambiguous completion. + - `AUTO_PARAM_SLASH` if completed parameter is a directory, add a trailing slash. + - `EXTENDED_GLOB` needed for file modification glob modifiers with compinit. + - `MENU_COMPLETE` do not autoselect the first completion entry. + - `FLOW_CONTROL` disable start/stop characters in shell editor. + Settings -------- diff --git a/.zprezto/modules/completion/external/CONTRIBUTING.md b/.zprezto/modules/completion/external/CONTRIBUTING.md new file mode 100644 index 0000000..8002c56 --- /dev/null +++ b/.zprezto/modules/completion/external/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing + +## How to Contribute to zsh-completions + +Contributions are welcome, just make sure you follow the guidelines: + + * Completions are not accepted when already available in zsh. + * Completions are not accepted when already available in their original project. + * Please do not just copy/paste someone else's completion, ask before. + * Partially implemented completions are not accepted. + * Please add a header containing authors, status and origin of the script and license header if you do not wish to use the Zsh license (example [here](src/_ack)). + * Any reasonable open source licence is acceptable but note that we recommend the use of the Zsh license and that you should use it if you hope for the function to migrate to zsh itself. + * Please try to follow the [Zsh completion style guide](https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide). + * Please send one separate pull request per file. + * Send a pull request or ask for committer access. + +## Contributing Completion Functions to Zsh + +The zsh project itself welcomes completion function contributions via +[github pull requests](https://github.com/zsh-users/zsh/), +[gitlab merge requests](https://gitlab.com/zsh-org/zsh/) or via patch +files sent to its mailing list, `zsh-workers@zsh.org`. + +Contributing to zsh has the advantage of reaching the most users. + +## Including Completion Functions in Upstream Projects + +Many upstream projects include zsh completions. + +If well maintained, this has the advantage that users get a completion +function that matches the installed version of their software. + +If you are the upstream maintainer this is a good choice. If the project +already includes completions for bash, fish, tcsh, etc then they are +likely open to including zsh's too. It can also be a good option for +completions handling commands that are system or distribution specific. + +Ideally, arrange for the project's build system to install the +completion function in `$prefix/share/zsh/site-functions`. diff --git a/.zprezto/modules/completion/external/README.md b/.zprezto/modules/completion/external/README.md index 57ba687..1265c4d 100644 --- a/.zprezto/modules/completion/external/README.md +++ b/.zprezto/modules/completion/external/README.md @@ -6,11 +6,6 @@ zsh-completions ![GitHub release](https://img.shields.io/github/release/zsh-user *This projects aims at gathering/developing new completion scripts that are not available in Zsh yet. The scripts may be contributed to the Zsh project when stable enough.* -## Status - -See [issues](https://github.com/zsh-users/zsh-completions/issues) for details on each completion definition. - - ## Usage ### Using packages @@ -20,11 +15,14 @@ See [issues](https://github.com/zsh-users/zsh-completions/issues) for details on | Debian / Ubuntu | [zsh-completions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-completions&package=zsh-completions) | | Fedora / CentOS / RHEL / Scientific Linux | [zsh-completions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-completions&package=zsh-completions) | | OpenSUSE / SLE | [zsh-completions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-completions&package=zsh-completions) | -| Arch Linux | [zsh-completions](https://www.archlinux.org/packages/zsh-completions), [zsh-completions-git](https://aur.archlinux.org/packages/zsh-completions-git) | -| Gentoo | [app-shells/zsh-completions](http://packages.gentoo.org/package/app-shells/zsh-completions) | -| NixOS | [zsh-completions](https://github.com/NixOS/nixpkgs/blob/master/pkgs/shells/zsh-completions/default.nix) | -| Void Linux | [zsh-completions](https://github.com/voidlinux/void-packages/tree/master/srcpkgs/zsh-completions) | -| Mac OS | [homebrew](https://github.com/Homebrew/homebrew-core/blob/master/Formula/zsh-completions.rb) | +| Arch Linux / Manjaro / Antergos / Hyperbola | [zsh-completions](https://www.archlinux.org/packages/zsh-completions), [zsh-completions-git](https://aur.archlinux.org/packages/zsh-completions-git) | +| Gentoo / Funtoo | [app-shells/zsh-completions](http://packages.gentoo.org/package/app-shells/zsh-completions) | +| NixOS | [zsh-completions](https://github.com/NixOS/nixpkgs/blob/master/pkgs/shells/zsh/zsh-completions/default.nix) | +| Void Linux | [zsh-completions](https://github.com/void-linux/void-packages/blob/master/srcpkgs/zsh-completions/template) | +| Slackware | [Slackbuilds](https://slackbuilds.org/repository/14.2/system/zsh-completions) | +| Mac OS | [homebrew](https://github.com/Homebrew/homebrew-core/blob/master/Formula/zsh-completions.rb), [MacPorts](https://github.com/macports/macports-ports/blob/master/sysutils/zsh-completions/Portfile) | +| NetBSD | [pkgsrc](ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/shells/zsh-completions/README.html) | + ### Using zsh frameworks @@ -59,18 +57,9 @@ Add `antigen bundle zsh-users/zsh-completions` to your `~/.zshrc`. ### Contributing -Contributions are welcome, just make sure you follow the guidelines: - - * Completions are not accepted when already available in zsh. - * Completions are not accepted when already available in their original project. - * Please do not just copy/paste someone else completion, ask before. - * Completions only partially implemented are not accepted. - * Please add a header containing authors, status and origin of the script and license header if you do not wish to use the Zsh license (example [here](src/_ack)). - * Please try to follow [Zsh completion style guide](https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide). - * Please send one separate pull request per file. - * Send a pull request or ask for committer access. +Contributions are welcome, see [CONTRIBUTING](https://github.com/zsh-users/zsh-completions/blob/master/CONTRIBUTING.md). ## License -Completions use the Zsh license, unless explicitely mentionned in the file header. +Completions use the Zsh license, unless explicitly mentioned in the file header. See [LICENSE](https://github.com/zsh-users/zsh-completions/blob/master/LICENSE) for more information. diff --git a/.zprezto/modules/completion/external/src/_afew b/.zprezto/modules/completion/external/src/_afew index 15a9ab7..c93dde7 100644 --- a/.zprezto/modules/completion/external/src/_afew +++ b/.zprezto/modules/completion/external/src/_afew @@ -38,30 +38,24 @@ # # ------------------------------------------------------------------------------ -_afew() { - - _arguments -C \ - '(- 1 *)'-h"[Show help and exit]" \ - "(-c --classify -l --learn= -t --tag -u --update -U --update-reference -m --move-mails)"{-w,--watch}"[Continuously monitor the mailbox for new messages matching the given query]" \ - "(-c --classify -l --learn= -u --update -U --update-reference -m --move-mails -w --watch)"{-t,--tag}"[Run the tag filters]" \ - "(-c --classify -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-l,--learn=}"[Train category with the messages matching query]" \ - "(-c --classify -l --learn= -t --tag -U --update-reference -m --move-mails -w --watch)"{-u,--update}"[Update the categories (requires no query)]" \ - "(-c --classify -l --learn= -t --tag -u --update -m --move-mails -w --watch)"{-U,--update-reference}"[Update the reference category (takes quite some time) (requires no query)]" \ - "(-l --learn= -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-c,--classify}"[Classify each message matching the iven query]" \ - "(-c --classify -l --learn= -t --tag -u --update -U --update-reference -w --watch)"{-m,--move-mails}"[Move mail files between maildir folders]" \ - "(-n --all)"{-a,--all}"[Operate on all email]" \ - "(-a --new)"{-n,--new}"[Operate on all new email]" \ - {-C,--notmuch-config=}"[Path to notmuch configuration file]:files:_files" \ - {-e,--enable-filters=}"[Flter classes to use]:filters" \ - {-d,--dry-run}"[Dont change the DB]" \ - {-R,--reference-set-size=}"[Size of the reference set (default: 1000)]:size:" \ - {-T,--reference-set-timeframe-days=}"[Do not use emails older than DAYS days (default: 30)]:days:" \ - {--verbose,-v}"[Be more verbose]" \ - '*:Query:' \ - -} - -_afew +_arguments \ + '(- 1 *)-h[display usage information]' \ + "(-c --classify -l --learn= -t --tag -u --update -U --update-reference -m --move-mails)"{-w,--watch}"[continuously monitor the mailbox for new messages matching the given query]" \ + "(-c --classify -l --learn= -u --update -U --update-reference -m --move-mails -w --watch)"{-t,--tag}"[run the tag filters]" \ + "(-c --classify -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-l,--learn=}"[train category with the messages matching query]" \ + "(-c --classify -l --learn= -t --tag -U --update-reference -m --move-mails -w --watch)"{-u,--update}"[update the categories (requires no query)]" \ + "(-c --classify -l --learn= -t --tag -u --update -m --move-mails -w --watch)"{-U,--update-reference}"[update the reference category (takes quite some time) (requires no query)]" \ + "(-l --learn= -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-c,--classify}"[classify each message matching the iven query]" \ + "(-c --classify -l --learn= -t --tag -u --update -U --update-reference -w --watch)"{-m,--move-mails}"[move mail files between maildir folders]" \ + "(-n --all)"{-a,--all}"[operate on all email]" \ + "(-a --new)"{-n,--new}"[operate on all new email]" \ + {-C,--notmuch-config=}"[specify path to notmuch configuration file]:files:_files" \ + {-e,--enable-filters=}"[specify filter classes to use]:filter" \ + {-d,--dry-run}"[don't change the DB]" \ + {-R,--reference-set-size=}"[specify size of the reference set]:size [1000]" \ + {-T,--reference-set-timeframe-days=}"[don't use emails older than specified age]:age (days) [30]" \ + {--verbose,-v}"[be more verbose]" \ + '*: :_guard "^-*" query' # Local Variables: # mode: Shell-Script diff --git a/.zprezto/modules/completion/external/src/_ansible b/.zprezto/modules/completion/external/src/_ansible index e3a1d0c..cf8b118 100644 --- a/.zprezto/modules/completion/external/src/_ansible +++ b/.zprezto/modules/completion/external/src/_ansible @@ -40,7 +40,7 @@ # ------------------------------------------------------------------------------ # # Needs either ANSIBLE_HOSTS or /etc/ansible/hosts on linux -# (or /usr/local/etc/ansible/hosts on OSX) +# (or /usr/local/etc/ansible/hosts on macOS) # # Note 1: the following gist (https://gist.github.com/15ed54a438a36d67fd99.git) # has some files to help improve the hostfile shell parsing @@ -416,8 +416,8 @@ _modules=( 'os_user:Manage OpenStack Identity Users' 'os_user_group:Associate OpenStack Identity users and groups' 'os_volume:Create/Delete Cinder Volumes' -'osx_defaults:osx_defaults allows users to read, write, and delete Mac OS X user defaults from Ansible' -'osx_say:Makes an OSX computer to speak.' +'osx_defaults:osx_defaults allows users to read, write, and delete macOS user defaults from Ansible' +'osx_say:Makes a macOS computer speak.' 'ovirt:oVirt/RHEV platform management' 'package:Generic OS package manager' 'pacman:Manage packages with *pacman*' @@ -643,7 +643,7 @@ _ansible () local curcontext="$curcontext" state line typeset -A opt_args - _arguments -C -W \ + _arguments -s -C -W \ '1:pattern:->pattern'\ "(-a --args)"{-a,--args}"[ARGS module arguments]:arguments:(ARG)"\ '--ask-become-pass[ask for privilege escalation password]'\ @@ -658,14 +658,14 @@ _ansible () "(-C --check)"{-C,--check}"[don't make any changes]"\ "(-c --connection)"{-c,--connection}"[CONNECTION connection type to use (default=smart)]:connection type:(smart ssh local chroot)"\ "(-D --diff)"{-D,--diff}"[show differences when changing (small) files and templates]"\ - "(-e --extra-vars)"{-e,--extra-vars}"[set additional variables as key=value or YAML/JSON]"\ + "*"{-e,--extra-vars}"[set additional variables as key=value or YAML/JSON]"\ "(-f --forks)"{-f,--forks}"[FORKS number of parallel processes to use (default=5)]:forks:(5)"\ "(-h --help)"{-h,--help}"[help message]"\ - "(-i --inventory-file)"{-i,--inventory-file}"[INVENTORY specify inventory host file]:inventory file:_files"\ + "*"{-i,--inventory,--inventory-file}"[INVENTORY specify inventory host file]:inventory file:_files"\ "(-l --limit)"{-l,--limit}"[SUBSET further limit selected hosts to an additional pattern]:subset pattern:->pattern"\ '--list-hosts[outputs a list of matching hosts. Does not execute anything else]'\ "(-m --module-name)"{-m,--module-name}"[MODULE_NAME module name (default=command)]:module name:->module"\ - "(-M --module-path)"{-M,--module-path}"[MODULE_PATH specify path to module library (default=None)]:module path:_files -/"\ + "*"{-M,--module-path}"[MODULE_PATH specify path to module library (default=None)]:module path:_files -/"\ '--new-vault-password-file[new vault password file for rekey]:new vault password file:_files'\ "(-o --one-line)"{-o,--one-line}"[condense output]"\ '--output[output file name for encrypt or decrypt; use - for stdout]:output file:_files'\ @@ -683,8 +683,8 @@ _ansible () "(-T --timeout)"{-T,--timeout}"[TIMEOUT override the SSH timeout (s) (default=10)]:ssh timeout:(10)"\ "(-t --tree)"{-t,--tree}"[OUTPUT_DIRECTORY log output to this directory]:output directory:_files -/"\ "(-u --user)"{-u,--user}"[REMOTE_USER connect as this user (default=${USER})]:connect as user:(${USER})"\ - "--vault-password-file[VAULT_PASSWORD_FILE vault password file]:vault password file:_files"\ - "(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]"\ + "*--vault-password-file[VAULT_PASSWORD_FILE vault password file]:vault password file:_files"\ + "*"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]"\ "--version[show program's version number and exit]"\ case $state in diff --git a/.zprezto/modules/completion/external/src/_ansible-galaxy b/.zprezto/modules/completion/external/src/_ansible-galaxy index 53b8c64..ddd94be 100644 --- a/.zprezto/modules/completion/external/src/_ansible-galaxy +++ b/.zprezto/modules/completion/external/src/_ansible-galaxy @@ -84,7 +84,7 @@ _ansible-galaxy () _arguments \ "(-h --help)"{-h,--help}"[help message]" \ "(-c --ignore-certs)"{-c,--ignore-certs}"[Ignore SSL certificate validation errors.]" \ - "(-p --roles-path)"{-p,--roles-path}"[ROLES_PATH The path to the directory containing your roles (default: from ansible.cfg)]:roles path:_files -/" \ + "*"{-p,--roles-path}"[ROLES_PATH The path to the directory containing your roles (default: from ansible.cfg)]:roles path:_files -/" \ "(-s --server)"{-s,--server}"[API_SERVER The API server destination]:api server:(http://apiserver)" \ "(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \ "--version[show program's version number and exit]" \ diff --git a/.zprezto/modules/completion/external/src/_ansible-playbook b/.zprezto/modules/completion/external/src/_ansible-playbook index e7c6b6a..749a813 100644 --- a/.zprezto/modules/completion/external/src/_ansible-playbook +++ b/.zprezto/modules/completion/external/src/_ansible-playbook @@ -40,7 +40,7 @@ # ------------------------------------------------------------------------------ # # Needs either ANSIBLE_HOSTS or /etc/ansible/hosts on linux -# (or /usr/local/etc/ansible/hosts on OSX) +# (or /usr/local/etc/ansible/hosts on macOS) # # Note 1: the following gist (https://gist.github.com/15ed54a438a36d67fd99.git) # has some files to help improve the hostfile shell parsing @@ -126,8 +126,8 @@ _ansible-playbook () local curcontext="$curcontext" state line typeset -A opt_args - _arguments -C -W \ - "1:playbook yml file:_files -g '*.yml|*.yaml'"\ + _arguments -s -C -W \ + "*:playbook yml file:_files -g '*.yml|*.yaml'"\ '--ask-become-pass[ask for privilege escalation password]'\ "(-k --ask-pass)"{-k,--ask-pass}"[ask for connection password]"\ '--ask-su-pass[ask for su password (deprecated, use become)]'\ @@ -139,23 +139,23 @@ _ansible-playbook () "(-C --check)"{-C,--check}"[don't make any changes]"\ "(-c --connection)"{-c,--connection}"[CONNECTION connection type to use (default=smart)]:connection type:(smart ssh local chroot)"\ "(-D --diff)"{-D,--diff}"[when changing (small files and templates, show the diff in those. Works great with --check)]"\ - "(-e --extra-vars)"{-e,--extra-vars}"[EXTRA_VARS set additional variables as key=value or YAML/JSON]:extra vars:(EXTRA_VARS)"\ + "*"{-e,--extra-vars}"[EXTRA_VARS set additional variables as key=value or YAML/JSON]:extra vars:(EXTRA_VARS)"\ '--flush-cache[clear the fact cache]'\ '--force-handlers[run handlers even if a task fails]'\ "(-f --forks)"{-f,--forks}"[FORKS number of parallel processes to use (default=5)]:forks:(5)"\ "(-h --help)"{-h,--help}"[help message]"\ - "(-i --inventory-file)"{-i,--inventory-file}"[INVENTORY specify inventory host file]:inventory file:_files"\ + "*"{-i,--inventory,--inventory-file}"[INVENTORY specify inventory host file]:inventory file:_files"\ "(-l --limit)"{-l,--limit}"[SUBSET further limit selected hosts to an additional pattern]:subset pattern:->pattern"\ '--list-hosts[outputs a list of matching hosts. Does not execute anything else]'\ '--list-tags[list all available tags]'\ '--list-tasks[list all tasks that would be executed]'\ - "(-M --module-path)"{-M,--module-path}"[MODULE_PATH specify path to module library (default=None)]:module path:_files -/"\ + "*"{-M,--module-path}"[MODULE_PATH specify path to module library (default=None)]:module path:_files -/"\ '--new-vault-password-file[new vault password file for rekey]:new vault password file:_files'\ '--output[output file name for encrypt or decrypt; use - for stdout]:output file:_files'\ '--private-key[PRIVATE_KEY_FILE use this file to authenticate the connection]:private key file:_files'\ '--scp-extra-args[specify extra arguments to pass to scp only]'\ '--sftp-extra-args[specify extra arguments to pass to sftp only]'\ - "--skip-tags[SKIP_TAGS only run plays and tasks whose tags do not match these values]:skip tags:(SKIP_TAGS)"\ + "*--skip-tags[SKIP_TAGS only run plays and tasks whose tags do not match these values]:skip tags:(SKIP_TAGS)"\ '--ssh-common-args[specify common arguments to pass to sftp/scp/ssh]'\ '--ssh-extra-args[specify extra arguments to pass to ssh only]'\ "--start-at-task[START_AT start the playbook at the task matching this name]:name:(TASK_NAME)"\ @@ -165,11 +165,11 @@ _ansible-playbook () "(-s --sudo)"{-s,--sudo}"[run operations with sudo (nopasswd) (deprecated, use become)]"\ "(-U --sudo-user)"{-U,--sudo-user}"[SUDO_USER desired sudo user (default=root) (deprecated, use become)]:su user:(root)"\ '--syntax-check[perform a syntax check on the playbook, but do not execute it]'\ - "(-t --tags)"{-t,--tags}"[TAGS only run plays and tasks gagged with these values]:task tags:(TAGS)"\ + "*"{-t,--tags}"[TAGS only run plays and tasks gagged with these values]:task tags:(TAGS)"\ "(-T --timeout)"{-T,--timeout}"[TIMEOUT override the SSH timeout (s) (default=10)]:ssh timeout:(10)"\ "(-u --user)"{-u,--user}"[REMOTE_USER connect as this user (default=${USER})]:connect as user:(${USER})"\ - "--vault-password-file[VAULT_PASSWORD_FILE vault password file]:vault password file:_files"\ - "(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]"\ + "*--vault-password-file[VAULT_PASSWORD_FILE vault password file]:vault password file:_files"\ + "*"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]"\ "--version[show program's version number and exit]"\ case $state in diff --git a/.zprezto/modules/completion/external/src/_bower b/.zprezto/modules/completion/external/src/_bower index 0daa978..69197ea 100644 --- a/.zprezto/modules/completion/external/src/_bower +++ b/.zprezto/modules/completion/external/src/_bower @@ -39,9 +39,9 @@ # ------------------------------------------------------------------------------ -local curcontext="$curcontext" state line _packages _opts ret=1 +local curcontext="$curcontext" state line _opts ret=1 -_arguments -C -A "-v" -A "--version" \ +_arguments -C \ '(- 1 *)'{-v,--version}'[display version information]' \ '1: :->cmds' \ '*:: :->args' && ret=0 @@ -49,35 +49,34 @@ _arguments -C -A "-v" -A "--version" \ case $state in cmds) _values "bower command" \ - "cache[Manage bower cache]" \ - "help[Display help information about Bower]" \ - "home[Opens a package homepage into your favorite browser]" \ - "info[Info of a particular package]" \ - "init[Interactively create a bower.json file]" \ - "install[Install a package locally]" \ - "link[Symlink a package folder]" \ - "list[List local packages - and possible updates]" \ - "login[Authenticate with GitHub and store credentials]" \ - "lookup[Look up a package URL by name]" \ - "prune[Removes local extraneous packages]" \ - "register[Register a package]" \ - "search[Search for a package by name]" \ - "update[Update a local package]" \ - "uninstall[Remove a local package]" \ - "unregister[Remove a package from the registry]" \ - "version[Bump a package version]" + "cache[manage bower cache]" \ + "help[display help information about Bower]" \ + "home[opens a package homepage into your favorite browser]" \ + "info[info of a particular package]" \ + "init[interactively create a bower.json file]" \ + "install[install a package locally]" \ + "link[symlink a package folder]" \ + "list[list local packages - and possible updates]" \ + "login[authenticate with GitHub and store credentials]" \ + "lookup[look up a package URL by name]" \ + "prune[removes local extraneous packages]" \ + "register[register a package]" \ + "search[search for a package by name]" \ + "update[update a local package]" \ + "uninstall[remove a local package]" \ + "unregister[remove a package from the registry]" \ + "version[bump a package version]" && ret=0 _arguments \ - '(--force)--force[Makes various commands more forceful]' \ - '(--json)--json[Output consumable JSON]' \ - '(--log-level)--log-level[What level of logs to report]' \ - '(--offline)--offline[Do not hit the network]' \ - '(--quiet)--quiet[Only output important information]' \ - '(--silent)--silent[Do not output anything, besides errors]' \ - '(--verbose)--verbose[Makes output more verbose]' \ - '(--allow-root)--allow-root[Allows running commands as root]' \ - '(--version)--version[Output Bower version]' \ - '(--no-color)--no-color[Disable colors]' - ret=0 + '(--force)--force[make various commands more forceful]' \ + '(--json)--json[output consumable JSON]' \ + '(--log-level)--log-level[what level of logs to report]' \ + "(--offline)--offline[don't hit the network]" \ + '(--quiet)--quiet[only output important information]' \ + "(--silent)--silent[don't output anything, besides errors]" \ + '(--verbose)--verbose[make output more verbose]' \ + '(--allow-root)--allow-root[allow running commands as root]' \ + '(--version)--version[output Bower version]' \ + '(--no-color)--no-color[disable colors]' && ret=0 ;; args) case $line[1] in @@ -98,54 +97,46 @@ case $state in 'update' \ 'uninstall' \ 'unregister' \ - 'version' - ret=0 + 'version' && ret=0 ;; (home|info|init|link|lookup|prune|register|search|unregister) _arguments \ - '(--help)--help[Show help message]' - ret=0 + '(--help)--help[show help message]' && ret=0 ;; install) _arguments \ - '(--force-latest)--force-latest[Force latest version on conflict]' \ - '(--help)--help[Show help message]' \ - '(--production)--production[Do not install project devDependencies]' \ - '(--save)--save[Save installed packages into the project''s bower.json dependencies]' \ - '(--save-dev)--save-dev[Save installed packages into the project''s bower.json devDependencies]' - ret=0 + '(--force-latest)--force-latest[force latest version on conflict]' \ + '(--help)--help[show help message]' \ + "(--production)--production[don't install project devDependencies]" \ + "(--save)--save[save installed packages into the project's bower.json dependencies]" \ + "(--save-dev)--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0 ;; list) _arguments \ - '(--help)--help[Show help message]' \ - '(--paths)--paths[Generate a simple JSON source mapping]' \ - '(--relative)--relative[Make paths relative to the directory config property, which defaults to bower_components]' - ret=0 + '(--help)--help[show help message]' \ + '(--paths)--paths[generate a simple JSON source mapping]' \ + '(--relative)--relative[make paths relative to the directory config property, which defaults to bower_components]' && ret=0 ;; login) _arguments \ - '(--help)--help[Show help message]' \ - '(-t --token)'{-t,--token}'[Pass GitHub auth token (will not prompt for username/password)]' - ret=0 + '(--help)--help[show help message]' \ + '(-t --token)'{-t,--token}'[Pass GitHub auth token (will not prompt for username/password)]' && ret=0 ;; uninstall) _arguments \ - '(--help)--help[Show help message]' \ - '(--save)--save[Save installed packages into th projects''s bower.json dependencies]' \ - '(--save-dev)--save-dev[Save installed packages into th projects''s bower.json devDependencies]' - ret=0 + '(--help)--help[show help message]' \ + "(--save)--save[save installed packages into the project's bower.json dependencies]" \ + "(--save-dev)--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0 ;; update) _arguments \ - '(--force-latest)--force-latest[Force latest version on conflict]' \ - '(--help)--help[Show help message]' \ - '(--production)--production[Do not install project devDependencies]' - ret=0 + '(--force-latest)--force-latest[force latest version on conflict]' \ + '(--help)--help[show help message]' \ + "(--production)--production[don't install project devDependencies]" && ret=0 ;; version) _arguments \ - '(--message)--message[Custom git commit and tag message]' - ret=0 + '(--message)--message[custom git commit and tag message]' && ret=0 ;; exec) _normal && ret=0 @@ -154,7 +145,7 @@ case $state in _opts=( $(bower help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') ) _opts+=( $(bower help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') ) if [[ $_opts != "" ]]; then - _values 'options' $_opts && ret=0 + _values 'option' $_opts && ret=0 fi ;; esac diff --git a/.zprezto/modules/completion/external/src/_caffeinate b/.zprezto/modules/completion/external/src/_caffeinate index 5f1e6a7..afcd569 100644 --- a/.zprezto/modules/completion/external/src/_caffeinate +++ b/.zprezto/modules/completion/external/src/_caffeinate @@ -28,7 +28,7 @@ # Description # ----------- # -# Completion script for the OSX 'caffeinate' tool (man 8 caffeinate). +# Completion script for the macOS 'caffeinate' tool (man 8 caffeinate). # # ------------------------------------------------------------------------- # Authors diff --git a/.zprezto/modules/completion/external/src/_ccache b/.zprezto/modules/completion/external/src/_ccache new file mode 100644 index 0000000..8bb33a2 --- /dev/null +++ b/.zprezto/modules/completion/external/src/_ccache @@ -0,0 +1,325 @@ +#compdef ccache -P -value-,CCACHE_*,-default- + +# zsh completion script for ccache + +# Copyright 2018 CERN for the benefit of the LHCb Collaboration. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# * Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# In applying this licence, CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +# allow users to define their better compilers +# inspired by _cmake_compilers +# users could override with +# +# _ccache_compilers() { +# local -a _ccache_compilers +# _ccache_compilers=(gcc g++ clang clang++) +# _wanted compilers expl "compiler" compadd -- $_ccache_compilers +# } +(( $+functions[_ccache_compilers] )) || +_ccache_compilers() { + _command_names -e +} + +_ccache_booleans() { + _message 'There are no "false" values, unset variable to disable' + local description; description=${1:-boolean} + local booleans; booleans=( + 'true' + 'yes' + ) + _describe -t booeans "$description" booleans +} + +(( $+functions[_ccache_compressionlevels] )) || +_ccache_compressionlevels() { + local -a one_nine + one_nine=(1 2 3 4 5 6 7 8 9) + _describe -t onetonine "compression level (if using compression)" one_nine +} + +(( $+functions[_ccache_sloppiness] )) || +_ccache_sloppiness() { + _values -s ',' \ + "file_macro[ignore __FILE__]" \ + "file_stat_matches[rely on mtimes and ctimes]" \ + "include_file_ctime[ignore headers' ctime too new]" \ + "include_file_mtime[ignore headers' mtime too new]" \ + "no_system_headers[exclude system headers from cache]" \ + "pch_defines[be sloppy about #defines in pch]" \ + "time_macros[ignore __date__ and __time__]" +} + +(( $+functions[_ccache_compilerchecks] )) || +_ccache_compilerchecks() { + local -a compiler_check_values + compiler_check_values=( + 'content: the actual compiler binary' + 'mtime: mtime and size of the compiler' + 'none: ignore compiler for hashing' + 'string\:: any hard coded string (pre-computed version)' + '%compiler%\ -v:any compiler invocation output' + ) + _describe -t compilerchecks "compiler information included in the hash" compiler_check_values +} + +(( $+functions[_ccache_dirlevels] )) || +_ccache_dirlevels() { + local -a one_eight + one_eight=(1 2 3 4 5 6 7 8) + _describe -t onetoeight "directory levels in the cache directory" one_eight +} + +if [[ "$service" = -value-* ]]; then + case $service in + *CCACHE_*DIR*) + # CCACHE_BASEDIR: relative to which top level paths are hashed + # CCACHE_DIR: where the cache and config are kept + # CCACHE_TEMPDIR: where temporary files are kept + # all: a single path + _path_files -/ + ;; + *CCACHE_NLEVELS*) + _ccache_dirlevels + ;; + *CCACHE_CC*) + _ccache_compilers + ;; + *CCACHE_COMPILERCHECK*) + _ccache_compilerchecks + ;; + *CCACHE_*COMPRESS*) + _ccache_booleans "write compressed cache" + ;; + *CCACHE_COMPRESSLEVEL*) + _ccache_compressionlevels + ;; + *CCACHE_EXTENSION*) + _alternative ':set extension for intermediate files: ' + ;; + *CCACHE_*DIRECT*) + _ccache_booleans "use direct mode" + ;; + *CCACHE_*DISABLE*) + _ccache_booleans "disable cache usage" + ;; + *CCACHE_EXTRAFILES*) + local sep=: + compset -P "*${sep}" + compset -S "${sep}*" || suf="$sep" + + _files "" -r "${sep}"' /\t\t\-' "$@" + ;; + *CCACHE_*HARDLINK*) + _ccache_booleans "create hard links rather than copies" + ;; + *CCACHE_*HASHDIR*) + _ccache_booleans "include the cwd in the hash" + ;; + *CCACHE_IGNOREHEADERS*) + _dir_list + ;; + *CCACHE_*COMMENTS*) + _ccache_booleans "consider comments in hashing" + ;; + *CCACHE_LIMIT_MULTIPLE*) + _alternative ":clean up down to level (e.g. 0.8): " + ;; + *CCACHE_LOGFILE*) + _path_files -g "*(/) *.log" + ;; + *CCACHE_MAXFILES*) + _alternative ":maximum number of files in the cache (0= no limit): " + ;; + *CCACHE_MAXSIZE*) + _alternative ':maximum cache size (0= no limit) with suffix k,M,G,T or Ki,Mi,Gi,Ti: ' + ;; + *CCACHE_PATH*) + _alternative ':PATH for compiler lookup (instead of $PATH):_dir_list' + ;; + *CCACHE_PREFIX*) + _alternative ':prefixes for compiler invokation: ' + ;; + *CCACHE_PREFIX_CPP*) + _alternative ':prefixes for preprocessor invokation: ' + ;; + *CCACHE_*READONLY*) + _ccache_booleans "treat cache as read-only" + ;; + *CCACHE_*READONLY_DIRECT*) + _ccache_booleans "retrieve from read-only cache in direct mode" + ;; + *CCACHE_*RECACHE*) + _ccache_booleans "use cache in write-only mode" + ;; + *CCACHE_*CPP2*) + _ccache_booleans "pass originial rather than preprocessed source code to compiler" + ;; + *CCACHE_SLOPPINESS*) + _ccache_sloppiness + ;; + *CCACHE_*STATS*) + _ccache_booleans "update statistics counters" + ;; + *CCACHE_UMASK*) + _alternative ":umask value (octal): " + ;; + *CCACHE_*UNIFY*) + _ccache_booleans "normalise sources prior to processing" + ;; + esac + + return +fi + +__ccache_config_keys() { + local -a keys + keys=( + 'compression:write compressed cache' + 'direct_mode:use direct mode' + 'disable:disable cache usage' + 'hard_link:create hard links rather than copies' + 'hash_dir:include the cwd in the hash' + 'keep_comments_cpp:consider comments in hashing' + 'read_only:treat cache as read-only' + 'read_only_direct:retrieve from read-only cache in direct mode' + 'recache:use cache in write-only mode' + 'run_second_cpp:pass originial rather than preprocessed source code to compiler' + 'stats:update statistics counters' + 'unify:normalise sources prior to processing' + 'base_dir:specify relative to which top level paths are hashed' + 'temporary_dir:specify where temporary files are kept' + 'cache_dir:specify where the cache is kept' + 'compiler:specify compiler' + 'cache_dir_levels:directory levels in the cache directory' + 'compiler_check:compiler information included in the hash' + 'compression_level:cache compression level' + 'cpp_extension:set extensions for intermediate files' + 'extra_files_to_hash:additional files to consider in hashing' + 'ignore_headers_in_manifest:set paths to headers to ignore in hashing' + 'limit_multiple:cleanup level' + 'log_file:specify a log file' + 'max_files:maximum number of files in the cache' + 'max_size:maximum size of the cache' + 'path:PATH for compiler lookup (instead of $PATH)' + 'prefix_command:prefixes for compiler invokation' + 'prefix_command_cpp:prefixes for preprocessor invokation' + 'sloppiness:hash files sloppy' + 'umask:set umask for ccache and child processes (e.g. for sharing cache)' + ) + _describe -t configkeys "configuration keys" keys -S '=' +} + +if compset -P '--set-config=*='; then + case $IPREFIX in + *=compression= | *=direct_mode= | *=disable= | *=hard_link= | *=hash_dir= | *=keep_comments_cpp= | *=read_only= | *=read_only_direct= | *=recache= | *=run_second_cpp= | *=stats= | *=unify= ) + local booleans; booleans=( + 'true' + 'false' + ) + _describe -t booleans 'boolean' booleans + ;; + *=base_dir= | *=temporary_dir= | *=cache_dir=) + _path_files -/ + ;; + *=compiler=) + _ccache_compilers + ;; + *=cache_dir_levels=) + _ccache_dirlevels + ;; + *=compiler_check=) + _ccache_compilerchecks + ;; + *=compression_level=) + _ccache_compressionlevels + ;; + *=cpp_extension=) + _alternative ':set extension for intermediate files: ' + ;; + *=extra_files_to_hash=) + local sep=: + compset -P "*${sep}" + compset -S "${sep}*" || suf="$sep" + + _files "" -r "${sep}"' /\t\t\-' "$@" + ;; + *=ignore_headers_in_manifest=) + _dir_list + ;; + *=limit_multiple=) + _alternative ":clean up down to level (e.g. 0.8): " + ;; + *=log_file=) + _path_files -g "*(/) *.log" + ;; + *=max_files=) + _alternative ":maximum number of files in the cache (0= no limit): " + ;; + *=max_size=) + _alternative ':maximum cache size (0= no limit) with suffix k,M,G,T or Ki,Mi,Gi,Ti: ' + ;; + *=path=) + _alternative ':PATH for compiler lookup (instead of $PATH):_dir_list' + ;; + *=prefix_command=) + _alternative ':prefixes for compiler invokation: ' + ;; + *=prefix_command_cpp=) + _alternative ':prefixes for preprocessor invokation: ' + ;; + *=sloppiness=) + _ccache_sloppiness + ;; + *=umask=) + _alternative ":umask value (octal): " + ;; + esac +elif [[ $words[2] == -* ]]; then + # if the first argument starts with -, we are in configure-ccache mode + _arguments \ + '*'{-o,--set-config=}"[set configuration key]:keys:__ccache_config_keys" \ + '(: -)'{-h,--help}'[show help message]' \ + '(: -)'{-V,--version}'[print version and copyright information]' \ + '(-z --zero-stats)'{-z,--zero-stats}'[zero statistics counters]' \ + '(-c --cleanup)'{-c,--cleanup}'[delete old files and recalculate size counters]' \ + '(-C --clear)'{-C,--clear}'[clear the cache completely (except configuration)]' \ + '(-p --print-config)'{-p,--print-config}'[print current configuration options]' \ + '(-s --show-stats)'{-s,--show-stats}'[show statistics summary]' \ + '(-F --max-files=)'{-F,--max-files=}'[set maximum number of files in cache]:number of files in cache: ' \ + '(-M --max-size=)'{-M,--max-size=}'[set maximum size of cache]:cache size: ' +elif [[ $CURRENT -eq 2 ]]; then + _ccache_compilers +else + # the command line already looks like 'ccache ...' + # forward to the completion function of the compiler + (( CURRENT-- )) + shift words + _normal +fi diff --git a/.zprezto/modules/completion/external/src/_chromium b/.zprezto/modules/completion/external/src/_chromium new file mode 100644 index 0000000..917739b --- /dev/null +++ b/.zprezto/modules/completion/external/src/_chromium @@ -0,0 +1,211 @@ +#compdef chromium + +# Copyright 2018 CERN for the benefit of the LHCb Collaboration + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of CERN nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# In applying this licence, CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +_arguments \ + "--user-data-dir=[Specify the directory that user data is kept in]:directory:_path_files -/" \ + "--app=[Runs URL in app mode]:url:_urls" \ + "--incognito[Open in incognito mode]" \ + "--new-window[open in new window]" \ + "(--no-proxy-server --proxy-auto-detect --proxy-pac-url --password-store)--proxy-server=[specify proxy server]:[\://][\:]:_chromium_proxyurls" \ + "--no-proxy-server[Disables the proxy server]" \ + "--proxy-auto-detect[Autodetect proxy configuration]" \ + "--proxy-pac-url=[Specify proxy autoconfiguration URL]:proxy autoconfiguration url:_urls" \ + "--password-store=[Set the password store to use]:password store: _wanted arguments expl 'wallet store' compadd -- basic gnome kwallet" \ + "--version[print version]" \ + "*:: :{ _alternative _urls _files }" + +# excerpt from the chromium help message: +# +# Specify the HTTP/SOCKS4/SOCKS5 proxy server to use for requests. This overrides any environment variables or settings picked via the options dialog. An individual proxy server is specified +# using the format: +# +# +# +# Where is the protocol of the proxy server, and is one of: +# +# "http", "socks", "socks4", "socks5". +# +# If the is omitted, it defaults to "http". Also note that "socks" is equivalent to "socks5". +# +# Examples: +# +# --proxy-server="foopy:99" +# Use the HTTP proxy "foopy:99" to load all URLs. +# +# --proxy-server="socks://foobar:1080" +# Use the SOCKS v5 proxy "foobar:1080" to load all URLs. +# +# --proxy-server="socks4://foobar:1080" +# Use the SOCKS v4 proxy "foobar:1080" to load all URLs. +# +# --proxy-server="socks5://foobar:66" +# Use the SOCKS v5 proxy "foobar:66" to load all URLs. +# +# It is also possible to specify a separate proxy server for different URL types, by prefixing the proxy server specifier with a URL specifier: +# +# Example: +# +# --proxy-server="https=proxy1:80;http=socks4://baz:1080" +# Load https://* URLs using the HTTP proxy "proxy1:80". And load http://* +# URLs using the SOCKS v4 proxy "baz:1080". +# + +_chromium_proxyurls () { + #TODO: semicolon separated urls not yet implemented + # mostly copied from _urls + local ipre scheme host user uhosts ret=1 expl match glob suf + local localhttp + zstyle -a ":completion:${curcontext}:urls" local localhttp + local localhttp_servername="$localhttp[1]" + local localhttp_documentroot="$localhttp[2]" + local localhttp_userdir="$localhttp[3]" + zstyle -a ":completion:${curcontext}:urls" urls urls + if [[ $#urls -gt 1 || ( $#urls -eq 1 && ! -d $urls[1] ) ]] + then + [[ $#urls -eq 1 && -f $urls[1] ]] && urls=($(< $urls[1])) + _wanted urls expl 'URL' compadd "$@" -a urls && return 0 + urls=() + fi + urls="$urls[1]" + glob=(-g '*(^/)') + zparseopts -D -K -E 'g:=glob' + ipre="$IPREFIX" + if ! compset -P '(#b)([-+.a-z0-9]#):' + then + _tags -C argument prefixes + while _tags + do + while _next_label prefixes expl 'URL prefix' -S '' "$@" + do + compset -S '[^:/]*' && compstate[to_end]='' + compadd "$expl[@]" http:// socks:// socks4:// socks5:// && ret=0 + done + (( ret )) || return 0 + done + return 1 + fi + scheme="$match[1]" + case "$scheme" in + (http(|s)|socks(|4|5)) if ! compset -P // + then + _wanted -C "$scheme" prefixes expl 'end of prefix' compadd -S '' "$@" // + return + fi ;; + (file) [[ -prefix //(127.0.0.1|localhost)/ ]] && compset -P '//(127.0.0.1|localhost)' + [[ -prefix /// ]] && compset -P // + if ! compset -P // + then + _tags -C file files + while _tags + do + while _next_label files expl 'local file' + do + if [[ -prefix / ]] + then + _path_files "$expl[@]" -S '' "${glob[@]}" && ret=0 + _path_files "$expl[@]" -S/ -r '/' -/ && ret=0 + elif [[ -z "$PREFIX" ]] + then + compadd -S '/' -r '/' "$expl[@]" "$@" - "${PWD%/}" && ret=0 + fi + done + (( ret )) || return 0 + done + return 1 + fi ;; + esac + if ! compset -P '(#b)([^:/]#)([:/])' + then + uhosts=($urls/$scheme/$PREFIX*$SUFFIX(/:t)) + _tags hosts + while _tags + do + while _next_label hosts expl host + do + compset -S '[:/]*' || suf="/" + (( $#uhosts )) || _hosts -S "$suf" -r '/:' "$expl[@]" && ret=0 + [[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername) + compadd -S "$suf" -r '/:' "$expl[@]" -a uhosts && ret=0 + done + (( ret )) || return 0 + done + return 1 + fi + host="$match[1]" + [[ $match[2] = ':' ]] && ! compset -P '<->/' && _message -e ports 'port number' && return 0 + _tags remote-files files || return 1 + if [[ "$localhttp_servername" = "$host" ]] + then + if compset -P \~ + then + if ! compset -P '(#b)([^/]#)/' + then + _users -S/ "$@" + return + fi + user="$match[1]" + while _tags + do + while _next_label files expl 'local file' + do + _path_files "$expl[@]" "$@" -W ~$user/$localhttp_userdir "${glob[@]}" && ret=0 + _path_files -S/ -r '/' "$expl[@]" -W ~$user/$localhttp_userdir-/ && ret=0 + done + (( ret )) || return 0 + done + else + while _tags + do + while _next_label files expl 'local file' + do + _path_files "$expl[@]" "$@" -W $localhttp_documentroot "${glob[@]}" && ret=0 + _path_files -S/ -r '/' "$expl[@]" -W $localhttp_documentroot -/ && ret=0 + done + (( ret )) || return 0 + done + fi + else + while _tags + do + (( $#urls )) && while _next_label files expl 'local file' + do + _path_files "$expl[@]" "$@" -W $urls/$scheme/$host "${glob[@]}" && ret=0 + _path_files -S/ -r '/' "$expl[@]" -W $urls/$scheme/$host -/ && ret=0 + done + [[ $scheme = (scp|sftp) ]] && _requested remote-files && _remote_files -h $host -- ssh && ret=0 + (( ret )) || return 0 + done + fi + return $ret +} diff --git a/.zprezto/modules/completion/external/src/_cmake b/.zprezto/modules/completion/external/src/_cmake index 240c7ea..55efa73 100644 --- a/.zprezto/modules/completion/external/src/_cmake +++ b/.zprezto/modules/completion/external/src/_cmake @@ -1,6 +1,6 @@ #compdef cmake # ------------------------------------------------------------------------------ -# Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users +# Copyright (c) 2017 Github zsh-users - http://github.com/zsh-users # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -35,7 +35,7 @@ # ------- # # * Scott M. Kroll (initial version) -# * Paul Seyfert (handling of --build) +# * Paul Seyfert (handling of --build and updates) # # ------------------------------------------------------------------------- # Notes @@ -78,9 +78,15 @@ local cmake_build_options;cmake_build_options=( # ------------------------ # _cmake_generator_options +# +# arguments are $1: build working directory (top level Makefile or build.ninja file) +# $2: position of "--" in the command line # ------------------------ (( $+functions[_cmake_generator_options] )) || _cmake_generator_options() { + # pass only the part of the command line starting at "--" to the completion + shift (( $2 - 1 )) words + (( CURRENT = $CURRENT + 1 - $2 )) if [ -f $1/Makefile ] then $_comps[make] @@ -116,6 +122,10 @@ _cmake_targets() { _describe 'build targets' targets } +_cmake_suggest_builddirs() { + _alternative ':current directory:(.)' 'directory::_directories' && return 0 +} + _cmake_on_build() { local build_extras;build_extras=( '--[Native build tool options]' @@ -130,14 +140,14 @@ _cmake_on_build() { (( i++ )) done inbuild=false - nativemode=false + dashdashposition=-1 for ((i = (($CURRENT - 1)); i > 1 ; i--)); do if [[ $words[$i] == --build ]] ; then inbuild=true buildat=$i (( difference = $CURRENT - $i )) elif [[ $words[$i] == -- ]] ; then - nativemode=true + dashdashposition=$i fi done # check if build mode has been left @@ -149,18 +159,16 @@ _cmake_on_build() { if [[ $words[(($i - 1))] == --config ]] ; then continue ; fi outofbuild=true done - if [ "$nativemode" = true ] ; then - _cmake_generator_options $words[(($buildat + 1))] && return 0 + if (( $dashdashposition > 0 )) ; then + _cmake_generator_options $words[(($buildat + 1))] $dashdashposition && return 0 fi - if [ "$inbuild" = false ] ; then + if [[ "$inbuild" == false || "$difference" -eq 1 ]] ; then + # either there is no --build or completing the directory after --build _arguments -C -s \ - build_opts \ "$cmake_build_options[@]" \ - build_cmds \ "$cmake_suggest_build[@]" && return 0 - elif [ $difference -eq 1 ] ; then - # directly after --build comes the build directory - _alternative ':current directory:(.)' 'directory::_directories' && return 0 elif [[ $words[(($CURRENT - 1))] == --target ]] ; then # after --build --target, suggest targets _cmake_targets $words[(($buildat + 1))] && return 0 @@ -291,6 +299,9 @@ _cmake_define_lang_property_names() { "CMAKE_${cmake_lang}_FLAGS_RELEASE:${cmake_lang_desc} compiler flags for all Relase build" "CMAKE_${cmake_lang}_FLAGS_MINSIZREL:${cmake_lang_desc} compiler flags for all MinSizRel build" "CMAKE_${cmake_lang}_FLAGS_RELWITHDEBINFO:${cmake_lang_desc} compiler flags for all RelWithDebInfo build" + "CMAKE_${cmake_lang}_STANDARD:${cmake_lang_desc} language standard" + "CMAKE_${cmake_lang}_STANDARD_REQUIRED:${cmake_lang_desc} language standard is required" + "CMAKE_${cmake_lang}_EXTENSIONS:${cmake_lang_desc} enable compiler specific extensions" ) _describe -t "${cmake_lang//:/-}-property-names" "${cmake_lang_desc} property name" properties $@[0,-3] && return 0 @@ -302,12 +313,15 @@ _cmake_define_lang_property_names() { (( $+functions[_cmake_define_common_property_names] )) || _cmake_define_common_property_names() { local properties; properties=( - 'CMAKE_MODULE_PATH:Search path for cmake modules' + 'CMAKE_MODULE_PATH:Search path for cmake modules (FindPROJECT.cmake)' + 'CMAKE_PREFIX_PATH:Search path for installations (PROJECTConfig.cmake)' 'CMAKE_BUILD_TYPE:Specifies the build type for make based generators' 'CMAKE_TOOLCHAIN_FILE:Absolute or relative path to a cmake script which sets up toolchain related variables' 'CMAKE_COLOR_MAKEFILE:Enables/disables color output when using the Makefile generator' 'CMAKE_INSTALL_PREFIX:Install directory used by install' 'CMAKE_EXPORT_COMPILE_COMMANDS:Enable/disable output of compilation database during generation' + 'CMAKE_RULE_MESSAGES:Specify whether to report a message for each make rule' + 'CMAKE_VERBOSE_MAKEFILE:Enable verbose output from Makefile builds' ) _describe -t 'common-property-names' 'common property name' properties $@ @@ -322,12 +336,18 @@ _cmake_define_property_values() { setopt localoptions extendedglob case $@[-1] in (CMAKE_BUILD_TYPE) _wanted build-types expl 'build type' _cmake_build_types && ret=0;; + (CMAKE_CXX_STANDARD) _wanted cxx-standards expl 'cxx standard' _cmake_cxx_standars && ret=0;; + (CMAKE_C_STANDARD) _wanted c-standards expl 'c standard' _cmake_c_standars && ret=0;; (CMAKE_TOOLCHAIN_FILE) _wanted toolchain-files expl 'file' _cmake_toolchain_files && ret=0;; (CMAKE_COLOR_MAKEFILE) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;; + (CMAKE_RULE_MESSAGES) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;; + (CMAKE_VERBOSE_MAKEFILE) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;; (CMAKE_INSTALL_PREFIX) _files -/ && ret=0;; (CMAKE_EXPORT_COMPILE_COMMANDS) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;; (CMAKE_*_COMPILER) _wanted compilers expl 'compiler' _cmake_compilers && ret=0;; - (CMAKE_*_FLAGS(|_?*)) _message -e compiler-flags 'compiler flags' && ret=0;; + (CMAKE_*_FLAGS(|_?*)) _message -e compiler-flags 'compiler flags' && _dispatch $service -value-,CPPFLAGS,-default- && ret=0;; + (CMAKE_*_STANDARD_REQUIRED) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;; + (CMAKE_*_EXTENSIONS) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;; (*) _files && ret=0;; esac @@ -348,6 +368,33 @@ _cmake_build_types() { _values 'build type' ${build_types[@]} } +# ------------------- +# _cmake_c_standars +# ------------------- +(( $+functions[_cmake_c_standars] )) || +_cmake_c_standars() { + local c_standards; c_standards=( + '90' + '99' + '11' + ) + _values 'c standard' ${c_standards[@]} +} + +# ------------------- +# _cmake_cxx_standars +# ------------------- +(( $+functions[_cmake_cxx_standars] )) || +_cmake_cxx_standars() { + local cxx_standards; cxx_standards=( + '98' + '11' + '14' + '17' + ) + _values 'cxx standard' ${cxx_standards[@]} +} + # ----------------- # _cmake_generators # ----------------- @@ -405,7 +452,7 @@ _cmake_command() { } local cmake_suggest_build;cmake_suggest_build=( - '--build[build]' + '--build[build]:build dir:_cmake_suggest_builddirs' ) if [ $CURRENT -eq 2 ] ; then diff --git a/.zprezto/modules/completion/external/src/_conan b/.zprezto/modules/completion/external/src/_conan new file mode 100644 index 0000000..dd56b87 --- /dev/null +++ b/.zprezto/modules/completion/external/src/_conan @@ -0,0 +1,626 @@ +#compdef conan +# ------------------------------------------------------------------------------ +# Copyright (c) 2010-2017 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for conan 0.28.1 (https://www.conan.io). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Julien Nicoulaud +# +# ------------------------------------------------------------------------------ + + +_conan() { + + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(- : *)'{-v,--version}'[display version information]' \ + '(-h --help)1: :_conan_commands' \ + '(-h --help)*:: :->command_args' + + case $state in + command_args) + (( $+functions[_conan_${words[1]}_args] )) && _conan_${words[1]}_args + ;; + esac +} + +(( $+functions[_conan_commands] )) || +_conan_commands() { + local consumer_commands creator_commands package_development_commands misc_commands deprecated_commands + consumer_commands=( + 'install:installs the requirements specified in a "conanfile.py" or "conanfile.txt"' + 'config:manages conan configuration information' + 'get:gets a file or list a directory of a given reference or package' + 'info:prints information about a package recipe'\''s dependency graph' + 'search:search package recipes and binaries in the local cache or in a remote server' + ) + creator_commands=( + 'new:creates a new package recipe template with a '\''conanfile.py'\''' + 'create:export, build package and test it with a consumer project' + 'upload:uploads a package recipe and the generated binary packages to a specified remote' + 'export:copies the package recipe (conanfile.py and associated files) to your local cache' + 'export-pkg:exports a recipe & creates a package with given files calling '\''package'\''' + 'test:runs a test-folder/conanfile.py to test an existing package' + ) + package_development_commands=( + 'source:calls your conanfile.py "source()" method to configure the source directory' + 'build:utility command to run your current project "conanfile.py" build() method' + 'package:calls your conanfile.py "package" method for a specific package recipe' + ) + misc_commands=( + 'profile:list profiles in the ".conan/profiles" folder, or show profile details' + 'remote:handles the remote list and the package recipes associated to a remote' + 'user:update your cached user name (and auth token) to avoid it being requested later' + 'imports:execute the "imports" stage of a conanfile.txt or a conanfile.py' + 'copy:copy conan recipes and packages to another user/channel.' + 'remove:remove any package recipe or binary matching a pattern' + 'alias:creates and export an alias recipe' + ) + _describe -t 'consumer-commands' "consumer commands" consumer_commands + _describe -t 'creator-commands' "creator commands" creator_commands + _describe -t 'package-development-commands' "package development commands" package_development_commands + _describe -t 'misc-commands' "misc commands" misc_commands +} + +(( $+functions[_conan_alias_args] )) || +_conan_alias_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1:alias reference:_conan_package_references' \ + '(-h --help)2:target reference:_conan_package_references' +} + +(( $+functions[_conan_build_args] )) || +_conan_build_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + "(-h --help -f --file)"{-f,--file}'[specify conanfile filename]: :_conan_conanfiles' \ + "(-h --help -sf --source-folder)"{-sf,--source-folder}'[local folder containing the sources. Defaulted to the directory of the conanfile. A relative path can also be specified (relative to the current directory)]: :_files -/' \ + "(-h --help -bf --build-folder)"{-bf,--build-folder}'[build folder, working directory of the build process. Defaulted to the current directory. A relative path can also be specified (relative to the current directory)]: :_files -/' \ + "(-h --help -pf --package-folder)"{-pf,--package-folder}'[folder to install the package (when the build system or build() method does it). Defaulted to the '\''{build_folder}/package'\'' folder. A relative path can be specified, relative to the current folder. Also an absolute path is allowed.]: :_files -/' \ + "(-h --help -if --install-folder)"{-if,--install-folder}'[local folder containing the conaninfo.txt and conanbuildinfo.txt files (from a previous conan install execution). Defaulted to --build-folder]: :_files -/' \ + '(-h --help)1: :_conan_conanfiles' +} + +(( $+functions[_conan_config_args] )) || +_conan_config_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_config_commands' \ + '(-h --help)*:: :->command_args' + + case $state in + command_args) + (( $+functions[_conan_config_${words[1]}_args] )) && _conan_config_${words[1]}_args + ;; + esac +} + +(( $+functions[_conan_config_commands] )) || +_conan_config_commands() { + local commands + commands=( + 'rm:rm an existing config element' + 'set:set/add value' + 'get:get the value of existing element' + 'install:install a full configuration from a zip file, local or remote' + ) + _describe -t 'commands' "command" commands +} + +(( $+functions[_conan_config_rm_args] )) || +_conan_config_rm_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_config_keys' +} + +(( $+functions[_conan_config_get_args] )) || +_conan_config_get_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_config_keys' +} + +(( $+functions[_conan_config_set_args] )) || +_conan_config_set_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_config_set_key_values' +} + +(( $+functions[_conan_config_set_key_values] )) || +_conan_config_set_key_values() { + local ret=1 + if compset -P '*='; then + _wanted property-values expl 'config value' _conan_config_values ${IPREFIX%=} && ret=0 + else + _wanted property-names expl 'config key' _conan_config_keys -qS= && ret=0 + fi + return ret +} + +(( $+functions[_conan_config_install_args] )) || +_conan_config_install_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1:config file:_files' +} + +(( $+functions[_conan_copy_args] )) || +_conan_copy_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + "(-h --help --all -p --package)"{-p,--package}'[copy specified package ID]:package reference:_conan_package_references' \ + '(-h --help --all -p --package)--all[copy all packages from the specified package recipe]' \ + '(-h --help --force)--force[override destination packages and the package recipe]' \ + '(-h --help)1: :_conan_package_references' \ + '(-h --help)2: :_conan_user_channels' +} + +(( $+functions[_conan_export_args] )) || +_conan_export_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help -p --path)'{-p,--path}'[folder with a conanfile.py (default current directory)]: :_files -/' \ + '(-h --help -k --keep-source)'{-k,--keep-source}'[do not remove the source folder in the local cache]' \ + '(-h --help -f --file)'{-f,--file}'[specify conanfile filename]: :_conan_conanfiles' \ + '(-h --help)1: :_conan_channel_or_package_references' +} + +(( $+functions[_conan_get_args] )) || +_conan_get_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + "(-h --help -p --package)"{-p,--package}'[package ID]: :_conan_package_references' \ + '(-h --help -r --remote)'{-r,--remote}'[get from this specific remote]: :_conan_remotes' \ + '(-h --help -raw --raw)'{-raw,--raw}'[do not decorate the text]' \ + '(-h --help)1: :_conan_package_references' \ + '(-h --help)2:file or directory path:_files' +} + +(( $+functions[_conan_imports_args] )) || +_conan_imports_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help -f --file)'{-f,--file}'[use another filename]: :_conan_conanfiles' \ + '(-h --help -imf --import-folder)'{-imf,--import-folder}'[directory to copy the artifacts to. By default it will be the current directory]: :_files -/' \ + '(-h --help -if --install-folder)'{-if,--install-folder}'[local folder containing the conaninfo.txt and conanbuildinfo.txt files (from a previous conan install execution)]: :_files -/' \ + '(-h --help -u --undo)'{-u,--undo}'[undo imports (remove imported files)]' \ + '(-h --help)1: :_conan_directory_or_package_references' +} + +(( $+functions[_conan_info_args] )) || +_conan_info_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help -f --file)'{-f,--file}'[specify conanfile filename]: :_conan_conanfiles' \ + '(-h --help -n --only)'{-n,--only}'[filter fields]: :_conan_info_only_values' \ + '(-h --help --paths)--paths[show package paths in local cache]' \ + '(-h --help --package-filter)--package-filter[print information only for packages that match the filtere.g., MyPackage/1.2@user/channel or MyPackage*]: :_conan_package_references' \ + '(-h --help -bo --build_order)'{-bo,--build_order}'[given a modified reference, return an ordered list to build (CI)]' \ + '(-h --help -j --json)'{-j,--json}'[only with --build_order option, return the information in a json]: :_files -g "*.json"' \ + '(-h --help -g --graph)'{-g,--graph}'[creates file with project dependencies graph]: :_files -g "*.(dot|html)"' \ + '(-h --help -u --update)'{-u,--update}'[check updates exist from upstream remotes]' \ + '(-h --help -sc --scope)'{-sc,--scope}'[use the specified scope in the install command]: :_conan_scopes' \ + '(-h --help -pr --profile)'{-pr,--profile}'[apply the specified profile to the install command]: :_conan_profiles' \ + '(-h --help -r --remote)'{-r,--remote}'[look in the specified remote server]: :_conan_remotes' \ + '(-h --help)'{-o,--options}'[options to build the package, overwriting the defaults. e.g., -o with_qt=true]: :_conan_options' \ + '(-h --help)'{-s,--settings}'[settings to build the package, overwriting the defaults. e.g., -s compiler=gcc]: :_conan_settings' \ + '(-h --help)'{-e,--env}'[environment variables that will be set during the package build, -e CXX=/usr/bin/clang++]: :_conan_environment_variables' \ + '(-h --help -b --build)'{-b,--build}'[given a build policy (same install command "build" parameter), return an ordered list of packages that would be built from sources in install command (simulation)]: :_conan_build_policies' \ + '(-h --help)1: :_conan_conanfile_or_package_references' +} + +(( $+functions[_conan_info_only_values] )) || +_conan_info_only_values() { + local values + values=( + 'id:show only "id"' + 'build_id:show only "build_id"' + 'remote:show only "remote"' + 'url:show only "url"' + 'license:show only "license"' + 'requires:show only "requires"' + 'update:show only "update"' + 'required:show only "required"' + 'date:show only "date"' + 'author:show only "author"' + 'export_folder:use with --paths' + 'build_folder:use with --paths' + 'package_folder:use with --paths' + 'source_folder:use with --paths' + 'None:show only references' + ) + _describe -t 'values' "value" values +} + +(( $+functions[_conan_install_args] )) || +_conan_install_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help -f --file)'{-f,--file}'[specify conanfile filename]: :_conan_conanfiles' \ + '(-h --help -g --generator)'{-g,--generator}'[generators to use]: :_conan_generators' \ + '(-h --help --werror)--werror[error instead of warnings for graph inconsistencies]' \ + '(-h --help -if --install-folder)'{-if,--install-folder}'[Use this directory as the directory where to put the generatorfiles, conaninfo/conanbuildinfo.txt etc.]: :_files -/' \ + '(-h --help -m --manifests)'{-m,--manifests}'[install dependencies manifests in folder for later verify]: :_files -/' \ + '(-h --help -mi --manifests-interactive)'{-mi,--manifests-interactive}'[install dependencies dependencies manifests in folder for later verify]: :_files -/' \ + '(-h --help -v --verify)'{-v,--verify}'[verify dependencies manifests against stored ones]: :_files -/' \ + '(-h --help --no-imports)--no-imports[install specified packages but avoid running imports]' \ + '(-h --help -u --update)'{-u,--update}'[check updates exist from upstream remotes]' \ + '(-h --help -sc --scope)'{-sc,--scope}'[use the specified scope in the install command]: :_conan_scopes' \ + '(-h --help -pr --profile)'{-pr,--profile}'[apply the specified profile to the install command]: :_conan_profiles' \ + '(-h --help -r --remote)'{-r,--remote}'[look in the specified remote server]: :_conan_remotes' \ + '(-h --help)'{-o,--options}'[options to build the package, overwriting the defaults. e.g., -o with_qt=true]: :_conan_options' \ + '(-h --help)'{-s,--settings}'[settings to build the package, overwriting the defaults. e.g., -s compiler=gcc]: :_conan_settings' \ + '(-h --help)'{-e,--env}'[environment variables that will be set during the package build, -e CXX=/usr/bin/clang++]: :_conan_environment_variables' \ + '(-h --help -b --build)'{-b,--build}'[given a build policy (same install command "build" parameter), return an ordered list of packages that would be built from sources in install command (simulation)]: :_conan_build_policies' \ + '(-h --help)1: :_conan_conanfile' +} + +(( $+functions[_conan_new_args] )) || +_conan_new_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help -t --test)'{-t,--test}'[create test_package skeleton to test package]' \ + '(-h --help -i --header)'{-i,--header}'[create a headers only package template]' \ + '(-h --help -c --pure_c)'{-c,--pure_c}'[create a C language package only package, deleting "self.settings.compiler.libcxx" setting in the configure method]' \ + '(-h --help -s --sources)'{-s,--sources}'[create a package with embedded sources in "src" folder, using "exports_sources" instead of retrieving external code with the "source()" method]' \ + '(-h --help -b --bare)'{-b,--bare}'[create the minimum package recipe, without build() or package() methods. Useful in combination with "package_files" command]' \ + '(-h --help -cis --ci_shared)'{-cis,--ci_shared}'[package will have a "shared" option to be used in CI]' \ + '(-h --help -cilg --ci_travis_gcc)'{-cilg,--ci_travis_gcc}'[generate travis-ci files for linux gcc]' \ + '(-h --help -cilc --ci_travis_clang)'{-cilc,--ci_travis_clang}'[generate travis-ci files for linux clang]' \ + '(-h --help -cilg --ci_travis_gcc)'{-cilg,--ci_travis_gcc}'[generate travis-ci files for linux gcc]' \ + '(-h --help -cio --ci_travis_osx)'{-cio,--ci_travis_osx}'[generate travis-ci files for OSX apple-clang]' \ + '(-h --help -ciw --ci_appveyor_win)'{-ciw,--ci_appveyor_win}'[generate appveyor files for Appveyor Visual Studio]' \ + '(-h --help -ciglg --ci_gitlab_gcc)'{-ciglg,--ci_gitlab_gcc}'[generate GitLab files for linux gcc]' \ + '(-h --help -ciglc --ci_gitlab_clang)'{-ciglc,--ci_gitlab_clang}'[generate GitLab files for linux clang]' \ + '(-h --help -cilg --ci_travis_gcc)'{-cilg,--ci_travis_gcc}'[generate travis-ci files for linux gcc]' \ + '(-h --help -gi --gitignore)'{-gi,--gitignore}'[generate a .gitignore with the known patterns to excluded]' \ + '(-h --help -ciu --ci_upload_url)'{-ciu,--ci_upload_url}'[define URL of the repository to upload]: :_urls' \ + '(-h --help)1: :_conan_package_references' +} + +(( $+functions[_conan_package_args] )) || +_conan_package_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + "(-h --help -sf --source-folder)"{-sf,--source-folder}'[local folder containing the sources. Defaulted to the directory of the conanfile. A relative path can also be specified (relative to the current directory)]: :_files -/' \ + "(-h --help -bf --build-folder)"{-bf,--build-folder}'[build folder, working directory of the build process. Defaulted to the current directory. A relative path can also be specified (relative to the current directory)]: :_files -/' \ + "(-h --help -pf --package-folder)"{-pf,--package-folder}'[folder to install the package (when the build system or build() method does it). Defaulted to the '\''{build_folder}/package'\'' folder. A relative path can be specified, relative to the current folder. Also an absolute path is allowed.]: :_files -/' \ + "(-h --help -if --install-folder)"{-if,--install-folder}'[local folder containing the conaninfo.txt and conanbuildinfo.txt files (from a previous conan install execution). Defaulted to --build-folder]: :_files -/' \ + '(-h --help)1: :_conan_package_references' \ + '(-h --help)2:package ID:' +} + +(( $+functions[_conan_profile_args] )) || +_conan_profile_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_profile_commands' \ + '(-h --help)*:: :->command_args' + + case $state in + command_args) + (( $+functions[_conan_profile_${words[1]}_args] )) && _conan_profile_${words[1]}_args + ;; + esac +} + +(( $+functions[_conan_profile_commands] )) || +_conan_profile_commands() { + local commands + commands=( + 'list:list current profiles' + 'show:show the values defined for a profile' + 'new:creates a new empty profile' + 'update:update a profile' + 'get:get a profile key' + 'remove:remove a profile key' + ) + _describe -t 'commands' "command" commands +} + +(( $+functions[_conan_profile_list_args] )) || +_conan_profile_list_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' +} + +(( $+functions[_conan_profile_show_args] )) || +_conan_profile_show_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_profiles' +} + +(( $+functions[_conan_profile_new_args] )) || +_conan_profile_new_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)--detect[autodetect settings and fill \[settings\] section]' \ + '(-h --help)1:profile name:' +} + +(( $+functions[_conan_profile_update_args] )) || +_conan_profile_update_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_settings' \ + '(-h --help)2: :_conan_profiles' +} + +(( $+functions[_conan_profile_get_args] )) || +_conan_profile_get_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_setting_keys' \ + '(-h --help)2: :_conan_profiles' +} + +(( $+functions[_conan_profile_remove_args] )) || +_conan_profile_remove_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_setting_keys' \ + '(-h --help)2: :_conan_profiles' +} + +(( $+functions[_conan_remote_args] )) || +_conan_remote_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_remote_commands' \ + '(-h --help)*:: :->command_args' + + case $state in + command_args) + (( $+functions[_conan_remote_${words[1]}_args] )) && _conan_remote_${words[1]}_args + ;; + esac +} + +(( $+functions[_conan_remote_commands] )) || +_conan_remote_commands() { + local commands + commands=( + 'list:list current remotes' + 'add:add a remote' + 'remove:remove a remote' + 'update:update the remote url' + 'list_ref:list the package recipes and its associated remotes' + 'add_ref:associate a recipe'\''s reference to a remote' + 'remove_ref:dissociate a recipe'\''s reference and its remote' + 'update_ref:update the remote associated with a package recipe' + ) + _describe -t 'commands' "command" commands +} + +(( $+functions[_conan_remote_list_args] )) || +_conan_remote_list_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' +} + +(( $+functions[_conan_remote_add_args] )) || +_conan_remote_add_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1:name of the remote:' \ + '(-h --help)2:url of the remote:_urls' \ + '(-h --help)3:verify SSL certificated:(True False)' +} + +(( $+functions[_conan_remote_remove_args] )) || +_conan_remote_remove_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_remotes' +} + +(( $+functions[_conan_remote_update_args] )) || +_conan_remote_update_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' \ + '(-h --help)1: :_conan_remotes' \ + '(-h --help)2:url of the remote:_urls' \ + '(-h --help)3:verify SSL certificated:(True False)' +} + +(( $+functions[_conan_remote_list_ref_args] )) || +_conan_remote_list_ref_args() { + _arguments -C \ + '(- : *)'{-h,--help}'[display help information]' +} + +# TODO complete conan remote add_ref +# TODO complete conan remote remove_ref +# TODO complete conan remote update_ref +# TODO complete conan remove +# TODO complete conan search +# TODO complete conan source +# TODO complete conan upload +# TODO complete conan user +# TODO complete conan export-pkg +# TODO complete conan test + + +(( $+functions[_conan_conanfiles] )) || +_conan_conanfiles() { + _files -g '*.py' +} + +(( $+functions[_conan_directory_or_package_references] )) || +_conan_conanfile_or_package_references() { + _alternative \ + 'conanfile: :_conan_conanfiles' \ + 'package-references: :_conan_package_references' +} + +(( $+functions[_conan_directory_or_package_references] )) || +_conan_directory_or_package_references() { + _alternative \ + 'directory: :_files -/' \ + 'package-references: :_conan_package_references' +} + +(( $+functions[_conan_channel_or_package_references] )) || +_conan_channel_or_package_references() { + _alternative \ + 'package-references: :_conan_package_references' \ + 'user-channels: :_conan_user_channels' +} + +(( $+functions[_conan_package_references] )) || +_conan_package_references() { + _guard '[^\-]#' 'package reference' # TODO complete package references +} + +(( $+functions[_conan_user_channels] )) || +_conan_user_channels() { + _guard '[^\-]#' 'user channel' # TODO complete user channels +} + +(( $+functions[_conan_remotes] )) || +_conan_remotes() { + local remotes; remotes=(${(f)"$(_call_program remotes $service remote list)"}) + _describe -t remotes 'remote' remotes "$@" +} + +(( $+functions[_conan_scopes] )) || +_conan_scopes() { + _guard '[^\-]#' 'scope' # TODO complete scopes +} + +(( $+functions[_conan_build_policies] )) || +_conan_build_policies() { + _guard '[^\-]#' 'build policy' # TODO complete build policies +} + +(( $+functions[_conan_generators] )) || +_conan_generators() { + _guard '[^\-]#' 'generator' # TODO complete generators +} + +(( $+functions[_conan_profiles] )) || +_conan_profiles() { + local profiles; profiles=(${(f)"$(_call_program profiles $service profile list)"}) + _describe -t profiles 'profile' profiles "$@" +} + +(( $+functions[_conan_config_keys] )) || +_conan_config_keys() { + _guard '[^\-]#' 'config key' # TODO complete config keys +} + +(( $+functions[_conan_config_values] )) || +_conan_config_values() { + _guard '[^\-]#' 'config value' # TODO complete config values +} + +(( $+functions[_conan_options] )) || +_conan_options() { + local ret=1 + if compset -P '*='; then + _wanted option-values expl 'option value' _conan_option_values ${IPREFIX%=} && ret=0 + else + _wanted option-names expl 'option key' _conan_option_keys -qS= && ret=0 + fi + return ret +} + +(( $+functions[_conan_option_keys] )) || +_conan_option_keys() { + _guard '[^\-]#' 'option key' # TODO complete option keys +} + +(( $+functions[_conan_option_values] )) || +_conan_option_values() { + _guard '[^\-]#' 'option value' # TODO complete option values +} + +(( $+functions[_conan_settings] )) || +_conan_settings() { + local ret=1 + if compset -P '*='; then + _wanted setting-values expl 'setting value' _conan_setting_values ${IPREFIX%=} && ret=0 + else + _wanted setting-names expl 'setting key' _conan_setting_keys -qS= && ret=0 + fi + return ret +} + +(( $+functions[_conan_setting_keys] )) || +_conan_setting_keys() { + _guard '[^\-]#' 'setting key' # TODO complete setting keys +} + +(( $+functions[_conan_setting_values] )) || +_conan_setting_values() { + _guard '[^\-]#' 'setting value' # TODO complete setting values +} + +(( $+functions[_conan_environment_variables] )) || +_conan_environment_variables() { + local ret=1 + if compset -P '*='; then + _wanted environment_variable-values expl 'environment variable value' _conan_environment_variable_values ${IPREFIX%=} && ret=0 + else + _wanted environment_variable-names expl 'environment variable' _conan_environment_variable_keys -qS= && ret=0 + fi + return ret +} + +(( $+functions[_conan_environment_variable_keys] )) || +_conan_environment_variable_keys() { + _parameters -g "*export*" +} + +(( $+functions[_conan_environment_variable_values] )) || +_conan_environment_variable_values() { + _guard '[^\-]#' 'environment variable value' # TODO complete environment variable values +} + + +_conan "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/.zprezto/modules/completion/external/src/_ecdsautil b/.zprezto/modules/completion/external/src/_ecdsautil new file mode 100644 index 0000000..5d0a6f3 --- /dev/null +++ b/.zprezto/modules/completion/external/src/_ecdsautil @@ -0,0 +1,53 @@ +#compdef ecdsautil +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for ecdsaultils v0.4.0 (https://github.com/tcatm/ecdsautils) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Robinhuett +# +# ------------------------------------------------------------------------------ + +_ecdsautil_args() { + case $words[1] in + (sign) + _arguments '1:somefile:_files' + ;; + (verify) + _arguments '-s[signature]:secret:_files' '-p[publickey]:pubkey:_files' +'-n[signaturecount]:signaturecount:""' ':file:_files' + ;; + esac +} + +_ecdsautil() { + local -a commands + + commands=( + "help:Show help" + "generate-key:generate a new secret on stdout" + "show-key:output public key of secret read from stdin" + "sign:sign file" + "verify:verify signature of file" + ) + + _arguments -C \ + '1:cmd:->cmds' \ + '*:: :->args' \ + + case "$state" in + (cmds) + _describe -t commands 'commands' commands + ;; + (*) + _ecdsautil_args + ;; + esac +} + +_ecdsautil "$@" diff --git a/.zprezto/modules/completion/external/src/_flutter b/.zprezto/modules/completion/external/src/_flutter new file mode 100644 index 0000000..c63a5d9 --- /dev/null +++ b/.zprezto/modules/completion/external/src/_flutter @@ -0,0 +1,442 @@ +#compdef flutter +# ------------------------------------------------------------------------------ +#MIT License +# +#Copyright (c) 2018 Nickolay Simonov +# +#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. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for the Flutter.io sdk's cli tool (https://flutter.io) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Nikolai Simonov (https://github.com/NiKoTron) +# +# ------------------------------------------------------------------------------ +_flutter() { + +typeset -A opt_args +local context state line + +local curcontext="$curcontext" + +local ret=1 + +_arguments -C -A "-*" \ +'(-h --help)'{-h,--help}'[Print this usage information.]' \ +'(-v --verbose)'{-v,--verbose}'[Noisy logging, including all shell commands executed.]' \ +'--quiet[Reduce the amount of output from some commands.]' \ +'(-d --device-id)'{-d,--device-id}'[Target device id or name (prefixes allowed).]' \ +'--version[Reports the version of this tool.]' \ +'--color[Whether to use terminal colors.]' \ +'--no-color[Whether to use terminal colors.]' \ +'--suppress-analytics[Suppress analytics reporting when this command runs.]' \ +'--bug-report[Captures a bug report file to submit to the Flutter team (contains local paths, device identifiers, and log snippets).]' \ +'--packages[Path to your ".packages" file. (required, since the current directory does not contain a ".packages" file)]' \ +'--flutter-root[The root directory of the Flutter repository (uses $FLUTTER_ROOT if set).]' \ +'1: :_root_commands' \ +'*::arg:->args' \ +&& ret=0 + + case "$state" in + (args) + case $words[1] in + (help) + _arguments -C \ + '1: :_root_commands' \ + && ret=0 + ;; + (analyze) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--flutter-repo[Include all the examples and tests from the Flutter repository.]' \ + '--no-flutter-repo[Include all the examples and tests from the Flutter repository.]' \ + '--current-package[Include the lib/main.dart file from the current directory, if any. (defaults to on)]' \ + '--no-current-package[Include the lib/main.dart file from the current directory, if any. (defaults to on)]' \ + '--watch[Run analysis continuously, watching the filesystem for changes.]' \ + '--preview-dart-2[Preview Dart 2.0 functionality. (defaults to on)]' \ + '--no-preview-dart-2[Preview Dart 2.0 functionality. (defaults to on)]' \ + '--write=[Also output the results to a file. This is useful with --watch if you want a file to always contain the latest results.]: :_files -/' \ + '--pub[Whether to run "flutter packages get" before executing this command. (defaults to on)]' \ + '--no-pub[Whether to run "flutter packages get" before executing this command. (defaults to on)]' \ + '--congratulate[When analyzing the flutter repository, show output even when there are no errors, warnings, hints, or lints. (defaults to on)]' \ + '--no-congratulate[When analyzing the flutter repository, show output even when there are no errors, warnings, hints, or lints. (defaults to on)]' \ + '--preamble[When analyzing the flutter repository, display the number of files that will be analyzed. (defaults to on)]' \ + '--no-preamble[When analyzing the flutter repository, display the number of files that will be analyzed. (defaults to on)]' \ + && ret=0 + ;; + (build) + _arguments -C \ + '1: :_build_entities' \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (channel) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (clean) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (config) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--analytics[Enable or disable reporting anonymously tool usage statistics and crash reports.]' \ + '--no-analytics[Enable or disable reporting anonymously tool usage statistics and crash reports.]' \ + '--clear-ios-signing-cert[Clear the saved development certificate choice used to sign apps for iOS device deployment.]' \ + '--gradle-dir[The gradle install directory.]' \ + '--android-sdk[The Android SDK directory.]' \ + '--android-studio-dir[The Android Studio install directory.]' \ + && ret=0 + ;; + + (create) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--pub[Whether to run "flutter packages get" after the project has been created. (defaults to on)]' \ + '--no-pub[Whether to run "flutter packages get" after the project has been created. (defaults to on)]' \ + '--offline[When "flutter packages get" is run by the create command, this indicates whether to run it in offline mode or not. In offline mode, it will need to have all dependencies already available in the pub cache to succeed.]' \ + '--no-offline[When "flutter packages get" is run by the create command, this indicates whether to run it in offline mode or not. In offline mode, it will need to have all dependencies already available in the pub cache to succeed.]' \ + "--with-driver-test[Also add a fl:_root_commandsutter_driver dependency and generate a sample 'flutter drive' test.]" \ + "--no-with-driver-test[Also add a flutter_driver dependency and generate a sample 'flutter drive' test.]" \ + '(-t= --template=)'{-t=,--template=}'[Specify the type of project to create.]: :_project_templates' \ + "--description[The description to use for your new Flutter project. This string ends up in the pubspec.yaml file. (defaults to 'A new Flutter project.')]" \ + "--org[The organization responsible for your new Flutter project, in reverse domain name notation. This string is used in Java package names and as prefix in the iOS bundle identifier. (defaults to 'com.example')]" \ + '(-i= --ios-language)'{-i=,--ios-language}'[iOS project language]: :_ios_languages' \ + '(-a= --android-language)'{-a=,--android-language}'[Android project language]: :_droid_languages' \ + && ret=0 + ;; + + (daemon) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (devices) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (doctor) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + "--android-licenses[Run the Android SDK manager tool to accept the SDK's licenses.]" \ + && ret=0 + ;; + (drive) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--debug[Build a debug version of your app (default mode).]' \ + '--profile[Build a version of your app specialized for performance profiling.]' \ + '--release[Build a release version of your app.]' \ + '--flavor[Build a custom app flavor as defined by platform-specific build setup. Supports the use of product flavors in Android Gradle scripts. Supports the use of custom Xcode schemes.]' \ + '--trace-startup[Start tracing during startup.]' \ + '--route[Which route to load when running the app.]' \ + '--target-platform[Specify the target platform when building the app for an Android device. Ignored on iOS.]: :_target_platforms' \ + '(-t= --target=)'{-t=,-target=}'[The main entry-point file of the application, as run on the device. If the --target option is omitted, but a file name is provided on the command line, then that is used instead. (defaults to "lib/main.dart")]: :_files -g "*.dart"' \ + '--observatory-port[Listen to the given port for an observatory debugger connection. Specifying port 0 will find a random free port. Defaults to the first available port after 8100.]' \ + '--pub[Whether to run "flutter packages get" before executing this command. (defaults to on)]' \ + '--no-pub[Whether to run "flutter packages get" before executing this command. (defaults to on)]' \ + '--no-keep-app-running[Will keep the Flutter application running when done testing. By default, "flutter drive" stops the application after tests are finished, and --keep-app-running overrides this. On the other hand, if --use-existing-app is specified, then "flutter drive" instead defaults to leaving the application running, and --no-keep-app-running overrides it.]' \ + '--keep-app-running[Will keep the Flutter application running when done testing. By default, "flutter drive" stops the application after tests are finished, and --keep-app-running overrides this. On the other hand, if --use-existing-app is specified, then "flutter drive" instead defaults to leaving the application running, and --no-keep-app-running overrides it.]' \ + '--use-existing-app=[Connect to an already running instance via the given observatory URL. If this option is given, the application will not be automatically started, and it will only be stopped if --no-keep-app-running is explicitly set.]' \ + '--driver=[The test file to run on the host (as opposed to the target file to run on the device). By default, this file has the same base name as the target file, but in the "test_driver/" directory instead, and with "_test" inserted just before the extension, so e.g. if the target is "lib/main.dart", the driver will be "test_driver/main_test.dart".]: :_files' \ + '--preview-dart-2[Preview Dart 2.0 functionality. (defaults to on)]' \ + '--no-preview-dart-2[Preview Dart 2.0 functionality. (defaults to on)]' \ + && ret=0 + ;; + (format) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (fuchsia_reload) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--debug[Build a debug version of your app (default mode).]' \ + '--profile[Build a version of your app specialized for performance profiling.]' \ + '--release[Build a release version of your app.]' \ + '(-a --address)'{-a,--address}'[Fuchsia device network name or address.]' \ + '(-b --build-dir)'{-b,--build-dir}'[Fuchsia build directory, e.g. out/release-x86-64.]' \ + '(-g --gn-target)'{-g,--gn-target}'[GN target of the application, e.g //path/to/app:app.]' \ + '(-i --isolate-number)'{-i,--isolate-number}'[To reload only one instance, specify the isolate number, e.g. the number in foo$main-###### given by --list.]' \ + '(-l --list)'{-l,--list}'[Lists the running modules.]' \ + '(-l --no-list)'{-l,--no-list}'[Lists the running modules.]' \ + '(-n --name-override)'{-n,--name-override}'[On-device name of the application binary.]' \ + '(-2 --preview-dart-2)'{-2,--preview-dart-2}'[Preview Dart 2.0 functionality.]' \ + '(-2 --no-preview-dart-2)'{-2,--no-preview-dart-2}'[Preview Dart 2.0 functionality.]' \ + '(-t --target)'{-t,--target}'[Target app path / main entry-point file. Relative to --gn-target path, e.g. lib/main.dart. (defaults to "lib/main.dart")]' \ + && ret=0 + ;; + (ide-config) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--overwrite[When performing operations, overwrite existing files.]' \ + '--no-overwrite[When performing operations, overwrite existing files.]' \ + '--update-templates[Update the templates in the template directory from the current configuration files. This is the opposite of what ide-config usually does. Will search the flutter tree for .iml files and copy any missing ones into the template directory. If --overwrite is also specified, it will update any out-of-date files, and remove any deleted files from the template directory.]' \ + && ret=0 + ;; + (inject-plugins) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (install) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (logs) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '(-c --clear)'{-c,--clear}'[Clear log history before reading from logs.]' \ + && ret=0 + ;; + (packages) + _arguments -C \ + '1: :_package_subcomands' \ + '*::pkg-arg:->pkg-args' \ + && ret=0 + case "$state" in + (pkg-args) + case $words[1] in + (get) + _arguments \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--offline[Use cached packages instead of accessing the network.]' \ + && ret=0 + ;; + (pub) + _arguments \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (test) + _arguments \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (upgrade) + _arguments \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--offline[Use cached packages instead of accessing the network.]' \ + && ret=0 + ;; + esac + ;; + esac + ;; + + (precache) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '(-a --all-platforms)]'{-a--all-platforms}'[Precache artifacts for all platforms.]' \ + && ret=0 + ;; + (run) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--debug[Build a debug version of your app (default mode).]' \ + '--profile[Build a version of your app specialized for performance profiling.]' \ + '--release[Build a release version of your app.]' \ + '--flavor[Build a custom app flavor as defined by platform-specific build setup. Supports the use of product flavors in Android Gradle scripts. Supports the use of custom Xcode schemes.]' \ + '--trace-startup[Start tracing during startup.]' \ + '--route[Which route to load when running the app.]' \ + '--target-platform[Specify the target platform when building the app for an Android device. Ignored on iOS.]: :_target_platforms' \ + '(-t= --target=)'{-t=,--target=}'[The main entry-point file of the application, as run on the device. If the --target option is omitted, but a file name is provided on the command line, then that is used instead. (defaults to "lib/main.dart")]: :_files -g "*.dart"' \ + '--observatory-port[Listen to the given port for an observatory debugger connection. Specifying port 0 will find a random free port.Defaults to the first available port after 8100.]' \ + '--pub[Whether to run "flutter packages get" before executing this command. (defaults to on)]' \ + '--no-pub[Whether to run "flutter packages get" before executing this command. (defaults to on)]' \ + '--full-restart[Stop any currently running application process before running the app. (defaults to on)]' \ + '--no-full-restart[Stop any currently running application process before running the app. (defaults to on)]' \ + '--start-paused[Start in a paused mode and wait for a debugger to connect.]' \ + '--enable-software-rendering[Enable rendering using the Skia software backend. This is useful when testing Flutter on emulators. By default, Flutter will attempt to either use OpenGL or Vulkan and fall back to software when neither is available.]' \ + '--skia-deterministic-rendering When combined with --enable-software-rendering, provides 100% deterministic Skia rendering.]' \ + '--trace-skia[Enable tracing of Skia code. This is useful when debugging the GPU thread. By default, Flutter will not log skia code.]' \ + '--use-test-fonts[Enable (and default to) the "Ahem" font. This is a special font used in tests to remove any dependencies on the font metrics. It is enabled when you use "flutter test". Set this flag when running a test using "flutter run" for debugging purposes. This flag is only available when running in debug mode.]' \ + '--no-use-test-fonts[Enable (and default to) the "Ahem" font. This is a special font used in tests to remove any dependencies on the font metrics. It is enabled when you use "flutter test". Set this flag when running a test using "flutter run" for debugging purposes. This flag is only available when running in debug mode.]' \ + '--build[If necessary, build the app before running. (defaults to on)]' \ + '--no-build[If necessary, build the app before running. (defaults to on)]' \ + '--hot[Run with support for hot reloading. (defaults to on)]' \ + '--no-hot[Run with support for hot reloading. (defaults to on)]' \ + '--pid-file[Specify a file to write the process id to. You can send SIGUSR1 to trigger a hot reload and SIGUSR2 to trigger a full restart.]' \ + && ret=0 + ;; + (screenshot) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '(-o --out)'{-o,--out}'[Location to write the screenshot.]: :_files' \ + '--skia=[Retrieve the last frame rendered by a Flutter app as a Skia picture using the specified observatory port. To find the observatory port number, use "flutter run --verbose" and look for "Forwarded host port ... for Observatory" in the output.]' \ + && ret=0 + ;; + (stop) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + (test) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--pub[Whether to run "flutter packages get" before executing this command. (defaults to on)]' \ + '--no-pub[Whether to run "flutter packages get" before executing this command. (defaults to on)]' \ + '--name=[A regular expression matching substrings of the names of tests to run.]' \ + '--plain-name=[A plain-text substring of the names of tests to run.]' \ + '--start-paused[Start in a paused mode and wait for a debugger to connect. You must specify a single test file to run, explicitly. Instructions for connecting with a debugger and printed to the console once the test has started.]' \ + '--coverage[Whether to collect coverage information.]' \ + '--merge-coverage[Whether to merge coverage data with "coverage/lcov.base.info". Implies collecting coverage data. (Requires lcov)]' \ + '--coverage-path[Where to store coverage information (if coverage is enabled). (defaults to "coverage/lcov.info")]' \ + && ret=0 + (trace) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--start[Start tracing.]' \ + '--stop[Stop tracing.]' \ + '--out[Specify the path of the saved trace file.]' \ + '(-d --duration)'{-d,--duration}'[Duration in seconds to trace. (defaults to "10")]' \ + '--debug-port[Local port where the observatory is listening. (defaults to "8100")]' \ + && ret=0 + ;; + (update-packages) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + '--force-upgrade[Attempt to update all the dependencies to their latest versions. This will actually modify the pubspec.yaml files in your checkout.]' \ + '--no-force-upgrade[Attempt to update all the dependencies to their latest versions. This will actually modify the pubspec.yaml files in your checkout.]' \ + '--paths[Finds paths in the dependency chain leading from package specified in --from to package specified in --to.]' \ + '--no-paths[Finds paths in the dependency chain leading from package specified in --from to package specified in --to.]' \ + '--from[Used with flag --dependency-path. Specifies the package to begin searching dependency path from.]' \ + '--to[Used with flag --dependency-path. Specifies the package that the sought after dependency path leads to.]' \ + '--transitive-closure[Prints the dependency graph that is the transitive closure of packages the Flutter SDK depends on.]' \ + '--no-transitive-closure[Prints the dependency graph that is the transitive closure of packages the Flutter SDK depends on.]' \ + '--verify-only[verifies the package checksum without changing or updating deps]' \ + '--no-verify-only[verifies the package checksum without changing or updating deps]' \ + && ret=0 + ;; + (upgrade) + _arguments -C \ + '(-h --help)'{-h,--help}'[Print this usage information.]' \ + && ret=0 + ;; + + esac + ;; + esac + + + return ret + + } + + +(( $+functions[root_commands] )) || +_root_commands() { + local commands; + commands=( + "analyze:Analyze the project's Dart code." + 'build:Flutter build commands.' + 'channel:List or switch flutter channels.' + 'clean:Delete the build/ directory.' + 'config:Configure Flutter settings.' + 'create:Create a new Flutter project.' + 'daemon:Run a persistent, JSON-RPC based server to communicate with devices.' + 'devices:List all connected devices.' + 'doctor:Show information about the installed tooling.' + 'drive:Runs Flutter Driver tests for the current project.' + 'format:Format one or more dart files.' + 'fuchsia_reload:Hot reload on Fuchsia.' + 'help:Display help information for flutter.' + 'ide-config:Configure the IDE for use in the Flutter tree.' + 'inject-plugins:Re-generates the GeneratedPluginRegistrants.' + 'install:Install a Flutter app on an attached device.' + 'logs:Show log output for running Flutter apps.' + 'packages:Commands for managing Flutter packages.' + "precache:Populates the Flutter tool's cache of binary artifacts." + 'run:Run your Flutter app on an attached device.' + 'screenshot:Take a screenshot from a connected device.' + 'stop:Stop your Flutter app on an attached device.' + 'test:Run Flutter unit tests for the current project.' + 'trace:Start and stop tracing for a running Flutter app.' + 'update-packages:Update the packages inside the Flutter repo.' + 'upgrade:Upgrade your copy of Flutter.') + _describe -t commands 'command' commands "$@" +} + +(( $+functions[_build_entities] )) || +_build_entities() { + local entities; + entities=("aot:Build an ahead-of-time compiled snapshot of your app's Dart code." + "apk:Build an Android APK file from your app." + "flx:Build a Flutter FLX file from your app." + "ios:Build an iOS application bundle (Mac OS X host only).") + _describe -t entities 'entity' entities "$@" +} + +(( $+functions[_project_templates] )) || +_project_templates() { + local templates; + templates=("app:(default) Generate a Flutter application." + "package:Generate a shareable Flutter project containing modular Dart code." + "plugin:Generate a shareable Flutter project containing an API in Dart code with a platform-specific implementation for Android, for iOS code, or for both.") + _describe -t templates 'template' templates "$@" +} + +(( $+functions[_ios_languages] )) || +_ios_languages() { + local languages; + languages=("objc:(default) Objective-C." + "swift:Swift.") + _describe -t languages 'language' languages "$@" +} + +(( $+functions[_droid_languages] )) || +_droid_languages() { + local languages; + languages=("java:(default) Java." + "kotlin:Kotlin.") + _describe -t languages 'language' languages "$@" +} + +(( $+functions[_target_platforms] )) || +_target_platforms() { + local platforms; + platforms=("default:(default) default." + "android-arm:android-arm." + "android-arm64:android-arm64.") + _describe -t platforms 'platform' platforms "$@" +} + + +(( $+functions[_package_subcomands] )) || +_package_subcomands() { + local subcommands; + subcommands=("get:Get packages in a Flutter project." + "pub:Pass the remaining arguments to Dart's 'pub' tool." + "test:Run the 'test' package." + "upgrade:Upgrade packages in a Flutter project.") + _describe -t subcommands 'subcommand' subcommands "$@" +} + +_flutter "$@" diff --git a/.zprezto/modules/completion/external/src/_ghc b/.zprezto/modules/completion/external/src/_ghc index 7d4e1ef..2709406 100644 --- a/.zprezto/modules/completion/external/src/_ghc +++ b/.zprezto/modules/completion/external/src/_ghc @@ -92,15 +92,15 @@ _ghc_compiler () '-c[Stop after generating object files]' \ '-eventlog[Enable runtime event tracing]' \ '-debug[Use the debugging runtime]' \ - "-dylib-install-name[On Darwin/OS X only, set the install name]" \ + "-dylib-install-name[On Darwin/macOS only, set the install name]" \ '-dynamic[Use dynamic Haskell libraries]' \ '-dynamic-too[Build dynamic object files as well as static object files during compilation]' \ '-dynosuf[Set the output suffix for dynamic object files]' \ '-dynload[Select one of a number of modes for finding shared libraries at runtime]' \ '--mk-dll[DLL-creation mode (Windows only)]' \ - '-framework-path[On Darwin/OS X/iOS only, add dir to the list of directories searched for frameworks]' \ + '-framework-path[On Darwin/macOS/iOS only, add dir to the list of directories searched for frameworks]' \ '-shared[Generate a shared library (as opposed to an executable)]' \ - '-staticlib[On Darwin/OS X/iOS only, generate a standalone static library (as opposed to an executable)]' \ + '-staticlib[On Darwin/macOS/iOS only, generate a standalone static library (as opposed to an executable)]' \ '-e[Evaluate expression]' \ '-hide-all-packages[Hide all packages by default]' \ '-hpcdir[Directory to deposit .mix files during compilation (default is .hpc)]' \ diff --git a/.zprezto/modules/completion/external/src/_glances b/.zprezto/modules/completion/external/src/_glances index e0298ea..a86f875 100644 --- a/.zprezto/modules/completion/external/src/_glances +++ b/.zprezto/modules/completion/external/src/_glances @@ -40,24 +40,36 @@ _glances() { - _arguments \ - "-b[Display network rate in Byte per second]" \ - "-B[Bind server to the given IP or host NAME]:host:_hosts" \ - "-c[Connect to a Glances server]:host:_hosts" \ - "-C[Path to the configuration file]:configuration path:_files -/" \ - "-d[Disable disk I/O module]" \ - "-e[Enable the sensors module (Linux-only)]" \ - "-f[Set the output folder (HTML) or file (CSV)]:output path:_files -/" \ - "-h[Display the syntax and exit]" \ - "-m[Disable mount module]" \ - "-n[Disable network module]" \ - "-o[Define additional output (available: HTML or CSV)]:output type:(HTML CSV)" \ - "-p[Define the client or server TCP port (default: 61209)]:port:_ports" \ - "-P[Client/server password]:password:" \ - "-s[Run Glances in server mode]" \ - "-t[Set the refresh time in seconds (default: 3)]:seconds:" \ - "-v[Display the version and exit]" \ - "-z[Do not use the bold color attribute]" \ + _arguments \ + "-0[Divide task CPU usage by the total number of CPUs]" \ + "-1[Start Glances in per CPU mode]" \ + "-2[Disable left sidebar]" \ + "-3[Disable quick look module]" \ + "-4[Disable all but quick look and load]" \ + "-5[Disable top menu]" \ + "-6[Start Glances in mean GPU mode]" \ + "-b[Display network rate in Byte per second]" \ + "-B[Bind server to the given IP or host NAME]:host:_hosts" \ + "-c[Connect to a Glances server]:host:_hosts" \ + "-C[Path to the configuration file]:configuration path:_files -/" \ + "-d[Enable debug mode]" \ + "-h[Display the syntax and exit]" \ + "-o[Define additional output (available: HTML or CSV)]:output type:(HTML CSV)" \ + "-p[Define the client or server TCP port (default: 61209)]:port:_ports" \ + "-q[Disable the curses interface]" \ + "-s[Run Glances in server mode]" \ + "-t[Set the refresh time in seconds (default: 3)]:seconds:" \ + "-V[Display the version and exit]" \ + "-w[Run Glances in web server mode]" \ + "-z[Do not use the bold color attribute]" \ + "--browser[Start the client browser]" \ + "--disable-bg[Disable background colors in the terminal]" \ + "--disable-bold[Disable bold mode in the terminal]" \ + "--hide-kernel-threads[Hide kernel threads in process list]" \ + "--password[Define a client/server password]" \ + "--theme-white[Optimize display colors for white background]" \ + "--tree[Display processes as tree]" \ + "--username[Define a client/server username]" \ } -_glances "$@" \ No newline at end of file +_glances "$@" diff --git a/.zprezto/modules/completion/external/src/_go b/.zprezto/modules/completion/external/src/_go deleted file mode 100644 index 0a9b6a0..0000000 --- a/.zprezto/modules/completion/external/src/_go +++ /dev/null @@ -1,554 +0,0 @@ -#compdef go -# ------------------------------------------------------------------------------ -# Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users -# Copyright (c) 2013-2015 Robby Russell and contributors (see -# https://github.com/robbyrussell/oh-my-zsh/contributors) -# Copyright (c) 2010-2014 Go authors -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the zsh-users nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY DIRECT, -# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for go 1.5 (http://golang.org). -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * Mikkel Oscar Lyderik -# * oh-my-zsh authors: -# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/golang/golang.plugin.zsh -# * Go authors -# -# ------------------------------------------------------------------------------ - -typeset -A opt_args - -_go() { - local -a commands build_flags - commands=( - 'build:compile packages and dependencies' - 'clean:remove object files' - 'doc:show documentation for package or symbol' - 'env:print Go environment information' - 'fix:run go tool fix on packages' - 'fmt:run gofmt on package sources' - 'generate:generate Go files by processing source' - 'get:download and install packages and dependencies' - 'install:compile and install packages and dependencies' - 'list:list packages' - 'run:compile and run Go program' - 'test:test packages' - 'tool:run specified go tool' - 'version:print Go version' - 'vet:run go tool vet on packages' - 'help:get more information about a command' - ) - - _arguments \ - "1: :{_describe 'command' commands}" \ - '*:: :->args' - - case $state in - args) - build_flags=( - '-a[force rebuilding of packages that are already up-to-date]' - '-n[print the commands but do not run them]' - '-p[number of builds that can be run in parallel]:number' - '-race[enable data race detection]' - '-v[print the names of packages as they are compiled]' - '-work[print temporary work directory and keep it]' - '-x[print the commands]' - '-asmflags[arguments for each go tool asm invocation]:flags' - '-buildmode[build mode to use]:mode' - '-compiler[name of compiler to use]:name' - '-gccgoflags[arguments for gccgo]:args' - '-gcflags[arguments for each go tool compile invocation]:args' - '-installsuffix[suffix to add to package directory]:suffix' - '-ldflags[arguments to pass on each go tool link invocation.]:flags' - '-linkshared[link against shared libraries]' - '-pkgdir[install and load all packages from dir]:dir' - '-tags[list of build tags to consider satisfied]:tags' - '-toolexec[program to use to invoke toolchain programs]:args' - ) - - __go_packages() { - local gopaths - declare -a gopaths - gopaths=("${(s/:/)$(go env GOPATH)}") - gopaths+=("$(go env GOROOT)") - for p in $gopaths; do - _path_files -W "$p/src" -/ - done - } - - case $words[1] in - build) - _arguments \ - '-o[force build to write to named output file]:file:_files' \ - '-i[installs the packages that are dependencies of the target]' \ - ${build_flags[@]} \ - '*:importpaths:__go_packages' - ;; - - clean) - _arguments \ - '-i[remove corresponding installed archive or binary]' \ - '-r[apply clean recursively on all dependencies]' \ - ${build_flags[@]} \ - '*:importpaths:__go_packages' - ;; - - doc) - _arguments \ - '-c[respect case when matching symbols]' \ - '-cmd[treat a command (package main) like a regular package]' \ - '-u[show docs for unexported and exported symbols and methods]' - ;; - - fix) - _arguments '*:importpaths:__go_packages' - ;; - - fmt) - _arguments \ - '-n[prints commands that would be executed]' \ - '-x[prints commands as they are executed]' \ - '*:importpaths:__go_packages' - ;; - - generate) - _arguments \ - '-run=[specifies a regular expression to select directives]:regex' \ - '-x[print the commands]' \ - '-n[print the commands but do not run them]' \ - '-v[print the names of packages as they are compiled]' \ - "*:args:{ _alternative ':importpaths:__go_packages' _files }" - ;; - - get) - _arguments \ - '-d[instructs get to stop after downloading the packages]' \ - '-f[force get -u not to verify that each package has been checked from vcs]' \ - '-fix[run the fix tool on the downloaded packages]' \ - '-insecure[permit fetching/resolving custom domains]' \ - '-t[also download the packages required to build tests]' \ - '-u[use the network to update the named packages]' \ - ${build_flags[@]} \ - '*:importpaths:__go_packages' - ;; - - install) - _arguments ${build_flags[@]} \ - '*:importpaths:__go_packages' - ;; - - list) - _arguments \ - '-e[changes the handling of erroneous packages]' \ - '-f[specifies an alternate format for the list]:format' \ - '-json[causes package data to be printed in JSON format]' \ - ${build_flags[@]} \ - '*:importpaths:__go_packages' - ;; - - run) - _arguments \ - ${build_flags[@]} \ - '-exec[invoke the binary using xprog]:xporg' \ - '*:file:_files -g "*.go(-.)"' - ;; - - test) - _arguments \ - "-c[compile but don't run test]" \ - '-i[install dependencies of the test]' \ - '-bench[run benchmarks matching the regular expression]:regexp' \ - '-benchmem[print memory allocation statistics for benchmarks]' \ - '-benchtime[run benchmarks for t rime]:t' \ - '-blockprofile[write a goroutine blocking profile to the specified file]:block' \ - '-blockprofilerate[control goroutine blocking profiles]:n' \ - '-count[run each test and benchmark n times]:n' \ - '-cover[enable coverage analysis]' \ - '-covermode[set the mode for coverage analysis]:mode:(set count atomic)' \ - '-coverpkg[apply coverage analysis in each test of listed packages]:list' \ - '-coverprofile[write a coverage profile to file]:cover' \ - '-cpu[specify a list of GOMAXPROCS values]:cpus' \ - '-cpuprofile[write a CPU profile to the specified file]:profile' \ - '-memprofile[write a memory profile to file]:mem' \ - '-memprofilerate[enable more precise memory profiles]:n' \ - '-outputdir[place output files from profiling in output dir]:dir' \ - '-parallel[allow parallel execution of test functions]:n' \ - '-run[run tests and examples matching the regular expression]:regexp' \ - '-short[tell long-running tests to shorten their run time]' \ - '-timeout[timeout long running tests]:t' \ - '-trace[write an execution trace to the specified file]:trace' \ - '-v[verbose output]' \ - ${build_flags[@]} \ - '-exec[run test binary using xprog]:xprog' \ - '-o[compile test binary to named file]:file:_files' \ - '*:importpaths:__go_packages' - ;; - - tool) - local -a tools - tools=($(go tool)) - - _arguments \ - '-n[print command that would be executed]' \ - "1: :{_describe 'tool' tools}" \ - '*:: :->args' - - case $state in - args) - case $words[1] in - addr2line) - _files - ;; - - asm) - _arguments \ - '-D[predefined symbol with optional simple value]:value' \ - '-I[include directory]:value' \ - '-S[print assembly and machine code]' \ - '-debug[dump instructions as they are parsed]' \ - '-dynlink[support references to Go symbols]' \ - '-o[output file]:string' \ - '-shared[generate code that can be linked into a shared lib]' \ - '-trimpath[remove prefix from recorded source file paths]:string' - ;; - - callgraph) - local -a algos graphs - algos=( - 'static:static calls only' - 'cha:Class Hierarchy Analysis' - 'rta:Rapid Type Analysis' - 'pta:inclusion-based Points-To Analysis' - ) - graphs=( - 'digraph:output in digraph format' - 'graphviz:output in AT&T GraphViz (.dot) format' - ) - - _arguments \ - '-algo=[call-graph construction algorithm]:algos:{ _describe "algos" algos }' \ - "-test[include the package's tests in the analysis]" \ - '-format=[format in which each call graph edge is displayed]:graphs:{ _describe "graphs" graphs }' - ;; - - cgo) - _arguments \ - '-debug-define[print relevant #defines]' \ - '-debug-gcc[print gcc invocations]' \ - '-dynimport[if non-empty, print dynamic import data]:string' \ - '-dynlinker[record dynamic linker information]' \ - '-dynout[write -dynimport output to file]:file' \ - '-dynpackage[set Go package for -dynimport output]:string' \ - '-exportheader[where to write export header]:string' \ - '-gccgo[generate files for use with gccgo]' \ - '-gccgopkgpath[-fgo-pkgpath option used with gccgo]:string' \ - '-gccgoprefix[-fgo-prefix option used with gccgo]:string' \ - '-godefs[write Go definitions for C file to stdout]' \ - '-import_runtime_cgo[import runtime/cgo in generated code]' \ - '-import_syscall[import syscall in generated code]' \ - '-importpath[import path of package being built]:path' \ - '-objdir[object directory]:dir' - ;; - - compile) - _arguments \ - '-%[debug non-static initializers]' \ - '-+[compiling runtime]' \ - "-A[for bootstrapping, allow 'any' type]" \ - '-B[disable bounds checking]' \ - '-D[set relative path for local imports]:path' \ - '-E[debug symbol export]' \ - '-I[add directory to import search path]:directory' \ - '-K[debug missing line numbers]' \ - '-L[use full (long) path in error messages]' \ - '-M[debug move generation]' \ - '-N[disable optimizations]' \ - '-P[debug peephole optimizer]' \ - '-R[debug register optimizer]' \ - '-S[print assembly listing]' \ - '-V[print compiler version]' \ - '-W[debug parse tree after type checking]' \ - '-asmhdr[write assembly header to file]:file' \ - '-buildid[record id as the build id in the export metadata]:id' \ - '-complete[compiling complete package (no C or assembly)]' \ - '-cpuprofile[write cpu profile to file]:file' \ - '-d[print debug information about items in list]:list' \ - '-dynlink[support references to Go symbols]' \ - '-e[no limit on number of errors reported]' \ - '-f[debug stack frames]' \ - '-g[debug code generation]' \ - '-h[halt on error]' \ - '-i[debug line number stack]' \ - '-importmap[add definition of the form source=actual to import map]:definition' \ - '-installsuffix[set pkg directory suffix]:suffix' \ - '-j[debug runtime-initialized variables]' \ - '-l[disable inlining]' \ - '-largemodel[generate code that assumes a large memory model]' \ - '-live[debug liveness analysis]' \ - '-m[print optimization decisions]' \ - '-memprofile[write memory profile to file]:file' \ - '-memprofilerate[set runtime.MemProfileRate to rate]:rate' \ - '-nolocalimports[reject local (relative) imports]' \ - '-o[write output to file]:file' \ - '-p[set expected package import path]:path' \ - '-pack[write package file instead of object file]' \ - '-r[debug generated wrappers]' \ - '-race[enable race detector]' \ - '-s[warn about composite literals that can be simplified]' \ - '-shared[generate code that can be linked into a shared library]' \ - '-trimpath[remove prefix from recorded source file paths]:prefix' \ - '-u[reject unsafe code]' \ - '-v[increase debug verbosity]' \ - '-w[debug type checking]' \ - '-wb[enable write barrier (default 1)]' \ - '-x[debug lexer]' \ - '-y[debug declarations in canned imports (with -d)]' \ - '*:file:_files -g "*.go(-.)"' - ;; - - cover) - if (( CURRENT == 2 )); then - _arguments \ - '-func=[output coverage profile information for each function]:string' \ - '-html=[generate HTML representation of coverage profile]:file:_files' \ - '-mode=[coverage mode]:mode:(set count atomic)' - return - fi - - _arguments \ - '-o[file for output]:file' \ - '-var=[name of coverage variable to generate]:var' \ - '*:file:_files -g "*.go(-.)"' - ;; - - doc) - _arguments \ - '-c[respect case when matching symbols]' \ - '-cmd[treat a command (package main) like a regular package]' \ - '-u[show docs for unexported and exported symbols and methods]' \ - ;; - - fix) - _arguments \ - '-diff[display diffs instead of rewriting files]' \ - '-force[force fixes to run even if the code looks updated]:string' \ - '-r[restrict the rewrites]:string' \ - '*:files:_files' - ;; - - link) - _arguments \ - '-B[add an ELF NT_GNU_BUILD_ID note when using ELF]:note' \ - '-C[check Go calls to C code]' \ - '-D[set data segment address (default -1)]:address' \ - '-E[set entry symbol name]:entry' \ - '-H[set header type]:type' \ - '-I[use linker as ELF dynamic linker]:linker' \ - '-L[add specified directory to library path]:directory' \ - '-R[set address rounding quantum (default -1)]:quantum' \ - '-T[set text segment address (default -1)]:address' \ - '-V[print version and exit]' \ - '-W[disassemble input]' \ - '-X[add string value definition]:definition' \ - '-a[disassemble output]' \ - '-buildid[record id as Go toolchain build id]:id' \ - '-buildmode[set build mode]:mode' \ - '-c[dump call graph]' \ - '-cpuprofile[write cpu profile to file]:file' \ - '-d[disable dynamic executable]' \ - '-extld[use linker when linking in external mode]:linker' \ - '-extldflags[pass flags to external linker]:flags' \ - '-f[ignore version mismatch]' \ - '-g[disable go package data checks]' \ - '-h[halt on error]' \ - '-installsuffix[set package directory suffix]:suffix' \ - '-k[set field tracking symbol]:symbol' \ - '-linkmode[set link mode]:mode:(internal external auto)' \ - '-linkshared[link against installed Go shared libraries]' \ - '-memprofile[write memory profile to file]:file' \ - '-memprofilerate[set runtime.MemProfileRate to rate]:rate' \ - '-n[dump symbol table]' \ - '-o[write output to file]:file' \ - '-r[set the ELF dynamic linker search path to dir1:dir2:...]:path' \ - '-race[enable race detector]' \ - '-s[disable symbol table]' \ - '-shared[generate shared object (implies -linkmode external)]' \ - '-tmpdir[use directory for temporary files]:directory' \ - '-u[reject unsafe packages]' \ - '-v[print link trace]' \ - '-w[disable DWARF generation]' \ - '*:files:_files' - ;; - - objdump) - _arguments \ - '-s[only dump symbols matching this regexp]:regexp' \ - '*:files:_files' - ;; - - pack) - _arguments '1:ops:(c p r t x)' '::verbose:(v)' ':files:_files' - ;; - - pprof) - _arguments \ - '-callgrind[outputs a graph in callgrind format]' \ - '-disasm=[output annotated assembly]:p' \ - '-dot[outputs a graph in DOT format]' \ - '-eog[visualize graph through eog]' \ - '-evince[visualize graph through evince]' \ - '-gif[outputs a graph image in GIF format]' \ - '-gv[visualize graph through gv]' \ - '-list=[output annotated source for functions matching regexp]:p' \ - '-pdf[outputs a graph in PDF format]' \ - '-peek=[output callers/callees of functions matching regexp]:p' \ - '-png[outputs a graph image in PNG format]' \ - '-proto[outputs the profile in compressed protobuf format]' \ - '-ps[outputs a graph in PS format]' \ - '-raw[outputs a text representation of the raw profile]' \ - '-svg[outputs a graph in SVG format]' \ - '-tags[outputs all tags in the profile]' \ - '-text[outputs top entries in text form]' \ - '-top[outputs top entries in text form]' \ - '-tree[outputs a text rendering of call graph]' \ - '-web[visualize graph through web browser]' \ - '-weblist=[output annotated source in HTML]:p' \ - '-output=[generate output on file f (stdout by default)]:f' \ - '-functions[report at function level (default)]' \ - '-files[report at source file level]' \ - '-lines[report at source line level]' \ - '-addresses[report at address level]' \ - '-base[show delta from this profile]:profile' \ - '-drop_negative[ignore negative differences]' \ - '-cum[sort by cumulative data]' \ - '-seconds=[length of time for dynamic profiles]:n' \ - '-nodecount=[max number of nodes to show]:n' \ - '-nodefraction=[hide nodes below *total]:f' \ - '-edgefraction=[hide edges below *total]:f' \ - '-sample_index[index of sample value to display]' \ - '-mean[average sample value over first value]' \ - '-inuse_space[display in-use memory size]' \ - '-inuse_objects[display in-use object counts]' \ - '-alloc_space[display allocated memory size]' \ - '-alloc_objects[display allocated object counts]' \ - '-total_delay[display total delay at each region]' \ - '-contentions[display number of delays at each region]' \ - '-mean_delay[display mean delay at each region]' \ - '-runtime[show runtime call frames in memory profiles]' \ - '-focus=[restricts to paths going through a node matching regexp]:r' \ - '-ignore=[skips paths going through any nodes matching regexp]:r' \ - '-tagfocus=[restrict to samples tagged with key:value matching regexp]:r' \ - '-tagignore=[discard samples tagged with key:value matching regexp]' \ - '-call_tree[generate a context-sensitive call tree]' \ - '-unit=[convert all samples to unit u for display]:u' \ - '-divide_by=[scale all samples by dividing them by f]:f' \ - '-buildid=[override build id for main binary in profile]:id' \ - '-tools=[search path for object-level tools]:path' \ - '-help[help message]' \ - '*:files:_files' - ;; - - trace) - _arguments \ - '-http=[HTTP service address]:addr' \ - '*:files:_files' - ;; - - vet) - _arguments \ - '-all[check everything]' \ - '-asmdecl[check assembly against Go declarations]' \ - '-assign[check for useless assignments]' \ - '-atomic[check for common mistaken usages of the sync/atomic]' \ - '-bool[check for mistakes involving boolean operators]' \ - '-buildtags[check that +build tags are valid]' \ - '-composites[check that composite literals used field-keyed elements]' \ - '-compositewhitelist[use composite white list]' \ - '-copylocks[check that locks are not passed by value]' \ - '-methods[check that canonically named methods are canonically defined]' \ - '-nilfunc[check for comparisons between functions and nil]' \ - '-printf[check printf-like invocations]' \ - '-printfuncs[print function names to check]:string' \ - '-rangeloops[check that range loop variables are used correctly]' \ - '-shadow[check for shadowed variables]' \ - '-shadowstrict[whether to be strict about shadowing]' \ - '-shift[check for useless shifts]' \ - '-structtags[check that struct field tags have canonical format]' \ - '-tags[list of build tags to apply when parsing]:list' \ - '-test[for testing only: sets -all and -shadow]' \ - '-unreachable[check for unreachable code]' \ - '-unsafeptr[check for misuse of unsafe.Pointer]' \ - '-unusedfuncs[list of functions whose results must be used]:string' \ - '-unusedresult[check for unused result of calls to functions in -unusedfuncs]' \ - '-unusedstringmethods[list of methods whose results must be used]:string' \ - '-v[verbose]' \ - '*:files:_files' - ;; - - yacc) - _arguments \ - '-o[output]:output' \ - '-v[parsetable]:parsetable' \ - '*:files:_files' - ;; - esac - ;; - esac - ;; - - vet) - _arguments \ - '-n[print commands that would be executed]' \ - '-x[prints commands as they are executed]' \ - ${build_flags[@]} \ - '*:importpaths:__go_packages' - ;; - help) - local -a topics - topics=( - 'c:calling between Go and C' - 'buildmode:description of build modes' - 'filetype:file types' - 'gopath:GOPATH environment variable' - 'environment:environment variables' - 'importpath:import path syntax' - 'packages:description of package lists' - 'testflag:description of testing flags' - 'testfunc:description of testing functions' - ) - - _arguments "1: :{_describe 'command' commands -- topics}" - ;; - esac - ;; - esac -} - -_go diff --git a/.zprezto/modules/completion/external/src/_golang b/.zprezto/modules/completion/external/src/_golang new file mode 100644 index 0000000..ad37aab --- /dev/null +++ b/.zprezto/modules/completion/external/src/_golang @@ -0,0 +1,646 @@ +#compdef go +# ------------------------------------------------------------------------------ +# Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users +# Copyright (c) 2013-2015 Robby Russell and contributors (see +# https://github.com/robbyrussell/oh-my-zsh/contributors) +# Copyright (c) 2010-2014 Go authors +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for go 1.11 (http://golang.org). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Mikkel Oscar Lyderik Larsen +# * oh-my-zsh authors: +# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/golang/golang.plugin.zsh +# * Go authors +# +# ------------------------------------------------------------------------------ + +typeset -A opt_args + +__go_buildmodes() { + local -a buildmodes + buildmodes=( + 'archive[non-main packages into .a files]' + 'c-archive[main package, plus all packages it imports, into a C archive file]' + 'c-shared[main package, plus all packages it imports, into a C shared library]' + 'default[main packages are built into executables and listed non-main packages are built into .a files]' + 'shared[non-main packages into a single shared library that will be used when building with the -linkshared option]' + 'exe[main packages into executables]' + 'pie[main packages and everything they import into position independent executables (PIE)]' + 'plugin[main packages, plus all packages that they import, into a Go plugin]' + ) + + _values 'mode' $buildmodes +} + + +local -a commands build_flags +commands=( +'bug:start a bug report' +'build:compile packages and dependencies' +'clean:remove object files and cached files' +'doc:show documentation for package or symbol' +'env:print Go environment information' +'fix:update packages to use new APIs' +'fmt:gofmt (reformat) package sources' +'generate:generate Go files by processing source' +'get:download and install packages and dependencies' +'install:compile and install packages and dependencies' +'list:list packages or modules' +'mod:module maintenance' +'run:compile and run Go program' +'test:test packages' +'tool:run specified go tool' +'version :print Go version' +'vet:report likely mistakes in packages' +'help:get more information about a command' +) + +_arguments \ + "1: :{_describe 'command' commands}" \ + '*:: :->args' + +case $state in + args) + build_flags=( + '-a[force rebuilding of packages that are already up-to-date]' + '-n[print the commands but do not run them]' + '-p[number of builds that can be run in parallel]:number' + '-race[enable data race detection]' + '-v[print the names of packages as they are compiled]' + '-work[print temporary work directory and keep it]' + '-x[print the commands]' + '-asmflags[arguments for each go tool asm invocation]:flags' + '-buildmode[build mode to use]:mode:__go_buildmodes' + '-compiler[name of compiler to use]:name' + '-gccgoflags[arguments for gccgo]:args' + '-gcflags[arguments for each go tool compile invocation]:args' + '-installsuffix[suffix to add to package directory]:suffix' + '-ldflags[arguments to pass on each go tool link invocation.]:flags' + '-linkshared[link against shared libraries]' + '-pkgdir[install and load all packages from dir]:dir' + '-tags[list of build tags to consider satisfied]:tags' + '-toolexec[program to use to invoke toolchain programs]:args' + ) + + __go_packages() { + local gopaths + declare -a gopaths + gopaths=("${(s/:/)$(go env GOPATH)}") + gopaths+=("$(go env GOROOT)") + for p in $gopaths; do + _path_files -W "$p/src" -/ + done + } + + case $words[1] in + build) + _arguments \ + '-o[force build to write to named output file]:file:_files' \ + '-i[installs the packages that are dependencies of the target]' \ + ${build_flags[@]} \ + '*:importpaths:__go_packages' + ;; + + clean) + _arguments \ + '-i[remove corresponding installed archive or binary]' \ + '-r[apply clean recursively on all dependencies]' \ + ${build_flags[@]} \ + '*:importpaths:__go_packages' + ;; + + doc) + _arguments \ + '-c[respect case when matching symbols]' \ + '-cmd[treat a command (package main) like a regular package]' \ + '-u[show docs for unexported and exported symbols and methods]' + ;; + + fix) + _arguments '*:importpaths:__go_packages' + ;; + + fmt) + _arguments \ + '-n[prints commands that would be executed]' \ + '-x[prints commands as they are executed]' \ + '*:importpaths:__go_packages' + ;; + + generate) + _arguments \ + '-run=[specifies a regular expression to select directives]:regex' \ + '-x[print the commands]' \ + '-n[print the commands but do not run them]' \ + '-v[print the names of packages as they are compiled]' \ + "*:args:{ _alternative ':importpaths:__go_packages' _files }" + ;; + + get) + _arguments \ + '-d[instructs get to stop after downloading the packages]' \ + '-f[force get -u not to verify that each package has been checked from vcs]' \ + '-fix[run the fix tool on the downloaded packages]' \ + '-insecure[permit fetching/resolving custom domains]' \ + '-t[also download the packages required to build tests]' \ + '-u[use the network to update the named packages]' \ + ${build_flags[@]} \ + '*:importpaths:__go_packages' + ;; + + install) + _arguments ${build_flags[@]} \ + '*:importpaths:__go_packages' + ;; + + list) + _arguments \ + '-e[changes the handling of erroneous packages]' \ + '-f[specifies an alternate format for the list]:format' \ + '-json[causes package data to be printed in JSON format]' \ + '-compiled[set CompiledGoFiles to the Go source files presented to the compiler]' \ + '-deps[iterate over named packages and their dependencies]' \ + '-m[list modules instead of packages]' \ + ${build_flags[@]} \ + '*:importpaths:__go_packages' + ;; + + mod) + local -a mod_commands + mod_commands=( + 'download:download modules to local cache' + 'edit:edit go.mod from tools or scripts' + 'graph:print module requirement graph' + 'init:initialize new module in current directory' + 'tidy:add missing and remove unused modules' + 'vendor:make vendored copy of dependencies' + 'verify:verify dependencies have expected content' + 'why:explain why packages or modules are needed' + 'help:get more information about a command' + ) + + _arguments \ + "1: :{_describe 'command' mod_commands}" \ + '*:: :->args' + + case $state in + args) + case $words[1] in + download) + _arguments \ + '-json[print a sequance of JSON objects to standard output]' + ;; + + edit) + _arguments \ + '-fmt[reformats the go.mod file without making other changes]' \ + "-module[change the module's path]" \ + '*-require=[add a requirement on the given module path and version]:require' \ + '*-droprequire=[drop a requirement on the given module path and version]:droprequire' \ + '*-exclude=[add an exclusion for the given module path and version]:exclude' \ + '*-dropexclude=[drop an exclusion for the given module path and version]:dropexclude' \ + '*-replace=[add a replacement of the given module path and version]:replace' \ + '*-dropreplace=[drop a replacement of the given module path and version]:dropreplace' \ + '-json[prints the final go.mod file in JSON format]' \ + '-print[prints the final go.mod in its text format]' \ + ':go.mod:_path_files -g "go.mod"' + ;; + graph) + ;; + init) + # Use go packages as module name suggestion + _arguments \ + '*:module:__go_packages' + ;; + tidy) + _arguments \ + '-v[print information about removed modules to standard error]' + ;; + vendor) + _arguments \ + '-v[print the names of vendored modules and packages to standard error]' + ;; + verify) + ;; + why) + _arguments \ + '-m[treats the arguments as a list of modules]' \ + '-vendor[exclude tests of dependencies]' \ + '*:module:__go_packages' + ;; + esac + ;; + esac + ;; + + run) + _arguments \ + ${build_flags[@]} \ + '-exec[invoke the binary using xprog]:xporg' \ + '*:file:_files -g "*.go(-.)"' + ;; + + test) + _arguments \ + "-c[compile but don't run test]" \ + '-i[install dependencies of the test]' \ + '-bench[run benchmarks matching the regular expression]:regexp' \ + '-benchmem[print memory allocation statistics for benchmarks]' \ + '-benchtime[run benchmarks for t rime]:t' \ + '-blockprofile[write a goroutine blocking profile to the specified file]:block' \ + '-blockprofilerate[control goroutine blocking profiles]:n' \ + '-count[run each test and benchmark n times]:n' \ + '-cover[enable coverage analysis]' \ + '-covermode[set the mode for coverage analysis]:mode:(set count atomic)' \ + '-coverpkg[apply coverage analysis in each test of listed packages]:list' \ + '-coverprofile[write a coverage profile to file]:cover' \ + '-cpu[specify a list of GOMAXPROCS values]:cpus' \ + '-cpuprofile[write a CPU profile to the specified file]:profile' \ + '-memprofile[write a memory profile to file]:mem' \ + '-memprofilerate[enable more precise memory profiles]:n' \ + '-outputdir[place output files from profiling in output dir]:dir' \ + '-parallel[allow parallel execution of test functions]:n' \ + '-run[run tests and examples matching the regular expression]:regexp' \ + '-short[tell long-running tests to shorten their run time]' \ + '-timeout[timeout long running tests]:t' \ + '-trace[write an execution trace to the specified file]:trace' \ + '-v[verbose output]' \ + ${build_flags[@]} \ + '-exec[run test binary using xprog]:xprog' \ + '-o[compile test binary to named file]:file:_files' \ + '*:importpaths:__go_packages' + ;; + + tool) + local -a tools + tools=($(go tool)) + + _arguments \ + '-n[print command that would be executed]' \ + "1: :{_describe 'tool' tools}" \ + '*:: :->args' + + case $state in + args) + case $words[1] in + addr2line) + _files + ;; + + asm) + _arguments \ + '-D[predefined symbol with optional simple value]:value' \ + '-I[include directory]:value' \ + '-S[print assembly and machine code]' \ + '-debug[dump instructions as they are parsed]' \ + '-dynlink[support references to Go symbols]' \ + '-o[output file]:string' \ + '-shared[generate code that can be linked into a shared lib]' \ + '-trimpath[remove prefix from recorded source file paths]:string' + ;; + + callgraph) + local -a algos graphs + algos=( + 'static:static calls only' + 'cha:Class Hierarchy Analysis' + 'rta:Rapid Type Analysis' + 'pta:inclusion-based Points-To Analysis' + ) + graphs=( + 'digraph:output in digraph format' + 'graphviz:output in AT&T GraphViz (.dot) format' + ) + + _arguments \ + '-algo=[call-graph construction algorithm]:algos:{ _describe "algos" algos }' \ + "-test[include the package's tests in the analysis]" \ + '-format=[format in which each call graph edge is displayed]:graphs:{ _describe "graphs" graphs }' + ;; + + cgo) + _arguments \ + '-debug-define[print relevant #defines]' \ + '-debug-gcc[print gcc invocations]' \ + '-dynimport[if non-empty, print dynamic import data]:string' \ + '-dynlinker[record dynamic linker information]' \ + '-dynout[write -dynimport output to file]:file' \ + '-dynpackage[set Go package for -dynimport output]:string' \ + '-exportheader[where to write export header]:string' \ + '-gccgo[generate files for use with gccgo]' \ + '-gccgopkgpath[-fgo-pkgpath option used with gccgo]:string' \ + '-gccgoprefix[-fgo-prefix option used with gccgo]:string' \ + '-godefs[write Go definitions for C file to stdout]' \ + '-import_runtime_cgo[import runtime/cgo in generated code]' \ + '-import_syscall[import syscall in generated code]' \ + '-importpath[import path of package being built]:path' \ + '-objdir[object directory]:dir' + ;; + + compile) + _arguments \ + '-%[debug non-static initializers]' \ + '-+[compiling runtime]' \ + "-A[for bootstrapping, allow 'any' type]" \ + '-B[disable bounds checking]' \ + '-D[set relative path for local imports]:path' \ + '-E[debug symbol export]' \ + '-I[add directory to import search path]:directory' \ + '-K[debug missing line numbers]' \ + '-L[use full (long) path in error messages]' \ + '-M[debug move generation]' \ + '-N[disable optimizations]' \ + '-P[debug peephole optimizer]' \ + '-R[debug register optimizer]' \ + '-S[print assembly listing]' \ + '-V[print compiler version]' \ + '-W[debug parse tree after type checking]' \ + '-asmhdr[write assembly header to file]:file' \ + '-buildid[record id as the build id in the export metadata]:id' \ + '-complete[compiling complete package (no C or assembly)]' \ + '-cpuprofile[write cpu profile to file]:file' \ + '-d[print debug information about items in list]:list' \ + '-dynlink[support references to Go symbols]' \ + '-e[no limit on number of errors reported]' \ + '-f[debug stack frames]' \ + '-g[debug code generation]' \ + '-h[halt on error]' \ + '-i[debug line number stack]' \ + '-importmap[add definition of the form source=actual to import map]:definition' \ + '-installsuffix[set pkg directory suffix]:suffix' \ + '-j[debug runtime-initialized variables]' \ + '-l[disable inlining]' \ + '-largemodel[generate code that assumes a large memory model]' \ + '-live[debug liveness analysis]' \ + '-m[print optimization decisions]' \ + '-memprofile[write memory profile to file]:file' \ + '-memprofilerate[set runtime.MemProfileRate to rate]:rate' \ + '-nolocalimports[reject local (relative) imports]' \ + '-o[write output to file]:file' \ + '-p[set expected package import path]:path' \ + '-pack[write package file instead of object file]' \ + '-r[debug generated wrappers]' \ + '-race[enable race detector]' \ + '-s[warn about composite literals that can be simplified]' \ + '-shared[generate code that can be linked into a shared library]' \ + '-trimpath[remove prefix from recorded source file paths]:prefix' \ + '-u[reject unsafe code]' \ + '-v[increase debug verbosity]' \ + '-w[debug type checking]' \ + '-wb[enable write barrier (default 1)]' \ + '-x[debug lexer]' \ + '-y[debug declarations in canned imports (with -d)]' \ + '*:file:_files -g "*.go(-.)"' + ;; + + cover) + if (( CURRENT == 2 )); then + _arguments \ + '-func=[output coverage profile information for each function]:string' \ + '-html=[generate HTML representation of coverage profile]:file:_files' \ + '-mode=[coverage mode]:mode:(set count atomic)' + return + fi + + _arguments \ + '-o[file for output]:file' \ + '-var=[name of coverage variable to generate]:var' \ + '*:file:_files -g "*.go(-.)"' + ;; + + doc) + _arguments \ + '-c[respect case when matching symbols]' \ + '-cmd[treat a command (package main) like a regular package]' \ + '-u[show docs for unexported and exported symbols and methods]' \ + ;; + + fix) + _arguments \ + '-diff[display diffs instead of rewriting files]' \ + '-force[force fixes to run even if the code looks updated]:string' \ + '-r[restrict the rewrites]:string' \ + '*:files:_files' + ;; + + link) + _arguments \ + '-B[add an ELF NT_GNU_BUILD_ID note when using ELF]:note' \ + '-C[check Go calls to C code]' \ + '-D[set data segment address (default -1)]:address' \ + '-E[set entry symbol name]:entry' \ + '-H[set header type]:type' \ + '-I[use linker as ELF dynamic linker]:linker' \ + '-L[add specified directory to library path]:directory' \ + '-R[set address rounding quantum (default -1)]:quantum' \ + '-T[set text segment address (default -1)]:address' \ + '-V[print version and exit]' \ + '-W[disassemble input]' \ + '-X[add string value definition]:definition' \ + '-a[disassemble output]' \ + '-buildid[record id as Go toolchain build id]:id' \ + '-buildmode[set build mode]:mode' \ + '-c[dump call graph]' \ + '-cpuprofile[write cpu profile to file]:file' \ + '-d[disable dynamic executable]' \ + '-extld[use linker when linking in external mode]:linker' \ + '-extldflags[pass flags to external linker]:flags' \ + '-f[ignore version mismatch]' \ + '-g[disable go package data checks]' \ + '-h[halt on error]' \ + '-installsuffix[set package directory suffix]:suffix' \ + '-k[set field tracking symbol]:symbol' \ + '-linkmode[set link mode]:mode:(internal external auto)' \ + '-linkshared[link against installed Go shared libraries]' \ + '-memprofile[write memory profile to file]:file' \ + '-memprofilerate[set runtime.MemProfileRate to rate]:rate' \ + '-n[dump symbol table]' \ + '-o[write output to file]:file' \ + '-r[set the ELF dynamic linker search path to dir1:dir2:...]:path' \ + '-race[enable race detector]' \ + '-s[disable symbol table]' \ + '-shared[generate shared object (implies -linkmode external)]' \ + '-tmpdir[use directory for temporary files]:directory' \ + '-u[reject unsafe packages]' \ + '-v[print link trace]' \ + '-w[disable DWARF generation]' \ + '*:files:_files' + ;; + + objdump) + _arguments \ + '-s[only dump symbols matching this regexp]:regexp' \ + '*:files:_files' + ;; + + pack) + _arguments '1:ops:(c p r t x)' '::verbose:(v)' ':files:_files' + ;; + + pprof) + _arguments \ + '-callgrind[outputs a graph in callgrind format]' \ + '-disasm=[output annotated assembly]:p' \ + '-dot[outputs a graph in DOT format]' \ + '-eog[visualize graph through eog]' \ + '-evince[visualize graph through evince]' \ + '-gif[outputs a graph image in GIF format]' \ + '-gv[visualize graph through gv]' \ + '-list=[output annotated source for functions matching regexp]:p' \ + '-pdf[outputs a graph in PDF format]' \ + '-peek=[output callers/callees of functions matching regexp]:p' \ + '-png[outputs a graph image in PNG format]' \ + '-proto[outputs the profile in compressed protobuf format]' \ + '-ps[outputs a graph in PS format]' \ + '-raw[outputs a text representation of the raw profile]' \ + '-svg[outputs a graph in SVG format]' \ + '-tags[outputs all tags in the profile]' \ + '-text[outputs top entries in text form]' \ + '-top[outputs top entries in text form]' \ + '-tree[outputs a text rendering of call graph]' \ + '-web[visualize graph through web browser]' \ + '-weblist=[output annotated source in HTML]:p' \ + '-output=[generate output on file f (stdout by default)]:f' \ + '-functions[report at function level (default)]' \ + '-files[report at source file level]' \ + '-lines[report at source line level]' \ + '-addresses[report at address level]' \ + '-base[show delta from this profile]:profile' \ + '-drop_negative[ignore negative differences]' \ + '-cum[sort by cumulative data]' \ + '-seconds=[length of time for dynamic profiles]:n' \ + '-nodecount=[max number of nodes to show]:n' \ + '-nodefraction=[hide nodes below *total]:f' \ + '-edgefraction=[hide edges below *total]:f' \ + '-sample_index[index of sample value to display]' \ + '-mean[average sample value over first value]' \ + '-inuse_space[display in-use memory size]' \ + '-inuse_objects[display in-use object counts]' \ + '-alloc_space[display allocated memory size]' \ + '-alloc_objects[display allocated object counts]' \ + '-total_delay[display total delay at each region]' \ + '-contentions[display number of delays at each region]' \ + '-mean_delay[display mean delay at each region]' \ + '-runtime[show runtime call frames in memory profiles]' \ + '-focus=[restricts to paths going through a node matching regexp]:r' \ + '-ignore=[skips paths going through any nodes matching regexp]:r' \ + '-tagfocus=[restrict to samples tagged with key:value matching regexp]:r' \ + '-tagignore=[discard samples tagged with key:value matching regexp]' \ + '-call_tree[generate a context-sensitive call tree]' \ + '-unit=[convert all samples to unit u for display]:u' \ + '-divide_by=[scale all samples by dividing them by f]:f' \ + '-buildid=[override build id for main binary in profile]:id' \ + '-tools=[search path for object-level tools]:path' \ + '-help[help message]' \ + '*:files:_files' + ;; + + trace) + _arguments \ + '-http=[HTTP service address]:addr' \ + '*:files:_files' + ;; + + vet) + _arguments \ + '-all[check everything]' \ + '-asmdecl[check assembly against Go declarations]' \ + '-assign[check for useless assignments]' \ + '-atomic[check for common mistaken usages of the sync/atomic]' \ + '-bool[check for mistakes involving boolean operators]' \ + '-buildtags[check that +build tags are valid]' \ + '-composites[check that composite literals used field-keyed elements]' \ + '-compositewhitelist[use composite white list]' \ + '-copylocks[check that locks are not passed by value]' \ + '-methods[check that canonically named methods are canonically defined]' \ + '-nilfunc[check for comparisons between functions and nil]' \ + '-printf[check printf-like invocations]' \ + '-printfuncs[print function names to check]:string' \ + '-rangeloops[check that range loop variables are used correctly]' \ + '-shadow[check for shadowed variables]' \ + '-shadowstrict[whether to be strict about shadowing]' \ + '-shift[check for useless shifts]' \ + '-structtags[check that struct field tags have canonical format]' \ + '-tags[list of build tags to apply when parsing]:list' \ + '-test[for testing only: sets -all and -shadow]' \ + '-unreachable[check for unreachable code]' \ + '-unsafeptr[check for misuse of unsafe.Pointer]' \ + '-unusedfuncs[list of functions whose results must be used]:string' \ + '-unusedresult[check for unused result of calls to functions in -unusedfuncs]' \ + '-unusedstringmethods[list of methods whose results must be used]:string' \ + '-v[verbose]' \ + '*:files:_files' + ;; + + yacc) + _arguments \ + '-o[output]:output' \ + '-v[parsetable]:parsetable' \ + '*:files:_files' + ;; + esac + ;; + esac + ;; + + vet) + _arguments \ + '-n[print commands that would be executed]' \ + '-x[prints commands as they are executed]' \ + ${build_flags[@]} \ + '*:importpaths:__go_packages' + ;; + help) + local -a topics + topics=( + 'buildmode:build modes' + 'c:calling between Go and C' + 'cache:build and test caching' + 'environment:environment variables' + 'filetype:file types' + 'go.mod:the go.mod file' + 'gopath:GOPATH environment variable' + 'gopath-get:legacy GOPATH go get' + 'goproxy:module proxy protocol' + 'importpath:import path syntax' + 'modules:modules, module versions, and more' + 'module-get:module-aware go get' + 'packages:package lists and patterns' + 'testflag:testing flags' + 'testfunc:testing functions' + ) + + _arguments "1: :{_describe 'command' commands -- topics}" + ;; + esac + ;; +esac diff --git a/.zprezto/modules/completion/external/src/_hledger b/.zprezto/modules/completion/external/src/_hledger new file mode 100644 index 0000000..0c1937b --- /dev/null +++ b/.zprezto/modules/completion/external/src/_hledger @@ -0,0 +1,286 @@ +#compdef hledger + +# ------------------------------------------------------------------------------ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for hleder 1.10 ( http://hledger.org/ ) +# Last updated: 07.08.2018 +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Valodim ( https://github.com/Valodim ) +# * fdw ( https://github.com/fdw ) +# +# ------------------------------------------------------------------------------ +# Notes +# ----- +# +# account completion depends on availability of a ~/.hledger.journal file +# +# ------------------------------------------------------------------------------ + + +local curcontext="$curcontext" curstate state line expl grp cmd ret=1 +typeset -a args +typeset -A opt_args + +args=( + '(- *)'{-h,--help}'[print help information]' + '(-f --file)'{-f,--file}'=[use a different input file]:input file:_files' + '--rules-file=[CSV conversion rules file]:rules file:_files' + '--alias=[display accounts named OLD as NEW]:alias specification' + '--anon=[anonymize accounts and payees]' + '(-b --begin)'{-b,--begin}'=[include postings/txns on or after this date]:date' + '(-e --end)'{-e,--end}'=[include postings/txns before this date]:date' + '(-D --daily)'{-D,--daily}'[multiperiod/multicolumn report by day]' + '(-W --weekly)'{-W,--weekly}'[multiperiod/multicolumn report by week]' + '(-M --monthly)'{-M,--monthly}'[multiperiod/multicolumn report by month]' + '(-Q --quarterly)'{-Q,--quarterly}'[multiperiod/multicolumn report by quarter]' + '(-Y --yearly)'{-Y,--yearly}'[multiperiod/multicolumn report by year]' + '(-p --period)'{-p,--period}'=[set start date, end date, and/or reporting interval all at once]' + '(-C --cleared)'{-C,--cleared}'[include only cleared postings/txns]' + '(-U --uncleared)'{-U,--uncleared}'[include only uncleared postings/txns]' + '(-R --real)'{-R,--real}'[include only non-virtual postings]' + '(--depth)--depth=[hide accounts/postings deeper than N]:depth' + '(-E --empty)'{-E,--empty}'[show empty/zero things which are normally omitted]' + '(-B --cost)'{-B,--cost}'[show amounts in their cost price'\''s commodity]' + '(-V --value)'{-V,--value}'[converts reported amounts to the current market value]' + '(-I --ignore-assertions)'{-I,--ignore-assertions}'[ignore any failing balance assertions]' + '--forecast=[apply periodic transaction rules to generate future transactions]' +) + +_arguments -C "$args[@]" -A "-*" \ + '(- *)--version[print version information]' \ + '--debug[show debug output]' \ + '1: :->cmds' \ + '*:: :->args' && ret=0 + +while (( $#state )); do + curstate=$state + shift state + case $curstate in + cmds) + typeset -a cmds + cmds=( + 'accounts:show account names (a)' + 'activity:show an ascii barchart of posting counts per interval' + 'add:prompt for transactions and add them to the journal' + 'balance:show accounts and balances (b, bal)' + 'balancesheet:show a balance sheet (bs)' + 'balancesheetequity:like balancesheet, but also reports equity' + 'cashflow:show a cashflow statement (cf)' + 'check-dates:check that transactions are sorted by increasing date' + 'check-dupes:report account names having the same leaf but different prefixes' + 'close:print closing/opening transactions that bring some or all account balances to zero and back' + 'help:show any of the hledger manuals' + 'import:read new transactions added to each file since last run, and add them to the main journal file' + 'incomestatement:show an income statement (is)' + 'prices:print market price directives from the journal' + 'print:show transaction entries (p, txns)' + 'print-unique:print transactions which do not reuse an already-seen description' + 'register:show postings and running total (r, reg)' + 'register-patch:print the one posting whose transaction description is closest to the description' + 'rewrite:print all transactions, adding custom postings to the matched ones' + 'stats:show some journal statistics' + 'tags:list all the tag names used in the journal' + 'test:run built-in unit tests' + ) + _describe 'subcommands' cmds && ret=0 + ;; + args) + : $words + local cmd=$words[1] + (( $+cmd )) || return 1 + # curcontext="${curcontext%:*:*}:$service-$cmd:" + case $cmd in + accounts) + args=( + '(--declared)--declared[show account names declared with account directives]' + '(--used)--used[show account names posted to by transactions]' + '(--tree)--tree[show accounts as a tree (default in simple reports)]' + '(--flat)--flat[show accounts as a list (default in multicolumn)]' + '(--drop)--drop=[flat mode, omit N leading account name parts]:drop n' + ) + ;; + activity) + ;; + add) + args=( + '(--no-new-accounts)--no-new-accounts=[do not allow creating new accounts]' + ) + ;; + bal|balance) + args+=( + '(--change)--change[show balance change in each period (default)]' + '(--cumulative)--cumulative[show balance change accumulated across periods]' + '(-H --historical)'{-H,--historical}'[show historical ending balance in each period]' + '(--tree)--tree[show accounts as a tree (default in simple reports)]' + '(--flat)--flat[show accounts as a list (default in multicolumn)]' + '(-A --average)'{-A,--average}'[show a row average column (in multicolumn mode)]' + '(-T --row-total)'{-T,--row-total}'[show a row total column]' + '(-N --no-total)'{-N,--no-total}'[do not show the final total row]' + '(--drop)--drop=[in flat mode, omit N leading account name parts]:drop n' + '(--no-elide)--no-elide[tree mode, do not squash boring parent accounts]' + '(--format)--format=[in tree mode, use this custom line format]:custom line format' + '(-O --output-format)'{-O,--output-format}='[select the output format from txt, csv, html]:format' + '(-o --output-file)'{-o,--output-file}'=[write output to file]:file' + '(--pretty-tables)--pretty-tables[use unicode to display prettier tables]' + '(--sort-amount)--sort-amount[sort by amount instead of account code/name]' + '(--invert)--invert[display all amounts with reversed sign]' + '(--budget)--budget[show performance compared to budget goals]' + '(--show-unbudgeted)--show-unbudgeted[with --budget, show unbudgeted accounts also]' + ) + ;; + bl|balancesheet|balancesheetequity) + args+=( + '(--change)--change[show balance change in each period (default)]' + '(--cumulative)--cumulative[show balance change accumulated across periods]' + '(-H --historical)'{-H,--historical}'[show historical ending balance in each period]' + '(--tree)--tree[show accounts as a tree (default in simple reports)]' + '(--flat)--flat[show accounts as a list (default in multicolumn)]' + '(-A --average)'{-A,--average}'[show a row average column (in multicolumn mode)]' + '(-T --row-total)'{-T,--row-total}'[show a row total column]' + '(-N --no-total)'{-N,--no-total}'[do not show the final total row]' + '(--drop)--drop=[in flat mode, omit N leading account name parts]:drop n' + '(--no-elide)--no-elide[tree mode, do not squash boring parent accounts]' + '(--format)--format=[in tree mode, use this custom line format]:custom line format' + '(--sort-amount)--sort-amount[sort by amount instead of account code/name]' + ) + ;; + cashflow|cf|balancesheet|bs|incomestatement|is) + args+=( + '(--change)--change[show balance change in each period (default)]' + '(--cumulative)--cumulative[show balance change accumulated across periods]' + '(-H --historical)'{-H,--historical}'[show historical ending balance in each period]' + '(--tree)--tree[show accounts as a tree (default in simple reports)]' + '(--flat)--flat[show accounts as a list (default in multicolumn)]' + '(-A --average)'{-A,--average}'[show a row average column (in multicolumn mode)]' + '(-T --row-total)'{-T,--row-total}'[show a row total column]' + '(-N --no-total)'{-N,--no-total}'[do not show the final total row]' + '(--drop)--drop=[in flat mode, omit N leading account name parts]:drop n' + '(--no-elide)--no-elide[tree mode, do not squash boring parent accounts]' + '(--format)--format=[in tree mode, use this custom line format]:custom line format' + '(--sort-amount)--sort-amount[sort by amount instead of account code/name]' + ) + ;; + import) + args=( + '(--dry-run)--dry-run[just show the transactions to be imported]' + ) + ;; + is|incomestatement) + args+=( + '(--change)--change[show balance change in each period (default)]' + '(--cumulative)--cumulative[show balance change accumulated across periods]' + '(-H --historical)'{-H,--historical}'[show historical ending balance in each period]' + '(--tree)--tree[show accounts as a tree (default in simple reports)]' + '(--flat)--flat[show accounts as a list (default in multicolumn)]' + '(-A --average)'{-A,--average}'[show a row average column (in multicolumn mode)]' + '(-T --row-total)'{-T,--row-total}'[show a row total column]' + '(-N --no-total)'{-N,--no-total}'[do not show the final total row]' + '(--drop)--drop=[in flat mode, omit N leading account name parts]:drop n' + '(--no-elide)--no-elide[tree mode, do not squash boring parent accounts]' + '(--format)--format=[in tree mode, use this custom line format]:custom line format' + '(--sort-amount)--sort-amount[sort by amount instead of account code/name]' + ) + ;; + print) + args=( + '(-m --match)'{-m,--match}'[show the transaction whose description is most similar]:string' + '(--new)--new[show only newer-dated transactions added in each file since last run]' + '(-x --explicit)'{-x,--explicit}'[show all amounts explicitly]' + '(-O --output-format)'{-O,--output-format}='[select the output format from txt, csv, html]:format' + '(-o --output-file)'{-o,--output-file}'=[write output to file]:file' + ) + ;; + register|reg) + args+=( + '(--cumulative)--cumulative[show balance change accumulated across periods]' + '(-H --historical)'{-H,--historical}'[show historical ending balance in each period]' + '(-A --average)'{-A,--average}'[show a row average column (in multicolumn mode)]' + '(-r --related)'{-r,--related}'[show postings'\'' siblings instead]' + '(-w --width)'{-w,--width}'=[set output width to 120, or N]:width (default 80)' + '(-O --output-format)'{-O,--output-format}='[select the output format from txt, csv, html]:format' + '(-o --output-file)'{-o,--output-file}'=[write output to file]:file' + ) + ;; + stats) + args=( + '(-o --output-file)'{-o,--output-file}'=[write output to file]:file' + ) + ;; + # fallback to _default + *) _arguments -C -A "-*" "$args[@]" \ + '*: :_default' && ret=0 + continue + esac + _arguments -C -A "-*" "$args[@]" \ + '*:query patterns:->query' && ret=0 + ;; + query) + + local -a accs keywords + keywords=( + 'acct\::match account names' + 'code\::match by transaction code' + 'desc\::match transaction descriptions' + 'tag\::match by tag name' + 'depth\::match at or above depth' + 'status\::match cleared/uncleared transactions' + 'real\::match real/virtual transactions' + 'empty\::match if amount is/is not zero' + 'amt\::match transaction amount' + 'cur\::match by currency' + ) + if compset -P 'amt:'; then + _message 'match amount (<, <=, >, >=, add sign for non-absolute match)' && ret=0 + continue + fi + if compset -P '(#b)(code|desc|tag|depth|status|real|empty):'; then + _message "'$match[1]' parameter" && ret=0 + continue + fi + + accs=( ${(f)"$(_call_program hledger hledger accounts $PREFIX 2>/dev/null)"} ) + if (( $? )); then + _message "error fetching accounts from hledger" + fi + + # decided against partial matching here. these lines can + # be uncommented to complete subaccounts hierarchically + # (add -S '' -q to the compadd below, too) + # if compset -P '(#b)(*):'; then + # accs=( ${(M)accs:#$match[1]:*} ) + # accs=( ${accs#$IPREFIX} ) + # fi + # accs=( ${accs%%:*} ) + + _wanted accounts expl "accounts" compadd -a accs && ret=0 + _describe "matcher keywords" keywords -S '' && ret=0 + + # not is special, it doesn't need the -S '' + keywords=( + 'not:negate expression' + ) + _describe "matcher keywords" keywords && ret=0 + + ;; + esac +done + +return ret diff --git a/.zprezto/modules/completion/external/src/_include-what-you-use b/.zprezto/modules/completion/external/src/_include-what-you-use new file mode 100644 index 0000000..bb9902c --- /dev/null +++ b/.zprezto/modules/completion/external/src/_include-what-you-use @@ -0,0 +1,65 @@ +#compdef include-what-you-use + +# Copyright 2018 CERN for the benefit of the LHCb Collaboration. +# All rights reserved. +# +# Developed by: +# +# CERN LBC group +# +# CERN +# +# http://cern.ch +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# with 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: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimers. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimers in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of the LBC group, CERN, nor the names of its +# contributors may be used to endorse or promote products derived from +# this Software without specific prior written permission. +# +# 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 +# CONTRIBUTORS 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 WITH +# THE SOFTWARE. +# +# In applying this licence, CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# TODO: +# - prevent _iwyu_opts from running once the first clang option got passed + +_iwyu_opts() { + _arguments '--check_also=[print iwyu-violation info for files matching the given glob pattern]:glob pattern:' \ + '--cwd=[specify the current working directory]:current working directory:_path_files -/' \ + '--howtodebug[print instructions on how to run iwyu under gdb]' \ + '--howtodebug=[print instructions on how to run iwyu under gdb if file matches argument]:file for debug run:_path_files' \ + '*'"--mapping_file=[iwyu mapping file]:iwyu mapping file:_path_files -g '*(/) *.imp'" \ + "--no_default_mappings[do not add iwyu's default mappings]" \ + '--pch_in_code[mark the first include in a translation unit as a precompiled header]' \ + '--prefix_header_includes=[what to do with command line includes]:command line include treatment:(add keep remove)' \ + "--transitive_includes_only[do not suggest that a file add headers that aren't already visible]" \ + '--max_line_length=[maximum line length for includes]:a number:' \ + '--no_comments[do not add "why" comments]' \ + '--no_fwd_decls[do not use forward declarations]' \ + '--verbose=[the higher the level, the more output]:a number:' +} + +_arguments "*-Xiwyu[include-what-you-use options]:include-what-you-use options:_iwyu_opts" +# gcc will also provide --version and --help. Not ideal. +_gcc diff --git a/.zprezto/modules/completion/external/src/_kak b/.zprezto/modules/completion/external/src/_kak index 9fd2540..6079f36 100644 --- a/.zprezto/modules/completion/external/src/_kak +++ b/.zprezto/modules/completion/external/src/_kak @@ -42,8 +42,10 @@ # ------------------------------------------------------------------------------ _kak_sessions() { - session_ids=($(_call_program session_ids kak -l)) - _values "${session_ids[@]}" + local -a session_ids expl + session_ids=($(_call_program session_names kak -l)) + _description session-ids expl "session name" + compadd "$expl[@]" -a session_ids } _kak() { diff --git a/.zprezto/modules/completion/external/src/_node b/.zprezto/modules/completion/external/src/_node index f9ef3c7..36c58ff 100644 --- a/.zprezto/modules/completion/external/src/_node +++ b/.zprezto/modules/completion/external/src/_node @@ -1,6 +1,6 @@ #compdef node # ------------------------------------------------------------------------------ -# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# Copyright (c) 2018 Github zsh-users - http://github.com/zsh-users # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ # Description # ----------- # -# Completion script for Node.js v0.8.4 (http://nodejs.org) +# Completion script for Node.js v10.4.1 (https://nodejs.org) # # ------------------------------------------------------------------------------ # Authors @@ -36,24 +36,64 @@ # # * Mario Fernandez (https://github.com/sirech) # * Nicholas Penree (https://github.com/drudge) +# * Masafumi Koba (https://github.com/ybiquitous) # # ------------------------------------------------------------------------------ +_node_files() { + _files -g "*.(js|mjs)" +} + local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C \ - '(- 1 *)--help[print options help]' \ - '(- 1 *)'{-v,--version}'[print node version]' \ - '(--no-deprecation)--no-deprecation[silence deprecation warnings]' \ - '(--trace-deprecation)--trace-deprecation[show stack traces on deprecations]' \ + '-[script read from stdin (default; interactive mode if a tty)]' \ + '--[indicate the end of node options]' \ + '--abort-on-uncaught-exception[aborting instead of exiting causes a core file to be generated for analysis]' \ + '--experimental-modules[experimental ES Module support and caching modules]' \ + '--experimental-repl-await[experimental await keyword support in REPL]' \ + '--experimental-vm-modules[experimental ES Module support in vm module]' \ + '--icu-data-dir=[set ICU data load path to dir (overrides NODE_ICU_DATA) note: linked-in ICU data is present]: :_directories' \ + '--inspect-brk=-[activate inspector on host:port and break at start of user script]:[host\:]port' \ + '--inspect-port=[set host:port for inspector]:[host\:]port' \ + '--inspect=-[activate inspector on host:port (default: 127.0.0.1:9229)]:[host\:]port' \ + '--napi-modules[load N-API modules (no-op - option kept for compatibility)]' \ + '--no-deprecation[silence deprecation warnings]' \ + '--no-force-async-hooks-checks[disable checks for async_hooks]' \ + '--no-warnings[silence all process warnings]' \ + '--openssl-config=[load OpenSSL configuration from the specified file (overrides OPENSSL_CONF)]:file:_files' \ + '--pending-deprecation[emit pending deprecation warnings]' \ + '--preserve-symlinks[preserve symbolic links when resolving]' \ + '--preserve-symlinks-main[preserve symbolic links when resolving the main module]' \ + '--prof[generate V8 profiler output]' \ + '--prof-process[process V8 profiler output generated using --prof]' \ + '--redirect-warnings=[write warnings to file instead of stderr]: :_files' \ + '--throw-deprecation[throw an exception on deprecations]' \ + '--tls-cipher-list=[use an alternative default TLS cipher list]:cipher list string' \ + '--trace-deprecation[show stack traces on deprecations]' \ + '--trace-event-categories[comma separated list of trace event categories to record]: :{_values -s , categories node node.async_hooks node.bootstrap node.perf node.perf.usertiming node.perf.timerify node.fs.sync node.vm.script v8}' \ + '--trace-event-file-pattern[Template string specifying the filepath for the trace-events data, it supports ${rotation} and ${pid} log-rotation id. %2$u is the pid.]:template string' \ + '--trace-events-enabled[track trace events]' \ + '--trace-sync-io[show stack trace when use of sync IO is detected after the first tick]' \ + '--trace-warnings[show stack traces on process warnings]' \ + '--track-heap-objects[track heap object allocations for heap snapshots]' \ + '--use-bundled-ca[use bundled CA store (default)]' \ + "--use-openssl-ca[use OpenSSL's default CA store]" \ '(- 1 *)--v8-options[print v8 command line options]' \ - '(--max-stack-size)--max-stack-size=[set max v8 stack size (bytes)]' \ - '(-e --eval)'{-e,--eval}'[evaluate script]:Inline Script' \ - '(-i --interactive)'{-i,--interactive}'[always enter the REPL even if stdin does not appear to be a terminal]' \ - '(-p --print)'{-p,--print}'[print result of --eval]' \ - '(--vars)--vars[print various compiled-in variables]' \ - '*:JS Script:_files -g "*.js"' && ret=0 + "--v8-pool-size=[set v8's thread pool size]:number" \ + '--zero-fill-buffers[automatically zero-fill all newly allocated Buffer and SlowBuffer instances]' \ + {-c,--check}'[syntax check script without executing]' \ + '(- 1 *)'{-e,--eval}'[evaluate script]:inline JavaScript' \ + '(- 1 *)'{-h,--help}'[print node command line options]' \ + {-i,--interactive}'[always enter the REPL even if stdin does not appear to be a terminal]' \ + '(- 1 *)'{-p,--print}'[evaluate script and print result]:inline JavaScript' \ + '*'{-r,--require}'[module to preload (option can be repeated)]: :_node_files' \ + '(- 1 *)'{-v,--version}'[print Node.js version]' \ + '*: :_node_files' && ret=0 + +_values 'commands' \ + 'inspect[enable inspector for debugging]' && ret=0 return ret diff --git a/.zprezto/modules/completion/external/src/_paste b/.zprezto/modules/completion/external/src/_paste deleted file mode 100644 index fd7d035..0000000 --- a/.zprezto/modules/completion/external/src/_paste +++ /dev/null @@ -1,58 +0,0 @@ -#compdef paste -# -# ------------------------------------------------------------------------------ -# Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the zsh-users nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for paste (from util-linux 2.27.1->) -# (https://git.kernel.org/cgit/utils/util-linux/util-linux.git/) -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * Ole Jørgen Brønner -# -# ------------------------------------------------------------------------------ -# -# Note: paste has upstream bash completion -# Note: Credit to https://github.com/RobSis/zsh-completion-generator which was -# used to generate most of the script. - -local arguments - -arguments=( - '*'{-d,--delimiters}'[reuse characters from LIST instead of TABs]:delimiters' - '(-s --serial)'{-s,--serial}'[paste one file at a time instead of in parallel]' - '(-z --zero-terminated)'{-z,--zero-terminated}'[line delimiter is NUL, not newline]' - '--help[display this help and exit]' - '--version[output version information and exit]' - '*:filename:_files' -) - -_arguments -s $arguments diff --git a/.zprezto/modules/completion/external/src/_pgsql_utils b/.zprezto/modules/completion/external/src/_pgsql_utils index 8bd16fb..ae44844 100644 --- a/.zprezto/modules/completion/external/src/_pgsql_utils +++ b/.zprezto/modules/completion/external/src/_pgsql_utils @@ -303,7 +303,8 @@ _pg_restore () { --no-security-labels'[do not restore security labels]' \ --no-tablespaces'[do not restore tablespace assignments]' \ --section=':dump named section:_values "section" pre-data data post-data' \ - --use-set-session-authorization'[use SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to set ownership]' + --use-set-session-authorization'[use SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to set ownership]' \ + "1: :_files" } _pg_dumpall () { diff --git a/.zprezto/modules/completion/external/src/_port b/.zprezto/modules/completion/external/src/_port index 29a08fa..d186ef9 100644 --- a/.zprezto/modules/completion/external/src/_port +++ b/.zprezto/modules/completion/external/src/_port @@ -119,7 +119,7 @@ _port() { ) pseudo_common=(all current active inactive actinact installed uninstalled outdated - obsolete requested unrequested leaves) + obsolete requested unrequested leaves rleaves) pseudo_advanced=('variants:' 'variant:' 'description:' 'depends:' 'depends_lib:' 'depends_run:' 'depends_build:' 'depends_fetch:' 'depends_extract:' @@ -127,6 +127,7 @@ _port() { 'maintainers:' 'maintainer:' 'categories:' 'category:' 'version:' 'revision:' 'license:') select_options=( + '--summary:Display sumamry of selected options' '--list:List available versions for the group' '--set:Select the given version for the group' '--show:Show which version is currently selected for the group (default if none given)' @@ -157,7 +158,7 @@ _port() { '-F[Read and process the file of commands specified by the argument.]' \ '-p[Despite any errors encountered, proceed to process multiple ports and commands.]' \ '-y[Perform a dry run.]' \ - '-t[Enable trace mode debug facilities on platforms that support it (Mac OS X).]' \ + '-t[Enable trace mode debug facilities on platforms that support it (macOS).]' \ "1:Port actions:(($actions))" \ '::Per-action arguments:_port_dispatch' \ && return 0 diff --git a/.zprezto/modules/completion/external/src/_rclone b/.zprezto/modules/completion/external/src/_rclone deleted file mode 100644 index 15d3fc0..0000000 --- a/.zprezto/modules/completion/external/src/_rclone +++ /dev/null @@ -1,119 +0,0 @@ -#compdef rclone - -# ------------------------------------------------------------------------------ -# Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the zsh-users nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for rclone (http://rclone.org/). -# -# ------------------------------------------------------------------------------ -# Author(s) -# ------- -# -# * Rajat Roy -# -# ------------------------------------------------------------------------------ - -_rclone() { - local state - - _arguments \ - '1: :->subcommand' \ - '--bwlimit' \ - '--checkers' \ - '(-c --checksum)'{-c,--checksum}'[check the file hash and size to determine if files are equal]' \ - '--config' \ - '--contimeout' \ - '--dedupe-mode' \ - '(-n --dry-run)'{-n,--dry-run}'[Do a trial run with no permanent changes]' \ - '--ignore-existing' \ - '--ignore-size' \ - '(-I --ignore-times)'{-I,--ignore-times}'[unconditionally upload all files regardless of the state of files on the destination]' \ - '--log-file' \ - '--low-level-retries' \ - '--max-depth' \ - '--modify-window' \ - '--no-gzip-encoding' \ - '--no-update-modtime' \ - '(-q --quiet)'{-q,--quiet}'[as little output as possible]' \ - '--retries' \ - '--size-only' \ - '--stats' \ - '--delete-' \ - '--timeout' \ - '--transfers' \ - '(-u --update)'{-u,--update}'[skip any files which exist on the destination and have a modified time that is newer than the source file]' \ - '(-v --verbose)'{-v,--verbose}'[tells you about every file it considers and transfers]' \ - '--delete-excluded' \ - '--filter' \ - '--filter-from' \ - '-exclude' \ - '--exclude-from' \ - '--include' \ - '--include-from' \ - '--files-from' \ - '--min-size' \ - '--max-size' \ - '--min-age' \ - '--max-age' \ - '--dump-filters' \ - '*:files:_files' - - case $state in - subcommand) - _arguments '1: :( - config - copy - sync - move - delete - purge - mkdir - rmdir - check - ls - lsd - lsl - md5sum - sha1sum - size - version - cleanup - dedupe - authorize - cat - genautocomplete - gendocs - listremotes - mount - --help)' - ;; - esac -} - -_rclone "$@" diff --git a/.zprezto/modules/completion/external/src/_rspec b/.zprezto/modules/completion/external/src/_rspec index 2ffb196..7bef11c 100644 --- a/.zprezto/modules/completion/external/src/_rspec +++ b/.zprezto/modules/completion/external/src/_rspec @@ -48,6 +48,9 @@ _rspec() { '*'{-O,--options}'[Specify the path to a custom options file]:PATH:_files' \ --order'[Run examples by the specified order type]: :->order' \ --seed'[Equivalent of --order rand:SEED]: :_guard "[[\:digit\:]]#" "SEED"' \ + --bisect'[Repeatedly runs the suite in order to isolate the failures to the smallest reproducible case]' \ + --only-failures'[Filter to just the examples that failed the last time they ran]' \ + '(-n --next-failure)'{-n,--next-failure}'[Apply `--only-failures` and abort after one failure (equivalent to `--only-failures --fail-fast --order defined`)]' \ --fail-fast'[Abort the run on first failure]' \ --no-fail-fast'[Do not abort the run on first failure]' \ --failure-exit-code'[Override the exit code used when there are failing specs]: :_guard "[[\:digit\:]]#" "CODE"' \ @@ -58,8 +61,10 @@ _rspec() { '(-o --out)'{-o,--out}'[Write output to a file instead of $stdout]:FILE:_files' \ --deprecation-out'[Write deprecation warnings to a file instead of $stderr]:FILE:_files' \ '(-b --backtrace)'{-b,--backtrace}'[Enable full backtrace]' \ - '(-c --color)'{-c,--color}'[Enable color in the output]' \ + --force-color'[Force the output to be in color, even if the output is not a TTY]' \ + --no-color'[Force the output to not be in color, even if the output is a TTY]' \ '(-p --profile)'{-p,--profile}'[Enable profiling of examples and list the slowest examples (default: 10)]: :_guard "[[\:digit\:]]#" "COUNT"' \ + --no-profile'[Disable profiling of examples]' \ '(-w --warnings)'{-w,--warnings}'[Enable ruby warnings]' \ '(-P --pattern)'{-P,--pattern}'[Load files matching pattern (default: "spec/**/*_spec.rb")]:PATTERN:' \ --exclude-pattern'[Load files except those matching pattern]:PATTERN:' \ diff --git a/.zprezto/modules/completion/external/src/_scl b/.zprezto/modules/completion/external/src/_scl deleted file mode 100644 index 831d528..0000000 --- a/.zprezto/modules/completion/external/src/_scl +++ /dev/null @@ -1,81 +0,0 @@ -#compdef scl -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for Software Collections (https://www.softwarecollections.org). -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * Julien Nicoulaud -# -# ------------------------------------------------------------------------------ - -_scl() { - local context curcontext="$curcontext" state line - typeset -A opt_args - - local ret=1 - - _arguments -C \ - '1: :_scl_cmds' \ - "(- : *)"{-h,--help}'[display help information]' \ - "(- : *)"{-l,--list}'[list installed Software Collections or packages that belong to them]:installed collection:_scl_installed_collections' \ - '*::arg:->args' \ - && ret=0 - - case $state in - (args) - curcontext="${curcontext%:*:*}:scl-cmd-$words[1]:" - case $line[1] in - (register) - _arguments '1:Software Collection path:_files -/' && ret=0 - ;; - (deregister) - _arguments -C \ - '1:: :_scl_installed_collections' \ - '--force[force suppression of the collection]' \ - && ret=0 - ;; - (enable) - _arguments -C \ - '1:: :_scl_installed_collections' \ - '2:command: _command_names -e' \ - && ret=0 - ;; - *) - _call_function ret _scl_cmd_$words[1] && ret=0 - (( ret )) && _message 'no more arguments' - ;; - esac - ;; - esac -} - -(( $+functions[_scl_cmds] )) || -_scl_cmds() { - local commands; commands=( - 'register:register a Software Collection' - 'deregister:deregister a Software Collection' - 'enable:enable a Software Collection' - ) - _describe -t commands 'scl command' commands "$@" -} - -(( $+functions[_scl_installed_collections] )) || -_scl_installed_collections() { - local installed_collections; installed_collections=($(_call_program installed_collections $service --list)) - _describe -t collections 'Software Collection' installed_collections "$@" -} - -_scl "$@" - -# Local Variables: -# mode: Shell-Script -# sh-indentation: 2 -# indent-tabs-mode: nil -# sh-basic-offset: 2 -# End: -# vim: ft=zsh sw=2 ts=2 et diff --git a/.zprezto/modules/completion/external/src/_scons b/.zprezto/modules/completion/external/src/_scons new file mode 100644 index 0000000..f9b6b8c --- /dev/null +++ b/.zprezto/modules/completion/external/src/_scons @@ -0,0 +1,72 @@ +#compdef scons +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for SCons 2.5.1 (http://scons.org/) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Oliver Kiddle +# +# ------------------------------------------------------------------------------ + +_arguments -s -S \ + '(-c --clean --remove)-'{c,-clean,-remove}'[remove specified targets and dependencies]' \ + '(-C --directory)-'{C,-directory=}'[change to specified directory first]:directory:_directories' \ + '--cache-debug=[print CacheDir debug info to file]:file:_files' \ + '(--cache-disable --no-cache)--'{cache-disable,no-cache}"[don't retrieve built targets from cache]" \ + '(--cache-force --cache-populate)--'{cache-force,cache-populate}'[copy already-built targets into cache]' \ + "--cache-readonly[don't update CacheDir with built targets]" \ + '--cache-show[print build actions for files from cache]' \ + '--config=[set Configure mode]:mode:(auto force cache)' \ + '(-u --up --search-up -U)-D[search up for SConstruct; build default targets]' \ + '--debug=[print debugging information]:type:( + count duplicate explain findlibs includes memoizer memory objects pdb prepare presub stacktrace time)' \ + '--diskcheck=[enable specific on-disk checks]:check:(all none match rcs sccs)' \ + '--duplicate=[set preferred file duplication methods]:file duplication methods:( + hard-soft-copy soft-hard-copy hard-copy soft-copy copy)' \ + '(-f --file --makefile --sconstruct)-'{f,-file=,-makefile=,-sconstruct=}'[specify SConstruct file]:file:_files' \ + '(-)-'{h,-help}'[display defined usage information]' \ + '(-)-'{H,-help-options}'[display usage information]' \ + '(-i -ignore-errors)-'{i,-ignore-errors}'[ignore errors from build actions]' \ + \*{-I,--include-dir=}'[add directory to search Python modules]:directories:_directories' \ + '(--implicit-deps-changed --implicit-deps-unchanged)--implicit-cache[cache scanned dependencies]' \ + '(--implicit-cache --implicit-deps-changed)--implicit-deps-changed[rescan dependencies]' \ + '(--implicit-cache --implicit-deps-unchanged)--implicit-deps-unchanged[ignore changes to scanned dependencies]' \ + '--interactive[start interactive mode]' \ + '(-j --jobs)-'{j,jobs=}'[specify no of jobs to run in parallel]' \ + '(-k --keep-going)-'{k,-keep-going}'[continue after an error]' \ + '--max-drift=[set the maximum clock drift]:drift (seconds)' \ + '--md5-chunksize=[set chunksize for MD5 signature computation]:size (kB)' \ + '(-n --just-print --dry-run --recon)-'{n,-just-print,-dry-run,-recon}"[print commands but don't run them]" \ + "--no-site-dir[don't use the usual site_scons directory]" \ + '--profile=[profile scons]:output file:_files' \ + '(-q --question)-'{q,question}'[query whether up-to-date]' \ + '-Q[suppress progress messages]' \ + '--random[build dependencies in random order]' \ + '(-s --silent --quiet)-'{s,-silent,-quiet}"[don't print commands]" \ + '--site-dir=[specify site_scons directory]:directory:_directories' \ + '--stack-size[set stacksize of threads]:size (kB)' \ + '--taskmastertrace=[trace node evaluation to file]:file' \ + '--tree=[print dependency tree]:format:(all derived prune status)' \ + '(-u --up --search-up -D -U)-'{u,-up,-search-up}'[search up for SConstruct; build current directory]' \ + '(-u --up --search-up -D)-U[search up for SConstruct; build Default targets]' \ + '(-)-'{v,-version}'[print version information]' \ + \*{--warn=,--warning=}'[enable or disable warnings]:type:( + all cache-write-error corrupt-sconsign dependency deprecated + deprecated-copy deprecated-source-signatures deprecated-target-signatures + duplicate-environment fortran-cxx-mix link misleading-keywords + missing-sconscript no-md5-module no-metaclass-support no-object-count + no-parallel-support python-version reserved-variable stack-size no-all + no-cache-write-error no-corrupt-sconsign no-dependency no-deprecated + no-deprecated-copy no-deprecated-source-signatures + no-deprecated-target-signatures no-duplicate-environment + no-fortran-cxx-mix no-link no-misleading-keywords no-missing-sconscript + no-no-md5-module no-no-metaclass-support no-no-object-count + no-no-parallel-support no-python-version no-reserved-variable + no-stack-size)' \ + \*{-Y,--repository}'[search specified repository for files]:repository:_files' \ + '*:target:_default' # Doesn't seem to be a simple way to get a list of targets diff --git a/.zprezto/modules/completion/external/src/_sfdx b/.zprezto/modules/completion/external/src/_sfdx new file mode 100644 index 0000000..9fbf313 --- /dev/null +++ b/.zprezto/modules/completion/external/src/_sfdx @@ -0,0 +1,935 @@ +#compdef sfdx + +# DESCRIPTION: Zsh completion script for the Salesforce CLI +# AUTHOR: Wade Wegner (@WadeWegner) +# REPO: https://github.com/wadewegner/salesforce-cli-zsh-completion +# LICENSE: https://github.com/wadewegner/salesforce-cli-zsh-completion/blob/master/LICENSE + +local -a _1st_arguments + +_1st_arguments=( + "force\:alias\:list":"list username aliases for the Salesforce CLI" + "force\:alias\:set":"set username aliases for the Salesforce CLI" + "force\:apex\:class\:create":"create an Apex class" + "force\:apex\:execute":"execute anonymous Apex code" + "force\:apex\:log\:get":"fetch a debug log" + "force\:apex\:log\:list":"list debug logs" + "force\:apex\:test\:report":"display test results" + "force\:apex\:test\:run":"invoke Apex tests" + "force\:apex\:trigger\:create":"create an Apex trigger" + "force\:auth\:jwt\:grant":"authorize an org using the JWT flow" + "force\:auth\:sfdxurl\:store":"authorize an org using an SFDX auth URL" + "force\:auth\:web\:login":"authorize an org using the web login flow" + "force\:config\:get":"get config var values for given names" + "force\:config\:list":"list config vars for the Salesforce CLI" + "force\:config\:set":"set config vars for the Salesforce CLI" + "force\:data\:bulk\:delete":"bulk delete records from a csv file" + "force\:data\:bulk\:status":"view the status of a bulk data load job or batch" + "force\:data\:bulk\:upsert":"bulk upsert records from a CSV file" + "force\:data\:record\:create":"create a record" + "force\:data\:record\:delete":"delete a record" + "force\:data\:record\:get":"view a record" + "force\:data\:record\:update":"update a record" + "force\:data\:soql\:query":"execute a SOQL query" + "force\:data\:tree\:export":"export data from an org into sObject tree format for force:data:tree:import consumption" + "force\:data\:tree\:import":"import data into an org using SObject Tree Save API" + "force\:doc\:commands\:display":"display help for force commands" + "force\:doc\:commands\:list":"list the force commands" + "force\:lightning\:app\:create":"create a Lightning app" + "force\:lightning\:component\:create":"create a Lightning component" + "force\:lightning\:event\:create":"create a Lightning event" + "force\:lightning\:interface\:create":"create a Lightning interface" + "force\:lightning\:lint":"analyse (lint) Lightning component code" + "force\:lightning\:test\:create":"create a Lightning test" + "force\:lightning\:test\:install":"install Lightning Testing Service unmanaged package in your org" + "force\:lightning\:test\:run":"invoke Lightning component tests" + "force\:limits\:api\:display":"display current org’s limits" + "force\:mdapi\:convert":"convert Metadata API source into the Salesforce DX source format" + "force\:mdapi\:deploy":"deploy metadata to an org using Metadata API" + "force\:mdapi\:deploy\:report":"check the status of a metadata deployment" + "force\:mdapi\:retrieve":"retrieve metadata from an org using Metadata API" + "force\:mdapi\:retrieve\:report":"check the status of a metadata retrieval" + "force\:org\:create":"create a scratch org" + "force\:org\:delete":"mark a scratch org for deletion" + "force\:org\:display":"get org description" + "force\:org\:list":"list all orgs you’ve created or authenticated to" + "force\:org\:open":"open an org in your browser" + "force\:org\:shape\:create":"create a snapshot of org edition, features, and licenses" + "force\:org\:shape\:delete":"delete all org shapes for a target org" + "force\:org\:shape\:list":"list all org shapes you’ve created" + "force\:package1\:version\:create":"create a first-generation package version in the release org" + "force\:package1\:version\:create\:get":"retrieve the status of a package version creation request" + "force\:package1\:version\:display":"display details about a first-generation package version" + "force\:package1\:version\:list":"list package versions for the specified first-generation package or for the org" + "force\:package2\:create":"create a second-generation package" + "force\:package2\:list":"list all second-generation packages in the Dev Hub org" + "force\:package2\:update":"update a second-generation package" + "force\:package2\:version\:create":"create a second-generation package version" + "force\:package2\:version\:create\:get":"retrieve a package version creation request" + "force\:package2\:version\:create\:list":"list package version creation requests" + "force\:package2\:version\:get":"retrieve a package version in the Dev Hub org" + "force\:package2\:version\:list":"list all package versions in the Dev Hub org" + "force\:package2\:version\:update":"update a second-generation package version" + "force\:package\:install":"install a package in the target org" + "force\:package\:install\:get":"retrieve the status of a package installation request" + "force\:package\:installed\:list":"list the org’s installed packages" + "force\:package\:uninstall":"uninstall a second-generation package from the target org" + "force\:package\:uninstall\:get":"retrieve status of package uninstall request" + "force\:project\:create":"create a new SFDX project" + "force\:project\:upgrade":"update project config files to the latest format" + "force\:schema\:sobject\:describe":"describe an object" + "force\:schema\:sobject\:list":"list all objects of a specified category" + "force\:source\:convert":"convert Salesforce DX source into the Metadata API source format" + "force\:source\:open":"edit a Lightning Page with Lightning App Builder" + "force\:source\:pull":"pull source from the scratch org to the project" + "force\:source\:push":"push source to an org from the project" + "force\:source\:status":"list local changes and/or changes in a scratch org" + "force\:user\:create":"create a user for a scratch org" + "force\:user\:display":"displays information about a user of a scratch org" + "force\:user\:list":"lists all users of a scratch org" + "force\:user\:password\:generate":"generate a password for scratch org users" + "force\:user\:permset\:assign":"assign a permission set to one or more users of an org" + "force\:visualforce\:component\:create":"create a Visualforce component" + "force\:visualforce\:page\:create":"create a Visualforce page" +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "sfdx command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + force:limits:api:display) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:app:create) + _command_args=( + '(-n|--appname)'{-n,--appname}'[name of the generated Lightning app]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningApp*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (41.0*,40.0)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:bulk:delete) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the sObject type of the records you’re deleting]' \ + '(-f|--csvfile)'{-f,--csvfile}'[the path to the CSV file containing the ids of the records to delete]:file:_files' \ + '(-w|--wait)'{-w,--wait}'[the number of minutes to wait for the command to complete before displaying the results]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:bulk:status) + _command_args=( + '(-i|--jobid)'{-i,--jobid}'[the ID of the job you want to view or of the job whose batch you want to view]' \ + '(-b|--batchid)'{-b,--batchid}'[the ID of the batch whose status you want to view]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:bulk:upsert) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the sObject type of the records you want to upsert]' \ + '(-f|--csvfile)'{-f,--csvfile}'[the path to the CSV file that defines the records to upsert]:file:_files' \ + '(-i|--externalid)'{-i,--externalid}'[the column name of the external ID; if not provided, an arbitrary ID is used]' \ + '(-w|--wait)'{-w,--wait}'[the number of minutes to wait for the command to complete before displaying the results]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:class:create) + _command_args=( + '(-n|--classname)'{-n,--classname}'[name of the generated Apex class]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultApexClass*,ApexException,ApexUnitTest,InboundEmailService)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (41.0*,40.0)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:doc:commands:display) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:doc:commands:list) + _command_args=( + '(-u|--usage)'{-u,--usage}'[list only docopts usage strings]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:visualforce:component:create) + _command_args=( + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultVFComponent*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-n|--componentname)'{-n,--componentname}'[name of the generated Visualforce component]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (41.0*,40.0)]' \ + '(-l|--label)'{-l,--label}'[Visualforce component label]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:component:create) + _command_args=( + '(-n|--componentname)'{-n,--componentname}'[name of the generated Lightning component]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningCmp*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (41.0*,40.0)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:mdapi:convert) + _command_args=( + '(-r|--rootdir)'{-r,--rootdir}'[the root directory containing the Metadata API source]:file:_files' \ + '(-d|--outputdir)'{-d,--outputdir}'[the output directory to store the sfdx source]:file:_files' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:convert) + _command_args=( + '(-r|--rootdir)'{-r,--rootdir}'[the source directory for the source to be converted]:file:_files' \ + '(-d|--outputdir)'{-d,--outputdir}'[the output directory to export the Metadata API source to]:file:_files' \ + '(-n|--packagename)'{-n,--packagename}'[the name of the package to associate with the Metadata API source]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:create) + _command_args=( + '(-f|--definitionfile)'{-f,--definitionfile}'[path to a scratch org definition file]:file:_files' \ + '(-j|--definitionjson)'{-j,--definitionjson}'[scratch org definition in json format ]' \ + '(-n|--nonamespace)'{-n,--nonamespace}'[creates the scratch org with no namespace]' \ + '(-c|--noancestors)'{-c,--noancestors}'[do not include second-generation package ancestors in the scratch org]' \ + '(-i|--clientid)'{-i,--clientid}'[connected app consumer key]' \ + '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the created org as the default username]' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for for the created scratch org]' \ + '(-e|--env)'{-e,--env}'[environment where the scratch org is created: \[sandbox*,virtual,prototype\] (sandbox*,virtual,prototype)]' \ + '(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \ + '(-d|--durationdays)'{-d,--durationdays}'[duration of the scratch org (in days) (default:7, min:1, max:30)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package2:create) + _command_args=( + '(-n|--name)'{-n,--name}'[package name]' \ + '(-o|--containeroptions)'{-o,--containeroptions}'[\[*Managed | Unlocked | Locked\] container options for the package (Managed=DeveloperManagedSubscriberManaged, Unlocked=DeveloperControlledSubscriberEditable, Locked=DeveloperControlledSubscriberLocked)]' \ + '(-d|--description)'{-d,--description}'[package description]' \ + '(-e|--nonamespace)'{-e,--nonamespace}'[creates the package with no namespace; available only for developer-controlled packages.]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:user:create) + _command_args=( + '(-f|--definitionfile)'{-f,--definitionfile}'[file path to a user definition]:file:_files' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for the created username to reference within the CLI]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:project:create) + _command_args=( + '(-n|--projectname)'{-n,--projectname}'[name of the generated project]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (Defaultsfdx-project.json*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-l|--loginurl)'{-l,--loginurl}'[Salesforce instance login URL (https://login.salesforce.com*)]' \ + '(-x|--sourceapiversion)'{-x,--sourceapiversion}'[source API version number (41.0*)]' \ + '(-s|--namespace)'{-s,--namespace}'[project associated namespace]' \ + '(-p|--defaultpackagedir)'{-p,--defaultpackagedir}'[default package directory name (force-app*)]:file:_files' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:delete) + _command_args=( + '(-p|--noprompt)'{-p,--noprompt}'[no prompt to confirm deletion]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:mdapi:deploy) + _command_args=( + '(-c|--checkonly)'{-c,--checkonly}'[validate deploy but don’t save to the org (default:false)]' \ + '(-d|--deploydir)'{-d,--deploydir}'[root of directory tree of files to deploy]:file:_files' \ + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 0)]' \ + '(-i|--jobid)'{-i,--jobid}'[WARNING: The flag "jobid" has been deprecated and will be removed in v41.01.0 or later. Instead, use "sfdx force:mdapi:deploy:report -i ".]' \ + '(-l|--testlevel)'{-l,--testlevel}'[deployment testing level (NoTestRun,RunSpecifiedTests,RunLocalTests,RunAllTestsInOrg)]' \ + '(-r|--runtests)'{-r,--runtests}'[tests to run if --testlevel RunSpecifiedTests]' \ + '(-e|--rollbackonerror)'{-e,--rollbackonerror}'[WARNING: The flag "rollbackonerror" has been deprecated and will be removed in v41.01.0 or later. Instead, use "ignoreerrors".]' \ + '(-o|--ignoreerrors)'{-o,--ignoreerrors}'[ignore any errors and do not roll back deployment (default:false)]' \ + '(-g|--ignorewarnings)'{-g,--ignorewarnings}'[whether a warning will allow a deployment to complete successfully (default:false)]' \ + '(-f|--zipfile)'{-f,--zipfile}'[path to .zip file of metadata to deploy]:file:_files' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[verbose output of deploy results]' \ + ) + ;; + force:mdapi:deploy:report) + _command_args=( + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 0)]' \ + '(-i|--jobid)'{-i,--jobid}'[job ID of the deployment you want to check]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[verbose output of deploy results]' \ + ) + ;; + force:org:display) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[emit additional command output to stdout]' \ + ) + ;; + force:user:display) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:event:create) + _command_args=( + '(-n|--eventname)'{-n,--eventname}'[name of the generated Lightning event]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningEvt*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (41.0*,40.0)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:execute) + _command_args=( + '(-f|--apexcodefile)'{-f,--apexcodefile}'[path to a local file containing Apex code]:file:_files' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:config:get) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[emit additional command output to stdout]' \ + ) + ;; + force:package:install) + _command_args=( + '(-i|--id)'{-i,--id}'[ID of the package version to install (starts with 04t)]' \ + '(-w|--wait)'{-w,--wait}'[number of minutes to wait for installation status]' \ + '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (default: null)]' \ + '(-p|--publishwait)'{-p,--publishwait}'[number of minutes to wait for subscriber package version ID to become available in the target org]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:install:get) + _command_args=( + '(-i|--requestid)'{-i,--requestid}'[ID of the package install request you want to check]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:installed:list) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:interface:create) + _command_args=( + '(-n|--interfacename)'{-n,--interfacename}'[name of the generated Lightning interface]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningIntf*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (41.0*,40.0)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:auth:jwt:grant) + _command_args=( + '(-u|--username)'{-u,--username}'[authentication username]' \ + '(-f|--jwtkeyfile)'{-f,--jwtkeyfile}'[path to a file containing the private key]:file:_files' \ + '(-i|--clientid)'{-i,--clientid}'[OAuth client ID (sometimes called the consumer key)]' \ + '(-r|--instanceurl)'{-r,--instanceurl}'[the login URL of the instance the org lives on]' \ + '(-d|--setdefaultdevhubusername)'{-d,--setdefaultdevhubusername}'[set the authenticated org as the default dev hub org for scratch org creation]' \ + '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the authenticated org as the default username that all commands run against]' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for the authenticated org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:lint) + _command_args=( + '(-i|--ignore)'{-i,--ignore}'[pattern used to ignore some folders]' \ + '(--files)--files[pattern used to include specific files]:file:_files' \ + '(-j|--json)'{-j,--json}'[format output as JSON]' \ + '(--config)--config[path to a custom ESLint configuration file]:file:_files' \ + '(--verbose)--verbose[report warnings in addition to errors]' \ + '(--exit)--exit[exit with error code 1 if there are lint issues]' \ + ) + ;; + force:alias:list) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:config:list) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:list) + _command_args=( + '(--all)--all[include expired, deleted, and unknown-status scratch orgs]' \ + '(--clean)--clean[remove all local org authorizations for non-active orgs]' \ + '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for confirmation]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[list more information about each org]' \ + ) + ;; + force:package2:list) + _command_args=( + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:user:list) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:log:get) + _command_args=( + '(-i|--logid)'{-i,--logid}'[ID of the log to display]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:log:list) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:open) + _command_args=( + '(-p|--path)'{-p,--path}'[navigation URL path]:file:_files' \ + '(-r|--urlonly)'{-r,--urlonly}'[display navigation URL, but don’t launch browser]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:open) + _command_args=( + '(-f|--sourcefile)'{-f,--sourcefile}'[file to edit]:file:_files' \ + '(-r|--urlonly)'{-r,--urlonly}'[generate a navigation URL; don’t launch the editor]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:visualforce:page:create) + _command_args=( + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultVFPage*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-n|--pagename)'{-n,--pagename}'[name of the generated Visualforce page]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (41.0*,40.0)]' \ + '(-l|--label)'{-l,--label}'[Visualforce page label]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:user:password:generate) + _command_args=( + '(-o|--onbehalfof)'{-o,--onbehalfof}'[comma-separated list of usernames for which to generate passwords]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:user:permset:assign) + _command_args=( + '(-n|--permsetname)'{-n,--permsetname}'[the name of the permission set to assign]' \ + '(-o|--onbehalfof)'{-o,--onbehalfof}'[comma-separated list of usernames or aliases to assign the permission set to]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:pull) + _command_args=( + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \ + '(-f|--forceoverwrite)'{-f,--forceoverwrite}'[ignore conflict warnings and overwrite changes to the project]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:push) + _command_args=( + '(-f|--forceoverwrite)'{-f,--forceoverwrite}'[ignore conflict warnings and overwrite changes to scratch org]' \ + '(-g|--ignorewarnings)'{-g,--ignorewarnings}'[deploy changes even if warnings are generated]' \ + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:record:create) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re creating]' \ + '(-v|--values)'{-v,--values}'[the = pairs you’re creating]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[create the record with tooling api]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:record:delete) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re deleting]' \ + '(-i|--sobjectid)'{-i,--sobjectid}'[the ID of the record you’re deleting]' \ + '(-w|--where)'{-w,--where}'[a list of = pairs to search for]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[delete the record with Tooling API]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:record:get) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re retrieving]' \ + '(-i|--sobjectid)'{-i,--sobjectid}'[the ID of the record you’re retrieving]' \ + '(-w|--where)'{-w,--where}'[a list of = pairs to search for]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[retrieve the record with Tooling API]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:record:update) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re updating]' \ + '(-i|--sobjectid)'{-i,--sobjectid}'[the ID of the record you’re updating]' \ + '(-w|--where)'{-w,--where}'[a list of = pairs to search for]' \ + '(-v|--values)'{-v,--values}'[the = pairs you’re updating]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[update the record with Tooling API]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:mdapi:retrieve) + _command_args=( + '(-a|--apiversion)'{-a,--apiversion}'[target API version for the retrieve (default 41.0)]' \ + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: -1 (no limit))]' \ + '(-r|--retrievetargetdir)'{-r,--retrievetargetdir}'[directory root for the retrieved files]:file:_files' \ + '(-k|--unpackaged)'{-k,--unpackaged}'[file path of manifest of components to retrieve]:file:_files' \ + '(-d|--sourcedir)'{-d,--sourcedir}'[source dir to use instead of default manifest sfdx-project.xml]' \ + '(-p|--packagenames)'{-p,--packagenames}'[a comma-separated list of packages to retrieve]' \ + '(-s|--singlepackage)'{-s,--singlepackage}'[a single-package retrieve (default: false)]' \ + '(-i|--jobid)'{-i,--jobid}'[WARNING: The flag "jobid" has been deprecated and will be removed in v41.01.0 or later. Instead, use "sfdx force:mdapi:retrieve:report -i -r ".]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[verbose output of retrieve result]' \ + ) + ;; + force:mdapi:retrieve:report) + _command_args=( + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: -1 (no limit))]' \ + '(-r|--retrievetargetdir)'{-r,--retrievetargetdir}'[directory root for the retrieved files]:file:_files' \ + '(-i|--jobid)'{-i,--jobid}'[job ID of the retrieve you want to check]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[verbose output of retrieve result]' \ + ) + ;; + force:alias:set) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:config:set) + _command_args=( + '(-g|--global)'{-g,--global}'[set config var globally (to be used from any directory)]:file:_files' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:auth:sfdxurl:store) + _command_args=( + '(-f|--sfdxurlfile)'{-f,--sfdxurlfile}'[path to a file containing the sfdx url]:file:_files' \ + '(-d|--setdefaultdevhubusername)'{-d,--setdefaultdevhubusername}'[set the authenticated org as the default dev hub org for scratch org creation]' \ + '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the authenticated org as the default username that all commands run against]' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for the authenticated org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:shape:create) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:shape:delete) + _command_args=( + '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for confirmation]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username for the target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:shape:list) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[list more information about each org shape]' \ + ) + ;; + force:schema:sobject:describe) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the API name of the object to describe]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:schema:sobject:list) + _command_args=( + '(-c|--sobjecttypecategory)'{-c,--sobjecttypecategory}'[the type of objects to list (all|custom|standard)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:soql:query) + _command_args=( + '(-q|--query)'{-q,--query}'[SOQL query to execute]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[execute query with Tooling API]' \ + '(-r|--resultformat)'{-r,--resultformat}'[query result format emitted to stdout; --json flag overrides this parameter (human*,csv,json)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:status) + _command_args=( + '(-a|--all)'{-a,--all}'[list all the changes that have been made]' \ + '(-l|--local)'{-l,--local}'[list the changes that have been made locally]' \ + '(-r|--remote)'{-r,--remote}'[list the changes that have been made in the scratch org]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:test:create) + _command_args=( + '(-n|--testname)'{-n,--testname}'[name of the generated Lightning test]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningTest*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:test:install) + _command_args=( + '(-w|--wait)'{-w,--wait}'[number of minutes to wait for installation status (default:2)]' \ + '(-r|--releaseversion)'{-r,--releaseversion}'[release version of Lightning Testing Service (default:latest)]' \ + '(-t|--packagetype)'{-t,--packagetype}'[type of unmanaged package. 'full' option contains both jasmine and mocha, plus examples (full*,jasmine,mocha)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:test:report) + _command_args=( + '(-i|--testrunid)'{-i,--testrunid}'[ID of test run]' \ + '(-c|--codecoverage)'{-c,--codecoverage}'[retrieve code coverage results]' \ + '(-d|--outputdir)'{-d,--outputdir}'[directory to store test run files]:file:_files' \ + '(-r|--resultformat)'{-r,--resultformat}'[test result format emitted to stdout; --json flag overrides this parameter (human*,tap,junit,json)]' \ + '(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[display Apex test processing details]' \ + ) + ;; + force:apex:test:run) + _command_args=( + '(-n|--classnames)'{-n,--classnames}'[comma-separated list of Apex test class names to execute]' \ + '(-s|--suitenames)'{-s,--suitenames}'[comma-separated list of Apex test suite names to execute]' \ + '(-c|--codecoverage)'{-c,--codecoverage}'[retrieve code coverage results]' \ + '(-d|--outputdir)'{-d,--outputdir}'[directory to store test run files]:file:_files' \ + '(-l|--testlevel)'{-l,--testlevel}'[testlevel enum value (RunLocalTests,RunAllTestsInOrg,RunSpecifiedTests)]' \ + '(-r|--resultformat)'{-r,--resultformat}'[test result format emitted to stdout; --json flag overrides this parameter (human*,tap,junit,json)]' \ + '(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \ + '(--precompilewait)--precompilewait[how long to wait (in minutes) for Apex pre-compilation (default:3, min:3)]' \ + '(-y|--synchronous)'{-y,--synchronous}'[run tests from a single class synchronously]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[display Apex test processing details]' \ + ) + ;; + force:lightning:test:run) + _command_args=( + '(-a|--appname)'{-a,--appname}'[name of your Lightning test application]' \ + '(-d|--outputdir)'{-d,--outputdir}'[directory path to store test run artifacts: for example, log files and test results]:file:_files' \ + '(-r|--resultformat)'{-r,--resultformat}'[test result format emitted to stdout; --json flag overrides this parameter (human*,tap,junit,json)]' \ + '(-f|--configfile)'{-f,--configfile}'[path to config file for the test]:file:_files' \ + '(-o|--leavebrowseropen)'{-o,--leavebrowseropen}'[leave browser open]' \ + '(-t|--timeout)'{-t,--timeout}'[time (ms) to wait for results element in dom (default:60000)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:tree:export) + _command_args=( + '(-q|--query)'{-q,--query}'[soql query, or filepath of file containing a soql query, to retrieve records]:file:_files' \ + '(-p|--plan)'{-p,--plan}'[generate mulitple sobject tree files and a plan definition file for aggregated import]' \ + '(-x|--prefix)'{-x,--prefix}'[prefix of generated files]' \ + '(-d|--outputdir)'{-d,--outputdir}'[directory to store files]:file:_files' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:tree:import) + _command_args=( + '(-f|--sobjecttreefiles)'{-f,--sobjecttreefiles}'[comma-delimited, ordered paths of json files containing collection of record trees to insert]:file:_files' \ + '(-p|--plan)'{-p,--plan}'[path to plan to insert multiple data files that have master-detail relationships]:file:_files' \ + '(-c|--contenttype)'{-c,--contenttype}'[if data file extension is not .json, provide content type (applies to all files)]' \ + '(--confighelp)--confighelp[display schema information for the --plan configuration file to stdout; if you use this option, all other options except --json are ignored]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:trigger:create) + _command_args=( + '(-n|--triggername)'{-n,--triggername}'[name of the generated Apex trigger]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (ApexTrigger*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (41.0*,40.0)]' \ + '(-s|--sobject)'{-s,--sobject}'[sObject to create a trigger on (SOBJECT*)]' \ + '(-e|--triggerevents)'{-e,--triggerevents}'[events that fire the trigger (before insert*,before upsert,before delete,after insert,after upsert,after delete,after undelete)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:uninstall) + _command_args=( + '(-i|--id)'{-i,--id}'[ID of the package to uninstall (starts with 04t)]' \ + '(-w|--wait)'{-w,--wait}'[number of minutes to wait for uninstall status]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:uninstall:get) + _command_args=( + '(-i|--requestid)'{-i,--requestid}'[ID of the package uninstall request you want to check]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package2:update) + _command_args=( + '(-i|--package2id)'{-i,--package2id}'[id of the package (starts with 0Ho)]' \ + '(-n|--name)'{-n,--name}'[package name]' \ + '(-d|--description)'{-d,--description}'[package description]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:project:upgrade) + _command_args=( + '(-f|--forceupgrade)'{-f,--forceupgrade}'[run all upgrades even if project has already been upgraded]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package1:version:create) + _command_args=( + '(-i|--packageid)'{-i,--packageid}'[ID of the metadata package (starts with 033) of which you’re creating a new version]' \ + '(-n|--name)'{-n,--name}'[package version name]' \ + '(-d|--description)'{-d,--description}'[package version description]' \ + '(-v|--version)'{-v,--version}'[package version in major.minor format, for example, 3.2]' \ + '(-m|--managedreleased)'{-m,--managedreleased}'[create a managed package version]' \ + '(-r|--releasenotesurl)'{-r,--releasenotesurl}'[release notes URL]' \ + '(-p|--postinstallurl)'{-p,--postinstallurl}'[post install URL]' \ + '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (default: null)]' \ + '(-w|--wait)'{-w,--wait}'[minutes to wait for the package version to be created (default: 2 minutes)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package2:version:create) + _command_args=( + '(-i|--package2id)'{-i,--package2id}'[ID of the parent package (starts with 0Ho)]' \ + '(-d|--directory)'{-d,--directory}'[path to directory that contains the contents of the package version]:file:_files' \ + '(-b|--branch)'{-b,--branch}'[the package version’s branch]' \ + '(-t|--tag)'{-t,--tag}'[the package version’s tag]' \ + '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (default: null)]' \ + '(-p|--preserve)'{-p,--preserve}'[temp files are preserved that would otherwise be deleted]' \ + '(-j|--validateschema)'{-j,--validateschema}'[sfdx-project.json is validated against JSON schema]' \ + '(-w|--wait)'{-w,--wait}'[minutes to wait for the package version to be created (default:0)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package1:version:create:get) + _command_args=( + '(-i|--requestid)'{-i,--requestid}'[PackageUploadRequest ID]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package2:version:create:get) + _command_args=( + '(-i|--package2createrequestid)'{-i,--package2createrequestid}'[package2 version creation request ID (starts with 08c)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package2:version:create:list) + _command_args=( + '(-c|--createdlastdays)'{-c,--createdlastdays}'[created in the last specified number of days (starting at 00:00:00 of first day to now; 0 for today)]' \ + '(-s|--status)'{-s,--status}'[filter the list by version creation request status (Queued,InProgress,Success,Error)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package1:version:display) + _command_args=( + '(-i|--packageversionid)'{-i,--packageversionid}'[metadata package version ID (starts with 04t)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package2:version:get) + _command_args=( + '(-i|--package2versionid)'{-i,--package2versionid}'[the package version ID (starts wtih 05i)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package1:version:list) + _command_args=( + '(-i|--packageid)'{-i,--packageid}'[metadata package ID (starts with 033)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package2:version:list) + _command_args=( + '(-c|--createdlastdays)'{-c,--createdlastdays}'[created in the last specified number of days (starting at 00:00:00 of first day to now; 0 for today)]' \ + '(-m|--modifiedlastdays)'{-m,--modifiedlastdays}'[list items modified in the specified last number of days (starting at 00:00:00 of first day to now; 0 for today)]' \ + '(-i|--package2ids)'{-i,--package2ids}'[filter results on specified comma-delimited package2 ids (start with 0Ho)]' \ + '(-r|--released)'{-r,--released}'[display released versions only]' \ + '(-o|--orderby)'{-o,--orderby}'[order by the specified package2 version fields]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--concise)--concise[display limited package2 version details]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[display extended package2 versions detail]' \ + ) + ;; + force:package2:version:update) + _command_args=( + '(-i|--package2versionid)'{-i,--package2versionid}'[the package version ID (starts wtih 05i)]' \ + '(-n|--name)'{-n,--name}'[the package version name]' \ + '(-d|--description)'{-d,--description}'[the package version description]' \ + '(-b|--branch)'{-b,--branch}'[the package version branch]' \ + '(-t|--tag)'{-t,--tag}'[the package version tag]' \ + '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (default: null)]' \ + '(-s|--setasreleased)'{-s,--setasreleased}'[set the package version as released (can’t be undone)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:auth:web:login) + _command_args=( + '(-i|--clientid)'{-i,--clientid}'[OAuth client ID (sometimes called the consumer key)]' \ + '(-r|--instanceurl)'{-r,--instanceurl}'[the login URL of the instance the org lives on]' \ + '(-d|--setdefaultdevhubusername)'{-d,--setdefaultdevhubusername}'[set the authenticated org as the default dev hub org for scratch org creation]' \ + '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the authenticated org as the default username that all commands run against]' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for the authenticated org]' \ + '(--disablemasking)--disablemasking[disable masking of user input (for use with problematic terminals)]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + esac + +_arguments \ + $_command_args \ + && return 0 diff --git a/.zprezto/modules/completion/external/src/_ssh-copy-id b/.zprezto/modules/completion/external/src/_ssh-copy-id deleted file mode 100644 index 77bd01c..0000000 --- a/.zprezto/modules/completion/external/src/_ssh-copy-id +++ /dev/null @@ -1,34 +0,0 @@ -#compdef ssh-copy-id -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for ssh-copy-id. -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * Julien Nicoulaud -# -# ------------------------------------------------------------------------------ - - -# FIXME This completes "user@host" and not "[user@]host" ("user@" is optional), -# should be merged in _ssh. - -_arguments -A "-*" \ - '-i+[use identity file]:SSH identity file:_files' \ - '-n+[do a dry-run]' \ - '-h+[print usage summary]' \ - '-p+[specify custom port]' \ - '-o+[additional ssh option]' \ - '1: :_user_at_host' - -# Local Variables: -# mode: Shell-Script -# sh-indentation: 2 -# indent-tabs-mode: nil -# sh-basic-offset: 2 -# End: -# vim: ft=zsh sw=2 ts=2 et diff --git a/.zprezto/modules/completion/external/src/_stack b/.zprezto/modules/completion/external/src/_stack index 75eebfc..b6d1abe 100644 --- a/.zprezto/modules/completion/external/src/_stack +++ b/.zprezto/modules/completion/external/src/_stack @@ -40,54 +40,56 @@ _stack () { _arguments \ - --version'[Show version]' \ - --help'[Show this help text]' \ - '--docker*''[Run "stack --docker-help" for details]' \ - --verbosity'[Verbosity: silent, error, warn, info, debug]' \ - {-v,--verbose}'[Enable verbose mode: verbosity level "debug"]' \ - --system-ghc'[Enable using the system installed GHC (on the PATH) if available and a matching version]' \ - --no-system-ghc'[Disable using the system installed GHC (on the PATH) if available and a matching version]' \ - --install-ghc'[Enable downloading and installing GHC if necessary (can be done manually with stack setup)]' \ - --no-install-ghc'[Disable downloading and installing GHC if necessary (can be done manually with stack setup)]' \ - --arch'[System architecture, e.g. i386, x86_64]' \ - --os'[Operating system, e.g. linux, windows]' \ - {-j,--jobs}'[Number of concurrent jobs to run]' \ - --extra-include-dirs'[Extra directories to check for C header files]' \ - --extra-lib-dirs'[Extra directories to check for libraries]' \ - --skip-ghc-check'[Enable skipping the GHC version and architecture check]' \ - --no-skip-ghc-check'[Disable skipping the GHC version and architecture check]' \ - --skip-msys'[Enable skipping the local MSYS installation (Windows only)]' \ - --no-skip-msys'[Disable skipping the local MSYS installation (Windows only)]' \ - --resolver'[Override resolver in project file]' \ - --no-terminal'[Override terminal detection in the case of running in a false terminal]' \ - --stack-yaml'[Override project stack.yaml file (overrides any STACK_YAML environment variable)]' \ + --version'[display version information]' \ + --help'[display usage information]' \ + '--docker*''[run "stack --docker-help" for details]' \ + --verbosity'[verbosity: silent, error, warn, info, debug]' \ + {-v,--verbose}'[enable verbose mode: verbosity level "debug"]' \ + --system-ghc'[enable using the system installed GHC (on the PATH) if available and a matching version]' \ + --no-system-ghc'[disable using the system installed GHC (on the PATH) if available and a matching version]' \ + --install-ghc'[enable downloading and installing GHC if necessary (can be done manually with stack setup)]' \ + --no-install-ghc'[disable downloading and installing GHC if necessary (can be done manually with stack setup)]' \ + --arch'[system architecture, e.g. i386, x86_64]' \ + --os'[operating system, e.g. linux, windows]' \ + {-j,--jobs}'[number of concurrent jobs to run]' \ + --extra-include-dirs'[extra directories to check for C header files]' \ + --extra-lib-dirs'[extra directories to check for libraries]' \ + --skip-ghc-check'[enable skipping the GHC version and architecture check]' \ + --no-skip-ghc-check'[disable skipping the GHC version and architecture check]' \ + --skip-msys'[enable skipping the local MSYS installation (Windows only)]' \ + --no-skip-msys'[disable skipping the local MSYS installation (Windows only)]' \ + --resolver'[override resolver in project file]' \ + --no-terminal'[override terminal detection in the case of running in a false terminal]' \ + --stack-yaml'[override project stack.yaml file (overrides any STACK_YAML environment variable)]' \ '*: :__stack_modes' } __stack_modes () { _values \ 'subcommand' \ - 'build[Build the project(s) in this directory/configuration]' \ - 'install[Build executables and install to a user path]' \ - 'test[Build and test the project(s) in this directory/configuration]' \ - 'bench[Build and benchmark the project(s) in this directory/configuration]' \ - 'haddock[Generate haddocks for the project(s) in this directory/configuration]' \ - 'new[Create a brand new project]' \ - 'init[Initialize a stack project based on one or more cabal packages]' \ - 'solver[Use a dependency solver to try and determine missing extra-deps]' \ - 'setup[Get the appropriate ghc for your project]' \ - 'path[Print out handy path information]' \ - 'unpack[Unpack one or more packages locally]' \ - 'update[Update the package index]' \ - 'upgrade[Upgrade to the latest stack (experimental)]' \ - 'upload[Upload a package to Hackage]' \ - 'dot[Visualize your projects dependency graph using Graphviz dot]' \ - 'exec[Execute a command]' \ - 'ghc[Run ghc]' \ - 'ghci[Run ghci in the context of project(s)]' \ - 'ide[Run ide-backend-client with the correct arguments]' \ - 'runghc[Run runghc]' \ - 'clean[Clean the local packages]' \ - 'docker[Subcommands specific to Docker use]' + 'build[build the project(s) in this directory/configuration]' \ + 'install[build executables and install to a user path]' \ + 'test[build and test the project(s) in this directory/configuration]' \ + 'bench[build and benchmark the project(s) in this directory/configuration]' \ + 'haddock[generate haddocks for the project(s) in this directory/configuration]' \ + 'new[create a brand new project]' \ + 'init[initialize a stack project based on one or more cabal packages]' \ + 'solver[use a dependency solver to try and determine missing extra-deps]' \ + 'setup[get the appropriate ghc for your project]' \ + 'path[print out handy path information]' \ + 'unpack[unpack one or more packages locally]' \ + 'update[update the package index]' \ + 'upgrade[upgrade to the latest stack (experimental)]' \ + 'upload[upload a package to Hackage]' \ + 'dot[visualize your projects dependency graph using Graphviz dot]' \ + 'exec[execute a command]' \ + 'ghc[run ghc]' \ + 'ghci[run ghci in the context of project(s)]' \ + 'ide[run ide-backend-client with the correct arguments]' \ + 'runghc[run runghc]' \ + 'clean[clean the local packages]' \ + 'docker[subcommands specific to Docker use]' } + +_stack "$@" diff --git a/.zprezto/modules/completion/external/src/_subl b/.zprezto/modules/completion/external/src/_subl index 2f21385..9cb3471 100644 --- a/.zprezto/modules/completion/external/src/_subl +++ b/.zprezto/modules/completion/external/src/_subl @@ -39,22 +39,17 @@ # ------------------------------------------------------------------------------ -_subl() { - integer ret=1 - local I="-h --help -v --version" - local -a args - args+=( - "(- *)"{-h,--help}'[Show help and exit]' - "(- *)"{-v,--version}'[Show version and exit]' - "($I)--project[Load the given project]:project:" - "($I)--command[Run the given command]:command:" - "($I -n --new-window)"{-n,--new-window}'[Open a new window]' - "($I -a --add)"{-a,--add}'[Add folders to the current window]' - "($I -w --wait)"{-w,--wait}'[Wait for the files to be closed before returning]' - "($I -b --background)"{-b,--background}'[Do not activate the application]' - ) - _arguments $args[@] '*:file:_files' && ret=0 - return ret -} +local I="-h --help -v --version" +local -a args +args+=( + "(- *)"{-h,--help}'[display usage information]' + "(- *)"{-v,--version}'[display version information]' + "($I)--project[load the given project]:project" + "($I)--command[run the given command]:command" + "($I -n --new-window)"{-n,--new-window}'[open a new window]' + "($I -a --add)"{-a,--add}'[add folders to the current window]' + "($I -w --wait)"{-w,--wait}'[wait for the files to be closed before returning]' + "($I -b --background)"{-b,--background}"[don't activate the application]" +) +_arguments "$args[@]" '*:file:_files' -_subl diff --git a/.zprezto/modules/completion/external/src/_tarsnap b/.zprezto/modules/completion/external/src/_tarsnap new file mode 100644 index 0000000..17f47f1 --- /dev/null +++ b/.zprezto/modules/completion/external/src/_tarsnap @@ -0,0 +1,64 @@ +#compdef tarsnap +# ------------------------------------------------------------------------------ +# Copyright (c) 2014-2017 Daniel Teunis - https://github.com/danteu +# +# 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. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for tarsnap 1.0.39 (http://tarsnap.com). +# +# ------------------------------------------------------------------------------ +# Author +# ------- +# +# * Daniel Teunis +# +# ------------------------------------------------------------------------------ + +_arguments \ + '(- 1 *)--help[prints tarsnap help]' \ + '(- 1 *)--version[prints tarsnap version number]' \ + '(- 1 *)--verify-config[checks configuration files for syntactic errors]' \ + '--fsck[performs integrity checks on the stored archives]' \ + '--fsck-prune[performs integrity checks and prunes broken data]' \ + '--list-archives[prints names of stored archives]' \ + '--nuke[deletes all stored archives]' \ + '--print-stats[prints archive statistics]' \ + '--recover[recovers partial archive]' \ + '-c[creates archive]' \ + '-d[deletes specified archive]' \ + '-r[prints content of specified archive]' \ + '-t[lists archive content]' \ + '-x[extracts specified archive]' \ + '--lowmem[reduces memory usage by not caching small files]' \ + '--quiet[silences some warnings]' \ + '--keyfile[specifies keyfile]:keyfile:->file' \ + '--cachedir[specifies cache directory]:cachedir:->directory' \ + '-f[specifies archive name]:archivename:->file' + +case "$state" in + file) + _files + ;; + directory) + _path_files -/ + ;; +esac diff --git a/.zprezto/modules/completion/external/src/_tmuxp b/.zprezto/modules/completion/external/src/_tmuxp new file mode 100644 index 0000000..f42bbb2 --- /dev/null +++ b/.zprezto/modules/completion/external/src/_tmuxp @@ -0,0 +1,133 @@ +#compdef tmuxp + +# ------------------------------------------------------------------------------ +# Copyright (c) 2017 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for tmuxp (https://tmuxp.git-pull.com/en/latest/) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Bez Hermoso +# +# ------------------------------------------------------------------------------ + +_tmuxp() { + + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ":command:->command" \ + "*::options:->options" \ + "--log_level:log level:(DEBUG INFO WARNING ERROR CRITICAL)" \ + "--help[display usage information]" + + case $state in + (command) + local -a subcommands + subcommands=( + 'convert:Convert a tmuxp config between JSON and YAML.' + 'freeze:Snapshot a session into a config.' + 'import:Import a teamocil/tmuxinator config.' + 'load:Load tmuxp workspaces.' + ) + _describe -t commands 'commands' subcommands + ;; + (options) + case $line[1] in + (load) + __tmuxp_load + ;; + (import) + __tmuxp_import + ;; + (freeze) + local sessions="$(__tmux_sessions)" + _arguments -C \ + "1::session name:compadd $sessions" + ;; + (convert) + _arguments -C \ + '1:: :_files -g "*.(json|yaml|yml)"' + ;; + esac + esac + +} + +__tmuxp_load() { + local state line + typeset -A opt_args + _arguments -C \ + '*:sessions:->sessions' \ + '--yes:yes' \ + '-d[Load the session without attaching it]' \ + '-2[Force tmux to assume the terminal supports 256 colors]' \ + '-8[Like -2, but indicates that the terminal supports 88 colors]' + + # Cant get the options to be recognized when there are sessions that has + # a dash. + + case $state in + (sessions) + local s + _alternative \ + 'sessions-user:user session:compadd -F line - ~/.tmuxp/*.(json|yml|yaml)(:r:t)' \ + 'sessions-other:session in current directory:_path_files -g "**/*.(json|yaml|yml)(-.)"' + ;; + esac +} + +__tmuxp_import() { + local state line + typeset -A opt_args + _arguments -C \ + '1::program:(tmuxinator teamocil)' \ + '2::project:->project' + + case $state in + (project) + if [[ $line[1] == 'tmuxinator' ]] + then + _wanted tmuxinator-projects exp 'tmuxinator projects' compadd $(tmuxinator completions start) + fi + ;; + esac +} + +__tmux_sessions () { + local tmux_sessions + tmux_sessions=($(_call_program tmux_sessions 'tmux ls -F "#{session_name}"')) + echo $tmux_sessions +} + +_tmuxp "$@" + diff --git a/.zprezto/modules/completion/external/src/_tox b/.zprezto/modules/completion/external/src/_tox new file mode 100644 index 0000000..efd0549 --- /dev/null +++ b/.zprezto/modules/completion/external/src/_tox @@ -0,0 +1,61 @@ +#compdef tox +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for tox (https://tox.readthedocs.io). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Julien Nicoulaud +# +# ------------------------------------------------------------------------------ + + +(( $+functions[_tox_envs_list] )) || +_tox_envs_list() { + local envs; envs=($(_call_program envs $service --listenvs-all)) + if [ ${#envs} -gt 0 ]; then + _values -s , 'tox environments' "${envs[@]}" + else + _message 'tox environments (none found)' + fi +} + +_arguments \ + '(- 1 *)--version[show version and exit]' \ + '(- 1 *)'{-h,--help}'[show help options]' \ + '(- 1 *)'{--hi,--help-ini}'[show help about ini-names]' \ + '*-v[increase verbosity of reporting output]' \ + '*-q[progressively silence reporting output]' \ + '(- 1 *)--showconfig[show configuration information for all environments]' \ + '(- 1 *)'{-l,--listenvs}'[show list of test environments]' \ + '(- 1 *)'{-a,--listenvs-all}'[show list of all defined environments]' \ + '-c[config file name or directory with "tox.ini" file]:config path:_files -g "*.ini"' \ + '-e[work against specified environments]: :_tox_envs_list' \ + '--notest[skip invoking test commands]' \ + '--sdistonly[only perform the sdist packaging activity]' \ + '--parallel--safe-build[ensure two tox builds can run in parallel]' \ + '--installpkg[ensure two tox builds can run in parallel]:package path:_files -/' \ + '--develop[install package in the venv using "setup.py develop"]' \ + '(-i --index-url)'{-i,--index-url}'[set indexserver url]:index server URL:_urls' \ + '--pre[install pre-releases and development versions of dependencies]' \ + '(-r --recreate)'{-r,--recreate}'[force recreation of virtual environments]' \ + '--result-json[write a json file with detailed information about all commands and results involved]:JSON file path:_files -g "*.json"' \ + '--hashseed[set PYTHONHASHSEED to SEED before running commands]:seed' \ + '*--force-dep[forces a certain version of one of the dependencies when configuring the virtual environment]:pip requirement' \ + '--sitepackages[override sitepackages setting to True in all envs]' \ + '--alwayscopy[override alwayscopy setting to True in all envs]' \ + '--skip-missing-interpreters[do not fail tests for missing interpreters]: :(config true false)' \ + '--workdir[tox working directory]: :_files -/' \ + '*: :_guard "^-*" command positional substitution arguments' + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/.zprezto/modules/completion/external/src/_trash-list b/.zprezto/modules/completion/external/src/_trash-list index 0f821c0..c1b1004 100644 --- a/.zprezto/modules/completion/external/src/_trash-list +++ b/.zprezto/modules/completion/external/src/_trash-list @@ -39,16 +39,10 @@ # ------------------------------------------------------------------------------ -_trash-list() { - - _arguments -C \ - '--version[Show programs version number and exit]' \ - {-h,--help}'[Show help message and exit]' \ - '*: :' \ - -} - -_trash-list +_arguments \ + '--version[show programs version number and exit]' \ + {-h,--help}'[show help message and exit]' \ + '*: :' # Local Variables: # mode: Shell-Script diff --git a/.zprezto/modules/completion/external/src/_trash-put b/.zprezto/modules/completion/external/src/_trash-put index e9bf06d..770158e 100644 --- a/.zprezto/modules/completion/external/src/_trash-put +++ b/.zprezto/modules/completion/external/src/_trash-put @@ -39,21 +39,15 @@ # ------------------------------------------------------------------------------ -_trash-put() { - - _arguments -C \ - '--version[Show programs version number and exit]' \ - {-h,--help}'[Show help message and exit]' \ - {-d,--directory}'[Remove empty directories - ignored (for GNU rm compabilty)]' \ - {-f,--force}'[Ignore nonexistent arguments and never prompt - ignored (for GNU rm compabilty)]' \ - {-i,--interactive}'[Prompt before every removal - ignored (for GNU rm compabilty)]' \ - {-r,-R,--recursive}'[Remove directories and their content recursively - ignored (for GNU rm compabilty)]' \ - {-v,--verbose}'[Explain what is being done]' \ - '*: :_files' \ - -} - -_trash-put +_arguments -C \ + '--version[display version information]' \ + {-h,--help}'[display usage information]' \ + {-d,--directory}'[remove empty directories - ignored (for GNU rm compatibility)]' \ + {-f,--force}'[ignore nonexistent arguments and never prompt - ignored (for GNU rm compatibility)]' \ + {-i,--interactive}'[prompt before every removal - ignored (for GNU rm compabilty)]' \ + {-r,-R,--recursive}'[remove directories and their content recursively - ignored (for GNU rm compatibility)]' \ + {-v,--verbose}'[explain what is being done]' \ + '*: :_files' # Local Variables: # mode: Shell-Script diff --git a/.zprezto/modules/completion/external/src/_udisksctl b/.zprezto/modules/completion/external/src/_udisksctl index 267c4af..48cc9e5 100644 --- a/.zprezto/modules/completion/external/src/_udisksctl +++ b/.zprezto/modules/completion/external/src/_udisksctl @@ -56,7 +56,7 @@ _paths() { _path_list+=$_path done - _describe 'paths' _path_list + _describe 'path' _path_list } _filesystems() { @@ -68,96 +68,97 @@ _filesystems() { 'xenix' 'xfs' 'xiafs' ) - _describe 'file system types' _fs_types + _describe 'file system type' _fs_types } _udisksctl() { typeset -A opt_args - local curcontext="$curcontext" state line + local curcontext="$curcontext" state line ret=1 _arguments -C \ '1:udisksctl commands:->cmds' \ - '*:: :->cmd_args' \ + '*:: :->cmd_args' && ret=0 case $state in cmds) local commands; commands=( - 'help: Show help' - 'info: Show info about an object' - 'dump: Show info about all object' - 'status: Shows high-level status' - 'monitor: Monitor changes to objects' - 'mount: Mount a filesystem' - 'unmount: Unmount a filesystem' - 'unlock: Unlock an encrypted device' - 'lock: Lock an encrypted device' - 'loop-setup: Set-up a loop device' - 'loop-delete: Delete a loop device' - 'power-off: Safely power off a drive' - 'smart-simulate: Set SMART data for a drive' + 'help:show help' + 'info:show info about an object' + 'dump:show info about all object' + 'status:shows high-level status' + 'monitor:monitor changes to objects' + 'mount:mount a filesystem' + 'unmount:unmount a filesystem' + 'unlock:unlock an encrypted device' + 'lock:lock an encrypted device' + 'loop-setup:set-up a loop device' + 'loop-delete:delete a loop device' + 'power-off:safely power off a drive' + 'smart-simulate:set SMART data for a drive' ) - _describe -t commands 'udisksctl commands' commands + _describe -t commands 'udisksctl command' commands && ret=0 ;; cmd_args) case $words[1] in info) _arguments \ - {-p,--object-path}'[Object to get information about]:object path:_paths' \ - {-b,--block-device}'[Block device to get information about]:block device:_paths' \ - {-d,--drive}'[Drive to get information about]:drives:_paths' \ + {-p,--object-path}'[specify object to get information about]:object path:_paths' \ + {-b,--block-device}'[specify block device to get information about]:block device:_paths' \ + {-d,--drive}'[specify drive to get information about]:drive:_paths' && ret=0 ;; mount) _arguments \ - {-p,--object-path}'[Object to mount]:object path:_paths' \ - {-b,--block-device}'[Block device to mount]:block device:_paths' \ - {-t,--filesystem-type}'[Filesystem type to use]:fs type:_filesystems' \ - {-o,--options}'[Mount options]' \ - '(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \ + {-p,--object-path}'[specify object to mount]:object path:_paths' \ + {-b,--block-device}'[specify block device to mount]:block device:_paths' \ + {-t,--filesystem-type}'[specify filesystem type to use]:fs type:_filesystems' \ + {-o,--options}'[mount options]' \ + "(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0 ;; unmount) _arguments \ - {-p,--object-path}'[Object to unmount]:object path:_paths' \ - {-b,--block-device}'[Block device to unmount]:block device:_paths' \ - {-f,--force}'[Force/lazy unmount]' \ - '(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \ + {-p,--object-path}'[object to unmount]:object path:_paths' \ + {-b,--block-device}'[block device to unmount]:block device:_paths' \ + {-f,--force}'[force/lazy unmount]' \ + "(--no-user-interaction)--no-user-interaction[don't auhenticate the user if needed]" && ret=0 ;; unlock|lock) _arguments \ - {-p,--object-path}'[Object to lock/unlock]:object path:_paths' \ - {-b,--block-device}'[Block device to lock/unlock]:block device:_paths' \ - '(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \ + {-p,--object-path}'[object to lock/unlock]:object path:_paths' \ + {-b,--block-device}'[block device to lock/unlock]:block device:_paths' \ + "(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0 ;; loop-setup) _arguments \ - {-f,--file}'[File to set-up a loop device for]:files:_files' \ - {-r,--read-only}'[Setup read-only device]' \ - {-o,--offset}'[Start at bytes into file]:offset in bytes:' \ - {-s,--size}'[Limit size to bytes]:limit in bytes:' \ - '(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \ + {-f,--file}'[specify file to set-up a loop device for]:files:_files' \ + {-r,--read-only}'[setup read-only device]' \ + {-o,--offset}'[start at specified offset into file]:offset (bytes)' \ + {-s,--size}'[limit size]:limit (bytes)' \ + "(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0 ;; loop-delete) _arguments \ - {-p,--object-path}'[Object for loop device to delete]:object path:_paths' \ - {-b,--block-device}'[Loop device to delete]:block device:_paths' \ - '(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \ + {-p,--object-path}'[object for loop device to delete]:object path:_paths' \ + {-b,--block-device}'[loop device to delete]:block device:_paths' \ + "(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0 ;; power-off) _arguments \ - {-p,--object-path}'[Object path for ATA device]:object path:_paths' \ - {-b,--block-device}'[Device file for ATA devic]:block device:_paths' \ - '(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \ + {-p,--object-path}'[object path for ATA device]:object path:_paths' \ + {-b,--block-device}'[device file for ATA devic]:block device:_paths' \ + "(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0 ;; smart-simulate) _arguments \ - {-f,--file}'[File with libatasmart blob]:files:_files' \ - {-p,--object-path}'[Object to get information about]:object path:_paths' \ - {-b,--block-device}'[Block device to get information about]:block device:_paths' \ - '(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \ + {-f,--file}'[file with libatasmart blob]:files:_files' \ + {-p,--object-path}'[object to get information about]:object path:_paths' \ + {-b,--block-device}'[block device to get information about]:block device:_paths' \ + "(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0 ;; esac ;; esac + return ret } _udisksctl "$@" diff --git a/.zprezto/modules/completion/external/src/_ufw b/.zprezto/modules/completion/external/src/_ufw index b4cf0f1..010a3fa 100644 --- a/.zprezto/modules/completion/external/src/_ufw +++ b/.zprezto/modules/completion/external/src/_ufw @@ -41,7 +41,7 @@ _ufw_logging() { - local main additional second + local params additional second second=$words[2] if [ ! -z $second ]; then @@ -60,8 +60,8 @@ _ufw_logging() { "full" ) - _describe -t params 'On/Off' params - _describe -t additional 'Level' additional + _describe -t params 'on/off' params + _describe -t additional 'level' additional } @@ -85,35 +85,34 @@ _ufw_delete() { } _ufw() { - local -a commands + local curcontext="$curcontext" ret=1 + local -a state line commands commands=( - "enable:Enables the firewall" - "disable:Disables the firewall" - "default:Set default policy" - "logging:Set logging to LEVEL" - "allow:Add allow rule" - "deny:Add deny rule" - "reject:Add reject rule" - "limit:Add limit rule" - "delete:Delete RULE" - "insert:Insert RULE at NUM" - "route:Add route RULE" - "reload:Reload firewall" - "reset:Reset firewall" - "status:Show firewall status" - "show:Show firewall report" - "version:Display version information" + "enable:enable the firewall" + "disable:disable the firewall" + "default:set default policy" + "logging:set logging level" + "allow:add allow rule" + "deny:add deny rule" + "reject:add reject rule" + "limit:add limit rule" + "delete:delete rule" + "insert:insert rule at position" + "route:add route rule" + "reload:reload firewall" + "reset:reset firewall" + "status:show firewall status" + "show:show firewall report" + "version:display version information" ) - - _arguments -C -s -S -n \ - '(- 1 *)'--version"[Show program\'s version number and exit]: :->full" \ - '(- 1 *)'{-h,--help}'[Show help message and exit]: :->full' \ - '(- 1 *)'--dry-run"[Don\'t modify anything, just show the changes]: :->cmds" \ + '(- 1 *)'--version"[display version information]: :->full" \ + '(- 1 *)'{-h,--help}'[display usage information]: :->full' \ + '(- 1 *)'--dry-run"[don't modify anything, just show the changes]: :->cmds" \ '1:cmd:->cmds' \ - '*:: :->args' \ + '*:: :->args' && ret=0 case "$state" in (cmds) @@ -124,19 +123,21 @@ _ufw() { cmd=$words[1] case "$cmd" in (logging) - _ufw_logging + _ufw_logging && ret=0 ;; (delete) - _ufw_delete + _ufw_delete && ret=0 ;; (*) - return + _default && ret=0 ;; esac ;; (*) ;; esac + + return ret } _ufw diff --git a/.zprezto/modules/completion/external/src/_virsh b/.zprezto/modules/completion/external/src/_virsh deleted file mode 100644 index 3dee9c7..0000000 --- a/.zprezto/modules/completion/external/src/_virsh +++ /dev/null @@ -1,278 +0,0 @@ -#compdef virsh -# ------------------------------------------------------------------------------ -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the zsh-users nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for LibVirt's Shell (virsh) (http://libvirt.org). -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * Jan-Philipp Litza -# * Vadim A. Misbakh-Soloviov -# -# ------------------------------------------------------------------------------ - -local -a args reply - -function _virsh-domains() { - local -a out - out=( ${${${${(f)"$(virsh list "$@")"}:#(---| Id)*}## #[0-9-]## ##}%% *} ) - _describe -t domains "${${1#--}:-running} domains" out - return $? -} - -local -a expand_files -expand_files=(/$'[^\0]##\0'/ ':file:file name:_files') - -local -a expand_dirs -expand_dirs=(/$'[^\0]##\0'/ ":dir:dir name:_files -/") - -local -a expand_domains -expand_domains=( - /$'[^\0]##\0'/ - ":domains:domains:{_virsh-domains --all}" -) - -local -a expand_domains_running -expand_domains_running=( - /$'[^\0]##\0'/ - ":domains:running domains:{_virsh-domains}" -) - -local -a expand_domains_inactive -expand_domains_inactive=( - /$'[^\0]##\0'/ - ":domains:inactive domains:{_virsh-domains --inactive}" -) - -local -a expand_kilobytes -expand_kilobytes=( - /'\d+'/ - ":kilobytes:kilobytes:" -) - -local -a expand_count -expand_count=( - /'\d+'/ - ":count:count:" -) - -local -a subcmd_help -subcmd_help=( - /$'[^\0]##\0'/ - ":command:virsh command:" -) - -local -a subcmd_list -_regex_words \ - list-options 'list options' \ - '--all:list all domains, not only active' \ - '--inactive:list only inactive domains' -subcmd_list=("$reply[@]") - -local -a subcmd_freecell -subcmd_freecell=( - /'\d*'/ - ":numa-cell:NUMA cell:" -) - -local -a subcmd_autostart -_regex_words \ - autostart-options 'autostart options' \ - '--disable:disables autostart instead of enabling' -subcmd_autostart=("(" "$reply[@]" "|" ")" $expand_domains) - -local -a subcmd_create -_regex_words \ - create-options 'create options' \ - '--console:attach to the console after creation' \ - '--paused:pause domain after creation (if supported by driver)' -subcmd_create=("(" "$reply[@]" "|" ")" $expand_files) - -local -a subcmd_dumpxml -_regex_words \ - dumpxml-options 'dumpxml options' \ - '--inactive:use the config for next reboot instead of current' \ - '--security-info:include security sensitive information' \ - '--update-cpu:update CPU requirements according to host CPU' -subcmd_dumpxml=("(" "$reply[@]" "|" ")" $expand_domains) - -local -a subcmd_start -_regex_words \ - start-options 'start options' \ - '--console:attach to console after start' \ - '--paused: pause after start (if supported by driver)' -subcmd_start=("(" "$reply[@]" "|" ")" $expand_domains_inactive) - -args=( /$'[^\0]#\0'/ ) - -_regex_words \ - commands "virsh command" \ - 'help:print help:$subcmd_help' \ - 'attach-device:attach device from an XML file:$expand_domains $expand_files' \ - 'attach-disk:attach disk device' \ - 'attach-interface:attach network interface' \ - 'autostart:autostart a domain:$subcmd_autostart' \ - 'capabilities:capabilities:' \ - 'cd:change the current directory:$expand_dirs' \ - 'connect:(re)connect to hypervisor' \ - 'console:connect to the guest console:$expand_domains_running' \ - 'cpu-baseline:compute baseline CPU:$expand_files' \ - 'cpu-compare:compare host CPU with a CPU described by an XML file:$expand_files' \ - 'create:create a domain from an XML file:$subcmd_create' \ - 'start:start a (previously defined) inactive domain:$subcmd_start' \ - 'destroy:destroy a domain:$expand_domains_running' \ - 'detach-device:detach device from an XML file:$expand_domains $expand_files' \ - 'detach-disk:detach disk device' \ - 'detach-interface:detach network interface' \ - 'define:define (but don'"\'"'t start) a domain from an XML file:$expand_files' \ - 'domid:convert a domain name or UUID to domain id:$expand_domains' \ - 'domuuid:convert a domain name or id to domain UUID:$expand_domains' \ - 'dominfo:domain information:$expand_domains' \ - 'domjobinfo:domain job information:$expand_domains' \ - 'domjobabort:abort active domain job:$expand_domains' \ - 'domname:convert a domain id or UUID to domain name:$expand_domains' \ - 'domstate:domain state:$expand_domains' \ - 'domblkstat:get device block stats for a domain' \ - 'domifstat:get network interface stats for a domain' \ - 'dommemstat:get memory statistics for a domain:$expand_domains_running' \ - 'domblkinfo:domain block device size information' \ - 'domxml-from-native:Convert native config to domain XML' \ - 'domxml-to-native:Convert domain XML to native config' \ - 'dumpxml:domain information in XML:$subcmd_dumpxml' \ - 'edit:edit XML configuration for a domain:$expand_domains' \ - 'find-storage-pool-sources:discover potential storage pool sources' \ - 'find-storage-pool-sources-as:find potential storage pool sources' \ - 'freecell:NUMA free memory:$subcmd_freecell' \ - 'hostname:print the hypervisor hostname:' \ - 'list:list domains:$subcmd_list' \ - 'migrate:migrate domain to another host' \ - 'migrate-setmaxdowntime:set maximum tolerable downtime' \ - 'net-autostart:autostart a network' \ - 'net-create:create a network from an XML file:$expand_files' \ - 'net-define:define (but don'"\'"'t start) a network from an XML file:$expand_files' \ - 'net-destroy:destroy a network' \ - 'net-dumpxml:network information in XML' \ - 'net-edit:edit XML configuration for a network' \ - 'net-list:list networks' \ - 'net-name:convert a network UUID to network name' \ - 'net-start:start a (previously defined) inactive network' \ - 'net-undefine:undefine an inactive network' \ - 'net-uuid:convert a network name to network UUID' \ - 'iface-list:list physical host interfaces' \ - 'iface-name:convert an interface MAC address to interface name' \ - 'iface-mac:convert an interface name to interface MAC address' \ - 'iface-dumpxml:interface information in XML' \ - 'iface-define:define (but don'"\'"'t start) a physical host interface from an XML file' \ - 'iface-undefine:undefine a physical host interface (remove it from configuration)' \ - 'iface-edit:edit XML configuration for a physical host interface' \ - 'iface-start:start a physical host interface (enable it / "if-up")' \ - 'iface-destroy:destroy a physical host interface (disable it / "if-down")' \ - 'managedsave:managed save of a domain state:$expand_domains_running' \ - 'managedsave-remove:Remove managed save of a domain:$expand_domains' \ - 'nodeinfo:node information:' \ - 'nodedev-list:enumerate devices on this host' \ - 'nodedev-dumpxml:node device details in XML' \ - 'nodedev-dettach:dettach node device from its device driver' \ - 'nodedev-reattach:reattach node device to its device driver' \ - 'nodedev-reset:reset node device' \ - 'nodedev-create:create a device defined by an XML file on the node' \ - 'nodedev-destroy:destroy a device on the node' \ - 'nwfilter-define:define or update a network filter from an XML file:$expand_files' \ - 'nwfilter-undefine:undefine a network filter' \ - 'nwfilter-dumpxml:network filter information in XML' \ - 'nwfilter-list:list network filters' \ - 'nwfilter-edit:edit XML configuration for a network filter' \ - 'pool-autostart:autostart a pool' \ - 'pool-build:build a pool' \ - 'pool-create:create a pool from an XML file:$expand_files' \ - 'pool-create-as:create a pool from a set of args' \ - 'pool-define:define (but don'"\'"'t start) a pool from an XML file:$expand_files' \ - 'pool-define-as:define a pool from a set of args' \ - 'pool-destroy:destroy a pool' \ - 'pool-delete:delete a pool' \ - 'pool-dumpxml:pool information in XML' \ - 'pool-edit:edit XML configuration for a storage pool' \ - 'pool-info:storage pool information' \ - 'pool-list:list pools' \ - 'pool-name:convert a pool UUID to pool name' \ - 'pool-refresh:refresh a pool' \ - 'pool-start:start a (previously defined) inactive pool' \ - 'pool-undefine:undefine an inactive pool' \ - 'pool-uuid:convert a pool name to pool UUID' \ - 'secret-define:define or modify a secret from an XML file:$expand_files' \ - 'secret-dumpxml:secret attributes in XML' \ - 'secret-set-value:set a secret value' \ - 'secret-get-value:Output a secret value' \ - 'secret-undefine:undefine a secret' \ - 'secret-list:list secrets' \ - 'pwd:print the current directory:' \ - 'quit:quit this interactive terminal:' \ - 'exit:quit this interactive terminal:' \ - 'reboot:reboot a domain:$expand_domains' \ - 'restore:restore a domain from a saved state in a file:$expand_files' \ - 'resume:resume a domain:$expand_domains_running' \ - 'save:save a domain state to a file:$expand_domains $expand_files' \ - 'schedinfo:show/set scheduler parameters' \ - 'dump:dump the core of a domain to a file for analysis:$expand_domains $expand_files' \ - 'shutdown:gracefully shutdown a domain:$expand_domains_running' \ - 'setmem:change memory allocation:$expand_domains $expand_kilobytes' \ - 'setmaxmem:change maximum memory limit:$expand_domains $expand_kilobytes' \ - 'setvcpus:change number of virtual CPUs:$expand_domains $expand_count' \ - 'suspend:suspend a domain:$expand_domains_running' \ - 'ttyconsole:tty console:$expand_domains_running' \ - 'undefine:undefine an inactive domain:$expand_domains_inactive' \ - 'update-device:update device from an XML file' \ - 'uri:print the hypervisor canonical URI:' \ - 'vol-create:create a vol from an XML file' \ - 'vol-create-from:create a vol, using another volume as input' \ - 'vol-create-as:create a volume from a set of args' \ - 'vol-clone:clone a volume.' \ - 'vol-delete:delete a vol' \ - 'vol-wipe:wipe a vol' \ - 'vol-dumpxml:vol information in XML' \ - 'vol-info:storage vol information' \ - 'vol-list:list vols' \ - 'vol-pool:returns the storage pool for a given volume key or path' \ - 'vol-path:returns the volume path for a given volume name or key' \ - 'vol-name:returns the volume name for a given volume key or path' \ - 'vol-key:returns the volume key for a given volume name or path' \ - 'vcpuinfo:domain vcpu information:$expand_domains_running' \ - 'vcpupin:control domain vcpu affinity' \ - 'version:show version:' \ - 'vncdisplay:vnc display:$expand_domains_running' \ - 'snapshot-create:Create a snapshot:$expand_domains $expand_files' \ - 'snapshot-current:Get the current snapshot:$expand_domains' \ - 'snapshot-delete:Delete a domain snapshot' \ - 'snapshot-dumpxml:Dump XML for a domain snapshot' \ - 'snapshot-list:List snapshots for a domain:$expand_domains' \ - 'snapshot-revert:Revert a domain to a snapshot' -args+=("$reply[@]") - -_regex_arguments _virsh "${args[@]}" - -_virsh "$@" diff --git a/.zprezto/modules/completion/external/src/_vnstat b/.zprezto/modules/completion/external/src/_vnstat index bfb08dd..5676f8b 100644 --- a/.zprezto/modules/completion/external/src/_vnstat +++ b/.zprezto/modules/completion/external/src/_vnstat @@ -38,73 +38,75 @@ # # ------------------------------------------------------------------------------ -local context state state_descr line +local curcontext="$curcontext" state state_descr line ret=1 typeset -A opt_args local period="-d --days -h --hours -m --months -w --weeks" -_arguments : \ - '--cleartop[Remove all top 10 entries]' \ - '--config[Specify alternate configuration file]:file:_files' \ - "($period)"{-d,--days}'[Show traffic for days]' \ - "($period)"{-h,--hours}'[Show trafic for last 24 hours]' \ - "($period)"{-m,--months}'[Show traffic for months]' \ - "($period)"{-w,--weeks}'[Show traffic for 7 days]' \ - '--dbdir[Specify database directory]:directory:_files -/' \ - '(-D --debug)'{-D,--debug}'[Show additional debug output]' \ - '--delete[Delete database and stop monitoring selected interface]' \ - '--dumpdb[Dump database in parseable format]' \ - '(--disable)--enable[Enable updates for selected interface]' \ - '(--enable)--disable[Disable updates for selected interface]' \ - '(-i --iface)'{-i,--iface}'[Specify interface for actions]:interface:->interface' \ - '--iflist[List available interfaces]' \ - '(-l --live)'{-l,--live}'[Display current transfer rate]:mode:->live' \ - '--locale[Specify locale]:locale:' \ - '--nick[Set nickname for alias]:nickname:' \ - '--oneline[Traffic summary in one-line, parseable format]' \ - '(-q --query)'{-q,--query}'[Force database query mode]' \ - '(-r --reset)'{-r,--reset}'[Reset internal counters]' \ - '--rebuildtotal[Reset total trafic counters]' \ - '(-ru --rateunit)'{-ru,--rateunit}'[Swap configured rate unit]' \ - '--savemerged[Write result of database merge]' \ - '(-s --short)'{-s,--short}'[Use short output mode]' \ - '--style[Modify content and style of output]:style:->style' \ - '--sync[Synchronize internal counters]' \ - '--testkernel[Test kernel boot time information]' \ - '(-t --top10)'{-t,--top10}'[Show all time top 10 traffic days]' \ - '-tr[Calculate amount of traffic in given time]:seconds:' \ - '(-u --update)'{-u,--update}'[Update databases]' \ - '--xml[Show database content in XML format]' \ - '(-)'{-v,--version}'[Show current version]' \ - '(-)'{-\?,--help}'[Show command summary]' \ - '(-)--longhelp[Show complete options list]' \ +_arguments -C : \ + '--cleartop[remove all top 10 entries]' \ + '--config[specify alternate configuration file]:file:_files' \ + "($period)"{-d,--days}'[show traffic for days]' \ + "($period)"{-h,--hours}'[show trafic for last 24 hours]' \ + "($period)"{-m,--months}'[show traffic for months]' \ + "($period)"{-w,--weeks}'[show traffic for 7 days]' \ + '--dbdir[specify database directory]:directory:_files -/' \ + '(-D --debug)'{-D,--debug}'[show additional debug output]' \ + '--delete[delete database and stop monitoring selected interface]' \ + '--dumpdb[dump database in parseable format]' \ + '(--disable)--enable[enable updates for selected interface]' \ + '(--enable)--disable[disable updates for selected interface]' \ + '(-i --iface)'{-i,--iface}'[specify interface for actions]:interface:->interface' \ + '--iflist[list available interfaces]' \ + '(-l --live)'{-l,--live}'[display current transfer rate]:mode:->live' \ + '--locale[specify locale]:locale:' \ + '--nick[set nickname for alias]:nickname:' \ + '--oneline[traffic summary in one-line, parseable format]' \ + '(-q --query)'{-q,--query}'[force database query mode]' \ + '(-r --reset)'{-r,--reset}'[reset internal counters]' \ + '--rebuildtotal[reset total trafic counters]' \ + '(-ru --rateunit)'{-ru,--rateunit}'[swap configured rate unit]' \ + '--savemerged[write result of database merge]' \ + '(-s --short)'{-s,--short}'[use short output mode]' \ + '--style[modify content and style of output]:style:->style' \ + '--sync[synchronize internal counters]' \ + '--testkernel[test kernel boot time information]' \ + '(-t --top10)'{-t,--top10}'[show all time top 10 traffic days]' \ + '-tr[calculate amount of traffic in given time]:seconds:' \ + '(-u --update)'{-u,--update}'[update databases]' \ + '--xml[show database content in XML format]' \ + '(-)'{-v,--version}'[show current version]' \ + '(-)'{-\?,--help}'[show command summary]' \ + '(-)--longhelp[show complete options list]' \ && ret=0 case "$state" in (live) - _values 'Live mode' \ - '0[Packets per second]' \ - '1[Traffic counters]' + _values 'live mode' \ + '0[packets per second]' \ + '1[traffic counters]' && ret=0 ;; (style) - _values 'Output style' \ - '0[Narrow output]' \ - '1[Enable bar column]' \ - '2[Bar column with average traffic rate]' \ - '3[Enable average traffic rate]' \ - '4[Disable use of terminal control characters]' + _values 'output style' \ + '0[narrow output]' \ + '1[enable bar column]' \ + '2[bar column with average traffic rate]' \ + '3[enable average traffic rate]' \ + '4[disable use of terminal control characters]' && ret=0 ;; (interface) local interfaces="$(_call_program interfaces 'vnstat --iflist')" interfaces="${interfaces#*:}" - _values -s + 'Interface' ${(z)interfaces} + _values -s + 'interface' ${(z)interfaces} && ret=0 ;; esac +return ret + # Local Variables: # mode: Shell-Script # sh-indentation: 2 diff --git a/.zprezto/modules/completion/external/src/_vpnc b/.zprezto/modules/completion/external/src/_vpnc index 622b1d3..edda13a 100644 --- a/.zprezto/modules/completion/external/src/_vpnc +++ b/.zprezto/modules/completion/external/src/_vpnc @@ -35,13 +35,13 @@ _vpnc-connect() { '--ifname[visible name of the TUN/TAP interface]:name' \ '--ifmode[mode of TUN/TAP interface]: :_vpnc_tun_tap_modes' \ '--debug[show verbose debug messages]: :_vpnc_debug_levels' \ - '--no-detach[Don'\''t detach from the console after login]' \ + "--no-detach[don't detach from the console after login]" \ '--pid-file[store the pid of background process in the file]:pid file:_files' \ '--local-addr[local IP to use for ISAKMP/ESP/...]: :_hosts' \ '--local-port[local ISAKMP port number to use]: :_vpnc_isakmp_port_numbers' \ '--udp-port[local UDP port number to use]: :_vpnc_udp_port_numbers' \ '--dpd-idle[send DPD packet after not receiving anything for X seconds]: :_vpnc_dpd_idle_times' \ - '--non-inter[Don'\''t ask anything, exit on missing options]' \ + "--non-inter[don't ask anything, exit on missing options]" \ '--auth-mode[authentication mode]: :_vpnc_authentication_modes' \ '--ca-file[filename and path to the CA-PEM-File]:CA-PEM file:_files' \ '--ca-dir[path of the trusted CA-Directory]:CA directory:_files -/' \ @@ -116,7 +116,7 @@ _vpnc_tun_tap_modes() { (( $+functions[_vpnc_debug_levels] )) || _vpnc_debug_levels() { local levels; levels=( - '0:do not print debug information' + "0:don't print debug information" '1:print minimal debug information' '2:show statemachine and packet/payload type information' '3:dump everything excluding authentication data' diff --git a/.zprezto/modules/completion/external/src/_wg-quick b/.zprezto/modules/completion/external/src/_wg-quick new file mode 100644 index 0000000..8de17ce --- /dev/null +++ b/.zprezto/modules/completion/external/src/_wg-quick @@ -0,0 +1,25 @@ +#compdef wg-quick +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for wg-quick (a script for easy managemant of wireguard +# VPN tunnels) (https://www.wireguard.com/) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Nicolas Lenz +# +# ------------------------------------------------------------------------------ + +# The possible modes +local modes=('up\:"bring a wireguard interface up"'\ + 'down\:"tear down and remove a wireguard interface"'\ + 'save\:"save configuration of a running wireguard interface"') + +# 1: Complete mode +# 2: Complete interface with all .conf files in /etc/wireguard without the filename extension. +_arguments "1:mode:((${modes}))"\ + '2:interface:_path_files -W /etc/wireguard -g "*.conf(^/:r)"' diff --git a/.zprezto/modules/completion/external/src/_yaourt b/.zprezto/modules/completion/external/src/_yaourt index 920b16f..4727502 100644 --- a/.zprezto/modules/completion/external/src/_yaourt +++ b/.zprezto/modules/completion/external/src/_yaourt @@ -92,7 +92,7 @@ _yaourt_action_sync() { _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_sync_modifiers[@]" \ - '*-c[Remove old packages from cache]' \ + '*-c[remove old packages from cache]' \ ;; sync_group) _arguments -s : \ @@ -213,110 +213,110 @@ _yaourt() { # options for passing to _arguments: main pacman commands typeset -a _yaourt_opts_commands _yaourt_opts_commands=( - '-Q[Query the package database]' - '-R[Remove a package from the system]' - '-S[Synchronize packages]' - '-U[Upgrade a package]' - '-V[Display version and exit]' - '-h[Display usage]' + '-Q[query the package database]' + '-R[remove a package from the system]' + '-S[synchronize packages]' + '-U[upgrade a package]' + '-V[display version and exit]' + '-h[display usage information]' '-B[backup pacman database]' - '-G[Get PKGBUILD]' - '-C[Clean backup files]' - '--stats[Package Statistics]' + '-G[get PKGBUILD]' + '-C[clean backup files]' + '--stats[package statistics]' ) # options for passing to _arguments: options common to all commands typeset -a _yaourt_opts_common _yaourt_opts_common=( - '-b[Alternate database location]:database_location:_files -/' - '-h[Display syntax for the given operation]' - '-r[Alternate installation root]:installation root:_files -/' - '-v[Be more verbose]' - '--cachedir[Alternate package cache location]:cache_location:_files -/' - '--config[Alternate configuration file]:config file:_files' - '--debug[Display debug messages]' - '--gpgdir[Alternate GnuPG home directory]:gpg_directory:_files -/' - '--logfile[Alternate log file]:config file:_files' - '--noconfirm[Do not ask for confirmation]' - '--noprogressbar[Do not show a progress bar when downloading files]' - '--noscriptlet[Do not execute the install scriptlet if one exists]' - '--print[Only print the targets instead of performing the operation]' + '-b[alternate database location]:database_location:_files -/' + '-h[display syntax for the given operation]' + '-r[alternate installation root]:installation root:_files -/' + '-v[be more verbose]' + '--cachedir[specify alternate package cache location]:cache_location:_files -/' + '--config[specify alternate configuration file]:config file:_files' + '--debug[display debug messages]' + '--gpgdir[specify alternate GnuPG home directory]:gpg_directory:_files -/' + '--logfile[specify alternate log file]:config file:_files' + "--noconfirm[don't ask for confirmation]" + "--noprogressbar[don't show a progress bar when downloading files]" + "--noscriptlet[don't execute the install scriptlet if one exists]" + '--print[only print the targets instead of performing the operation]' ) # options for passing to _arguments: options for --upgrade commands typeset -a _yaourt_opts_pkgfile _yaourt_opts_pkgfile=( - '-d[Skip dependency checks]' - '-f[Overwrite conflicting files]' + '-d[skip dependency checks]' + '-f[overwrite conflicting files]' '*:package file:_files -g "*.pkg.tar*(.)"' ) # options for passing to _arguments: subactions for --query command typeset -a _yaourt_opts_query_actions _yaourt_opts_query_actions=( - '-g[View all members of a package group]:*:package groups:->query_group' - '-o[Query the package that owns a file]:file:_files' - '-p[Package file to query]:*:package file:->query_file' - '-s[Search package names and descriptions]:*:search text:->query_search' + '-g[view all members of a package group]:*:package groups:->query_group' + '-o[query the package that owns a file]:file:_files' + '-p[package file to query]:*:package file:->query_file' + '-s[search package names and descriptions]:*:search text:->query_search' ) # options for passing to _arguments: options for --query and subcommands typeset -a _yaourt_opts_query_modifiers _yaourt_opts_query_modifiers=( - '-c[List package changelog]' - '-d[List packages installed as dependencies]' - '-e[List packages explicitly installed]' - '-i[View package information]' - '-ii[View package information including backup files]' - '-k[Check package files]' - '-l[List package contents]' - '-m[List installed packages not found in sync db(s)]' - '-t[List packages not required by any package]' - '-u[List packages that can be upgraded]' - '--aur[Install packages from aur, even if they are in community, or, with the -u option, update packages installed from aur]' - '--devel[Used with -u updates all cvs/svn/git/hg/bzr packages]' - '--date[List packages sorted ascendingly (oldest is printed first) by installation date]' + '-c[list package changelog]' + '-d[list packages installed as dependencies]' + '-e[list packages explicitly installed]' + '-i[view package information]' + '-ii[view package information including backup files]' + '-k[check package files]' + '-l[list package contents]' + '-m[list installed packages not found in sync db(s)]' + '-t[list packages not required by any package]' + '-u[list packages that can be upgraded]' + '--aur[install packages from aur, even if they are in community, or, with the -u option, update packages installed from aur]' + '--devel[used with -u updates all cvs/svn/git/hg/bzr packages]' + '--date[list packages sorted in ascending order (oldest first) by installation date]' ) # options for passing to _arguments: options for --remove command typeset -a _yaourt_opts_remove _yaourt_opts_remove=( - '-c[Remove all dependent packages]' - '-d[Skip dependency checks]' - '-k[Only remove database entry, do not remove files]' - '-n[Remove protected configuration files]' - '-s[Remove dependencies not required by other packages]' + '-c[remove all dependent packages]' + '-d[skip dependency checks]' + "-k[only remove database entry, don't remove files]" + '-n[remove protected configuration files]' + '-s[remove dependencies not required by other packages]' '*:installed package:_yaourt_completions_installed_packages' ) # options for passing to _arguments: options for --sync command typeset -a _yaourt_opts_sync_actions _yaourt_opts_sync_actions=( - '*-c[Remove old packages from cache]:*:clean:->sync_clean' - '*-cc[Remove all packages from cache]:*:clean:->sync_clean' - '-g[View all members of a package group]:*:package groups:->sync_group' - '-s[Search package names and descriptions]:*:search text:->sync_search' + '*-c[remove old packages from cache]:*:clean:->sync_clean' + '*-cc[remove all packages from cache]:*:clean:->sync_clean' + '-g[view all members of a package group]:*:package group:->sync_group' + '-s[search package names and descriptions]:*:search text:->sync_search' ) # options for passing to _arguments: options for --sync command typeset -a _yaourt_opts_sync_modifiers _yaourt_opts_sync_modifiers=( - '-d[Skip dependency checks]' - '-f[Overwrite conflicting files]' - '-i[View package information]' - '-l[List all packages in a repository]' - '-p[Print download URIs for each package to be installed]' - '-u[Upgrade all out-of-date packages]' - '-w[Download packages only]' - '-y[Download fresh package databases]' - '*--ignore[Ignore a package upgrade]:package: + '-d[skip dependency checks]' + '-f[overwrite conflicting files]' + '-i[view package information]' + '-l[list all packages in a repository]' + '-p[print download URIs for each package to be installed]' + '-u[upgrade all out-of-date packages]' + '-w[download packages only]' + '-y[download fresh package databases]' + '*--ignore[ignore a package upgrade]:package: _yaourt_completions_all_packages' - '*--ignoregroup[Ignore a group upgrade]:package group: + '*--ignoregroup[ignore a group upgrade]:package group: _yaourt_completions_all_groups' - '--asdeps[Install packages as non-explicitly installed]' - '--asexplicit[Install packages as explicitly installed]' - '--needed[Do not reinstall up to date packages]' - '--devel[Used with -u updates all cvs/svn/git/hg/bzr packages]' + '--asdeps[install packages as non-explicitly installed]' + '--asexplicit[install packages as explicitly installed]' + "--needed[don't reinstall up to date packages]" + '--devel[used with -u updates all cvs/svn/git/hg/bzr packages]' ) case $words[2] in diff --git a/.zprezto/modules/completion/external/src/_yarn b/.zprezto/modules/completion/external/src/_yarn index a41262d..382f58a 100644 --- a/.zprezto/modules/completion/external/src/_yarn +++ b/.zprezto/modules/completion/external/src/_yarn @@ -37,14 +37,14 @@ _commands=( 'access' - 'cache' + 'autoclean:Clean and remove unnecessary files from package dependencies' + 'cache:List or clean every cached package' "check:Verify package dependencies agains yarn's lock file" - 'clean:Cleans and removes unnecessary files from package dependencies' 'config:Manages the yarn configuration files' 'generate-lock-entry:Generates a lock file entry' 'global:Install packages globally on your operating system' 'help:Show information about a command' - 'import' + 'import:Generate yarn.lock from an existing npm-installed node_modules folder' 'info:Show information about a package' 'init:Interactively creates or updates a package.json file' 'install:Install all the dependencies listed within package.json' @@ -53,16 +53,16 @@ _commands=( 'list:List installed packages' 'login:Store registry username and email' 'logout:Clear registry username and email' - 'outdated:Checks for outdated package dependencies' + 'outdated:Check for outdated package dependencies' 'owner:Manage package owners' - 'pack:Creates a compressed gzip archive of package dependencies' - 'publish:Publishes a package to the npm registry' - 'run:Runs a defined package script' + 'pack:Create a compressed gzip archive of package dependencies' + 'publish:Publish a package to the npm registry' + 'run:Run a defined package script' 'tag:Add, remove, or list tags on a package' 'team:Maintain team memberships' 'unlink:Unlink a previously created symlink for a package' - 'version:Updates the package version' - 'versions' + 'version:Update the package version' + 'versions:Display version information of currently installed Yarn, Node.js, and its dependencies' 'why:Show information about why a package is installed' ) @@ -76,13 +76,13 @@ _global_commands=( _yarn_commands_scripts() { local -a scripts - scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n')) + scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g')) _describe 'command or script' _commands -- _global_commands -- scripts } _yarn_scripts() { local -a scripts - scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n')) + scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g')) _describe 'script' scripts } diff --git a/.zprezto/modules/completion/external/src/_zcash-cli b/.zprezto/modules/completion/external/src/_zcash-cli index 6dfbe2d..70ffa40 100644 --- a/.zprezto/modules/completion/external/src/_zcash-cli +++ b/.zprezto/modules/completion/external/src/_zcash-cli @@ -38,25 +38,24 @@ # # ------------------------------------------------------------------------------ -_zcash-cli() { - local context state line curcontext="$curcontext" +local state line curcontext="$curcontext" ret=1 - _arguments -C \ - -?'[This help message]' \ - -conf='[Specify configuration file (default: zcash.conf)]:PATH:_files' \ - -datadir='[Specify data directory]:PATH:_directories' \ - -testnet'[Use the test network]' \ - -regtest'[Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.]' \ - -rpcconnect='[Send commands to node running on (default: 127.0.0.1)]:RPCCONNECT:_hosts' \ - -rpcport='[Connect to JSON-RPC on (default: 8232 or testnet: 18232)]: :_guard "[[\:digit\:]]#" "PORT"' \ - -rpcwait'[Wait for RPC server to start]' \ - -rpcuser='[Username for JSON-RPC connections]:RPCUSER:()' \ - -rpcpassword='[Password for JSON-RPC connections]:RPCPASSWORD:()' \ - -rpcclienttimeout='[Timeout in seconds during HTTP requests, or 0 for no timeout. (default: 900)]: :_guard "[[\:digit\:]]#" "RPCCLIENTTIMEOUT"' \ - ':subcommand:->subcommand' && ret=0 +_arguments -C \ + '-?[display usage information]' \ + -conf='[specify configuration file]:file [zcash.conf]:_files' \ + -datadir='[specify data directory]:directory:_directories' \ + -testnet'[use the test network]' \ + -regtest'[enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.]' \ + -rpcconnect='[send commands to node running on specified ip]:rpcconnect [127.0.0.1]:_hosts' \ + -rpcport='[connect to JSON-RPC on specified port]: :_guard "[[\:digit\:]]#" "port [8232 or testnet\: 18232]"' \ + -rpcwait'[wait for RPC server to start]' \ + -rpcuser='[username for JSON-RPC connections]:rpcuser' \ + -rpcpassword='[password for JSON-RPC connections]:rpcpassword' \ + -rpcclienttimeout='[specify timeout during HTTP requests, or 0 for no timeout]: :_guard "[[\:digit\:]]#" "timeout (seconds) [900]"' \ + ':subcommand:->subcommand' && ret=0 - case $state in - subcommand) +case $state in + subcommand) subcommands=( 'getbestblockhash' 'getblock' @@ -167,13 +166,11 @@ _zcash-cli() { 'zcsamplejoinsplit' ) - _describe -t subcommands 'zcash-cli subcommands' subcommands && ret=0 - esac + _describe -t subcommands 'zcash-cli subcommand' subcommands && ret=0 + ;; +esac - return ret -} - -_zcash-cli "$@" +return ret # Local Variables: # mode: Shell-Script diff --git a/.zprezto/modules/completion/external/zsh-completions-howto.org b/.zprezto/modules/completion/external/zsh-completions-howto.org index d494a10..b996e44 100644 --- a/.zprezto/modules/completion/external/zsh-completions-howto.org +++ b/.zprezto/modules/completion/external/zsh-completions-howto.org @@ -6,7 +6,7 @@ with examples, so that you can learn how to write more advanced completion funct give enough information and examples to get you up and running. If you need more details you can look it up for yourself in the [[http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][official documentation]]. -Please make any scripts that you create publically available for others (e.g. by forking this repo and making a [[id:64bcd501-b0f0-48c7-b8e2-07af708b95ec][pull request]]). +Please make any scripts that you create publicly available for others (e.g. by forking this repo and making a [[id:64bcd501-b0f0-48c7-b8e2-07af708b95ec][pull request]]). Also if you have any more information to add or improvements to make to this tutorial, please do. * Getting started ** Telling zsh which function to use for completing a command @@ -78,7 +78,7 @@ Examples of how to use these functions are given in the next section. *** main utility functions for overall completion | _alternative | Can be used to generate completion candidates from other utility functions or shell code. | | _arguments | Used to specify how to complete individual options & arguments for a command with unix style options. | -| _describe | Used for creating simple completions consisting of single words with descriptions (but no actions). Easier to use than _arguments | +| _describe | Used for creating simple completions consisting of words with descriptions (but no actions). Easier to use than _arguments | | _gnu_generic | Can be used to complete options for commands that understand the `--help' option. | | _regex_arguments | Creates a function for matching commandline arguments with regular expressions, and then performing actions/completions. | *** functions for performing complex completions of single words @@ -86,6 +86,7 @@ Examples of how to use these functions are given in the next section. | _combination | Used to complete combinations of values, for example pairs of hostnames and usernames. | | _multi_parts | Used for completing multiple parts of words separately where each part is separated by some char, e.g. for completing partial filepaths: /u/i/sy -> /usr/include/sys | | _sep_parts | Like _multi_parts but allows different separators at different parts of the completion. | +| _sequence | Used as a wrapper around another completion function to complete a delimited list of matches generated by that other function. *** functions for completing specific types of objects | _path_files | Used to complete filepaths. Take several options to control behaviour. | | _files | Calls _path_files with all options except -g and -/. These options depend on file-patterns style setting. | @@ -119,72 +120,76 @@ _regex_arguments or _alternative functions. ** Writing simple completion functions using _describe The _describe function can be used for simple completions where the order and position of the options/arguments is not important. You just need to create an array parameter to hold the options & their descriptions, and then pass -the parameter name as an argument to _describe. The following example creates completion candidates -c and -d, with +the parameter name as an argument to _describe. The following example creates completion candidates c and d, with the descriptions (note this should be put in a file called _cmd in some directory listed in $fpath). #+BEGIN_SRC sh #compdef cmd -local -a options -options=('-c:description for -c opt' '-d:description for -d opt') -_describe 'values' options +local -a subcmds +subcmds=('c:description for c command' 'd:description for d command') +_describe 'command' subcmds #+END_SRC -You can use several different lists separated by a double hyphen e.g. like this: +You can use several different lists separated by a double hyphen as follows but note that this mixes the matches under and single heading and is not intended to be used with different types of completion candidates: #+BEGIN_SRC sh -local -a options arguments -options=('-c:description for -c opt' '-d:description for -d opt') -arguments=('e:description for e arg' 'f:description for f arg') -_describe 'values' options -- arguments +local -a subcmds topics +subcmds=('c:description for c command' 'd:description for d command') +topics=('e:description for e help topic' 'f:description for f help topic') +_describe 'command' subcmds -- topics #+END_SRC +If two candidates have the same description, _describe collects them together on the same rowand ensures that descriptions are aligned in neatedly in columns. The _describe function can be used in an ACTION as part of a specification for _alternative, _arguments or _regex_arguments. In this case you will have to put it in braces with its arguments, e.g. 'TAG:DESCRIPTION:{_describe 'values' options}' ** Writing completion functions using _alternative Like _describe, this function performs simple completions where the order and position of options/arguments is not important. -However, unlike _describe, you can call execute shell code or call functions to obtain the completion candidates. +However, unlike _describe, instead of fixed matches further functions may be called to generate the completion candidates. Furthermore, _alternative allows a mix of different types of completion candidates to be mixed. -As arguments it takes a list of specifications each in the form 'TAG:DESCRIPTION:ACTION' where TAG is a tag name, -DESCRIPTION is a description, and ACTION is one of the action types listed previously (apart from the ->STRING and =ACTION forms). +As arguments it takes a list of specifications each in the form 'TAG:DESCRIPTION:ACTION' where TAG is a special tag that identifies the type of completion matches, +DESCRIPTION is used as a heading to describe the group of completion candidates collectively, and ACTION is one of the action types listed previously (apart from the ->STRING and =ACTION forms). For example: #+BEGIN_SRC sh -_alternative 'args:custom args:(a b c)' 'files:filenames:_files' +_alternative 'arguments:custom arg:(a b c)' 'files:filename:_files' #+END_SRC -The first specification adds completion candidates a, b & c, and the second specification calls the _files function -for completing filepaths. +The first specification adds completion candidates a, b & c, and the second specification calls the _files function for completing filepaths. We could split the specifications over several lines with \ and add descriptions to each of the custom args like this: #+BEGIN_SRC sh -_alternative 'args:custom args:((a\:"description a" b\:"description b" c\:"description c"))'\ - 'files:filenames:_files' +_alternative \ + 'args:custom arg:((a\:"description a" b\:"description b" c\:"description c"))' \ + 'files:filename:_files' #+END_SRC -If we want to call _files with arguments we can put it in braces, like this: +If we want to pass arguments to _files they can simply be included, like this: #+BEGIN_SRC sh -_alternative 'args:custom args:((a\:"description a" b\:"description b" c\:"description c"))'\ - 'files:filenames:{_files -/}' +_alternative \ + 'args:custom arg:((a\:"description a" b\:"description b" c\:"description c"))'\ + 'files:filename:_files -/' #+END_SRC To use parameter expansion to create our list of completions we must use double quotes to quote the specifications, e.g: #+BEGIN_SRC sh -_alternative "dirs:user directories:($userdirs)"\ - "pids:process IDs:($(ps -A o pid=))" +_alternative \ + "dirs:user directory:($userdirs)" \ + "pids:process ID:($(ps -A o pid=))" #+END_SRC In this case the first specification adds the words stored in the $userdirs variable, and the second specification -evaluates 'ps -A o pid=' to get a list of pids to use as completion candidates. +evaluates 'ps -A o pid=' to get a list of pids to use as completion candidates. In practice, we would make used of the existing _pids function for this. We can use other utility functions such as _values in the ACTION to perform more complex completions, e.g: #+BEGIN_SRC sh -_alternative "dirs:user directories:($userdirs)"\ - 'opts:comma separated opts:{_values -s , a b c}' +_alternative \ + "directories:user directory:($userdirs)" \ + 'options:comma-separated opt: _values -s , letter a b c' #+END_SRC -this will complete the items in $userdirs, aswell as a comma separated list containing a, b &/or c. +this will complete the items in $userdirs, as well as a comma separated list containing a, b &/or c. Note the use of the initial space before _values. This is needed because _values doesn't understand standard compadd options for descriptions. As with _describe, the _alternative function can itself be used in an ACTION as part of a specification for _arguments or _regex_arguments. ** Writing completion functions using _arguments -With the _arguments function you can create more sophisticated completion functions. +With a single call to the _arguments function you can create fairly sophisticated completion functions. It is intended to handle typical commands that take a variety of options along with some normal arguments. Like the _alternative function, _arguments takes a list of specification strings as arguments. -These specification strings can be for specifying options and any corresponding option arguments (e.g. -f filename), +These specification strings specify options and any corresponding option arguments (e.g. -f filename), or command arguments. Basic option specifications take the form '-OPT[DESCRIPTION]', e.g. like this: @@ -227,11 +232,11 @@ In this case paths to music files are completed stepwise descending down directo and the flags are completed as a comma separated list using the _values function. I have just given you the basics of _arguments specifications here, you can also specify mutually exclusive options, -repeated options & arguments, options beginning with + insead of -, etc. For more details see the [[http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][official documentation]]. +repeated options & arguments, options beginning with + instead of -, etc. For more details see the [[http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][official documentation]]. Also have a look at the tutorials mentioned at the end of this document, and the completion functions in the [[https://github.com/vapniks/zsh-completions/tree/master/src][src directory]]. ** Writing completion functions using _regex_arguments and _regex_words If you have a complex command line specification with several different possible argument sequences then -the _regex_arguments function may be what you need. +the _regex_arguments function may be what you need. It typically works well where you have a series of keywords followed by a variable number of arguments. _regex_arguments creates a completion function whose name is given by the first argument. Hence you need to first call _regex_arguments to create the completion function, and then call that function, @@ -251,7 +256,7 @@ For example: _regex_arguments _cmd SEQ1 '|' SEQ2 \( SEQ2a '|' SEQ2b \) _cmd "$@" #+END_SRC -this specifies a command line matching either SEQ1, or SEQ2 followed by SEQ2a or SEQ2b. +This specifies a command line matching either SEQ1, or SEQ2 followed by SEQ2a or SEQ2b. You are describing the form arguments to the command take in the form of a regular expression grammar. Each specification in a sequence must contain a / PATTERN/ part at the start followed by an optional ':TAG:DESCRIPTION:ACTION' part. @@ -266,7 +271,7 @@ except that it has an extra : at the start, and now all of the possible ACTION f Here is an example: #+BEGIN_SRC sh -_regex_arguments _hello /$'[^\0]##\0'/ \( /$'word1(a|b|c)\0'/ ':word:first word:(word1a word1b word1c)' '|'\ +_regex_arguments _cmd /$'[^\0]##\0'/ \( /$'word1(a|b|c)\0'/ ':word:first word:(word1a word1b word1c)' '|'\ /$'word11(a|b|c)\0'/ ':word:first word:(word11a word11b word11c)' \( /$'word2(a|b|c)\0'/ ':word:second word:(word2a word2b word2c)'\ '|' /$'word22(a|b|c)\0'/ ':word:second word:(word22a word22b word22c)' \) \) _cmd "$@" @@ -435,6 +440,6 @@ you can add another empty option (i.e. \:) to the ACTION like this ':TAG:DESCRIP Note this only applies to utility functions that use ACTIONs in their specification arguments (_arguments, _regex_arguments, etc.) * Other resources -[[http://wikimatze.de/writing-zsh-completion-for-padrino.html][Here]] is a nicely formatted short tutorial showing basic usage of the _arguments function, +[[https://wikimatze.de/writing-zsh-completion-for-padrino/][Here]] is a nicely formatted short tutorial showing basic usage of the _arguments function, and [[http://www.linux-mag.com/id/1106/][here]] is a slightly more advanced tutorial using the _arguments function. [[http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][Here]] is the zshcompsys man page. diff --git a/.zprezto/modules/completion/init.zsh b/.zprezto/modules/completion/init.zsh index 48202f3..07acf13 100644 --- a/.zprezto/modules/completion/init.zsh +++ b/.zprezto/modules/completion/init.zsh @@ -99,7 +99,7 @@ zstyle ':completion:*:history-words' remove-all-dups yes zstyle ':completion:*:history-words' list false zstyle ':completion:*:history-words' menu yes -# Environmental Variables +# Environment Variables zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-} # Populate hostname completion. But allow ignoring custom entries from static diff --git a/.zprezto/modules/editor/README.md b/.zprezto/modules/editor/README.md index c27e864..d5280c4 100644 --- a/.zprezto/modules/editor/README.md +++ b/.zprezto/modules/editor/README.md @@ -1,7 +1,17 @@ Editor ====== -Sets key bindings. +Sets editor specific key bindings options and variables. + +Options +------- + + - `BEEP` beep on error in line editor. + +Variables +--------- + + - `WORDCHARS` treat a given set of characters as part of a word. Settings -------- diff --git a/.zprezto/modules/environment/README.md b/.zprezto/modules/environment/README.md index b0d579b..15ee959 100644 --- a/.zprezto/modules/environment/README.md +++ b/.zprezto/modules/environment/README.md @@ -5,9 +5,6 @@ Sets general shell options and defines environment variables. This module must be loaded first. -Environment Variables ---------------------- - Contributors ------------ @@ -15,6 +12,39 @@ This module **MUST NOT** rely on any command not built in Zsh. Non-interactive environment variables should be defined in [`zshenv`][1]. +Options +------- + +### General + + - `COMBINING_CHARS` combine zero-length punctuation characters (accents) with + the base character. + - `INTERACTIVE_COMMENTS` enable comments in interactive shell. + - `RC_QUOTES` allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. + - `MAIL_WARNING` don't print a warning message if a mail file has been accessed. + +### Jobs + + - `LONG_LIST_JOBS` list jobs in the long format by default. + - `AUTO_RESUME` attempt to resume existing job before creating a new process. + - `NOTIFY` report status of background jobs immediately. + - `BG_NICE` don't run all background jobs at a lower priority. + - `HUP` don't kill jobs on shell exit. + - `CHECK_JOBS` don't report on jobs when shell exit. + +Variables +--------- + +### Termcap + + - `LESS_TERMCAP_mb` begins blinking. + - `LESS_TERMCAP_md` begins bold. + - `LESS_TERMCAP_me` ends mode. + - `LESS_TERMCAP_se` ends standout-mode. + - `LESS_TERMCAP_so` begins standout-mode. + - `LESS_TERMCAP_ue` ends underline. + - `LESS_TERMCAP_us` begins underline. + Authors ------- diff --git a/.zprezto/modules/environment/init.zsh b/.zprezto/modules/environment/init.zsh index 4f3bbfe..7ae8c4f 100644 --- a/.zprezto/modules/environment/init.zsh +++ b/.zprezto/modules/environment/init.zsh @@ -14,7 +14,7 @@ # paste had a regression. Additionally, 5.2 added bracketed-paste-url-magic # which is generally better than url-quote-magic so we load that when possible. autoload -Uz is-at-least -if [[ ${ZSH_VERSION} != 5.1.1 ]]; then +if [[ ${ZSH_VERSION} != 5.1.1 && ${TERM} != "dumb" ]]; then if is-at-least 5.2; then autoload -Uz bracketed-paste-url-magic zle -N bracketed-paste bracketed-paste-url-magic diff --git a/.zprezto/modules/git/functions/git-info b/.zprezto/modules/git/functions/git-info index a173c20..fe8ca2a 100644 --- a/.zprezto/modules/git/functions/git-info +++ b/.zprezto/modules/git/functions/git-info @@ -212,10 +212,17 @@ function git-info { # Format stashed. zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format' - if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then - stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')" - if [[ -n "$stashed" ]]; then - zformat -f stashed_formatted "$stashed_format" "S:$stashed" + if [[ -n "$stashed_format" ]]; then + commondir="" + if [[ -f "$(git-dir)/commondir" ]]; then + commondir="$(<$(git-dir)/commondir)" + [[ "$commondir" =~ ^/ ]] || commondir="$(git-dir)/$commondir" + fi + if [[ -f "$(git-dir)/refs/stash" || ( -n "$commondir" && -f "$commondir/refs/stash" ) ]]; then + stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')" + if [[ -n "$stashed" ]]; then + zformat -f stashed_formatted "$stashed_format" "S:$stashed" + fi fi fi diff --git a/.zprezto/modules/history-substring-search/external/README.md b/.zprezto/modules/history-substring-search/external/README.md index e9642ba..c9dbad6 100644 --- a/.zprezto/modules/history-substring-search/external/README.md +++ b/.zprezto/modules/history-substring-search/external/README.md @@ -17,6 +17,27 @@ Requirements * [ZSH](http://zsh.sourceforge.net) 4.3 or newer +Install +------------------------------------------------------------------------------ + +Using the [Homebrew]( https://brew.sh ) package manager: + + brew install zsh-history-substring-search + echo 'source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc + +Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh): + +1. Clone this repository in oh-my-zsh's plugins directory: + + git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search + +2. Activate the plugin in `~/.zshrc`: + + plugins=( [plugins...] history-substring-search) + +3. Source `~/.zshrc` to take changes into account: + + source ~/.zshrc Usage ------------------------------------------------------------------------------ @@ -35,24 +56,27 @@ Usage Users typically bind their UP and DOWN arrow keys to this script, thus: * Run `cat -v` in your favorite terminal emulator to observe key codes. +      (**NOTE:** In some cases, `cat -v` shows the wrong key codes. If the + key codes shown by `cat -v` don't work for you, press `` and + `` at your ZSH command line prompt for correct key codes.) * Press the UP arrow key and observe what is printed in your terminal. * Press the DOWN arrow key and observe what is printed in your terminal. * Press the Control and C keys simultaneously to terminate the `cat -v`. * Use your observations from the previous steps to create key bindings. For example, if you observed `^[[A` for UP and `^[[B` for DOWN, then: - bindkey '^[[A' history-substring-search-up - bindkey '^[[B' history-substring-search-down + bindkey '^[[A' history-substring-search-up + bindkey '^[[B' history-substring-search-down - You might also want to bind the Control-P/N keys for use in EMACS mode: + You might also want to bind the Control-P/N keys for use in EMACS mode: - bindkey -M emacs '^P' history-substring-search-up - bindkey -M emacs '^N' history-substring-search-down + bindkey -M emacs '^P' history-substring-search-up + bindkey -M emacs '^N' history-substring-search-down - You might also want to bind the `k` and `j` keys for use in VI mode: + You might also want to bind the `k` and `j` keys for use in VI mode: - bindkey -M vicmd 'k' history-substring-search-up - bindkey -M vicmd 'j' history-substring-search-down + bindkey -M vicmd 'k' history-substring-search-up + bindkey -M vicmd 'j' history-substring-search-down 3. Type any part of any previous command and then: @@ -107,6 +131,11 @@ default values only after having loaded this script into your ZSH session. Flags" section in the zshexpn(1) man page to learn about the kinds of values you may assign to this variable. +* `HISTORY_SUBSTRING_SEARCH_FUZZY` is a global variable that defines + how the command history will be searched for your query. If set to a non-empty + value, causes this script to perform a fuzzy search by words, matching in + given order e.g. `ab c` will match `*ab*c*` + * `HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE` is a global variable that defines whether all search results returned are _unique_. If set to a non-empty value, then only unique search results are presented. This behaviour is off diff --git a/.zprezto/modules/history-substring-search/external/zsh-history-substring-search.plugin.zsh b/.zprezto/modules/history-substring-search/external/zsh-history-substring-search.plugin.zsh new file mode 100644 index 0000000..93f894d --- /dev/null +++ b/.zprezto/modules/history-substring-search/external/zsh-history-substring-search.plugin.zsh @@ -0,0 +1,2 @@ +0=${(%):-%N} +source ${0:A:h}/zsh-history-substring-search.zsh diff --git a/.zprezto/modules/history-substring-search/external/zsh-history-substring-search.zsh b/.zprezto/modules/history-substring-search/external/zsh-history-substring-search.zsh index 34c3df5..0edf85e 100644 --- a/.zprezto/modules/history-substring-search/external/zsh-history-substring-search.zsh +++ b/.zprezto/modules/history-substring-search/external/zsh-history-substring-search.zsh @@ -7,6 +7,7 @@ # Copyright (c) 2011 Sorin Ionescu # Copyright (c) 2011 Vincent Guerci # Copyright (c) 2016 Geza Lore +# Copyright (c) 2017 Bengt Brodersen # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -39,34 +40,30 @@ ############################################################################## #----------------------------------------------------------------------------- -# declare global variables -#----------------------------------------------------------------------------- - -typeset -g BUFFER MATCH MBEGIN MEND CURSOR -typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND -typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND -typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS -typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE -typeset -g _history_substring_search_refresh_display -typeset -g _history_substring_search_query_highlight -typeset -g _history_substring_search_result -typeset -g _history_substring_search_query -typeset -g -A _history_substring_search_raw_matches -typeset -g _history_substring_search_raw_match_index -typeset -g -A _history_substring_search_matches -typeset -g -A _history_substring_search_unique_filter -typeset -g _history_substring_search_match_index - -#----------------------------------------------------------------------------- -# configuration variables +# declare global configuration variables #----------------------------------------------------------------------------- typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold' typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold' typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE='' -typeset -g _history_substring_search_{refresh_display,query_highlight,result,query,match_index,raw_match_index} -typeset -ga _history_substring_search{,_raw}_matches +typeset -g HISTORY_SUBSTRING_SEARCH_FUZZY='' + +#----------------------------------------------------------------------------- +# declare internal global variables +#----------------------------------------------------------------------------- + +typeset -g BUFFER MATCH MBEGIN MEND CURSOR +typeset -g _history_substring_search_refresh_display +typeset -g _history_substring_search_query_highlight +typeset -g _history_substring_search_result +typeset -g _history_substring_search_query +typeset -g -a _history_substring_search_query_parts +typeset -g -a _history_substring_search_raw_matches +typeset -g -i _history_substring_search_raw_match_index +typeset -g -a _history_substring_search_matches +typeset -g -i _history_substring_search_match_index +typeset -g -A _history_substring_search_unique_filter #----------------------------------------------------------------------------- # the main ZLE widgets @@ -223,6 +220,7 @@ _history-substring-search-begin() { # speed things up a little. # _history_substring_search_query= + _history_substring_search_query_parts=() _history_substring_search_raw_matches=() else @@ -233,20 +231,31 @@ _history-substring-search-begin() { _history_substring_search_query=$BUFFER # - # $BUFFER contains the text that is in the command-line currently. - # we put an extra "\\" before meta characters such as "\(" and "\)", - # so that they become "\\\(" and "\\\)". + # compose search pattern # - local escaped_query=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH} + if [[ -n $HISTORY_SUBSTRING_SEARCH_FUZZY ]]; then + # + # `=` split string in arguments + # + _history_substring_search_query_parts=(${=_history_substring_search_query}) + else + _history_substring_search_query_parts=(${_history_substring_search_query}) + fi # - # Find all occurrences of the search query in the history file. + # Escape and join query parts with wildcard character '*' as seperator + # `(j:CHAR:)` join array to string with CHAR as seperator + # + local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" + + # + # Find all occurrences of the search pattern in the history file. # # (k) returns the "keys" (history index numbers) instead of the values # (R) returns values in reverse older, so the index of the youngest # matching history entry is at the head of the list. # - _history_substring_search_raw_matches=(${(k)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${escaped_query}*]}) + _history_substring_search_raw_matches=(${(k)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${search_pattern}]}) fi # @@ -265,8 +274,7 @@ _history-substring-search-begin() { # _history_substring_search_raw_match_index=0 _history_substring_search_matches=() - unset _history_substring_search_unique_filter - typeset -A -g _history_substring_search_unique_filter + _history_substring_search_unique_filter=() # # If $_history_substring_search_match_index is equal to @@ -309,16 +317,20 @@ _history-substring-search-end() { _zsh_highlight # highlight the search query inside the command line - if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then - # - # The following expression yields a variable $MBEGIN, which - # indicates the begin position + 1 of the first occurrence - # of _history_substring_search_query in $BUFFER. - # - : ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)} - local begin=$(( MBEGIN - 1 )) - local end=$(( begin + $#_history_substring_search_query )) - region_highlight+=("$begin $end $_history_substring_search_query_highlight") + if [[ -n $_history_substring_search_query_highlight ]]; then + # highlight first matching query parts + local highlight_start_index=0 + local highlight_end_index=0 + for query_part in $_history_substring_search_query_parts; do + local escaped_query_part=${query_part//(#m)[\][()|\\*?#<>~^]/\\$MATCH} + # (i) get index of pattern + local query_part_match_index=${${BUFFER:$highlight_start_index}[(i)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${escaped_query_part}]} + if [[ $query_part_match_index -le ${#BUFFER:$highlight_start_index} ]]; then + highlight_start_index=$(( $highlight_start_index + $query_part_match_index )) + highlight_end_index=$(( $highlight_start_index + ${#query_part} )) + region_highlight+=("$(($highlight_start_index - 1)) $(($highlight_end_index - 1)) $_history_substring_search_query_highlight") + fi + done fi # For debugging purposes: @@ -447,7 +459,7 @@ _history_substring_search_process_raw_matches() { # # Move on to the next raw entry and get its history index. # - (( _history_substring_search_raw_match_index++ )) + _history_substring_search_raw_match_index+=1 local index=${_history_substring_search_raw_matches[$_history_substring_search_raw_match_index]} # @@ -627,7 +639,7 @@ _history-substring-search-up-search() { # 1. Move index to point to the next match. # 2. Update display to indicate search found. # - (( _history_substring_search_match_index++ )) + _history_substring_search_match_index+=1 _history-substring-search-found else @@ -638,7 +650,7 @@ _history-substring-search-up-search() { # _history_substring_search_matches. # 2. Update display to indicate search not found. # - (( _history_substring_search_match_index++ )) + _history_substring_search_match_index+=1 _history-substring-search-not-found fi @@ -707,7 +719,7 @@ _history-substring-search-down-search() { # 1. Move index to point to the previous match. # 2. Update display to indicate search found. # - (( _history_substring_search_match_index-- )) + _history_substring_search_match_index+=-1 _history-substring-search-found else @@ -718,7 +730,7 @@ _history-substring-search-down-search() { # _history_substring_search_matches. # 2. Update display to indicate search not found. # - (( _history_substring_search_match_index-- )) + _history_substring_search_match_index+=-1 _history-substring-search-not-found fi diff --git a/.zprezto/modules/history/README.md b/.zprezto/modules/history/README.md index 3dc9a26..d020688 100644 --- a/.zprezto/modules/history/README.md +++ b/.zprezto/modules/history/README.md @@ -3,13 +3,6 @@ History Sets [history][1] options and defines history aliases. -Variables ---------- - - - `HISTFILE` stores the path to the history file. - - `HISTSIZE` stores the maximum number of events to save in the internal history. - - `SAVEHIST` stores the maximum number of events to save in the history file. - Options ------- @@ -26,6 +19,13 @@ Options - `HIST_VERIFY` does not execute immediately upon history expansion. - `HIST_BEEP` beeps when accessing non-existent history. +Variables +--------- + + - `HISTFILE` stores the path to the history file. + - `HISTSIZE` stores the maximum number of events to save in the internal history. + - `SAVEHIST` stores the maximum number of events to save in the history file. + Aliases ------- diff --git a/.zprezto/modules/history/init.zsh b/.zprezto/modules/history/init.zsh index 31db4c5..db357b0 100644 --- a/.zprezto/modules/history/init.zsh +++ b/.zprezto/modules/history/init.zsh @@ -6,14 +6,6 @@ # Sorin Ionescu # -# -# Variables -# - -HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file. -HISTSIZE=10000 # The maximum number of events to save in the internal history. -SAVEHIST=10000 # The maximum number of events to save in the history file. - # # Options # @@ -31,6 +23,14 @@ setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history setopt HIST_VERIFY # Do not execute immediately upon history expansion. setopt HIST_BEEP # Beep when accessing non-existent history. +# +# Variables +# + +HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file. +HISTSIZE=10000 # The maximum number of events to save in the internal history. +SAVEHIST=10000 # The maximum number of events to save in the history file. + # # Aliases # diff --git a/.zprezto/modules/homebrew/README.md b/.zprezto/modules/homebrew/README.md index 98a3444..2a37553 100644 --- a/.zprezto/modules/homebrew/README.md +++ b/.zprezto/modules/homebrew/README.md @@ -1,7 +1,16 @@ Homebrew ======== -Defines Homebrew aliases. +Defines Homebrew specific environment variables and aliases. + +Variables +--------- + +Execute the following to list the environment variables loaded in the shell: + +```sh +brew shellenv +``` Aliases ------- @@ -20,12 +29,9 @@ Aliases ### Homebrew Cask - `cask` is aliased to `brew cask`. - - `caskc` cleans up old cached downloads. - - `caskC` cleans up all cached downloads. - `caski` installs a cask. - `caskl` lists installed casks. - `casko` lists casks which have an update available. - - `casks` searches for a cask. - `caskx` uninstalls a cask. Authors diff --git a/.zprezto/modules/homebrew/init.zsh b/.zprezto/modules/homebrew/init.zsh index e517c0a..d078b7a 100644 --- a/.zprezto/modules/homebrew/init.zsh +++ b/.zprezto/modules/homebrew/init.zsh @@ -10,6 +10,16 @@ if [[ "$OSTYPE" != (darwin|linux)* ]]; then return 1 fi +# +# Variables +# + +# Load standard Homebrew shellenv into the shell session. +# `brew shellenv` is relatively new, guard for legacy Homebrew. +if (( $+commands[brew] )); then + eval "$(brew shellenv 2> /dev/null)" +fi + # # Aliases # @@ -21,15 +31,26 @@ alias brewi='brew install' alias brewl='brew list' alias brewo='brew outdated' alias brews='brew search' -alias brewu='brew update && brew upgrade' -alias brewx='brew remove' +alias brewu='brew upgrade' +alias brewx='brew uninstall' # Homebrew Cask alias cask='brew cask' -alias caskc='brew cask cleanup --outdated' -alias caskC='brew cask cleanup' +alias caskc='hb_deprecated brew cask cleanup' +alias caskC='hb_deprecated brew cask cleanup' alias caski='brew cask install' alias caskl='brew cask list' alias casko='brew cask outdated' -alias casks='brew cask search' +alias casks='hb_deprecated brew cask search' alias caskx='brew cask uninstall' + +function hb_deprecated { + local cmd="${argv[3]}" + local cmd_args=( ${(@)argv:4} ) + + printf "'brew cask %s' has been deprecated, " "${cmd}" + printf "using 'brew %s' instead\n" "${cmd}" + + cmd_args=( ${(@)argv:4} ) + command brew "${cmd}" ${(@)cmd_args} +} diff --git a/.zprezto/modules/prompt/external/agnoster/README.md b/.zprezto/modules/prompt/external/agnoster/README.md index a45667e..dd3cbb5 100644 --- a/.zprezto/modules/prompt/external/agnoster/README.md +++ b/.zprezto/modules/prompt/external/agnoster/README.md @@ -29,6 +29,53 @@ To test if your terminal and font support it, check that all the necessary chara ![Screenshot](https://gist.githubusercontent.com/agnoster/3712874/raw/screenshot.png) +## Customize your prompt view + +By default prompt has these segments: `prompt_status`, `prompt_context`, `prompt_virtualenv`, `prompt_dir`, `prompt_git`, `prompt_end` in that particular order. + +If you want to add, change the order or remove some segments of the prompt, you can use array environment variable named `AGNOSTER_PROMPT_SEGMENTS`. + +Examples: +- Show all segments of the prompt with indices: +``` +echo "${(F)AGNOSTER_PROMPT_SEGMENTS[@]}" | cat -n +``` +- Add the new segment of the prompt to the beginning: +``` +AGNOSTER_PROMPT_SEGMENTS=("prompt_git" "${AGNOSTER_PROMPT_SEGMENTS[@]}") +``` +- Add the new segment of the prompt to the end: +``` +AGNOSTER_PROMPT_SEGMENTS+="prompt_end" +``` +- Insert the new segment of the prompt = `PROMPT_SEGMENT_NAME` on the particular position = `PROMPT_SEGMENT_POSITION`: +``` +PROMPT_SEGMENT_POSITION=5 PROMPT_SEGMENT_NAME="prompt_end";\ +AGNOSTER_PROMPT_SEGMENTS=("${AGNOSTER_PROMPT_SEGMENTS[@]:0:$PROMPT_SEGMENT_POSITION-1}" "$PROMPT_SEGMENT_NAME" "${AGNOSTER_PROMPT_SEGMENTS[@]:$PROMPT_SEGMENT_POSITION-1}");\ +unset PROMPT_SEGMENT_POSITION PROMPT_SEGMENT_NAME +``` +- Swap segments 4th and 5th: +``` +SWAP_SEGMENTS=(4 5);\ +TMP_VAR="$AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[1]]"; AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[1]]="$AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[2]]"; AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[2]]="$TMP_VAR" +unset SWAP_SEGMENTS TMP_VAR +``` +- Remove the 5th segment: +``` +AGNOSTER_PROMPT_SEGMENTS[5]= +``` + +A small demo of the dummy custom prompt segment, which has been created with help of the built-in `prompt_segment()` function from Agnoster theme: +``` +# prompt_segment() - Takes two arguments, background and foreground. +# Both can be omitted, rendering default background/foreground. + +customize_agnoster() { + prompt_segment 'red' '' ' ⚙ ⚡⚡⚡ ⚙ ' +} +``` +![Customization demo](https://github.com/apodkutin/agnoster-zsh-theme/raw/customize-prompt/agnoster_customization.gif) + ## Future Work I don't want to clutter it up too much, but I am toying with the idea of adding RVM (ruby version) and n (node.js version) display. diff --git a/.zprezto/modules/prompt/external/agnoster/agnoster.zsh-theme b/.zprezto/modules/prompt/external/agnoster/agnoster.zsh-theme index 4eceafd..d156340 100644 --- a/.zprezto/modules/prompt/external/agnoster/agnoster.zsh-theme +++ b/.zprezto/modules/prompt/external/agnoster/agnoster.zsh-theme @@ -22,6 +22,17 @@ # jobs are running in this shell will all be displayed automatically when # appropriate. +### Segments of the prompt, default order declaration + +typeset -aHg AGNOSTER_PROMPT_SEGMENTS=( + prompt_status + prompt_context + prompt_virtualenv + prompt_dir + prompt_git + prompt_end +) + ### Segment drawing # A few utility functions to make it easy and re-usable to draw segmented prompts @@ -135,12 +146,9 @@ prompt_virtualenv() { prompt_agnoster_main() { RETVAL=$? CURRENT_BG='NONE' - prompt_status - prompt_context - prompt_virtualenv - prompt_dir - prompt_git - prompt_end + for prompt_segment in "${AGNOSTER_PROMPT_SEGMENTS[@]}"; do + [[ -n $prompt_segment ]] && $prompt_segment + done } prompt_agnoster_precmd() { diff --git a/.zprezto/modules/prompt/external/agnoster/agnoster_customization.gif b/.zprezto/modules/prompt/external/agnoster/agnoster_customization.gif new file mode 100644 index 0000000..2e472d3 Binary files /dev/null and b/.zprezto/modules/prompt/external/agnoster/agnoster_customization.gif differ diff --git a/.zprezto/modules/prompt/external/async/README.md b/.zprezto/modules/prompt/external/async/README.md index 3f2b060..1541368 100644 --- a/.zprezto/modules/prompt/external/async/README.md +++ b/.zprezto/modules/prompt/external/async/README.md @@ -60,10 +60,18 @@ Simply stops a worker and all active jobs will be terminated immediately. Start a new asynchronous job on specified worker, assumes the worker is running. +#### `async_worker_eval []` + +Evaluate a command (like async_job) inside the async worker, then worker environment can be manipulated. For example, issuing a cd command will change the PWD of the worker which will then be inherited by all future async jobs. + +Output will be returned via callback, job name will be [async/eval]. + #### `async_process_results ` 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. +If the async process buffer becomes corrupt, the callback will be invoked with the first argument being `[async]` (job name), non-zero return code and fifth argument describing the error (stderr). + The `callback_function` is called with the following parameters: * `$1` job name, e.g. the function passed to async_job diff --git a/.zprezto/modules/prompt/external/async/async.zsh b/.zprezto/modules/prompt/external/async/async.zsh index 1257029..415da26 100644 --- a/.zprezto/modules/prompt/external/async/async.zsh +++ b/.zprezto/modules/prompt/external/async/async.zsh @@ -3,15 +3,26 @@ # # zsh-async # -# version: 1.6.2 +# version: 1.7.1 # author: Mathias Fredriksson # url: https://github.com/mafredri/zsh-async # -typeset -g ASYNC_VERSION=1.6.2 +typeset -g ASYNC_VERSION=1.7.1 # Produce debug output from zsh-async when set to 1. typeset -g ASYNC_DEBUG=${ASYNC_DEBUG:-0} +# Execute commands that can manipulate the environment inside the async worker. Return output via callback. +_async_eval() { + local ASYNC_JOB_NAME + # Rename job to _async_eval and redirect all eval output to cat running + # in _async_job. Here, stdout and stderr are not separated for + # simplicity, this could be improved in the future. + { + eval "$@" + } &> >(ASYNC_JOB_NAME=[async/eval] _async_job 'cat') +} + # 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. @@ -26,6 +37,7 @@ _async_job() { # 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 jobname=${ASYNC_JOB_NAME:-$1} local stdout stderr ret tok { stdout=$(eval "$@") @@ -36,7 +48,7 @@ _async_job() { read -r -k 1 -p tok || exit 1 # Return output ( ). - print -r -n - ${(q)1} $ret ${(q)stdout} $duration + print -r -n - $'\0'${(q)jobname} $ret ${(q)stdout} $duration } 2> >(stderr=$(cat) && print -r -n - " "${(q)stderr}$'\0') # Unlock mutex by inserting a token. @@ -80,7 +92,7 @@ _async_worker() { unset $zsh_hook_functions # And hooks with registered functions. unset zsh_hooks zsh_hook_functions # Cleanup. - child_exit() { + close_idle_coproc() { local -a pids pids=(${${(v)jobstates##*:*:}%\=*}) @@ -90,6 +102,10 @@ _async_worker() { coproc : coproc_pid=0 fi + } + + child_exit() { + close_idle_coproc # 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) @@ -132,7 +148,7 @@ _async_worker() { coproc_pid=0 # Reset pid. } - local request + local request do_eval=0 local -a cmd while :; do # Wait for jobs sent by async_job. @@ -147,8 +163,9 @@ _async_worker() { # Check for non-job commands sent to worker case $request in - _unset_trap) notify_parent=0; continue;; - _killjobs) killjobs; continue;; + _unset_trap) notify_parent=0; continue;; + _killjobs) killjobs; continue;; + _async_eval*) do_eval=1;; esac # Parse the request using shell parsing (z) to allow commands @@ -181,18 +198,34 @@ _async_worker() { 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]="$!" + if (( do_eval )); then + shift cmd # Strip _async_eval from cmd. + _async_eval $cmd + else + # 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]="$!" + fi processing=0 # Disable guard. + + if (( do_eval )); then + do_eval=0 + + # When there are no active jobs we can't rely on the CHLD trap to + # manage the coproc lifetime. + close_idle_coproc + fi 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. +# 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. +# +# If the async process buffer becomes corrupt, the callback will be invoked with the first argument being `[async]` (job +# name), non-zero return code and fifth argument describing the error (stderr). # # usage: # async_process_results @@ -245,13 +278,15 @@ async_process_results() { if (( $#items == 5 )); then items+=($has_next) $callback "${(@)items}" # Send all parsed items to the callback. + (( num_processed++ )) + elif [[ -z $items ]]; then + # Empty items occur between results due to double-null ($'\0\0') + # caused by commands being both pre and suffixed with null. 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 + $callback "[async]" 1 "" 0 "$0:$LINENO: error: bad format, got ${#items} items (${(q)items})" $has_next fi - - (( num_processed++ )) done done @@ -297,6 +332,30 @@ async_job() { zpty -w $worker "$cmd"$'\0' } +# +# Evaluate a command (like async_job) inside the async worker, then worker environment can be manipulated. For example, +# issuing a cd command will change the PWD of the worker which will then be inherited by all future async jobs. +# +# Output will be returned via callback, job name will be [async/eval]. +# +# usage: +# async_worker_eval [] +# +async_worker_eval() { + 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 "_async_eval $cmd"$'\0' +} + # This function traps notification signals and calls all registered callbacks _async_notify_trap() { setopt localoptions noshwordsplit diff --git a/.zprezto/modules/prompt/external/async/async_test.zsh b/.zprezto/modules/prompt/external/async/async_test.zsh index 0791fc7..17376b5 100644 --- a/.zprezto/modules/prompt/external/async/async_test.zsh +++ b/.zprezto/modules/prompt/external/async/async_test.zsh @@ -7,8 +7,8 @@ test__async_job_print_hi() { local line local -a out line=$(_async_job print hi) - # Remove trailing null, parse, unquote and interpret as array. - line=$line[1,$#line-1] + # Remove leading/trailing null, parse, unquote and interpret as array. + line=$line[2,$#line-1] out=("${(@Q)${(z)line}}") coproc exit @@ -396,8 +396,10 @@ test_async_flush_jobs() { # 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}" + # NOTE(mafredri): First 'p' in print_four is lost when null-prefixing + # _async_job output. + [[ $output = *'rint_four 0 4'* ]] || { + t_error "want discarded output 'rint_four 0 4' when ASYNC_DEBUG=1, got ${(Vq-)output}" } # Check that the killed job did not produce output. @@ -430,6 +432,35 @@ test_async_worker_survives_termination_of_other_worker() { (( $#result == 6 )) || t_error "wanted a result, got (${(@Vq)result})" } +test_async_worker_update_pwd() { + local -a result + local eval_out + cb() { + if [[ $1 == '[async/eval]' ]]; then + eval_out="$3" + else + result+=("$3") + fi + } + + async_start_worker test1 + t_defer async_stop_worker test1 + + async_job test1 'print $PWD' + async_worker_eval test1 'print -n foo; cd ..; print -n bar; print -n -u2 baz' + async_job test1 'print $PWD' + + start=$EPOCHREALTIME + while (( EPOCHREALTIME - start < 2.0 && $#result < 3 )); do + async_process_results test1 cb + done + + (( $#result == 2 )) || t_error "wanted 2 results, got ${#result}" + [[ $eval_out = foobarbaz ]] || t_error "wanted async_worker_eval to output foobarbaz, got ${(q)eval_out}" + [[ -n $result[2] ]] || t_error "wanted second pwd to be non-empty" + [[ $result[1] != $result[2] ]] || t_error "wanted worker to change pwd, was ${(q)result[1]}, got ${(q)result[2]}" +} + setopt_helper() { setopt localoptions $1 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/CHANGELOG.md b/.zprezto/modules/prompt/external/powerlevel9k/CHANGELOG.md index 02341f4..b40ce50 100644 --- a/.zprezto/modules/prompt/external/powerlevel9k/CHANGELOG.md +++ b/.zprezto/modules/prompt/external/powerlevel9k/CHANGELOG.md @@ -1,3 +1,21 @@ +## v0.6.6 + +- The `rbenv` segment is no longer a default segment in the LPROMPT. +- PR #959 - Fixing issue in v0.6.5 where we changed some color codes. +- PR #934 - Add Tests +- PR #884 - test-in-docker: fix with newer ZSH versions +- PR #928 - [Docs] Add etc state description in dir docs +- PR #937 - Use SUDO_COMMAND to check for sudo +- PR #925 - [Bugfix] Resolve #918 Transparent background +- PR #923 - Fix font issue debugging script +- PR #921 - Add missing colors to fix color comparison +- PR #951 - Add fallback icon for missing linux distro icons +- PR #956 - Fix broken link in readme +- Fixed #936 - fallback icons for Linux distros +- Fixed #926 - `etc` state for `dir` segment in docs +- Fixed #852 - `sudo` detection got crazy, there. sorry, everyone. +- Fixed #927 - more default color issues. + ## v0.6.5 - Multiple PRs: General fixes to README, improved documentation. diff --git a/.zprezto/modules/prompt/external/powerlevel9k/README.md b/.zprezto/modules/prompt/external/powerlevel9k/README.md index 90680ac..2b037bd 100644 --- a/.zprezto/modules/prompt/external/powerlevel9k/README.md +++ b/.zprezto/modules/prompt/external/powerlevel9k/README.md @@ -70,7 +70,7 @@ variables to your `~/.zshrc`. | Variable | Default Value | Description | |----------|---------------|-------------| -|`POWERLEVEL9K_LEFT_PROMPT_ELEMENTS`|`(context dir rbenv vcs)`|Segment list for left prompt| +|`POWERLEVEL9K_LEFT_PROMPT_ELEMENTS`|`(context dir vcs)`|Segment list for left prompt| |`POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS`|`(status root_indicator background_jobs history time)`|Segment list for right prompt| @@ -78,7 +78,7 @@ 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_LEFT_PROMPT_ELEMENTS=(context dir vcs) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time) ``` #### Available Prompt Segments @@ -357,13 +357,24 @@ end of the 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.| +This segment can have different states. They might help you to visualize your +different privileges. Read more about styling with states [here](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#special-segment-colors). + +| State | Meaning | +|---------------|----------------------------------------------------------| +| `DEFAULT` | You are a normal user | +| `ROOT` | You are the root user | +| `SUDO` | You are using elevated rights | +| `REMOTE_SUDO` | You are SSH'ed into the machine and have elevated rights | +| `REMOTE` | You are SSH'ed into the machine | + ##### 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.| +|`POWERLEVEL9K_DATE_FORMAT`|`%D{%d.%m.%y}`|[ZSH time format](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Date-and-time) to use in this segment.| ##### dir @@ -375,12 +386,14 @@ Powerline" fonts, there are additional glyphs, as well: | None | None | ![](https://cloud.githubusercontent.com/assets/1544760/12183451/40ec4016-b58f-11e5-9b9e-74e2b2f0b8b3.png) | At the root of your home folder | | None | None | ![](https://cloud.githubusercontent.com/assets/1544760/12369315/8a5d762c-bbf5-11e5-8a20-ca1179f48d6c.png) | Within a subfolder of your home directory | | None | None | ![](https://cloud.githubusercontent.com/assets/1544760/12183452/40f79286-b58f-11e5-9b8c-ed1343a07b08.png) | Outside of your home folder | +| None | None | ⚙ | Within the `/etc` directory | 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='' +POWERLEVEL9K_ETC_ICON='' ``` You can limit the output to a certain length by truncating long paths. Customizations available are: @@ -561,6 +574,19 @@ 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| +##### pyenv + +This segment shows the version of Python being used when using `pyenv` to change your current Python stack. + +The `PYENV_VERSION` environment variable will be used if specified. Otherwise it figures out the version being used by taking the output of the `pyenv version-name` command. + +* If `pyenv` is not in $PATH, nothing will be shown. +* If the current Python version is the same as the global Python version, nothing will be shown. + +| Variable | Default Value | Description | +|----------|---------------|-------------| +|`POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW`|`false`|Set to true if you wish to show the pyenv segment even if the current Python version is the same as the global Python version| + ##### rspec_stats See [Unit Test Ratios](#unit-test-ratios), below. diff --git a/.zprezto/modules/prompt/external/powerlevel9k/TESTS.md b/.zprezto/modules/prompt/external/powerlevel9k/TESTS.md index eb5db70..b57c4d6 100644 --- a/.zprezto/modules/prompt/external/powerlevel9k/TESTS.md +++ b/.zprezto/modules/prompt/external/powerlevel9k/TESTS.md @@ -1,25 +1,45 @@ -# Structure +# Tests -The Unit-Tests do not follow exactly the file structure of Powerlevel9k itself. +## Automated Tests -## Basic Tests +The Unit-Tests do not follow exactly the file structure of Powerlevel9k itself, +but we try to reflect the structure as much as possible. All tests are located +under `test/`. Segment specific tests under `test/segments/` (one file per +segment). -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`. +### Installation -## Segment Tests +In order to execute the tests you need to install `shunit2`, which is a +submodule. To install the submodule, you can execute +`git submodule init && git submodule update`. -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`. +### Executing tests -# Manual Testing +The tests are shell scripts on their own. So you can execute them right away. +To execute all tests you could just execute `./test/suite.spec`. + +### General Test Structure + +The tests usually have a `setUp()` function which is executed before every +test function. Speaking of, test functions must be prefixed with `test`. In +the tests, you can do [different Assertions](https://github.com/kward/shunit2#-asserts). +It is always a good idea to mock the program you want to test (just have a +look at other tests), so that the testrunner does not have to have all +programs installed. + +### Travis + +We use [Travis](https://travis-ci.org/) for Continuous Integration. This +service executes our tests after every push. For now, we need to tell travis +where to find the tests, which is what happens in the `.travis.yml` file. + +## 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 +### Docker This is the easiest to use _if_ you have Docker already installed and running. @@ -42,7 +62,7 @@ You can get Docker at . **Note:** Not all frameworks work with all versions of ZSH (or the underlying OS). -## Vagrant +### 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! diff --git a/.zprezto/modules/prompt/external/powerlevel9k/debug/font-issues.zsh b/.zprezto/modules/prompt/external/powerlevel9k/debug/font-issues.zsh index 166a6ac..82f8e60 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/debug/font-issues.zsh +++ b/.zprezto/modules/prompt/external/powerlevel9k/debug/font-issues.zsh @@ -1,111 +1,236 @@ #!/usr/bin/env zsh #vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 +source functions/colors.zsh +source functions/icons.zsh +source functions/utilities.zsh +# Map our $OS to neofetch $os +os="$OS" + + +trim() { + set -f + # shellcheck disable=2048,2086 + set -- $* + printf '%s\n' "${*//[[:space:]]/}" + set +f +} + +get_ppid() { + # Get parent process ID of PID. + case "$os" in + "Windows") + ppid="$(ps -p "${1:-$PPID}" | awk '{printf $2}')" + ppid="${ppid/PPID}" + ;; + + "Linux") + ppid="$(grep -i -F "PPid:" "/proc/${1:-$PPID}/status")" + ppid="$(trim "${ppid/PPid:}")" + ;; + + *) + ppid="$(ps -p "${1:-$PPID}" -o ppid=)" + ;; + esac + + printf "%s" "$ppid" +} + +get_process_name() { + # Get PID name. + case "$os" in + "Windows") + name="$(ps -p "${1:-$PPID}" | awk '{printf $8}')" + name="${name/COMMAND}" + name="${name/*\/}" + ;; + + "Linux") + name="$(< "/proc/${1:-$PPID}/comm")" + ;; + + *) + name="$(ps -p "${1:-$PPID}" -o comm=)" + ;; + esac + + printf "%s" "$name" +} + # Taken from NeoFetch (slightly modified) get_term() { local term + # If function was run, stop here. - #((term_run == 1)) && return + # ((term_run == 1)) && return # Workaround for macOS systems that # don't support the block below. case "$TERM_PROGRAM" in - "iTerm.app") term="iTerm2" ;; + "iTerm.app") term="iTerm2" ;; "Terminal.app") term="Apple Terminal" ;; - "Hyper") term="HyperTerm" ;; - *) term="${TERM_PROGRAM/\.app}" ;; + "Hyper") term="HyperTerm" ;; + *) term="${TERM_PROGRAM/\.app}" ;; esac + # Most likely TosWin2 on FreeMiNT - quick check + [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && \ + term="TosWin2" + + [[ "$SSH_CONNECTION" ]] && \ + term="$SSH_TTY" + # Check $PPID for terminal emulator. while [[ -z "$term" ]]; do parent="$(get_ppid "$parent")" + [[ -z "$parent" ]] && break 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 ;; + "${SHELL/*\/}"|*"sh"|"screen"|"su"*) ;; + + "login"*|*"Login"*|"init"|"(init)") + term="$(tty)" + ;; + + "ruby"|"1"|"tmux"*|"systemd"|"sshd"*|"python"*|"USER"*"PID"*|"kdeinit"*|"launchd"*) + break + ;; + "gnome-terminal-") term="gnome-terminal" ;; - *) term="${name##*/}" ;; + "urxvtd") term="urxvt" ;; + *"nvim") term="Neovim Terminal" ;; + *"NeoVimServer"*) term="VimR Terminal" ;; + *) term="${name##*/}" ;; esac done # Log that the function was run. - #term_run=1 + # term_run=1 echo "${term}" } get_term_font() { local term="${1}" - #((term_run != 1)) && get_term + # ((term_run != 1)) && get_term case "$term" in "alacritty"*) - term_font="$(awk -F ':|#' '/normal:/ {getline; print}' "${XDG_CONFIG_HOME}/alacritty/alacritty.yml")" + shopt -s nullglob + confs=({$XDG_CONFIG_HOME,$HOME}/{alacritty,}/{.,}alacritty.ym?) + shopt -u nullglob + + [[ -f "${confs[0]}" ]] || return + + term_font="$(awk -F ':|#' '/normal:/ {getline; print}' "${confs[0]}")" 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')" + term_font="$(osascript </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 + profiles_count="$(/usr/libexec/PlistBuddy -c "Print ':New Bookmarks:'" "$font_file" | \ + grep -w -c "Guid")" + + for ((i=0; i /etc/locale.gen +RUN locale-gen "en_US.UTF-8" + +COPY docker/fred-sudoers /etc/sudoers.d/fred + +USER fred +WORKDIR /home/fred +ENV LANG=en_US.UTF-8 +ENV TERM=xterm-256color +ENV DEFAULT_USER=fred +ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true + +RUN touch .zshrc + +CMD ["/bin/zsh", "-l"] diff --git a/.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.4.2/Dockerfile b/.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.4.2/Dockerfile new file mode 100644 index 0000000..8984c10 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.4.2/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:18.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=5.4.2-3ubuntu3 \ + mercurial \ + subversion \ + golang \ + jq \ + nodejs \ + ruby \ + python \ + python-virtualenv \ + sudo \ + locales + +RUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred +RUN locale-gen "en_US.UTF-8" + +COPY docker/fred-sudoers /etc/sudoers.d/fred + +USER fred +WORKDIR /home/fred +ENV LANG=en_US.UTF-8 +ENV TERM=xterm-256color +ENV DEFAULT_USER=fred +ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true + +RUN touch .zshrc + +CMD ["/bin/zsh", "-l"] diff --git a/.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.5.1/Dockerfile b/.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.5.1/Dockerfile new file mode 100644 index 0000000..85fc570 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/docker/base-5.5.1/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:18.10 + +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=5.5.1-1ubuntu1 \ + mercurial \ + subversion \ + golang \ + jq \ + nodejs \ + ruby \ + python \ + python-virtualenv \ + sudo \ + locales + +RUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred +RUN locale-gen "en_US.UTF-8" + +COPY docker/fred-sudoers /etc/sudoers.d/fred + +USER fred +WORKDIR /home/fred +ENV LANG=en_US.UTF-8 +ENV TERM=xterm-256color +ENV DEFAULT_USER=fred +ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true + +RUN touch .zshrc + +CMD ["/bin/zsh", "-l"] diff --git a/.zprezto/modules/prompt/external/powerlevel9k/docker/prezto/install.zsh b/.zprezto/modules/prompt/external/powerlevel9k/docker/prezto/install.zsh index 9cca57e..2b2e878 100644 --- a/.zprezto/modules/prompt/external/powerlevel9k/docker/prezto/install.zsh +++ b/.zprezto/modules/prompt/external/powerlevel9k/docker/prezto/install.zsh @@ -9,7 +9,7 @@ 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" \ +ln -snf "${HOME}/p9k/powerlevel9k.zsh-theme" \ "${HOME}/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup" echo "zstyle ':prezto:module:prompt' theme 'powerlevel9k'" \ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/docker/zshing/Dockerfile b/.zprezto/modules/prompt/external/powerlevel9k/docker/zshing/Dockerfile new file mode 100644 index 0000000..a51a306 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/docker/zshing/Dockerfile @@ -0,0 +1,7 @@ +ARG base +FROM p9k:${base} + +COPY docker/zshing/install.zsh /tmp/ +RUN zsh /tmp/install.zsh + +COPY ./ p9k/ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/docker/zshing/install.zsh b/.zprezto/modules/prompt/external/powerlevel9k/docker/zshing/install.zsh new file mode 100644 index 0000000..8f92699 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/docker/zshing/install.zsh @@ -0,0 +1,16 @@ +#!zsh + +# install zshing https://github.com/zakariaGatter/zshing +git clone https://github.com/zakariaGatter/zshing.git ~/.zshing/zshing + +# Link P9K in zshing directory +ln -nsf ~/p9k ~/.zshing/powerlevel9k + +{ + echo + echo 'ZSHING_PLUGINS=( + "bhilburn/powerlevel9k" + )' + echo + echo "source ~/.zshing/zshing/zshing.zsh" +} >> ~/.zshrc diff --git a/.zprezto/modules/prompt/external/powerlevel9k/functions/colors.zsh b/.zprezto/modules/prompt/external/powerlevel9k/functions/colors.zsh index e98bfd4..80abb6b 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/functions/colors.zsh +++ b/.zprezto/modules/prompt/external/powerlevel9k/functions/colors.zsh @@ -6,6 +6,270 @@ # https://github.com/bhilburn/powerlevel9k ################################################################ +typeset -gAh __P9K_COLORS +# https://jonasjacek.github.io/colors/ +# use color names by default to allow dark/light themes to adjust colors based on names +__P9K_COLORS=( + black 000 + red 001 + green 002 + yellow 003 + blue 004 + magenta 005 + cyan 006 + white 007 + grey 008 + maroon 009 + lime 010 + olive 011 + navy 012 + fuchsia 013 + purple 013 + aqua 014 + teal 014 + silver 015 + grey0 016 + navyblue 017 + darkblue 018 + blue3 019 + blue3 020 + blue1 021 + darkgreen 022 + deepskyblue4 023 + deepskyblue4 024 + deepskyblue4 025 + dodgerblue3 026 + dodgerblue2 027 + green4 028 + springgreen4 029 + turquoise4 030 + deepskyblue3 031 + deepskyblue3 032 + dodgerblue1 033 + green3 034 + springgreen3 035 + darkcyan 036 + lightseagreen 037 + deepskyblue2 038 + deepskyblue1 039 + green3 040 + springgreen3 041 + springgreen2 042 + cyan3 043 + darkturquoise 044 + turquoise2 045 + green1 046 + springgreen2 047 + springgreen1 048 + mediumspringgreen 049 + cyan2 050 + cyan1 051 + darkred 052 + deeppink4 053 + purple4 054 + purple4 055 + purple3 056 + blueviolet 057 + orange4 058 + grey37 059 + mediumpurple4 060 + slateblue3 061 + slateblue3 062 + royalblue1 063 + chartreuse4 064 + darkseagreen4 065 + paleturquoise4 066 + steelblue 067 + steelblue3 068 + cornflowerblue 069 + chartreuse3 070 + darkseagreen4 071 + cadetblue 072 + cadetblue 073 + skyblue3 074 + steelblue1 075 + chartreuse3 076 + palegreen3 077 + seagreen3 078 + aquamarine3 079 + mediumturquoise 080 + steelblue1 081 + chartreuse2 082 + seagreen2 083 + seagreen1 084 + seagreen1 085 + aquamarine1 086 + darkslategray2 087 + darkred 088 + deeppink4 089 + darkmagenta 090 + darkmagenta 091 + darkviolet 092 + purple 093 + orange4 094 + lightpink4 095 + plum4 096 + mediumpurple3 097 + mediumpurple3 098 + slateblue1 099 + yellow4 100 + wheat4 101 + grey53 102 + lightslategrey 103 + mediumpurple 104 + lightslateblue 105 + yellow4 106 + darkolivegreen3 107 + darkseagreen 108 + lightskyblue3 109 + lightskyblue3 110 + skyblue2 111 + chartreuse2 112 + darkolivegreen3 113 + palegreen3 114 + darkseagreen3 115 + darkslategray3 116 + skyblue1 117 + chartreuse1 118 + lightgreen 119 + lightgreen 120 + palegreen1 121 + aquamarine1 122 + darkslategray1 123 + red3 124 + deeppink4 125 + mediumvioletred 126 + magenta3 127 + darkviolet 128 + purple 129 + darkorange3 130 + indianred 131 + hotpink3 132 + mediumorchid3 133 + mediumorchid 134 + mediumpurple2 135 + darkgoldenrod 136 + lightsalmon3 137 + rosybrown 138 + grey63 139 + mediumpurple2 140 + mediumpurple1 141 + gold3 142 + darkkhaki 143 + navajowhite3 144 + grey69 145 + lightsteelblue3 146 + lightsteelblue 147 + yellow3 148 + darkolivegreen3 149 + darkseagreen3 150 + darkseagreen2 151 + lightcyan3 152 + lightskyblue1 153 + greenyellow 154 + darkolivegreen2 155 + palegreen1 156 + darkseagreen2 157 + darkseagreen1 158 + paleturquoise1 159 + red3 160 + deeppink3 161 + deeppink3 162 + magenta3 163 + magenta3 164 + magenta2 165 + darkorange3 166 + indianred 167 + hotpink3 168 + hotpink2 169 + orchid 170 + mediumorchid1 171 + orange3 172 + lightsalmon3 173 + lightpink3 174 + pink3 175 + plum3 176 + violet 177 + gold3 178 + lightgoldenrod3 179 + tan 180 + mistyrose3 181 + thistle3 182 + plum2 183 + yellow3 184 + khaki3 185 + lightgoldenrod2 186 + lightyellow3 187 + grey84 188 + lightsteelblue1 189 + yellow2 190 + darkolivegreen1 191 + darkolivegreen1 192 + darkseagreen1 193 + honeydew2 194 + lightcyan1 195 + red1 196 + deeppink2 197 + deeppink1 198 + deeppink1 199 + magenta2 200 + magenta1 201 + orangered1 202 + indianred1 203 + indianred1 204 + hotpink 205 + hotpink 206 + mediumorchid1 207 + darkorange 208 + salmon1 209 + lightcoral 210 + palevioletred1 211 + orchid2 212 + orchid1 213 + orange1 214 + sandybrown 215 + lightsalmon1 216 + lightpink1 217 + pink1 218 + plum1 219 + gold1 220 + lightgoldenrod2 221 + lightgoldenrod2 222 + navajowhite1 223 + mistyrose1 224 + thistle1 225 + yellow1 226 + lightgoldenrod1 227 + khaki1 228 + wheat1 229 + cornsilk1 230 + grey100 231 + grey3 232 + grey7 233 + grey11 234 + grey15 235 + grey19 236 + grey23 237 + grey27 238 + grey30 239 + grey35 240 + grey39 241 + grey42 242 + grey46 243 + grey50 244 + grey54 245 + grey58 246 + grey62 247 + grey66 248 + grey70 249 + grey74 250 + grey78 251 + grey82 252 + grey85 253 + grey89 254 + grey93 255 +) + function termColors() { if [[ $POWERLEVEL9K_IGNORE_TERM_COLORS == true ]]; then return @@ -28,339 +292,56 @@ function termColors() { # 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 + # If Color is not numerical, try to get the color code. + if [[ "$1" != <-> ]]; then + 1=$(getColorCode $1) 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 + echo -n "%K{$(getColor $1)}" } # empty paramenter resets (stops) foreground color function foregroundColor() { - if [[ -z $1 ]]; then - echo -n "%f" - else - echo -n "%F{$(getColor $1)}" - fi + echo -n "%F{$(getColor $1)}" } # 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 + # Early exit: Check if given value is already numerical + if [[ "$1" == <-> ]]; then + # Pad color with zeroes + echo -n "${(l:3::0:)1}" + return + fi - # 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 + local colorName="${1}" + # Check if value is none with any case. + if [[ "${(L)colorName}" == "none" ]]; then + echo -n 'none' + elif [[ "${colorName}" == "foreground" ]]; then + # for testing purposes in terminal + # call via `getColorCode foreground` + for i in "${(k@)__P9K_COLORS}"; do + print -P "$(foregroundColor $i)$(getColor $i) - $i%f" + done + elif [[ "${colorName}" == "background" ]]; then + # call via `getColorCode background` + for i in "${(k@)__P9K_COLORS}"; do + print -P "$(backgroundColor $i)$(getColor $i) - $i%k" + done + else + # Strip eventual "bg-" prefixes + colorName=${colorName#bg-} + # Strip eventual "fg-" prefixes + colorName=${colorName#fg-} + # Strip eventual "br" prefixes ("bright" colors) + colorName=${colorName#br} + echo -n $__P9K_COLORS[$colorName] fi } diff --git a/.zprezto/modules/prompt/external/powerlevel9k/functions/icons.zsh b/.zprezto/modules/prompt/external/powerlevel9k/functions/icons.zsh index 358f958..d8661e6 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/functions/icons.zsh +++ b/.zprezto/modules/prompt/external/powerlevel9k/functions/icons.zsh @@ -48,24 +48,24 @@ case $POWERLEVEL9K_MODE in 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' + LINUX_ARCH_ICON $'\uE271' #  + LINUX_DEBIAN_ICON $'\uE271' #  + LINUX_UBUNTU_ICON $'\uE271' #  + LINUX_CENTOS_ICON $'\uE271' #  + LINUX_COREOS_ICON $'\uE271' #  + LINUX_ELEMENTARY_ICON $'\uE271' #  + LINUX_MINT_ICON $'\uE271' #  + LINUX_FEDORA_ICON $'\uE271' #  + LINUX_GENTOO_ICON $'\uE271' #  + LINUX_MAGEIA_ICON $'\uE271' #  + LINUX_NIXOS_ICON $'\uE271' #  + LINUX_MANJARO_ICON $'\uE271' #  + LINUX_DEVUAN_ICON $'\uE271' #  + LINUX_ALPINE_ICON $'\uE271' #  + LINUX_AOSC_ICON $'\uE271' #  + LINUX_OPENSUSE_ICON $'\uE271' #  + LINUX_SABAYON_ICON $'\uE271' #  + LINUX_SLACKWARE_ICON $'\uE271' #  SUNOS_ICON $'\U1F31E ' # 🌞 HOME_ICON $'\uE12C' #  HOME_SUB_ICON $'\uE18D' #  @@ -148,24 +148,24 @@ case $POWERLEVEL9K_MODE in 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' + LINUX_ARCH_ICON $'\uF17C' #  + LINUX_DEBIAN_ICON $'\uF17C' #  + LINUX_UBUNTU_ICON $'\uF17C' #  + LINUX_CENTOS_ICON $'\uF17C' #  + LINUX_COREOS_ICON $'\uF17C' #  + LINUX_ELEMENTARY_ICON $'\uF17C' #  + LINUX_MINT_ICON $'\uF17C' #  + LINUX_FEDORA_ICON $'\uF17C' #  + LINUX_GENTOO_ICON $'\uF17C' #  + LINUX_MAGEIA_ICON $'\uF17C' #  + LINUX_NIXOS_ICON $'\uF17C' #  + LINUX_MANJARO_ICON $'\uF17C' #  + LINUX_DEVUAN_ICON $'\uF17C' #  + LINUX_ALPINE_ICON $'\uF17C' #  + LINUX_AOSC_ICON $'\uF17C' #  + LINUX_OPENSUSE_ICON $'\uF17C' #  + LINUX_SABAYON_ICON $'\uF17C' #  + LINUX_SLACKWARE_ICON $'\uF17C' #  SUNOS_ICON $'\uF185 ' #  HOME_ICON $'\uF015' #  HOME_SUB_ICON $'\uF07C' #  @@ -250,24 +250,24 @@ case $POWERLEVEL9K_MODE in 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' + LINUX_ARCH_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_DEBIAN_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_UBUNTU_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_CENTOS_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_COREOS_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_ELEMENTARY_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_MINT_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_FEDORA_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_GENTOO_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_MAGEIA_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_NIXOS_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_MANJARO_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_DEVUAN_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_ALPINE_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_AOSC_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_OPENSUSE_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_SABAYON_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  + LINUX_SLACKWARE_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX #  SUNOS_ICON '\u'$CODEPOINT_OF_AWESOME_SUN_O' ' #  HOME_ICON '\u'$CODEPOINT_OF_AWESOME_HOME #  HOME_SUB_ICON '\u'$CODEPOINT_OF_AWESOME_FOLDER_OPEN #  diff --git a/.zprezto/modules/prompt/external/powerlevel9k/functions/utilities.zsh b/.zprezto/modules/prompt/external/powerlevel9k/functions/utilities.zsh index 69fd2ec..127007f 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/functions/utilities.zsh +++ b/.zprezto/modules/prompt/external/powerlevel9k/functions/utilities.zsh @@ -9,9 +9,7 @@ # 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 + [[ ! -z "${(tP)1}" ]] } # Given the name of a variable and a default value, sets the variable diff --git a/.zprezto/modules/prompt/external/powerlevel9k/powerlevel9k.zsh-theme b/.zprezto/modules/prompt/external/powerlevel9k/powerlevel9k.zsh-theme index c1ea754..3c3303f 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/powerlevel9k.zsh-theme +++ b/.zprezto/modules/prompt/external/powerlevel9k/powerlevel9k.zsh-theme @@ -111,45 +111,54 @@ CURRENT_BG='NONE' set_default last_left_element_index 1 set_default POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS " " left_prompt_segment() { + local segment_name="${1}" local current_index=$2 # Check if the segment should be joined with the previous one local joined segmentShouldBeJoined $current_index $last_left_element_index "$POWERLEVEL9K_LEFT_PROMPT_ELEMENTS" && joined=true || joined=false + # Colors + local backgroundColor="${3}" + local foregroundColor="${4}" + # Overwrite given background-color by user defined variable for this segment. - local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND + local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_BACKGROUND local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE} - [[ -n $BG_COLOR_MODIFIER ]] && 3="$BG_COLOR_MODIFIER" + [[ -n $BG_COLOR_MODIFIER ]] && backgroundColor="$BG_COLOR_MODIFIER" # Overwrite given foreground-color by user defined variable for this segment. - local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND + local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_FOREGROUND local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE} - [[ -n $FG_COLOR_MODIFIER ]] && 4="$FG_COLOR_MODIFIER" + [[ -n $FG_COLOR_MODIFIER ]] && foregroundColor="$FG_COLOR_MODIFIER" - local bg fg - [[ -n "$3" ]] && bg="$(backgroundColor $3)" || bg="$(backgroundColor)" - [[ -n "$4" ]] && fg="$(foregroundColor $4)" || fg="$(foregroundColor)" + # Get color codes here to save some calls later on + backgroundColor="$(getColorCode ${backgroundColor})" + foregroundColor="$(getColorCode ${foregroundColor})" - if [[ $CURRENT_BG != 'NONE' ]] && ! isSameColor "$3" "$CURRENT_BG"; then - echo -n "$bg%F{$CURRENT_BG}" + local background foreground + [[ -n "${backgroundColor}" ]] && background="$(backgroundColor ${backgroundColor})" || background="%k" + [[ -n "${foregroundColor}" ]] && foreground="$(foregroundColor ${foregroundColor})" || foreground="%f" + + if [[ $CURRENT_BG != 'NONE' ]] && ! isSameColor "${backgroundColor}" "$CURRENT_BG"; then + echo -n "${background}%F{$CURRENT_BG}" if [[ $joined == false ]]; then # Middle segment echo -n "$(print_icon 'LEFT_SEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" fi - elif isSameColor "$CURRENT_BG" "$3"; then + elif isSameColor "$CURRENT_BG" "${backgroundColor}"; then # Middle segment with same color as previous segment # We take the current foreground color as color for our # subsegment (or the default color). This should have # enough contrast. local complement - [[ -n "$4" ]] && complement="$fg" || complement="$(foregroundColor $DEFAULT_COLOR)" - echo -n "${bg}${complement}" + [[ -n "${foregroundColor}" ]] && complement="${foreground}" || complement="$(foregroundColor $DEFAULT_COLOR)" + echo -n "${background}${complement}" if [[ $joined == false ]]; then echo -n "$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" fi else # First segment - echo -n "${bg}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" + echo -n "${background}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" fi local visual_identifier @@ -161,26 +170,26 @@ left_prompt_segment() { # we need to color both the visual identifier and the whitespace. [[ -n "$5" ]] && visual_identifier="$visual_identifier " # Allow users to overwrite the color for the visual identifier only. - local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR - set_default $visual_identifier_color_variable $4 - visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f" + local visual_identifier_color_variable=POWERLEVEL9K_${(U)${segment_name}#prompt_}_VISUAL_IDENTIFIER_COLOR + set_default $visual_identifier_color_variable "${foregroundColor}" + visual_identifier="$(foregroundColor ${(P)visual_identifier_color_variable})${visual_identifier}%f" fi fi # Print the visual identifier echo -n "${visual_identifier}" # Print the content of the segment, if there is any - [[ -n "$5" ]] && echo -n "${fg}${5}" + [[ -n "$5" ]] && echo -n "${foreground}${5}" echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}" - CURRENT_BG=$3 + CURRENT_BG="${backgroundColor}" last_left_element_index=$current_index } # End the left prompt, closes the final segment. left_prompt_end() { if [[ -n $CURRENT_BG ]]; then - echo -n "%k%F{$CURRENT_BG}$(print_icon 'LEFT_SEGMENT_SEPARATOR')" + echo -n "%k$(foregroundColor ${CURRENT_BG})$(print_icon 'LEFT_SEGMENT_SEPARATOR')" else echo -n "%k" fi @@ -203,25 +212,34 @@ CURRENT_RIGHT_BG='NONE' set_default last_right_element_index 1 set_default POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS " " right_prompt_segment() { + local segment_name="${1}" local current_index=$2 # Check if the segment should be joined with the previous one local joined segmentShouldBeJoined $current_index $last_right_element_index "$POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS" && joined=true || joined=false + # Colors + local backgroundColor="${3}" + local foregroundColor="${4}" + # Overwrite given background-color by user defined variable for this segment. - local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND + local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_BACKGROUND local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE} - [[ -n $BG_COLOR_MODIFIER ]] && 3="$BG_COLOR_MODIFIER" + [[ -n $BG_COLOR_MODIFIER ]] && backgroundColor="$BG_COLOR_MODIFIER" # Overwrite given foreground-color by user defined variable for this segment. - local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND + local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_FOREGROUND local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE} - [[ -n $FG_COLOR_MODIFIER ]] && 4="$FG_COLOR_MODIFIER" + [[ -n $FG_COLOR_MODIFIER ]] && foregroundColor="$FG_COLOR_MODIFIER" - local bg fg - [[ -n "$3" ]] && bg="$(backgroundColor $3)" || bg="$(backgroundColor)" - [[ -n "$4" ]] && fg="$(foregroundColor $4)" || fg="$(foregroundColor)" + # Get color codes here to save some calls later on + backgroundColor="$(getColorCode ${backgroundColor})" + foregroundColor="$(getColorCode ${foregroundColor})" + + local background foreground + [[ -n "${backgroundColor}" ]] && background="$(backgroundColor ${backgroundColor})" || background="%k" + [[ -n "${foregroundColor}" ]] && foreground="$(foregroundColor ${foregroundColor})" || foreground="%f" # If CURRENT_RIGHT_BG is "NONE", we are the first right segment. @@ -231,17 +249,17 @@ right_prompt_segment() { fi if [[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]]; then - if isSameColor "$CURRENT_RIGHT_BG" "$3"; then + if isSameColor "$CURRENT_RIGHT_BG" "${backgroundColor}"; then # Middle segment with same color as previous segment # We take the current foreground color as color for our # subsegment (or the default color). This should have # enough contrast. local complement - [[ -n "$4" ]] && complement="$fg" || complement="$(foregroundColor $DEFAULT_COLOR)" + [[ -n "${foregroundColor}" ]] && complement="${foreground}" || complement="$(foregroundColor $DEFAULT_COLOR)" echo -n "$complement$(print_icon 'RIGHT_SUBSEGMENT_SEPARATOR')%f" else - # Use the new BG color for the foreground with separator - echo -n "$(foregroundColor $3)$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f" + # Use the new Background Color as the foreground of the segment separator + echo -n "$(foregroundColor ${backgroundColor})$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f" fi fi @@ -254,13 +272,13 @@ right_prompt_segment() { # we need to color both the visual identifier and the whitespace. [[ -n "$5" ]] && visual_identifier=" $visual_identifier" # Allow users to overwrite the color for the visual identifier only. - local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR - set_default $visual_identifier_color_variable $4 - visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f" + local visual_identifier_color_variable=POWERLEVEL9K_${(U)${segment_name}#prompt_}_VISUAL_IDENTIFIER_COLOR + set_default $visual_identifier_color_variable "${foregroundColor}" + visual_identifier="$(foregroundColor ${(P)visual_identifier_color_variable})${visual_identifier}%f" fi fi - echo -n "${bg}${fg}" + echo -n "${background}${foreground}" # Print whitespace only if segment is not joined or first right segment [[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]] && echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}" @@ -270,7 +288,7 @@ right_prompt_segment() { # Print the visual identifier echo -n "${visual_identifier}" - CURRENT_RIGHT_BG=$3 + CURRENT_RIGHT_BG="${backgroundColor}" last_right_element_index=$current_index } @@ -278,11 +296,6 @@ right_prompt_segment() { # Prompt Segment Definitions ################################################################ -# The `CURRENT_BG` variable is used to remember what the last BG color used was -# when building the left-hand prompt. Because the RPROMPT is created from -# right-left but reads the opposite, this isn't necessary for the other side. -CURRENT_BG='NONE' - ################################################################ # Anaconda Environment prompt_anaconda() { @@ -409,12 +422,13 @@ prompt_battery() { 'charged' 'green' 'disconnected' "$DEFAULT_COLOR_INVERTED" ) + local ROOT_PREFIX="${4}" # Set default values if the user did not configure them set_default POWERLEVEL9K_BATTERY_LOW_THRESHOLD 10 - if [[ $OS =~ OSX && -f /usr/bin/pmset && -x /usr/bin/pmset ]]; then + if [[ $OS =~ OSX && -f "${ROOT_PREFIX}"/usr/bin/pmset && -x "${ROOT_PREFIX}"/usr/bin/pmset ]]; then # obtain battery information from system - local raw_data="$(pmset -g batt | awk 'FNR==2{print}')" + local raw_data="$(${ROOT_PREFIX}/usr/bin/pmset -g batt | awk 'FNR==2{print}')" # return if there is no battery on system [[ -z $(echo $raw_data | grep "InternalBattery") ]] && return @@ -446,7 +460,7 @@ prompt_battery() { fi if [[ "$OS" == 'Linux' ]] || [[ "$OS" == 'Android' ]]; then - local sysp="/sys/class/power_supply" + local sysp="${ROOT_PREFIX}/sys/class/power_supply" # Reported BAT0 or BAT1 depending on kernel version [[ -a $sysp/BAT0 ]] && local bat=$sysp/BAT0 @@ -468,8 +482,8 @@ prompt_battery() { [[ $bat_percent =~ 100 ]] && current_state="charged" [[ $bat_percent -lt 100 ]] && current_state="charging" fi - if [[ -f /usr/bin/acpi ]]; then - local time_remaining=$(acpi | awk '{ print $5 }') + if [[ -f ${ROOT_PREFIX}/usr/bin/acpi ]]; then + local time_remaining=$(${ROOT_PREFIX}/usr/bin/acpi | awk '{ print $5 }') if [[ $time_remaining =~ rate ]]; then local tstring="..." elif [[ $time_remaining =~ "[[:digit:]]+" ]]; then @@ -498,7 +512,7 @@ prompt_battery() { fi fi # return if POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD is set and the battery percentage is greater or equal - if [[ -v "POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD" && "${bat_percent}" -ge $POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]]; then + if defined POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD && [[ "${bat_percent}" -ge $POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]]; then return fi @@ -623,12 +637,12 @@ prompt_context() { if [[ $(print -P "%#") == '#' ]]; then current_state="ROOT" elif [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then - if sudo -n true 2>/dev/null; then + if [[ -n "$SUDO_COMMAND" ]]; then current_state="REMOTE_SUDO" else current_state="REMOTE" fi - elif sudo -n true 2>/dev/null; then + elif [[ -n "$SUDO_COMMAND" ]]; then current_state="SUDO" fi @@ -651,7 +665,7 @@ prompt_user() { "FOREGROUND_COLOR" "yellow" "VISUAL_IDENTIFIER" "ROOT_ICON" ) - elif sudo -n true 2>/dev/null; then + elif [[ -n "$SUDO_COMMAND" ]]; then user_state=( "STATE" "SUDO" "CONTENT" "${POWERLEVEL9K_USER_TEMPLATE}" @@ -702,11 +716,13 @@ prompt_host() { # The 'custom` prompt provides a way for users to invoke commands and display # the output in a segment. prompt_custom() { - local command=POWERLEVEL9K_CUSTOM_$3:u + local segment_name="${3:u}" + # Get content of custom segment + local command="POWERLEVEL9K_CUSTOM_${segment_name}" local segment_content="$(eval ${(P)command})" if [[ -n $segment_content ]]; then - "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$segment_content" + "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$segment_content" "CUSTOM_${segment_name}_ICON" fi } @@ -744,6 +760,31 @@ prompt_command_execution_time() { fi } +################################################################ +# Determine the unique path - this is needed for the +# truncate_to_unique strategy. +# +function getUniqueFolder() { + local trunc_path directory test_dir test_dir_length + local -a matching + local -a paths + local cur_path='/' + paths=(${(s:/:)1}) + for directory in ${paths[@]}; do + test_dir='' + for (( i=0; i < ${#directory}; i++ )); do + test_dir+="${directory:$i:1}" + matching=("$cur_path"/"$test_dir"*/) + if [[ ${#matching[@]} -eq 1 ]]; then + break + fi + done + trunc_path+="$test_dir/" + cur_path+="$directory/" + done + echo "${trunc_path: : -1}" +} + ################################################################ # Dir: current working directory # Parameters: @@ -811,23 +852,10 @@ prompt_dir() { # for each parent path component find the shortest unique beginning # characters sequence. Source: https://stackoverflow.com/a/45336078 if (( ${#current_path} > 1 )); then # root and home are exceptions and won't have paths - local matching - local cur_path='/' - [[ $current_path != "~"* ]] && trunc_path='/' || trunc_path='' - for directory in ${paths[@]}; do - test_dir='' - for (( i=0; i<${#directory}; i++ )); do - test_dir+="${directory:$i:1}" - matching=("$cur_path"/"$test_dir"*/) - if [[ ${#matching[@]} -eq 1 ]]; then - break - fi - done - trunc_path+="$test_dir/" - cur_path+="$directory/" - done - [[ $current_path == "~"* ]] && trunc_path="~/$trunc_path" - current_path="${trunc_path: : -1}" + # cheating here to retain ~ as home folder + local home_path="$(getUniqueFolder $HOME)" + trunc_path="$(getUniqueFolder $PWD)" + [[ $current_path == "~"* ]] && current_path="~${trunc_path//${home_path}/}" || current_path="/${trunc_path}" fi ;; truncate_with_folder_marker) @@ -1043,18 +1071,14 @@ prompt_history() { ################################################################ # Detection for virtualization (systemd based systems only) prompt_detect_virt() { - if ! command -v systemd-detect-virt > /dev/null; then - return - fi - local virt=$(systemd-detect-virt) + local virt=$(systemd-detect-virt 2> /dev/null) if [[ "$virt" == "none" ]]; then if [[ "$(ls -di / | grep -o 2)" != "2" ]]; then virt="chroot" - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" - else - ; fi - else + fi + + if [[ -n "${virt}" ]]; then "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" fi } @@ -1089,18 +1113,20 @@ prompt_ip() { else if defined POWERLEVEL9K_IP_INTERFACE; then # Get the IP address of the specified interface. - ip=$(ip -4 a show "$POWERLEVEL9K_IP_INTERFACE" | grep -o "inet\s*[0-9.]*" | grep -o "[0-9.]*") + ip=$(ip -4 a show "$POWERLEVEL9K_IP_INTERFACE" | grep -o "inet\s*[0-9.]*" | grep -o -E "[0-9.]+") else local interfaces callback # Get all network interface names that are up - interfaces=$(ip link ls up | grep -o -E ":\s+[a-z0-9]+:" | grep -v "lo" | grep -o "[a-z0-9]*") - callback='ip -4 a show $item | grep -o "inet\s*[0-9.]*" | grep -o "[0-9.]*"' + interfaces=$(ip link ls up | grep -o -E ":\s+[a-z0-9]+:" | grep -v "lo" | grep -o -E "[a-z0-9]+") + callback='ip -4 a show $item | grep -o "inet\s*[0-9.]*" | grep -o -E "[0-9.]+"' ip=$(getRelevantItem "$interfaces" "$callback") fi fi - "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'NETWORK_ICON' + if [[ -n "$ip" ]]; then + "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'NETWORK_ICON' + fi } ################################################################ @@ -1118,11 +1144,10 @@ prompt_vpn_ip() { ################################################################ # Segment to display laravel version prompt_laravel_version() { - local laravel_version="$(php artisan --version 2>/dev/null)" - if [[ -n "${laravel_version}" ]]; then - # Remove unrelevant infos - laravel_version="${laravel_version//Laravel Framework version /}" - + local laravel_version="$(php artisan --version 2> /dev/null)" + if [[ -n "${laravel_version}" && "${laravel_version}" =~ "Laravel Framework" ]]; then + # Strip out everything but the version + laravel_version="${laravel_version//Laravel Framework /}" "$1_prompt_segment" "$0" "$2" "maroon" "white" "${laravel_version}" 'LARAVEL_ICON' fi } @@ -1131,6 +1156,7 @@ prompt_laravel_version() { # Segment to display load set_default POWERLEVEL9K_LOAD_WHICH 5 prompt_load() { + local ROOT_PREFIX="${4}" # The load segment can have three different states local current_state="unknown" local load_select=2 @@ -1166,7 +1192,7 @@ prompt_load() { fi ;; *) - load_avg=$(cut -d" " -f${load_select} /proc/loadavg) + load_avg=$(cut -d" " -f${load_select} ${ROOT_PREFIX}/proc/loadavg) cores=$(nproc) esac @@ -1239,6 +1265,7 @@ prompt_php_version() { ################################################################ # Segment to display free RAM and used Swap prompt_ram() { + local ROOT_PREFIX="${4}" local base='' local ramfree=0 if [[ "$OS" == "OSX" ]]; then @@ -1250,9 +1277,9 @@ prompt_ram() { ramfree=$(( ramfree * 4096 )) else if [[ "$OS" == "BSD" ]]; then - ramfree=$(grep 'avail memory' /var/run/dmesg.boot | awk '{print $4}') + ramfree=$(grep 'avail memory' ${ROOT_PREFIX}/var/run/dmesg.boot | awk '{print $4}') else - ramfree=$(grep -o -E "MemAvailable:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") + ramfree=$(grep -o -E "MemAvailable:\s+[0-9]+" ${ROOT_PREFIX}/proc/meminfo | grep -o -E "[0-9]+") base='K' fi fi @@ -1260,21 +1287,19 @@ prompt_ram() { "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$ramfree" $base)" 'RAM_ICON' } - +################################################################ +# Segment to display rbenv information +# https://github.com/rbenv/rbenv#choosing-the-ruby-version set_default POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW false -# rbenv information prompt_rbenv() { - if command which rbenv 2>/dev/null >&2; then + if [[ -n "$RBENV_VERSION" ]]; then + "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$RBENV_VERSION" 'RUBY_ICON' + elif [ $commands[rbenv] ]; then local rbenv_version_name="$(rbenv version-name)" local rbenv_global="$(rbenv global)" - - # Don't show anything if the current Ruby is the same as the global Ruby - # unless `POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW` is set. - if [[ $rbenv_version_name == $rbenv_global && "$POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW" = false ]]; then - return + if [[ "${rbenv_version_name}" != "${rbenv_global}" || "${POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW}" == "true" ]]; then + "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON' fi - - "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON' fi } @@ -1419,6 +1444,7 @@ prompt_status() { ################################################################ # Segment to display Swap information prompt_swap() { + local ROOT_PREFIX="${4}" local swap_used=0 local base='' @@ -1433,8 +1459,8 @@ prompt_swap() { base=$(echo "$raw_swap_used" | grep -o "[A-Z]*$") else - swap_total=$(grep -o -E "SwapTotal:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - swap_free=$(grep -o -E "SwapFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") + swap_total=$(grep -o -E "SwapTotal:\s+[0-9]+" ${ROOT_PREFIX}/proc/meminfo | grep -o -E "[0-9]+") + swap_free=$(grep -o -E "SwapFree:\s+[0-9]+" ${ROOT_PREFIX}/proc/meminfo | grep -o -E "[0-9]+") swap_used=$(( swap_total - swap_free )) base='K' fi @@ -1607,7 +1633,7 @@ set_default POWERLEVEL9K_VI_COMMAND_MODE_STRING "NORMAL" prompt_vi_mode() { case ${KEYMAP} in vicmd) - "$1_prompt_segment" "$0_NORMAL" "$2" "$DEFAULT_COLOR" "default" "$POWERLEVEL9K_VI_COMMAND_MODE_STRING" + "$1_prompt_segment" "$0_NORMAL" "$2" "$DEFAULT_COLOR" "white" "$POWERLEVEL9K_VI_COMMAND_MODE_STRING" ;; main|viins|*) if [[ -z $POWERLEVEL9K_VI_INSERT_MODE_STRING ]]; then return; fi @@ -1628,11 +1654,22 @@ prompt_virtualenv() { } ################################################################ -# pyenv: current active python version (with restrictions) +# Segment to display pyenv information # https://github.com/pyenv/pyenv#choosing-the-python-version +set_default POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW false prompt_pyenv() { if [[ -n "$PYENV_VERSION" ]]; then "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$PYENV_VERSION" 'PYTHON_ICON' + elif [ $commands[pyenv] ]; then + local pyenv_version_name="$(pyenv version-name)" + local pyenv_global="system" + local pyenv_root="$(pyenv root)" + if [[ -f "${pyenv_root}/version" ]]; then + pyenv_global="$(pyenv version-file-read ${pyenv_root}/version)" + fi + if [[ "${pyenv_version_name}" != "${pyenv_global}" || "${POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW}" == "true" ]]; then + "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$pyenv_version_name" 'PYTHON_ICON' + fi fi } @@ -1779,10 +1816,16 @@ powerlevel9k_preexec() { set_default POWERLEVEL9K_PROMPT_ADD_NEWLINE false powerlevel9k_prepare_prompts() { - local RETVAL RPROMPT_PREFIX RPROMPT_SUFFIX + # Return values. These need to be global, because + # they are used in prompt_status. Also, we need + # to get the return value of the last command at + # very first in this function. Do not move the + # lines down, otherwise the last command is not + # what you expected it to be. RETVAL=$? RETVALS=( "$pipestatus[@]" ) + local RPROMPT_SUFFIX RPROMPT_PREFIX _P9K_COMMAND_DURATION=$((EPOCHREALTIME - _P9K_TIMER_START)) # Reset start time @@ -1868,7 +1911,7 @@ prompt_powerlevel9k_setup() { fi fi - defined POWERLEVEL9K_LEFT_PROMPT_ELEMENTS || POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs) + defined POWERLEVEL9K_LEFT_PROMPT_ELEMENTS || POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs) defined POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS || POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time) # Display a warning if deprecated segments are in use. diff --git a/.zprezto/modules/prompt/external/powerlevel9k/prompt_powerlevel9k_setup b/.zprezto/modules/prompt/external/powerlevel9k/prompt_powerlevel9k_setup deleted file mode 100755 index c1ea754..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/prompt_powerlevel9k_setup +++ /dev/null @@ -1,1912 +0,0 @@ -# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 -################################################################ -# powerlevel9k Theme -# https://github.com/bhilburn/powerlevel9k -# -# This theme was inspired by agnoster's Theme: -# https://gist.github.com/3712874 -################################################################ - -################################################################ -# For basic documentation, please refer to the README.md in the top-level -# directory. For more detailed documentation, refer to the project wiki, hosted -# on Github: https://github.com/bhilburn/powerlevel9k/wiki -# -# There are a lot of easy ways you can customize your prompt segments and -# theming with simple variables defined in your `~/.zshrc`. -################################################################ - -## Turn on for Debugging -#PS4='%s%f%b%k%F{blue}%{λ%}%L %F{240}%N:%i%(?.. %F{red}%?) %1(_.%F{yellow}%-1_ .)%s%f%b%k ' -#zstyle ':vcs_info:*+*:*' debug true -#set -o xtrace - -# Try to set the installation path -if [[ -n "$POWERLEVEL9K_INSTALLATION_DIR" ]]; then - p9k_directory=${POWERLEVEL9K_INSTALLATION_DIR:A} -else - if [[ "${(%):-%N}" == '(eval)' ]]; then - if [[ "$0" == '-antigen-load' ]] && [[ -r "${PWD}/powerlevel9k.zsh-theme" ]]; then - # Antigen uses eval to load things so it can change the plugin (!!) - # https://github.com/zsh-users/antigen/issues/581 - p9k_directory=$PWD - else - print -P "%F{red}You must set POWERLEVEL9K_INSTALLATION_DIR work from within an (eval).%f" - return 1 - fi - else - # Get the path to file this code is executing in; then - # get the absolute path and strip the filename. - # See https://stackoverflow.com/a/28336473/108857 - p9k_directory=${${(%):-%x}:A:h} - fi -fi - -################################################################ -# Source icon functions -################################################################ - -source "${p9k_directory}/functions/icons.zsh" - -################################################################ -# Source utility functions -################################################################ - -source "${p9k_directory}/functions/utilities.zsh" - -################################################################ -# Source color functions -################################################################ - -source "${p9k_directory}/functions/colors.zsh" - -################################################################ -# Source VCS_INFO hooks / helper functions -################################################################ - -source "${p9k_directory}/functions/vcs.zsh" - -# cleanup temporary variables. -unset p9k_directory - -################################################################ -# Color Scheme -################################################################ - -if [[ "$POWERLEVEL9K_COLOR_SCHEME" == "light" ]]; then - DEFAULT_COLOR=white - DEFAULT_COLOR_INVERTED=black -else - DEFAULT_COLOR=black - DEFAULT_COLOR_INVERTED=white -fi - -################################################################ -# Prompt Segment Constructors -# -# Methodology behind user-defined variables overwriting colors: -# The first parameter to the segment constructors is the calling function's -# name. From this function name, we strip the "prompt_"-prefix and -# uppercase it. This is then prefixed with "POWERLEVEL9K_" and suffixed -# with either "_BACKGROUND" or "_FOREGROUND", thus giving us the variable -# name. So each new segment is user-overwritten by a variable following -# this naming convention. -################################################################ - -# The `CURRENT_BG` variable is used to remember what the last BG color used was -# when building the left-hand prompt. Because the RPROMPT is created from -# right-left but reads the opposite, this isn't necessary for the other side. -CURRENT_BG='NONE' - -# Begin a left prompt segment -# Takes four arguments: -# * $1: Name of the function that was originally invoked (mandatory). -# Necessary, to make the dynamic color-overwrite mechanism work. -# * $2: The array index of the current segment -# * $3: Background color -# * $4: Foreground color -# * $5: The segment content -# * $6: An identifying icon (must be a key of the icons array) -# The latter three can be omitted, -set_default last_left_element_index 1 -set_default POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS " " -left_prompt_segment() { - local current_index=$2 - # Check if the segment should be joined with the previous one - local joined - segmentShouldBeJoined $current_index $last_left_element_index "$POWERLEVEL9K_LEFT_PROMPT_ELEMENTS" && joined=true || joined=false - - # Overwrite given background-color by user defined variable for this segment. - local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND - local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE} - [[ -n $BG_COLOR_MODIFIER ]] && 3="$BG_COLOR_MODIFIER" - - # Overwrite given foreground-color by user defined variable for this segment. - local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND - local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE} - [[ -n $FG_COLOR_MODIFIER ]] && 4="$FG_COLOR_MODIFIER" - - local bg fg - [[ -n "$3" ]] && bg="$(backgroundColor $3)" || bg="$(backgroundColor)" - [[ -n "$4" ]] && fg="$(foregroundColor $4)" || fg="$(foregroundColor)" - - if [[ $CURRENT_BG != 'NONE' ]] && ! isSameColor "$3" "$CURRENT_BG"; then - echo -n "$bg%F{$CURRENT_BG}" - if [[ $joined == false ]]; then - # Middle segment - echo -n "$(print_icon 'LEFT_SEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" - fi - elif isSameColor "$CURRENT_BG" "$3"; then - # Middle segment with same color as previous segment - # We take the current foreground color as color for our - # subsegment (or the default color). This should have - # enough contrast. - local complement - [[ -n "$4" ]] && complement="$fg" || complement="$(foregroundColor $DEFAULT_COLOR)" - echo -n "${bg}${complement}" - if [[ $joined == false ]]; then - echo -n "$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" - fi - else - # First segment - echo -n "${bg}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" - fi - - local visual_identifier - if [[ -n $6 ]]; then - visual_identifier="$(print_icon $6)" - if [[ -n "$visual_identifier" ]]; then - # Add an whitespace if we print more than just the visual identifier. - # To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st), - # we need to color both the visual identifier and the whitespace. - [[ -n "$5" ]] && visual_identifier="$visual_identifier " - # Allow users to overwrite the color for the visual identifier only. - local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR - set_default $visual_identifier_color_variable $4 - visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f" - fi - fi - - # Print the visual identifier - echo -n "${visual_identifier}" - # Print the content of the segment, if there is any - [[ -n "$5" ]] && echo -n "${fg}${5}" - echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}" - - CURRENT_BG=$3 - last_left_element_index=$current_index -} - -# End the left prompt, closes the final segment. -left_prompt_end() { - if [[ -n $CURRENT_BG ]]; then - echo -n "%k%F{$CURRENT_BG}$(print_icon 'LEFT_SEGMENT_SEPARATOR')" - else - echo -n "%k" - fi - echo -n "%f$(print_icon 'LEFT_SEGMENT_END_SEPARATOR')" - CURRENT_BG='' -} - -CURRENT_RIGHT_BG='NONE' - -# Begin a right prompt segment -# Takes four arguments: -# * $1: Name of the function that was originally invoked (mandatory). -# Necessary, to make the dynamic color-overwrite mechanism work. -# * $2: The array index of the current segment -# * $3: Background color -# * $4: Foreground color -# * $5: The segment content -# * $6: An identifying icon (must be a key of the icons array) -# No ending for the right prompt segment is needed (unlike the left prompt, above). -set_default last_right_element_index 1 -set_default POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS " " -right_prompt_segment() { - local current_index=$2 - - # Check if the segment should be joined with the previous one - local joined - segmentShouldBeJoined $current_index $last_right_element_index "$POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS" && joined=true || joined=false - - # Overwrite given background-color by user defined variable for this segment. - local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND - local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE} - [[ -n $BG_COLOR_MODIFIER ]] && 3="$BG_COLOR_MODIFIER" - - # Overwrite given foreground-color by user defined variable for this segment. - local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND - local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE} - [[ -n $FG_COLOR_MODIFIER ]] && 4="$FG_COLOR_MODIFIER" - - local bg fg - [[ -n "$3" ]] && bg="$(backgroundColor $3)" || bg="$(backgroundColor)" - [[ -n "$4" ]] && fg="$(foregroundColor $4)" || fg="$(foregroundColor)" - - # If CURRENT_RIGHT_BG is "NONE", we are the first right segment. - - if [[ "$CURRENT_RIGHT_BG" != "NONE" ]]; then - # This is the closing whitespace for the previous segment - echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}%f" - fi - - if [[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]]; then - if isSameColor "$CURRENT_RIGHT_BG" "$3"; then - # Middle segment with same color as previous segment - # We take the current foreground color as color for our - # subsegment (or the default color). This should have - # enough contrast. - local complement - [[ -n "$4" ]] && complement="$fg" || complement="$(foregroundColor $DEFAULT_COLOR)" - echo -n "$complement$(print_icon 'RIGHT_SUBSEGMENT_SEPARATOR')%f" - else - # Use the new BG color for the foreground with separator - echo -n "$(foregroundColor $3)$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f" - fi - fi - - local visual_identifier - if [[ -n "$6" ]]; then - visual_identifier="$(print_icon $6)" - if [[ -n "$visual_identifier" ]]; then - # Add an whitespace if we print more than just the visual identifier. - # To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st), - # we need to color both the visual identifier and the whitespace. - [[ -n "$5" ]] && visual_identifier=" $visual_identifier" - # Allow users to overwrite the color for the visual identifier only. - local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR - set_default $visual_identifier_color_variable $4 - visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f" - fi - fi - - echo -n "${bg}${fg}" - - # Print whitespace only if segment is not joined or first right segment - [[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]] && echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}" - - # Print segment content if there is any - [[ -n "$5" ]] && echo -n "${5}" - # Print the visual identifier - echo -n "${visual_identifier}" - - CURRENT_RIGHT_BG=$3 - last_right_element_index=$current_index -} - -################################################################ -# Prompt Segment Definitions -################################################################ - -# The `CURRENT_BG` variable is used to remember what the last BG color used was -# when building the left-hand prompt. Because the RPROMPT is created from -# right-left but reads the opposite, this isn't necessary for the other side. -CURRENT_BG='NONE' - -################################################################ -# Anaconda Environment -prompt_anaconda() { - # Depending on the conda version, either might be set. This - # variant works even if both are set. - local _path=$CONDA_ENV_PATH$CONDA_PREFIX - if ! [ -z "$_path" ]; then - # config - can be overwritten in users' zshrc file. - set_default POWERLEVEL9K_ANACONDA_LEFT_DELIMITER "(" - set_default POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER ")" - "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" 'PYTHON_ICON' - fi -} - -################################################################ -# AWS Profile -prompt_aws() { - local aws_profile="${AWS_PROFILE:-$AWS_DEFAULT_PROFILE}" - - if [[ -n "$aws_profile" ]]; then - "$1_prompt_segment" "$0" "$2" red white "$aws_profile" 'AWS_ICON' - fi -} - -################################################################ -# Current Elastic Beanstalk environment -prompt_aws_eb_env() { - local eb_env=$(grep environment .elasticbeanstalk/config.yml 2> /dev/null | awk '{print $2}') - - if [[ -n "$eb_env" ]]; then - "$1_prompt_segment" "$0" "$2" black green "$eb_env" 'AWS_EB_ICON' - fi -} - -################################################################ -# Segment to indicate background jobs with an icon. -set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true -set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS false -prompt_background_jobs() { - local background_jobs_number=${$(jobs -l | wc -l)// /} - local wrong_lines=`jobs -l | awk '/pwd now/{ count++ } END {print count}'` - if [[ wrong_lines -gt 0 ]]; then - background_jobs_number=$(( $background_jobs_number - $wrong_lines )) - fi - if [[ background_jobs_number -gt 0 ]]; then - local background_jobs_number_print="" - if [[ "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE" == "true" ]] && ([[ "$background_jobs_number" -gt 1 ]] || [[ "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS" == "true" ]]); then - background_jobs_number_print="$background_jobs_number" - fi - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "cyan" "$background_jobs_number_print" 'BACKGROUND_JOBS_ICON' - fi -} - -################################################################ -# A newline in your prompt, so you can segments on multiple lines. -prompt_newline() { - local lws newline - [[ "$1" == "right" ]] && return - newline=$'\n' - lws=$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS - if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then - newline="${newline}$(print_icon 'MULTILINE_NEWLINE_PROMPT_PREFIX')" - fi - POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS= - "$1_prompt_segment" \ - "$0" \ - "$2" \ - "NONE" "NONE" "${newline}" - POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=$lws -} - -################################################################ -# Segment that indicates usage level of current partition. -set_default POWERLEVEL9K_DISK_USAGE_ONLY_WARNING false -set_default POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL 90 -set_default POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL 95 -prompt_disk_usage() { - local current_state="unknown" - typeset -AH hdd_usage_forecolors - hdd_usage_forecolors=( - 'normal' 'yellow' - 'warning' "$DEFAULT_COLOR" - 'critical' 'white' - ) - typeset -AH hdd_usage_backcolors - hdd_usage_backcolors=( - 'normal' $DEFAULT_COLOR - 'warning' 'yellow' - 'critical' 'red' - ) - - local disk_usage="${$(\df -P . | sed -n '2p' | awk '{ print $5 }')%%\%}" - - if [ "$disk_usage" -ge "$POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL" ]; then - current_state='warning' - if [ "$disk_usage" -ge "$POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL" ]; then - current_state='critical' - fi - else - if [[ "$POWERLEVEL9K_DISK_USAGE_ONLY_WARNING" == true ]]; then - current_state='' - return - fi - current_state='normal' - fi - - local message="${disk_usage}%%" - - # Draw the prompt_segment - if [[ -n $disk_usage ]]; then - "$1_prompt_segment" "${0}_${current_state}" "$2" "${hdd_usage_backcolors[$current_state]}" "${hdd_usage_forecolors[$current_state]}" "$message" 'DISK_ICON' - fi -} - -################################################################ -# Segment that displays the battery status in levels and colors -prompt_battery() { - # The battery can have four different states - default to 'unknown'. - local current_state='unknown' - typeset -AH battery_states - battery_states=( - 'low' 'red' - 'charging' 'yellow' - 'charged' 'green' - 'disconnected' "$DEFAULT_COLOR_INVERTED" - ) - # Set default values if the user did not configure them - set_default POWERLEVEL9K_BATTERY_LOW_THRESHOLD 10 - - if [[ $OS =~ OSX && -f /usr/bin/pmset && -x /usr/bin/pmset ]]; then - # obtain battery information from system - local raw_data="$(pmset -g batt | awk 'FNR==2{print}')" - # return if there is no battery on system - [[ -z $(echo $raw_data | grep "InternalBattery") ]] && return - - # Time remaining on battery operation (charging/discharging) - local tstring=$(echo $raw_data | awk -F ';' '{print $3}' | awk '{print $1}') - # If time has not been calculated by system yet - [[ $tstring =~ '(\(no|not)' ]] && tstring="..." - - # percent of battery charged - typeset -i 10 bat_percent - bat_percent=$(echo $raw_data | grep -o '[0-9]*%' | sed 's/%//') - - local remain="" - # Logic for string output - case $(echo $raw_data | awk -F ';' '{print $2}' | awk '{$1=$1};1') in - # for a short time after attaching power, status will be 'AC attached;' - 'charging'|'finishing charge'|'AC attached') - current_state="charging" - remain=" ($tstring)" - ;; - 'discharging') - [[ $bat_percent -lt $POWERLEVEL9K_BATTERY_LOW_THRESHOLD ]] && current_state="low" || current_state="disconnected" - remain=" ($tstring)" - ;; - *) - current_state="charged" - ;; - esac - fi - - if [[ "$OS" == 'Linux' ]] || [[ "$OS" == 'Android' ]]; then - local sysp="/sys/class/power_supply" - - # Reported BAT0 or BAT1 depending on kernel version - [[ -a $sysp/BAT0 ]] && local bat=$sysp/BAT0 - [[ -a $sysp/BAT1 ]] && local bat=$sysp/BAT1 - - # Android-related - # Tested on: Moto G falcon (CM 13.0) - [[ -a $sysp/battery ]] && local bat=$sysp/battery - - # Return if no battery found - [[ -z $bat ]] && return - local capacity=$(cat $bat/capacity) - local battery_status=$(cat $bat/status) - [[ $capacity -gt 100 ]] && local bat_percent=100 || local bat_percent=$capacity - [[ $battery_status =~ Charging || $battery_status =~ Full ]] && local connected=true - if [[ -z $connected ]]; then - [[ $bat_percent -lt $POWERLEVEL9K_BATTERY_LOW_THRESHOLD ]] && current_state="low" || current_state="disconnected" - else - [[ $bat_percent =~ 100 ]] && current_state="charged" - [[ $bat_percent -lt 100 ]] && current_state="charging" - fi - if [[ -f /usr/bin/acpi ]]; then - local time_remaining=$(acpi | awk '{ print $5 }') - if [[ $time_remaining =~ rate ]]; then - local tstring="..." - elif [[ $time_remaining =~ "[[:digit:]]+" ]]; then - local tstring=${(f)$(date -u -d "$(echo $time_remaining)" +%k:%M 2> /dev/null)} - fi - fi - [[ -n $tstring ]] && local remain=" ($tstring)" - fi - - local message - # Default behavior: Be verbose! - set_default POWERLEVEL9K_BATTERY_VERBOSE true - if [[ "$POWERLEVEL9K_BATTERY_VERBOSE" == true ]]; then - message="$bat_percent%%$remain" - else - message="$bat_percent%%" - fi - - # override default icon if we are using battery stages - if [[ -n "$POWERLEVEL9K_BATTERY_STAGES" ]]; then - local segment=$(( 100.0 / (${#POWERLEVEL9K_BATTERY_STAGES} - 1 ) )) - if [[ $segment > 1 ]]; then - local offset=$(( ($bat_percent / $segment) + 1 )) - # check if the stages are in an array or a string - [[ "${(t)POWERLEVEL9K_BATTERY_STAGES}" =~ "array" ]] && POWERLEVEL9K_BATTERY_ICON="$POWERLEVEL9K_BATTERY_STAGES[$offset]" || POWERLEVEL9K_BATTERY_ICON=${POWERLEVEL9K_BATTERY_STAGES:$offset:1} - fi - fi - # return if POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD is set and the battery percentage is greater or equal - if [[ -v "POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD" && "${bat_percent}" -ge $POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]]; then - return - fi - - # override the default color if we are using a color level array - if [[ -n "$POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND" ]] && [[ "${(t)POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND}" =~ "array" ]]; then - local segment=$(( 100.0 / (${#POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND} - 1 ) )) - local offset=$(( ($bat_percent / $segment) + 1 )) - "$1_prompt_segment" "$0_${current_state}" "$2" "${POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND[$offset]}" "${battery_states[$current_state]}" "${message}" "BATTERY_ICON" - else - # Draw the prompt_segment - "$1_prompt_segment" "$0_${current_state}" "$2" "${DEFAULT_COLOR}" "${battery_states[$current_state]}" "${message}" "BATTERY_ICON" - fi -} - -################################################################ -# Public IP segment -# Parameters: -# * $1 Alignment: string - left|right -# * $2 Index: integer -# * $3 Joined: bool - If the segment should be joined -prompt_public_ip() { - # set default values for segment - set_default POWERLEVEL9K_PUBLIC_IP_TIMEOUT "300" - set_default POWERLEVEL9K_PUBLIC_IP_NONE "" - set_default POWERLEVEL9K_PUBLIC_IP_FILE "/tmp/p9k_public_ip" - set_default POWERLEVEL9K_PUBLIC_IP_HOST "http://ident.me" - defined POWERLEVEL9K_PUBLIC_IP_METHODS || POWERLEVEL9K_PUBLIC_IP_METHODS=(dig curl wget) - - # Do we need a fresh IP? - local refresh_ip=false - if [[ -f $POWERLEVEL9K_PUBLIC_IP_FILE ]]; then - typeset -i timediff - # if saved IP is more than - if [[ "$OS" == "OSX" ]]; then - timediff=$(($(date +%s) - $(stat -f "%m" $POWERLEVEL9K_PUBLIC_IP_FILE))) - else - timediff=$(($(date +%s) - $(date -r $POWERLEVEL9K_PUBLIC_IP_FILE +%s))) - fi - [[ $timediff -gt $POWERLEVEL9K_PUBLIC_IP_TIMEOUT ]] && refresh_ip=true - # If tmp file is empty get a fresh IP - [[ -z $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) ]] && refresh_ip=true - [[ -n $POWERLEVEL9K_PUBLIC_IP_NONE ]] && [[ $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) =~ "$POWERLEVEL9K_PUBLIC_IP_NONE" ]] && refresh_ip=true - else - touch $POWERLEVEL9K_PUBLIC_IP_FILE && refresh_ip=true - fi - - # grab a fresh IP if needed - local fresh_ip - if [[ $refresh_ip =~ true && -w $POWERLEVEL9K_PUBLIC_IP_FILE ]]; then - for method in "${POWERLEVEL9K_PUBLIC_IP_METHODS[@]}"; do - case $method in - 'dig') - fresh_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com 2> /dev/null)" - [[ "$fresh_ip" =~ ^\; ]] && unset fresh_ip - ;; - 'curl') - fresh_ip="$(curl --max-time 10 -w '\n' "$POWERLEVEL9K_PUBLIC_IP_HOST" 2> /dev/null)" - ;; - 'wget') - fresh_ip="$(wget -T 10 -qO- "$POWERLEVEL9K_PUBLIC_IP_HOST" 2> /dev/null)" - ;; - esac - # If we found a fresh IP, break loop. - if [[ -n "${fresh_ip}" ]]; then - break; - fi - done - - # write IP to tmp file or clear tmp file if an IP was not retrieved - # Redirection with `>!`. From the manpage: Same as >, except that the file - # is truncated to zero length if it exists, even if CLOBBER is unset. - # If the file already exists, and a simple `>` redirection and CLOBBER - # unset, ZSH will produce an error. - [[ -n "${fresh_ip}" ]] && echo $fresh_ip >! $POWERLEVEL9K_PUBLIC_IP_FILE || echo $POWERLEVEL9K_PUBLIC_IP_NONE >! $POWERLEVEL9K_PUBLIC_IP_FILE - fi - - # read public IP saved to tmp file - local public_ip="$(cat $POWERLEVEL9K_PUBLIC_IP_FILE)" - - # Draw the prompt segment - if [[ -n $public_ip ]]; then - icon='PUBLIC_IP_ICON' - # Check VPN is on if VPN interface is set - if [[ -n $POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE ]]; then - for vpn_iface in $(/sbin/ifconfig | grep -e ^"$POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE" | cut -d":" -f1) - do - icon='VPN_ICON' - break - done - fi - $1_prompt_segment "$0" "$2" "$DEFAULT_COLOR" "$DEFAULT_COLOR_INVERTED" "${public_ip}" "$icon" - fi -} - -################################################################ -# Context: user@hostname (who am I and where am I) -# Note that if $DEFAULT_USER is not set, this prompt segment will always print -set_default POWERLEVEL9K_ALWAYS_SHOW_CONTEXT false -set_default POWERLEVEL9K_ALWAYS_SHOW_USER false -set_default POWERLEVEL9K_CONTEXT_TEMPLATE "%n@%m" -prompt_context() { - local current_state="DEFAULT" - typeset -AH context_states - context_states=( - "ROOT" "yellow" - "SUDO" "yellow" - "DEFAULT" "yellow" - "REMOTE" "yellow" - "REMOTE_SUDO" "yellow" - ) - - local content="" - - if [[ "$POWERLEVEL9K_ALWAYS_SHOW_CONTEXT" == true ]] || [[ "$(whoami)" != "$DEFAULT_USER" ]] || [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then - content="${POWERLEVEL9K_CONTEXT_TEMPLATE}" - elif [[ "$POWERLEVEL9K_ALWAYS_SHOW_USER" == true ]]; then - content="$(whoami)" - else - return - fi - - if [[ $(print -P "%#") == '#' ]]; then - current_state="ROOT" - elif [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then - if sudo -n true 2>/dev/null; then - current_state="REMOTE_SUDO" - else - current_state="REMOTE" - fi - elif sudo -n true 2>/dev/null; then - current_state="SUDO" - fi - - "$1_prompt_segment" "${0}_${current_state}" "$2" "$DEFAULT_COLOR" "${context_states[$current_state]}" "${content}" -} - -################################################################ -# User: user (who am I) -# Note that if $DEFAULT_USER is not set, this prompt segment will always print -set_default POWERLEVEL9K_USER_TEMPLATE "%n" -prompt_user() { - local current_state="DEFAULT" - typeset -AH user_state - if [[ "$POWERLEVEL9K_ALWAYS_SHOW_USER" == true ]] || [[ "$(whoami)" != "$DEFAULT_USER" ]]; then - if [[ $(print -P "%#") == '#' ]]; then - user_state=( - "STATE" "ROOT" - "CONTENT" "${POWERLEVEL9K_USER_TEMPLATE}" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "ROOT_ICON" - ) - elif sudo -n true 2>/dev/null; then - user_state=( - "STATE" "SUDO" - "CONTENT" "${POWERLEVEL9K_USER_TEMPLATE}" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "SUDO_ICON" - ) - else - user_state=( - "STATE" "DEFAULT" - "CONTENT" "$(whoami)" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "USER_ICON" - ) - fi - "$1_prompt_segment" "${0}_${user_state[STATE]}" "$2" "${user_state[BACKGROUND_COLOR]}" "${user_state[FOREGROUND_COLOR]}" "${user_state[CONTENT]}" "${user_state[VISUAL_IDENTIFIER]}" - fi -} - -################################################################ -# Host: machine (where am I) -set_default POWERLEVEL9K_HOST_TEMPLATE "%m" -prompt_host() { - local current_state="LOCAL" - typeset -AH host_state - if [[ -n "$SSH_CLIENT" ]] || [[ -n "$SSH_TTY" ]]; then - host_state=( - "STATE" "REMOTE" - "CONTENT" "${POWERLEVEL9K_HOST_TEMPLATE}" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "SSH_ICON" - ) - else - host_state=( - "STATE" "LOCAL" - "CONTENT" "${POWERLEVEL9K_HOST_TEMPLATE}" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "HOST_ICON" - ) - fi - "$1_prompt_segment" "$0_${host_state[STATE]}" "$2" "${host_state[BACKGROUND_COLOR]}" "${host_state[FOREGROUND_COLOR]}" "${host_state[CONTENT]}" "${host_state[VISUAL_IDENTIFIER]}" -} - -################################################################ -# The 'custom` prompt provides a way for users to invoke commands and display -# the output in a segment. -prompt_custom() { - local command=POWERLEVEL9K_CUSTOM_$3:u - local segment_content="$(eval ${(P)command})" - - if [[ -n $segment_content ]]; then - "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$segment_content" - fi -} - -################################################################ -# Display the duration the command needed to run. -prompt_command_execution_time() { - set_default POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD 3 - set_default POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION 2 - - # Print time in human readable format - # For that use `strftime` and convert - # the duration (float) to an seconds - # (integer). - # See http://unix.stackexchange.com/a/89748 - local humanReadableDuration - if (( _P9K_COMMAND_DURATION > 3600 )); then - humanReadableDuration=$(TZ=GMT; strftime '%H:%M:%S' $(( int(rint(_P9K_COMMAND_DURATION)) ))) - elif (( _P9K_COMMAND_DURATION > 60 )); then - humanReadableDuration=$(TZ=GMT; strftime '%M:%S' $(( int(rint(_P9K_COMMAND_DURATION)) ))) - else - # If the command executed in seconds, print as float. - # Convert to float - if [[ "${POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION}" == "0" ]]; then - # If user does not want microseconds, then we need to convert - # the duration to an integer. - typeset -i humanReadableDuration - else - typeset -F ${POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION} humanReadableDuration - fi - humanReadableDuration=$_P9K_COMMAND_DURATION - fi - - if (( _P9K_COMMAND_DURATION >= POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD )); then - "$1_prompt_segment" "$0" "$2" "red" "yellow1" "${humanReadableDuration}" 'EXECUTION_TIME_ICON' - fi -} - -################################################################ -# Dir: current working directory -# Parameters: -# * $1 Alignment: string - left|right -# * $2 Index: integer -set_default POWERLEVEL9K_DIR_PATH_SEPARATOR "/" -set_default POWERLEVEL9K_HOME_FOLDER_ABBREVIATION "~" -set_default POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD false -prompt_dir() { - # using $PWD instead of "$(print -P '%~')" to allow use of POWERLEVEL9K_DIR_PATH_ABSOLUTE - local current_path=$PWD # WAS: local current_path="$(print -P '%~')" - # check if the user wants to use absolute paths or "~" paths - [[ ${(L)POWERLEVEL9K_DIR_PATH_ABSOLUTE} != "true" ]] && current_path=${current_path//$HOME/"~"} - # declare all local variables - local paths directory test_dir test_dir_length trunc_path threshhold - # if we are not in "~" or "/", split the paths into an array and exclude "~" - (( ${#current_path} > 1 )) && paths=(${(s:/:)${current_path//"~\/"/}}) || paths=() - # only run the code if SHORTEN_DIR_LENGTH is set, or we are using the two strategies that don't rely on it. - if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_with_folder_marker" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_to_last" ]]; then - set_default POWERLEVEL9K_SHORTEN_DELIMITER "\u2026" - # convert delimiter from unicode to literal character, so that we can get the correct length later - local delim=$(echo -n $POWERLEVEL9K_SHORTEN_DELIMITER) - - case "$POWERLEVEL9K_SHORTEN_STRATEGY" in - truncate_absolute_chars) - if [ ${#current_path} -gt $(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#POWERLEVEL9K_SHORTEN_DELIMITER} )) ]; then - current_path=$POWERLEVEL9K_SHORTEN_DELIMITER${current_path:(-POWERLEVEL9K_SHORTEN_DIR_LENGTH)} - fi - ;; - truncate_middle) - # truncate characters from the middle of the path - current_path=$(truncatePath $current_path $POWERLEVEL9K_SHORTEN_DIR_LENGTH $POWERLEVEL9K_SHORTEN_DELIMITER "middle") - ;; - truncate_from_right) - # truncate characters from the right of the path - current_path=$(truncatePath "$current_path" $POWERLEVEL9K_SHORTEN_DIR_LENGTH $POWERLEVEL9K_SHORTEN_DELIMITER) - ;; - truncate_absolute) - # truncate all characters except the last POWERLEVEL9K_SHORTEN_DIR_LENGTH characters - if [ ${#current_path} -gt $(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#POWERLEVEL9K_SHORTEN_DELIMITER} )) ]; then - current_path=$POWERLEVEL9K_SHORTEN_DELIMITER${current_path:(-POWERLEVEL9K_SHORTEN_DIR_LENGTH)} - fi - ;; - truncate_to_last) - # truncate all characters before the current directory - current_path=${current_path##*/} - ;; - truncate_to_first_and_last) - if (( ${#current_path} > 1 )) && (( ${POWERLEVEL9K_SHORTEN_DIR_LENGTH} > 0 )); then - threshhold=$(( ${POWERLEVEL9K_SHORTEN_DIR_LENGTH} * 2)) - # if we are in "~", add it back into the paths array - [[ $current_path == '~'* ]] && paths=("~" "${paths[@]}") - if (( ${#paths} > $threshhold )); then - local num=$(( ${#paths} - ${POWERLEVEL9K_SHORTEN_DIR_LENGTH} )) - # repace the middle elements - for (( i=$POWERLEVEL9K_SHORTEN_DIR_LENGTH; i<$num; i++ )); do - paths[$i+1]=$POWERLEVEL9K_SHORTEN_DELIMITER - done - [[ $current_path != '~'* ]] && current_path="/" || current_path="" - current_path+="${(j:/:)paths}" - fi - fi - ;; - truncate_to_unique) - # for each parent path component find the shortest unique beginning - # characters sequence. Source: https://stackoverflow.com/a/45336078 - if (( ${#current_path} > 1 )); then # root and home are exceptions and won't have paths - local matching - local cur_path='/' - [[ $current_path != "~"* ]] && trunc_path='/' || trunc_path='' - for directory in ${paths[@]}; do - test_dir='' - for (( i=0; i<${#directory}; i++ )); do - test_dir+="${directory:$i:1}" - matching=("$cur_path"/"$test_dir"*/) - if [[ ${#matching[@]} -eq 1 ]]; then - break - fi - done - trunc_path+="$test_dir/" - cur_path+="$directory/" - done - [[ $current_path == "~"* ]] && trunc_path="~/$trunc_path" - current_path="${trunc_path: : -1}" - fi - ;; - truncate_with_folder_marker) - if (( ${#paths} > 0 )); then # root and home are exceptions and won't have paths, so skip this - local last_marked_folder marked_folder - set_default POWERLEVEL9K_SHORTEN_FOLDER_MARKER ".shorten_folder_marker" - - # Search for the folder marker in the parent directories and - # buildup a pattern that is removed from the current path - # later on. - for marked_folder in $(upsearch $POWERLEVEL9K_SHORTEN_FOLDER_MARKER); do - if [[ "$marked_folder" == "/" ]]; then - # If we reached root folder, stop upsearch. - trunc_path="/" - elif [[ "$marked_folder" == "$HOME" ]]; then - # If we reached home folder, stop upsearch. - trunc_path="~" - elif [[ "${marked_folder%/*}" == $last_marked_folder ]]; then - trunc_path="${trunc_path%/}/${marked_folder##*/}" - else - trunc_path="${trunc_path%/}/$POWERLEVEL9K_SHORTEN_DELIMITER/${marked_folder##*/}" - fi - last_marked_folder=$marked_folder - done - - # Replace the shortest possible match of the marked folder from - # the current path. - current_path=$trunc_path${current_path#${last_marked_folder}*} - fi - ;; - truncate_with_package_name) - local name repo_path package_path current_dir zero - - # Get the path of the Git repo, which should have the package.json file - if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == "true" ]]; then - # Get path from the root of the git repository to the current dir - local gitPath=$(git rev-parse --show-prefix) - # Remove trailing slash from git path, so that we can - # remove that git path from the pwd. - gitPath=${gitPath%/} - package_path=${$(pwd)%%$gitPath} - # Remove trailing slash - package_path=${package_path%/} - elif [[ $(git rev-parse --is-inside-git-dir 2> /dev/null) == "true" ]]; then - package_path=${$(pwd)%%/.git*} - fi - - # Replace the shortest possible match of the marked folder from - # the current path. Remove the amount of characters up to the - # folder marker from the left. Count only the visible characters - # in the path (this is done by the "zero" pattern; see - # http://stackoverflow.com/a/40855342/5586433). - local zero='%([BSUbfksu]|([FB]|){*})' - trunc_path=$(pwd) - # Then, find the length of the package_path string, and save the - # subdirectory path as a substring of the current directory's path from 0 - # to the length of the package path's string - subdirectory_path=$(truncatePath "${trunc_path:${#${(S%%)package_path//$~zero/}}}" $POWERLEVEL9K_SHORTEN_DIR_LENGTH $POWERLEVEL9K_SHORTEN_DELIMITER) - # Parse the 'name' from the package.json; if there are any problems, just - # print the file path - defined POWERLEVEL9K_DIR_PACKAGE_FILES || POWERLEVEL9K_DIR_PACKAGE_FILES=(package.json composer.json) - - local pkgFile="unknown" - for file in "${POWERLEVEL9K_DIR_PACKAGE_FILES[@]}"; do - if [[ -f "${package_path}/${file}" ]]; then - pkgFile="${package_path}/${file}" - break; - fi - done - - local packageName=$(jq '.name' ${pkgFile} 2> /dev/null \ - || node -e 'console.log(require(process.argv[1]).name);' ${pkgFile} 2>/dev/null \ - || cat "${pkgFile}" 2> /dev/null | grep -m 1 "\"name\"" | awk -F ':' '{print $2}' | awk -F '"' '{print $2}' 2>/dev/null \ - ) - if [[ -n "${packageName}" ]]; then - # Instead of printing out the full path, print out the name of the package - # from the package.json and append the current subdirectory - current_path="`echo $packageName | tr -d '"'`$subdirectory_path" - fi - ;; - *) - if [[ $current_path != "~" ]]; then - current_path="$(print -P "%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c")" - fi - ;; - esac - fi - - # save state of path for highlighting and bold options - local path_opt=$current_path - - typeset -AH dir_states - dir_states=( - "DEFAULT" "FOLDER_ICON" - "HOME" "HOME_ICON" - "HOME_SUBFOLDER" "HOME_SUB_ICON" - "NOT_WRITABLE" "LOCK_ICON" - "ETC" "ETC_ICON" - ) - local state_path="$(print -P '%~')" - local current_state="DEFAULT" - if [[ $state_path == '/etc'* ]]; then - current_state='ETC' - elif [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == true && ! -w "$PWD" ]]; then - current_state="NOT_WRITABLE" - elif [[ $state_path == '~' ]]; then - current_state="HOME" - elif [[ $state_path == '~'* ]]; then - current_state="HOME_SUBFOLDER" - fi - - # declare variables used for bold and state colors - local bld_on bld_off dir_state_foreground dir_state_user_foreground - # test if user wants the last directory printed in bold - if [[ "${(L)POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD}" == "true" ]]; then - bld_on="%B" - bld_off="%b" - else - bld_on="" - bld_off="" - fi - # determine is the user has set a last directory color - local dir_state_user_foreground=POWERLEVEL9K_DIR_${current_state}_FOREGROUND - local dir_state_foreground=${(P)dir_state_user_foreground} - [[ -z ${dir_state_foreground} ]] && dir_state_foreground="${DEFAULT_COLOR}" - - local dir_name base_name - # use ZSH substitution to get the dirname and basename instead of calling external functions - dir_name=${path_opt%/*} - base_name=${path_opt##*/} - - # if the user wants the last directory colored... - if [[ -n ${POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND} ]]; then - # it the path is "/" or "~" - if [[ $path_opt == "/" || $path_opt == "~" ]]; then - current_path="${bld_on}%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${current_path}${bld_off}" - else # has a subfolder - # test if dirname != basename - they are equal if we use truncate_to_last or truncate_absolute - if [[ $dir_name != $base_name ]]; then - current_path="${dir_name}/${bld_on}%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${base_name}${bld_off}" - else - current_path="${bld_on}%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${base_name}${bld_off}" - fi - fi - else # no coloring - # it the path is "/" or "~" - if [[ $path_opt == "/" || $path_opt == "~" ]]; then - current_path="${bld_on}${current_path}${bld_off}" - else # has a subfolder - # test if dirname != basename - they are equal if we use truncate_to_last or truncate_absolute - if [[ $dir_name != $base_name ]]; then - current_path="${dir_name}/${bld_on}${base_name}${bld_off}" - else - current_path="${bld_on}${base_name}${bld_off}" - fi - fi - fi - - # check if we need to omit the first character and only do it if we are not in "~" or "/" - if [[ "${POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER}" == "true" && $path_opt != "/" && $path_opt != "~" ]]; then - current_path="${current_path[2,-1]}" - fi - - # check if the user wants the separator colored. - if [[ -n ${POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND} && $path_opt != "/" ]]; then - # because this contains color changing codes, it is easier to set a variable for what should be replaced - local repl="%F{$POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND}/%F{$dir_state_foreground}" - # escape the / with a \ - current_path=${current_path//\//$repl} - fi - - if [[ "${POWERLEVEL9K_DIR_PATH_SEPARATOR}" != "/" && $path_opt != "/" ]]; then - current_path=${current_path//\//$POWERLEVEL9K_DIR_PATH_SEPARATOR} - fi - - if [[ "${POWERLEVEL9K_HOME_FOLDER_ABBREVIATION}" != "~" && ! "${(L)POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER}" == "true" ]]; then - # use :s to only replace the first occurance - current_path=${current_path:s/~/$POWERLEVEL9K_HOME_FOLDER_ABBREVIATION} - fi - - "$1_prompt_segment" "$0_${current_state}" "$2" "blue" "$DEFAULT_COLOR" "${current_path}" "${dir_states[$current_state]}" -} - -################################################################ -# Docker machine -prompt_docker_machine() { - local docker_machine="$DOCKER_MACHINE_NAME" - - if [[ -n "$docker_machine" ]]; then - "$1_prompt_segment" "$0" "$2" "magenta" "$DEFAULT_COLOR" "$docker_machine" 'SERVER_ICON' - fi -} - -################################################################ -# GO prompt -prompt_go_version() { - local go_version - local go_path - go_version=$(go version 2>/dev/null | sed -E "s/.*(go[0-9.]*).*/\1/") - go_path=$(go env GOPATH 2>/dev/null) - - if [[ -n "$go_version" && "${PWD##$go_path}" != "$PWD" ]]; then - "$1_prompt_segment" "$0" "$2" "green" "grey93" "$go_version" "GO_ICON" - fi -} - -################################################################ -# Command number (in local history) -prompt_history() { - "$1_prompt_segment" "$0" "$2" "grey50" "$DEFAULT_COLOR" '%h' -} - -################################################################ -# Detection for virtualization (systemd based systems only) -prompt_detect_virt() { - if ! command -v systemd-detect-virt > /dev/null; then - return - fi - local virt=$(systemd-detect-virt) - if [[ "$virt" == "none" ]]; then - if [[ "$(ls -di / | grep -o 2)" != "2" ]]; then - virt="chroot" - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" - else - ; - fi - else - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" - fi -} - -################################################################ -# Test icons -prompt_icons_test() { - for key in ${(@k)icons}; do - # The lower color spectrum in ZSH makes big steps. Choosing - # the next color has enough contrast to read. - local random_color=$((RANDOM % 8)) - local next_color=$((random_color+1)) - "$1_prompt_segment" "$0" "$2" "$random_color" "$next_color" "$key" "$key" - done -} - -################################################################ -# Segment to display the current IP address -prompt_ip() { - if [[ "$OS" == "OSX" ]]; then - if defined POWERLEVEL9K_IP_INTERFACE; then - # Get the IP address of the specified interface. - ip=$(ipconfig getifaddr "$POWERLEVEL9K_IP_INTERFACE") - else - local interfaces callback - # Get network interface names ordered by service precedence. - interfaces=$(networksetup -listnetworkserviceorder | grep -o "Device:\s*[a-z0-9]*" | grep -o -E '[a-z0-9]*$') - callback='ipconfig getifaddr $item' - - ip=$(getRelevantItem "$interfaces" "$callback") - fi - else - if defined POWERLEVEL9K_IP_INTERFACE; then - # Get the IP address of the specified interface. - ip=$(ip -4 a show "$POWERLEVEL9K_IP_INTERFACE" | grep -o "inet\s*[0-9.]*" | grep -o "[0-9.]*") - else - local interfaces callback - # Get all network interface names that are up - interfaces=$(ip link ls up | grep -o -E ":\s+[a-z0-9]+:" | grep -v "lo" | grep -o "[a-z0-9]*") - callback='ip -4 a show $item | grep -o "inet\s*[0-9.]*" | grep -o "[0-9.]*"' - - ip=$(getRelevantItem "$interfaces" "$callback") - fi - fi - - "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'NETWORK_ICON' -} - -################################################################ -# Segment to display if VPN is active -set_default POWERLEVEL9K_VPN_IP_INTERFACE "tun" -# prompt if vpn active -prompt_vpn_ip() { - for vpn_iface in $(/sbin/ifconfig | grep -e ^"$POWERLEVEL9K_VPN_IP_INTERFACE" | cut -d":" -f1) - do - ip=$(/sbin/ifconfig "$vpn_iface" | grep -o "inet\s.*" | cut -d' ' -f2) - "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'VPN_ICON' - done -} - -################################################################ -# Segment to display laravel version -prompt_laravel_version() { - local laravel_version="$(php artisan --version 2>/dev/null)" - if [[ -n "${laravel_version}" ]]; then - # Remove unrelevant infos - laravel_version="${laravel_version//Laravel Framework version /}" - - "$1_prompt_segment" "$0" "$2" "maroon" "white" "${laravel_version}" 'LARAVEL_ICON' - fi -} - -################################################################ -# Segment to display load -set_default POWERLEVEL9K_LOAD_WHICH 5 -prompt_load() { - # The load segment can have three different states - local current_state="unknown" - local load_select=2 - local load_avg - local cores - - typeset -AH load_states - load_states=( - 'critical' 'red' - 'warning' 'yellow' - 'normal' 'green' - ) - - case "$POWERLEVEL9K_LOAD_WHICH" in - 1) - load_select=1 - ;; - 5) - load_select=2 - ;; - 15) - load_select=3 - ;; - esac - - case "$OS" in - OSX|BSD) - load_avg=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | sed -n ${load_select}p) - if [[ "$OS" == "OSX" ]]; then - cores=$(sysctl -n hw.logicalcpu) - else - cores=$(sysctl -n hw.ncpu) - fi - ;; - *) - load_avg=$(cut -d" " -f${load_select} /proc/loadavg) - cores=$(nproc) - esac - - # Replace comma - load_avg=${load_avg//,/.} - - if [[ "$load_avg" -gt $((${cores} * 0.7)) ]]; then - current_state="critical" - elif [[ "$load_avg" -gt $((${cores} * 0.5)) ]]; then - current_state="warning" - else - current_state="normal" - fi - - "$1_prompt_segment" "${0}_${current_state}" "$2" "${load_states[$current_state]}" "$DEFAULT_COLOR" "$load_avg" 'LOAD_ICON' -} - -################################################################ -# Segment to diplay Node version -prompt_node_version() { - local node_version=$(node -v 2>/dev/null) - [[ -z "${node_version}" ]] && return - - "$1_prompt_segment" "$0" "$2" "green" "white" "${node_version:1}" 'NODE_ICON' -} - -################################################################ -# Segment to display Node version from NVM -# Only prints the segment if different than the default value -prompt_nvm() { - local node_version nvm_default - (( $+functions[nvm_version] )) || return - - node_version=$(nvm_version current) - [[ -z "${node_version}" || ${node_version} == "none" ]] && return - - nvm_default=$(nvm_version default) - [[ "$node_version" =~ "$nvm_default" ]] && return - - $1_prompt_segment "$0" "$2" "magenta" "black" "${node_version:1}" 'NODE_ICON' -} - -################################################################ -# Segment to display NodeEnv -prompt_nodeenv() { - local nodeenv_path="$NODE_VIRTUAL_ENV" - if [[ -n "$nodeenv_path" && "$NODE_VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then - local info="$(node -v)[$(basename "$nodeenv_path")]" - "$1_prompt_segment" "$0" "$2" "black" "green" "$info" 'NODE_ICON' - fi -} - -################################################################ -# Segment to print a little OS icon -prompt_os_icon() { - "$1_prompt_segment" "$0" "$2" "black" "white" "$OS_ICON" -} - -################################################################ -# Segment to display PHP version number -prompt_php_version() { - local php_version - php_version=$(php -v 2>&1 | grep -oe "^PHP\s*[0-9.]*") - - if [[ -n "$php_version" ]]; then - "$1_prompt_segment" "$0" "$2" "fuchsia" "grey93" "$php_version" - fi -} - -################################################################ -# Segment to display free RAM and used Swap -prompt_ram() { - local base='' - local ramfree=0 - if [[ "$OS" == "OSX" ]]; then - # Available = Free + Inactive - # See https://support.apple.com/en-us/HT201538 - ramfree=$(vm_stat | grep "Pages free" | grep -o -E '[0-9]+') - ramfree=$((ramfree + $(vm_stat | grep "Pages inactive" | grep -o -E '[0-9]+'))) - # Convert pages into Bytes - ramfree=$(( ramfree * 4096 )) - else - if [[ "$OS" == "BSD" ]]; then - ramfree=$(grep 'avail memory' /var/run/dmesg.boot | awk '{print $4}') - else - ramfree=$(grep -o -E "MemAvailable:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - base='K' - fi - fi - - "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$ramfree" $base)" 'RAM_ICON' -} - - -set_default POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW false -# rbenv information -prompt_rbenv() { - if command which rbenv 2>/dev/null >&2; then - local rbenv_version_name="$(rbenv version-name)" - local rbenv_global="$(rbenv global)" - - # Don't show anything if the current Ruby is the same as the global Ruby - # unless `POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW` is set. - if [[ $rbenv_version_name == $rbenv_global && "$POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW" = false ]]; then - return - fi - - "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON' - fi -} - -################################################################ -# Segment to display chruby information -# see https://github.com/postmodern/chruby/issues/245 for chruby_auto issue with ZSH -prompt_chruby() { - # Uses $RUBY_VERSION and $RUBY_ENGINE set by chruby - set_default POWERLEVEL9K_CHRUBY_SHOW_VERSION true - set_default POWERLEVEL9K_CHRUBY_SHOW_ENGINE true - local chruby_label="" - - if [[ "$POWERLEVEL9K_CHRUBY_SHOW_ENGINE" == true ]]; then - chruby_label+="$RUBY_ENGINE " - fi - if [[ "$POWERLEVEL9K_CHRUBY_SHOW_VERSION" == true ]]; then - chruby_label+="$RUBY_VERSION" - fi - - # Truncate trailing spaces - chruby_label="${chruby_label%"${chruby_label##*[![:space:]]}"}" - - # Don't show anything if the chruby did not change the default ruby - if [[ "$RUBY_ENGINE" != "" ]]; then - "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "${chruby_label}" 'RUBY_ICON' - fi -} - -################################################################ -# Segment to print an icon if user is root. -prompt_root_indicator() { - if [[ "$UID" -eq 0 ]]; then - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "" 'ROOT_ICON' - fi -} - -################################################################ -# Segment to display Rust version number -prompt_rust_version() { - local rust_version - rust_version=$(command rustc --version 2>/dev/null) - # Remove "rustc " (including the whitespace) from the beginning - # of the version string and remove everything after the next - # whitespace. This way we'll end up with only the version. - rust_version=${${rust_version/rustc /}%% *} - - if [[ -n "$rust_version" ]]; then - "$1_prompt_segment" "$0" "$2" "darkorange" "$DEFAULT_COLOR" "$rust_version" 'RUST_ICON' - fi -} - -# RSpec test ratio -prompt_rspec_stats() { - if [[ (-d app && -d spec) ]]; then - local code_amount tests_amount - code_amount=$(ls -1 app/**/*.rb | wc -l) - tests_amount=$(ls -1 spec/**/*.rb | wc -l) - - build_test_stats "$1" "$0" "$2" "$code_amount" "$tests_amount" "RSpec" 'TEST_ICON' - fi -} - -################################################################ -# Segment to display Ruby Version Manager information -prompt_rvm() { - local version_and_gemset=${rvm_env_string/ruby-} - - if [[ -n "$version_and_gemset" ]]; then - "$1_prompt_segment" "$0" "$2" "grey35" "$DEFAULT_COLOR" "$version_and_gemset" 'RUBY_ICON' - fi -} - -################################################################ -# Segment to display SSH icon when connected -prompt_ssh() { - if [[ -n "$SSH_CLIENT" ]] || [[ -n "$SSH_TTY" ]]; then - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "" 'SSH_ICON' - fi -} - -################################################################ -# Status: When an error occur, return the error code, or a cross icon if option is set -# Display an ok icon when no error occur, or hide the segment if option is set to false -# -set_default POWERLEVEL9K_STATUS_CROSS false -set_default POWERLEVEL9K_STATUS_OK true -set_default POWERLEVEL9K_STATUS_SHOW_PIPESTATUS true -set_default POWERLEVEL9K_STATUS_HIDE_SIGNAME false -# old options, retro compatibility -set_default POWERLEVEL9K_STATUS_VERBOSE true -set_default POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE false - -exit_code_or_status() { - local ec=$1 - if [[ "$POWERLEVEL9K_STATUS_HIDE_SIGNAME" = true ]]; then - echo "$ec" - elif (( ec <= 128 )); then - echo "$ec" - else - local sig=$(( ec - 128 )) - local idx=$(( sig + 1 )) - echo "SIG${signals[$idx]}(${sig})" - fi -} - -prompt_status() { - local ec_text - local ec_sum - local ec - - if [[ $POWERLEVEL9K_STATUS_SHOW_PIPESTATUS == true ]]; then - if (( $#RETVALS > 1 )); then - ec_text=$(exit_code_or_status "${RETVALS[1]}") - ec_sum=${RETVALS[1]} - else - ec_text=$(exit_code_or_status "${RETVAL}") - ec_sum=${RETVAL} - fi - - for ec in "${(@)RETVALS[2,-1]}"; do - ec_text="${ec_text}|$(exit_code_or_status "$ec")" - ec_sum=$(( $ec_sum + $ec )) - done - else - # We use RETVAL instead of the right-most RETVALS item because - # PIPE_FAIL may be set. - ec_text=$(exit_code_or_status "${RETVAL}") - ec_sum=${RETVAL} - fi - - if (( ec_sum > 0 )); then - if [[ "$POWERLEVEL9K_STATUS_CROSS" == false && "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then - "$1_prompt_segment" "$0_ERROR" "$2" "red" "yellow1" "$ec_text" 'CARRIAGE_RETURN_ICON' - else - "$1_prompt_segment" "$0_ERROR" "$2" "$DEFAULT_COLOR" "red" "" 'FAIL_ICON' - fi - elif [[ "$POWERLEVEL9K_STATUS_OK" == true ]] && [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true || "$POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE" == true ]]; then - "$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "green" "" 'OK_ICON' - fi -} - -################################################################ -# Segment to display Swap information -prompt_swap() { - local swap_used=0 - local base='' - - if [[ "$OS" == "OSX" ]]; then - local raw_swap_used - raw_swap_used=$(sysctl vm.swapusage | grep -o "used\s*=\s*[0-9,.A-Z]*" | grep -o "[0-9,.A-Z]*$") - - typeset -F 2 swap_used - swap_used=${$(echo $raw_swap_used | grep -o "[0-9,.]*")//,/.} - # Replace comma - swap_used=${swap_used//,/.} - - base=$(echo "$raw_swap_used" | grep -o "[A-Z]*$") - else - swap_total=$(grep -o -E "SwapTotal:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - swap_free=$(grep -o -E "SwapFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - swap_used=$(( swap_total - swap_free )) - base='K' - fi - - "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$swap_used" $base)" 'SWAP_ICON' -} - -################################################################ -# Symfony2-PHPUnit test ratio -prompt_symfony2_tests() { - if [[ (-d src && -d app && -f app/AppKernel.php) ]]; then - local code_amount tests_amount - code_amount=$(ls -1 src/**/*.php | grep -vc Tests) - tests_amount=$(ls -1 src/**/*.php | grep -c Tests) - - build_test_stats "$1" "$0" "$2" "$code_amount" "$tests_amount" "SF2" 'TEST_ICON' - fi -} - -################################################################ -# Segment to display Symfony2-Version -prompt_symfony2_version() { - if [[ -f app/bootstrap.php.cache ]]; then - local symfony2_version - symfony2_version=$(grep " VERSION " app/bootstrap.php.cache | sed -e 's/[^.0-9]*//g') - "$1_prompt_segment" "$0" "$2" "grey35" "$DEFAULT_COLOR" "$symfony2_version" 'SYMFONY_ICON' - fi -} - -################################################################ -# Show a ratio of tests vs code -build_test_stats() { - local code_amount="$4" - local tests_amount="$5"+0.00001 - local headline="$6" - - # Set float precision to 2 digits: - typeset -F 2 ratio - local ratio=$(( (tests_amount/code_amount) * 100 )) - - (( ratio >= 75 )) && "$1_prompt_segment" "${2}_GOOD" "$3" "cyan" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6" - (( ratio >= 50 && ratio < 75 )) && "$1_prompt_segment" "$2_AVG" "$3" "yellow" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6" - (( ratio < 50 )) && "$1_prompt_segment" "$2_BAD" "$3" "red" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6" -} - -################################################################ -# System time -prompt_time() { - set_default POWERLEVEL9K_TIME_FORMAT "%D{%H:%M:%S}" - - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$POWERLEVEL9K_TIME_FORMAT" "TIME_ICON" -} - -################################################################ -# System date -prompt_date() { - set_default POWERLEVEL9K_DATE_FORMAT "%D{%d.%m.%y}" - - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$POWERLEVEL9K_DATE_FORMAT" "DATE_ICON" -} - -################################################################ -# todo.sh: shows the number of tasks in your todo.sh file -prompt_todo() { - if $(hash todo.sh 2>&-); then - count=$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }') - if [[ "$count" = <-> ]]; then - "$1_prompt_segment" "$0" "$2" "grey50" "$DEFAULT_COLOR" "$count" 'TODO_ICON' - fi - fi -} - -################################################################ -# VCS segment: shows the state of your repository, if you are in a folder under -# version control -set_default POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND "red" -# Default: Just display the first 8 characters of our changeset-ID. -set_default POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH "8" -powerlevel9k_vcs_init() { - if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then - POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH" - fi - - # Load VCS_INFO - autoload -Uz vcs_info - - VCS_WORKDIR_DIRTY=false - VCS_WORKDIR_HALF_DIRTY=false - - # The vcs segment can have three different states - defaults to 'clean'. - typeset -gAH vcs_states - vcs_states=( - 'clean' 'green' - 'modified' 'yellow' - 'untracked' 'green' - ) - - VCS_CHANGESET_PREFIX='' - if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then - VCS_CHANGESET_PREFIX="$(print_icon 'VCS_COMMIT_ICON')%0.$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH""i " - fi - - zstyle ':vcs_info:*' enable git hg svn - zstyle ':vcs_info:*' check-for-changes true - - VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%b%c%u%m" - zstyle ':vcs_info:*' formats "$VCS_DEFAULT_FORMAT" - - zstyle ':vcs_info:*' actionformats "%b %F{${POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND}}| %a%f" - - zstyle ':vcs_info:*' stagedstr " $(print_icon 'VCS_STAGED_ICON')" - zstyle ':vcs_info:*' unstagedstr " $(print_icon 'VCS_UNSTAGED_ICON')" - - defined POWERLEVEL9K_VCS_GIT_HOOKS || POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname) - zstyle ':vcs_info:git*+set-message:*' hooks $POWERLEVEL9K_VCS_GIT_HOOKS - defined POWERLEVEL9K_VCS_HG_HOOKS || POWERLEVEL9K_VCS_HG_HOOKS=(vcs-detect-changes) - zstyle ':vcs_info:hg*+set-message:*' hooks $POWERLEVEL9K_VCS_HG_HOOKS - defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(vcs-detect-changes svn-detect-changes) - zstyle ':vcs_info:svn*+set-message:*' hooks $POWERLEVEL9K_VCS_SVN_HOOKS - - # For Hg, only show the branch name - zstyle ':vcs_info:hg*:*' branchformat "$(print_icon 'VCS_BRANCH_ICON')%b" - # The `get-revision` function must be turned on for dirty-check to work for Hg - zstyle ':vcs_info:hg*:*' get-revision true - zstyle ':vcs_info:hg*:*' get-bookmarks true - zstyle ':vcs_info:hg*+gen-hg-bookmark-string:*' hooks hg-bookmarks - - # For svn, only - # TODO fix the %b (branch) format for svn. Using %b breaks - # color-encoding of the foreground for the rest of the powerline. - zstyle ':vcs_info:svn*:*' formats "$VCS_CHANGESET_PREFIX%c%u" - zstyle ':vcs_info:svn*:*' actionformats "$VCS_CHANGESET_PREFIX%c%u %F{${POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND}}| %a%f" - - if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then - zstyle ':vcs_info:*' get-revision true - fi -} - -################################################################ -# Segment to show VCS information -prompt_vcs() { - VCS_WORKDIR_DIRTY=false - VCS_WORKDIR_HALF_DIRTY=false - local current_state="" - - # Actually invoke vcs_info manually to gather all information. - vcs_info - local vcs_prompt="${vcs_info_msg_0_}" - - if [[ -n "$vcs_prompt" ]]; then - if [[ "$VCS_WORKDIR_DIRTY" == true ]]; then - # $vcs_visual_identifier gets set in +vi-vcs-detect-changes in functions/vcs.zsh, - # as we have there access to vcs_info internal hooks. - current_state='modified' - else - if [[ "$VCS_WORKDIR_HALF_DIRTY" == true ]]; then - current_state='untracked' - else - current_state='clean' - fi - fi - "$1_prompt_segment" "${0}_${(U)current_state}" "$2" "${vcs_states[$current_state]}" "$DEFAULT_COLOR" "$vcs_prompt" "$vcs_visual_identifier" - fi -} - -################################################################ -# Vi Mode: show editing mode (NORMAL|INSERT) -set_default POWERLEVEL9K_VI_INSERT_MODE_STRING "INSERT" -set_default POWERLEVEL9K_VI_COMMAND_MODE_STRING "NORMAL" -prompt_vi_mode() { - case ${KEYMAP} in - vicmd) - "$1_prompt_segment" "$0_NORMAL" "$2" "$DEFAULT_COLOR" "default" "$POWERLEVEL9K_VI_COMMAND_MODE_STRING" - ;; - main|viins|*) - if [[ -z $POWERLEVEL9K_VI_INSERT_MODE_STRING ]]; then return; fi - "$1_prompt_segment" "$0_INSERT" "$2" "$DEFAULT_COLOR" "blue" "$POWERLEVEL9K_VI_INSERT_MODE_STRING" - ;; - esac -} - -################################################################ -# Virtualenv: current working virtualenv -# More information on virtualenv (Python): -# https://virtualenv.pypa.io/en/latest/ -prompt_virtualenv() { - local virtualenv_path="$VIRTUAL_ENV" - if [[ -n "$virtualenv_path" && "$VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then - "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$(basename "$virtualenv_path")" 'PYTHON_ICON' - fi -} - -################################################################ -# pyenv: current active python version (with restrictions) -# https://github.com/pyenv/pyenv#choosing-the-python-version -prompt_pyenv() { - if [[ -n "$PYENV_VERSION" ]]; then - "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$PYENV_VERSION" 'PYTHON_ICON' - fi -} - -################################################################ -# Display openfoam information -prompt_openfoam() { - local wm_project_version="$WM_PROJECT_VERSION" - local wm_fork="$WM_FORK" - if [[ -n "$wm_project_version" ]] && [[ -z "$wm_fork" ]] ; then - "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "OF: $(basename "$wm_project_version")" - elif [[ -n "$wm_project_version" ]] && [[ -n "$wm_fork" ]] ; then - "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "F-X: $(basename "$wm_project_version")" - fi -} - -################################################################ -# Segment to display Swift version -prompt_swift_version() { - # Get the first number as this is probably the "main" version number.. - local swift_version=$(swift --version 2>/dev/null | grep -o -E "[0-9.]+" | head -n 1) - [[ -z "${swift_version}" ]] && return - - "$1_prompt_segment" "$0" "$2" "magenta" "white" "${swift_version}" 'SWIFT_ICON' -} - -################################################################ -# dir_writable: Display information about the user's permission to write in the current directory -prompt_dir_writable() { - if [[ ! -w "$PWD" ]]; then - "$1_prompt_segment" "$0_FORBIDDEN" "$2" "red" "yellow1" "" 'LOCK_ICON' - fi -} - -################################################################ -# Kubernetes Current Context/Namespace -prompt_kubecontext() { - local kubectl_version="$(kubectl version --client 2>/dev/null)" - - if [[ -n "$kubectl_version" ]]; then - # Get the current Kuberenetes context - local cur_ctx=$(kubectl config view -o=jsonpath='{.current-context}') - cur_namespace="$(kubectl config view -o=jsonpath="{.contexts[?(@.name==\"${cur_ctx}\")].context.namespace}")" - # If the namespace comes back empty set it default. - if [[ -z "${cur_namespace}" ]]; then - cur_namespace="default" - fi - - local k8s_final_text="" - - if [[ "$cur_ctx" == "$cur_namespace" ]]; then - # No reason to print out the same identificator twice - k8s_final_text="$cur_ctx" - else - k8s_final_text="$cur_ctx/$cur_namespace" - fi - - "$1_prompt_segment" "$0" "$2" "magenta" "white" "$k8s_final_text" "KUBERNETES_ICON" - fi -} - -################################################################ -# Dropbox status -prompt_dropbox() { - # The first column is just the directory, so cut it - local dropbox_status="$(dropbox-cli filestatus . | cut -d\ -f2-)" - - # Only show if the folder is tracked and dropbox is running - if [[ "$dropbox_status" != 'unwatched' && "$dropbox_status" != "isn't running!" ]]; then - # If "up to date", only show the icon - if [[ "$dropbox_status" =~ 'up to date' ]]; then - dropbox_status="" - fi - - "$1_prompt_segment" "$0" "$2" "white" "blue" "$dropbox_status" "DROPBOX_ICON" - fi -} - -# print Java version number -prompt_java_version() { - local java_version - # Stupid: Java prints its version on STDERR. - # The first version ouput will print nothing, we just - # use it to transport whether the command was successful. - # If yes, we parse the version string (and need to - # redirect the stderr to stdout to make the pipe work). - java_version=$(java -version 2>/dev/null && java -fullversion 2>&1 | cut -d '"' -f 2) - - if [[ -n "$java_version" ]]; then - "$1_prompt_segment" "$0" "$2" "red" "white" "$java_version" "JAVA_ICON" - fi -} - -################################################################ -# Prompt processing and drawing -################################################################ -# Main prompt -build_left_prompt() { - local index=1 - local element - for element in "${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[@]}"; do - # Remove joined information in direct calls - element=${element%_joined} - - # Check if it is a custom command, otherwise interpet it as - # a prompt. - if [[ $element[0,7] =~ "custom_" ]]; then - "prompt_custom" "left" "$index" $element[8,-1] - else - "prompt_$element" "left" "$index" - fi - - index=$((index + 1)) - done - - left_prompt_end -} - -# Right prompt -build_right_prompt() { - local index=1 - local element - for element in "${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[@]}"; do - # Remove joined information in direct calls - element=${element%_joined} - - # Check if it is a custom command, otherwise interpet it as - # a prompt. - if [[ $element[0,7] =~ "custom_" ]]; then - "prompt_custom" "right" "$index" $element[8,-1] - else - "prompt_$element" "right" "$index" - fi - - index=$((index + 1)) - done - - # Clear to the end of the line - echo -n "%E" -} - -powerlevel9k_preexec() { - _P9K_TIMER_START=$EPOCHREALTIME -} - -set_default POWERLEVEL9K_PROMPT_ADD_NEWLINE false -powerlevel9k_prepare_prompts() { - local RETVAL RPROMPT_PREFIX RPROMPT_SUFFIX - RETVAL=$? - RETVALS=( "$pipestatus[@]" ) - - _P9K_COMMAND_DURATION=$((EPOCHREALTIME - _P9K_TIMER_START)) - - # Reset start time - _P9K_TIMER_START=0x7FFFFFFF - - if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then - PROMPT='$(print_icon 'MULTILINE_FIRST_PROMPT_PREFIX')%f%b%k$(build_left_prompt) -$(print_icon 'MULTILINE_LAST_PROMPT_PREFIX')' - if [[ "$POWERLEVEL9K_RPROMPT_ON_NEWLINE" != true ]]; then - # The right prompt should be on the same line as the first line of the left - # prompt. To do so, there is just a quite ugly workaround: Before zsh draws - # the RPROMPT, we advise it, to go one line up. At the end of RPROMPT, we - # advise it to go one line down. See: - # http://superuser.com/questions/357107/zsh-right-justify-in-ps1 - local LC_ALL="" LC_CTYPE="en_US.UTF-8" # Set the right locale to protect special characters - RPROMPT_PREFIX='%{'$'\e[1A''%}' # one line up - RPROMPT_SUFFIX='%{'$'\e[1B''%}' # one line down - else - RPROMPT_PREFIX='' - RPROMPT_SUFFIX='' - fi - else - PROMPT='%f%b%k$(build_left_prompt)' - RPROMPT_PREFIX='' - RPROMPT_SUFFIX='' - fi - - if [[ "$POWERLEVEL9K_DISABLE_RPROMPT" != true ]]; then - RPROMPT="${RPROMPT_PREFIX}"'%f%b%k$(build_right_prompt)%{$reset_color%}'"${RPROMPT_SUFFIX}" - fi - -local NEWLINE=' -' - - if [[ $POWERLEVEL9K_PROMPT_ADD_NEWLINE == true ]]; then - NEWLINES="" - repeat ${POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT:-1} { NEWLINES+=$NEWLINE } - PROMPT="$NEWLINES$PROMPT" - fi - - # Allow iTerm integration to work - [[ $ITERM_SHELL_INTEGRATION_INSTALLED == "Yes" ]] && PROMPT="%{$(iterm2_prompt_mark)%}$PROMPT" -} - -zle-keymap-select () { - zle reset-prompt - zle -R -} - -set_default POWERLEVEL9K_IGNORE_TERM_COLORS false -set_default POWERLEVEL9K_IGNORE_TERM_LANG false - -prompt_powerlevel9k_setup() { - # The value below was set to better support 32-bit CPUs. - # It's the maximum _signed_ integer value on 32-bit CPUs. - # Please don't change it until 19 January of 2038. ;) - - # Disable false display of command execution time - _P9K_TIMER_START=0x7FFFFFFF - - # The prompt function will set these prompt_* options after the setup function - # returns. We need prompt_subst so we can safely run commands in the prompt - # without them being double expanded and we need prompt_percent to expand the - # common percent escape sequences. - prompt_opts=(cr percent sp subst) - - # Borrowed from promptinit, sets the prompt options in case the theme was - # not initialized via promptinit. - setopt noprompt{bang,cr,percent,sp,subst} "prompt${^prompt_opts[@]}" - - # Display a warning if the terminal does not support 256 colors - termColors - - # If the terminal `LANG` is set to `C`, this theme will not work at all. - if [[ $POWERLEVEL9K_IGNORE_TERM_LANG == false ]]; then - local term_lang - term_lang=$(echo $LANG) - if [[ $term_lang == 'C' ]]; then - print -P "\t%F{red}WARNING!%f Your terminal's 'LANG' is set to 'C', which breaks this theme!" - print -P "\t%F{red}WARNING!%f Please set your 'LANG' to a UTF-8 language, like 'en_US.UTF-8'" - print -P "\t%F{red}WARNING!%f _before_ loading this theme in your \~\.zshrc. Putting" - print -P "\t%F{red}WARNING!%f %F{blue}export LANG=\"en_US.UTF-8\"%f at the top of your \~\/.zshrc is sufficient." - fi - fi - - defined POWERLEVEL9K_LEFT_PROMPT_ELEMENTS || POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs) - defined POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS || POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time) - - # Display a warning if deprecated segments are in use. - typeset -AH deprecated_segments - # old => new - deprecated_segments=( - 'longstatus' 'status' - ) - print_deprecation_warning deprecated_segments - - # initialize colors - autoload -U colors && colors - - if segment_in_use "vcs"; then - powerlevel9k_vcs_init - fi - - # initialize timing functions - zmodload zsh/datetime - - # Initialize math functions - zmodload zsh/mathfunc - - # initialize hooks - autoload -Uz add-zsh-hook - - # prepare prompts - add-zsh-hook precmd powerlevel9k_prepare_prompts - add-zsh-hook preexec powerlevel9k_preexec - - zle -N zle-keymap-select -} - -prompt_powerlevel9k_teardown() { - add-zsh-hook -D precmd powerlevel9k_\* - add-zsh-hook -D preexec powerlevel9k_\* - PROMPT='%m%# ' - RPROMPT= -} - -prompt_powerlevel9k_setup "$@" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/prompt_powerlevel9k_setup b/.zprezto/modules/prompt/external/powerlevel9k/prompt_powerlevel9k_setup new file mode 120000 index 0000000..311575f --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/prompt_powerlevel9k_setup @@ -0,0 +1 @@ +powerlevel9k.zsh-theme \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/CODE_OF_CONDUCT.md b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..dc906ab --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies 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 kate.ward@forestent.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/LICENSE b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/README.md b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/README.md new file mode 100644 index 0000000..e0f92f2 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/README.md @@ -0,0 +1,434 @@ +# shUnit2 + +shUnit2 is a [xUnit](http://en.wikipedia.org/wiki/XUnit) unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to [JUnit](http://www.junit.org), [PyUnit](http://pyunit.sourceforge.net), etc.. If you have ever had the desire to write a unit test for a shell script, shUnit2 can do the job. + +[![Travis CI](https://img.shields.io/travis/kward/shunit2.svg)](https://travis-ci.org/kward/shunit2) + +## Table of Contents +* [Introduction](#introduction) + * [Credits / Contributors](#credits-contributors) + * [Feedback](#feedback) +* [Quickstart](#quickstart) +* [Function Reference](#function-reference) + * [General Info](#general-info) + * [Asserts](#asserts) + * [Failures](#failures) + * [Setup/Teardown](#setup-teardown) + * [Skipping](#skipping) + * [Suites](#suites) +* [Advanced Usage](#advanced-usage) + * [Some constants you can use](#some-constants-you-can-use) + * [Error Handling](#error-handling) + * [Including Line Numbers in Asserts (Macros)](#including-line-numbers-in-asserts-macros) + * [Test Skipping](#test-skipping) +* [Appendix](#appendix) + * [Getting help](#getting-help) + * [Zsh](#zsh) + +--- +## Introduction +shUnit2 was originally developed to provide a consistent testing solution for [log4sh][log4sh], a shell based logging framework similar to [log4j](http://logging.apache.org). During the development of that product, a repeated problem of having things work just fine under one shell (`/bin/bash` on Linux to be specific), and then not working under another shell (`/bin/sh` on Solaris) kept coming up. Although several simple tests were run, they were not adequate and did not catch some corner cases. The decision was finally made to write a proper unit test framework after multiple brown-bag releases were made. _Research was done to look for an existing product that met the testing requirements, but no adequate product was found._ + +Tested Operating Systems (varies over time) + +* Cygwin +* FreeBSD (user supported) +* Linux (Gentoo, Ubuntu) +* Mac OS X +* Solaris 8, 9, 10 (inc. OpenSolaris) + +Tested Shells + +* Bourne Shell (__sh__) +* BASH - GNU Bourne Again SHell (__bash__) +* DASH (__dash__) +* Korn Shell (__ksh__) +* pdksh - Public Domain Korn Shell (__pdksh__) +* zsh - Zsh (__zsh__) (since 2.1.2) _please see the Zsh shell errata for more information_ + +See the appropriate Release Notes for this release (`doc/RELEASE_NOTES-X.X.X.txt`) for the list of actual versions tested. + +### Credits / Contributors +A list of contributors to shUnit2 can be found in `doc/contributors.md`. Many thanks go out to all those who have contributed to make this a better tool. + +shUnit2 is the original product of many hours of work by Kate Ward, the primary author of the code. For related software, check out https://github.com/kward. + +### Feedback +Feedback is most certainly welcome for this document. Send your additions, comments and criticisms to the shunit2-users@google.com mailing list. + +--- + +## Quickstart +This section will give a very quick start to running unit tests with shUnit2. More information is located in later sections. + +Here is a quick sample script to show how easy it is to write a unit test in shell. _Note: the script as it stands expects that you are running it from the "examples" directory._ + +```sh +#! /bin/sh +# file: examples/equality_test.sh + +testEquality() { + assertEquals 1 1 +} + +# Load shUnit2. +. ./shunit2 +``` + +Running the unit test should give results similar to the following. + +```console +$ cd examples +$ ./equality_test.sh +testEquality + +Ran 1 test. + +OK +``` + +W00t! 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` library. The basic functionality for the script above goes like this: + +* When shUnit2 is sourced, it will walk through any functions defined whose name starts with the string `test`, and add 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. +* Before any tests are executed, shUnit2 again looks for a function, this time one named `oneTimeSetUp()`. 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 `oneTimeTearDown()` function that does the same thing, but once all the tests have been completed. It is good for removing temporary directories, etc. +* shUnit2 is now ready to run tests. Before doing so though, it again looks for another function that might be declared, one named `setUp()`. 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 `tearDown()`. 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. +* 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. + +We should now try adding a test that fails. Change your unit test to look like this. + +```sh +#! /bin/sh +# file: examples/party_test.sh + +testEquality() { + assertEquals 1 1 +} + +testPartyLikeItIs1999() { + year=`date '+%Y'` + assertEquals "It's not 1999 :-(" '1999' "${year}" +} + +# Load shUnit2. +. ./shunit2 +``` + +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. + +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 [log4sh][log4sh] or [shFlags][shflags]. Both provide excellent examples of more advanced usage. shUnit2 was after all written to meet the unit testing need that [log4sh][log4sh] had. + +--- + +## Function Reference + +### General Info + +Any string values passed should be properly quoted -- they should must be surrounded by single-quote (`'`) or double-quote (`"`) characters -- so that the shell will properly parse them. + +### Asserts + +`assertEquals [message] expected actual` + +Asserts that _expected_ and _actual_ are equal to one another. The _expected_ and _actual_ values can be either strings or integer values as both will be treated as strings. The _message_ is optional, and must be quoted. + +`assertNotEquals [message] unexpected actual` + +Asserts that _unexpected_ and _actual_ are not equal to one another. The _unexpected_ and _actual_ values can be either strings or integer values as both will be treaded as strings. The _message_ is optional, and must be quoted. + +`assertSame [message] expected actual` + +This function is functionally equivalent to `assertEquals`. + +`assertNotSame [message] unexpected actual` + +This function is functionally equivalent to `assertNotEquals`. + +`assertNull [message] value` + +Asserts that _value_ is _null_, or in shell terms, a zero-length string. The _value_ must be a string as an integer value does not translate into a zero-length string. The _message_ is optional, and must be quoted. + +`assertNotNull [message] value` + +Asserts that _value_ is _not null_, or in shell terms, a non-empty string. The _value_ may be a string or an integer as the later will be parsed as a non-empty string value. The _message_ is optional, and must be quoted. + +`assertTrue [message] condition` + +Asserts that a given shell test _condition_ is _true_. The condition can be as simple as a shell _true_ value (the value `0` -- equivalent to `${SHUNIT_TRUE}`), or a more sophisticated shell conditional expression. The _message_ is optional, and must be quoted. + +A sophisticated shell conditional expression is equivalent to what the __if__ or __while__ shell built-ins would use (more specifically, what the __test__ command would use). Testing for example whether some value is greater than another value can be done this way. + +`assertTrue "[ 34 -gt 23 ]"` + +Testing for the ability to read a file can also be done. This particular test will fail. + +`assertTrue 'test failed' "[ -r /some/non-existant/file' ]"` + +As the expressions are standard shell __test__ expressions, it is possible to string multiple expressions together with `-a` and `-o` in the standard fashion. This test will succeed as the entire expression evaluates to _true_. + +`assertTrue 'test failed' '[ 1 -eq 1 -a 2 -eq 2 ]'` + +_One word of warning: be very careful with your quoting as shell is not the most forgiving of bad quoting, and things will fail in strange ways._ + +`assertFalse [message] condition` + +Asserts that a given shell test _condition_ is _false_. The condition can be as simple as a shell _false_ value (the value `1` -- equivalent to `${SHUNIT_FALSE}`), or a more sophisticated shell conditional expression. The _message_ is optional, and must be quoted. + +_For examples of more sophisticated expressions, see `assertTrue`._ + +### Failures + +Just to clarify, failures __do not__ test the various arguments against one another. Failures simply fail, optionally with a message, and that is all they do. If you need to test arguments against one another, use asserts. + +If all failures do is fail, why might one use them? There are times when you may have some very complicated logic that you need to test, and the simple asserts provided are simply not adequate. You can do your own validation of the code, use an `assertTrue ${SHUNIT_TRUE}` if your own tests succeeded, and use a failure to record a failure. + +`fail [message]` + +Fails the test immediately. The _message_ is optional, and must be quoted. + +`failNotEquals [message] unexpected actual` + +Fails the test immediately, reporting that the _unexpected_ and _actual_ values are not equal to one another. The _message_ is optional, and must be quoted. + +_Note: no actual comparison of unexpected and actual is done._ + +`failSame [message] expected actual` + +Fails the test immediately, reporting that the _expected_ and _actual_ values are the same. The _message_ is optional, and must be quoted. + +_Note: no actual comparison of expected and actual is done._ + +`failNotSame [message] expected actual` + +Fails the test immediately, reporting that the _expected_ and _actual_ values are not the same. The _message_ is optional, and must be quoted. + +_Note: no actual comparison of expected and actual is done._ + +### Setup/Teardown + +`oneTimeSetUp` + +This function can be be optionally overridden by the user in their test suite. + +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. + +`oneTimeTearDown` + +This function can be be optionally overridden by the user in their test suite. + +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. + +`setUp` + +This function can be be optionally overridden by the user in their test suite. + +If this function exists, it will be called before each test is run. It is useful to reset the environment before each test. + +`tearDown` + +This function can be be optionally overridden by the user in their test suite. + +If this function exists, it will be called after each test completes. It is useful to clean up the environment after each test. + +### Skipping + +`startSkipping` + +This function forces the remaining _assert_ and _fail_ functions to be "skipped", i.e. they will have no effect. Each function skipped will be recorded so that the total of asserts and fails will not be altered. + +`endSkipping` + +This function returns calls to the _assert_ and _fail_ functions to their default behavior, i.e. they will be called. + +`isSkipping` + +This function returns the current state of skipping. It can be compared against `${SHUNIT_TRUE}` or `${SHUNIT_FALSE}` if desired. + +### Suites + +The default behavior of shUnit2 is that all tests will be found dynamically. If you have a specific set of tests you want to run, or you don't want to use the standard naming scheme of prefixing your tests with `test`, these functions are for you. Most users will never use them though. + +`suite` + +This function can be optionally overridden by the user in their test suite. + +If this function exists, it will be called when `shunit2` is sourced. If it does not exist, shUnit2 will search the parent script for all functions beginning with the word `test`, and they will be added dynamically to the test suite. + +`suite_addTest name` + +This function adds a function named _name_ to the list of tests scheduled for execution as part of this test suite. This function should only be called from within the `suite()` function. + +--- + +## Advanced Usage + +### Some constants you can use + +There are several constants provided by shUnit2 as variables that might be of use to you. + +*Predefined* + +| Constant | Value | +| --------------- | ----- | +| SHUNIT\_TRUE | Standard shell `true` value (the integer value 0). | +| SHUNIT\_FALSE | Standard shell `false` value (the integer value 1). | +| SHUNIT\_ERROR | The integer value 2. | +| SHUNIT\_TMPDIR | Path to temporary directory that will be automatically cleaned up upon exit of shUnit2. | +| SHUNIT\_VERSION | The version of shUnit2 you are running. | + +*User defined* + +| Constant | Value | +| ----------------- | ----- | +| SHUNIT\_CMD\_EXPR | Override which `expr` command is used. By default `expr` is used, except on BSD systems where `gexpr` is used. | +| SHUNIT\_COLOR | Enable colorized output. Options are 'auto', 'always', or 'never', with 'auto' being the default. | +| SHUNIT\_PARENT | The filename of the shell script containing the tests. This is needed specifically for Zsh support. | +| SHUNIT\_TEST\_PREFIX | Define this variable to add a prefix in front of each test name that is output in the test report. | + +### Error handling + +The constants values `SHUNIT_TRUE`, `SHUNIT_FALSE`, and `SHUNIT_ERROR` are returned from nearly every function to indicate the success or failure of the function. Additionally the variable `flags_error` is filled with a detailed error message if any function returns with a `SHUNIT_ERROR` value. + +### Including Line Numbers in Asserts (Macros) + +If you include lots of assert statements in an individual test function, it can become difficult to determine exactly which assert was thrown unless your messages are unique. To help somewhat, line numbers can be included in the assert messages. To enable this, a special shell "macro" must be used rather than the standard assert calls. _Shell doesn't actually have macros; the name is used here as the operation is similar to a standard macro._ + +For example, to include line numbers for a `assertEquals()` function call, replace the `assertEquals()` with `${_ASSERT_EQUALS_}`. + +_**Example** -- Asserts with and without line numbers_ +```sh +#! /bin/sh +# file: examples/lineno_test.sh + +testLineNo() { + # This assert will have line numbers included (e.g. "ASSERT:[123] ..."). + echo "ae: ${_ASSERT_EQUALS_}" + ${_ASSERT_EQUALS_} 'not equal' 1 2 + + # This assert will not have line numbers included (e.g. "ASSERT: ..."). + assertEquals 'not equal' 1 2 +} + +# Load shUnit2. +. ./shunit2 +``` + +Notes: + +1. Due to how shell parses command-line arguments, all strings used with macros should be quoted twice. Namely, single-quotes must be converted to single-double-quotes, and vice-versa. If the string being passed is absolutely for sure not empty, the extra quoting is not necessary.

Normal `assertEquals` call.
`assertEquals 'some message' 'x' ''`

Macro `_ASSERT_EQUALS_` call. Note the extra quoting around the _message_ and the _null_ value.
`_ASSERT_EQUALS_ '"some message"' 'x' '""'` + +1. Line numbers are not supported in all shells. If a shell does not support them, no errors will be thrown. Supported shells include: __bash__ (>=3.0), __ksh__, __pdksh__, and __zsh__. + +### Test Skipping + +There are times where the test code you have written is just not applicable to the system you are running on. This section describes how to skip these tests but maintain the total test count. + +Probably the easiest example would be shell code that is meant to run under the __bash__ shell, but the unit test is running under the Bourne shell. There are things that just won't work. The following test code demonstrates two sample functions, one that will be run under any shell, and the another that will run only under the __bash__ shell. + +_**Example** -- math include_ +```sh +# file: examples/math.inc. + +add_generic() { + num_a=$1 + num_b=$2 + + expr $1 + $2 +} + +add_bash() { + num_a=$1 + num_b=$2 + + echo $(($1 + $2)) +} +``` + +And here is a corresponding unit test that correctly skips the `add_bash()` function when the unit test is not running under the __bash__ shell. + +_**Example** -- math unit test_ +```sh +#! /bin/sh +# file: examples/math_test.sh + +testAdding() { + result=`add_generic 1 2` + assertEquals \ + "the result of '${result}' was wrong" \ + 3 "${result}" + + # Disable non-generic tests. + [ -z "${BASH_VERSION:-}" ] && startSkipping + + result=`add_bash 1 2` + assertEquals \ + "the result of '${result}' was wrong" \ + 3 "${result}" +} + +oneTimeSetUp() { + # Load include to test. + . ./math.inc +} + +# Load and run shUnit2. +. ./shunit2 +``` + +Running the above test under the __bash__ shell will result in the following output. + +```console +$ /bin/bash math_test.sh +testAdding + +Ran 1 test. + +OK +``` + +But, running the test under any other Unix shell will result in the following output. + +```console +$ /bin/ksh math_test.sh +testAdding + +Ran 1 test. + +OK (skipped=1) +``` + +As you can see, the total number of tests has not changed, but the report indicates that some tests were skipped. + +Skipping can be controlled with the following functions: `startSkipping()`, `endSkipping()`, and `isSkipping()`. Once skipping is enabled, it will remain enabled until the end of the current test function call, after which skipping is disabled. + +--- + +## Appendix + +### Getting Help + +For help, please send requests to either the shunit2-users@googlegroups.com mailing list (archives available on the web at http://groups.google.com/group/shunit2-users) or directly to Kate Ward . + +### Zsh + +For compatibility with Zsh, there is one requirement that must be met -- the `shwordsplit` option must be set. There are three ways to accomplish this. + +1. In the unit-test script, add the following shell code snippet before sourcing the `shunit2` library. + +```sh +setopt shwordsplit +``` + +1. When invoking __zsh__ from either the command-line or as a script with `#!`, add the `-y` parameter. + +```sh +#! /bin/zsh -y +``` + +1. When invoking __zsh__ from the command-line, add `-o shwordsplit --` as parameters before the script name. + +```console +$ zsh -o shwordsplit -- some_script +``` + +[log4sh]: https://github.com/kward/log4sh +[shflags]: https://github.com/kward/shflags diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/CHANGES-2.1.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/CHANGES-2.1.md similarity index 56% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/CHANGES-2.1.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/CHANGES-2.1.md index 8cde2f3..5c3fdf0 100644 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/CHANGES-2.1.txt +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/CHANGES-2.1.md @@ -1,14 +1,53 @@ -Changes in shUnit2 2.1.X -======================== +# shUnit2 2.1.x Changes -Changes with 2.1.7 ------------------- +## Changes with 2.1.8 -Updated the LGPL license from http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt. +### Enhancements + +Issue #29. Add support for user defined prefix for test names. A prefix can be added by defining the `SHUNIT_TEST_PREFIX` variable. + +Issue #78. Added an example for using suite tests. + +Run continuous integration additionally against Ubuntu Trusty. + +### Bug fixes + +Issue #84. Treat syntax errors in functions as test failures. + +Issue #77. Fail tests when the environment functions (e.g. `setup()` or `tearDown()`) fail. + +## Changes with 2.1.7 + +### Bug fixes + +Issue #69. shUnit2 should not exit with 0 when it has (syntax) errors. + +### Enhancements + +Issue #54. Shell commands prefixed with '\' so that they can be stubbed in +tests. + +Issue #68. Ran all code through [ShellCheck](http://www.shellcheck.net/). + +Issue #60. Continuous integration tests now run with +[Travis CI](https://travis-ci.org/kward/shunit2). + +Issue #56. Added color support. Color is enabled automatically when supported, +but can be disabled by defining the SHUNIT_COLOR environment variable before +sourcing shunit2. Accepted values are `always`, `auto` (the default), and +`none`. + +Issue #35. Add colored output. + +### Other + +Moved code to GitHub (https://github.com/kward/shunit2), and restructured to +be more GitHub like. + +Changed to the Apache 2.0 license. -Changes with 2.1.6 ------------------- +## Changes with 2.1.6 Removed all references to the DocBook documentation. @@ -18,11 +57,11 @@ Fixed error message in fail() that stated wrong number of required arguments. Updated lib/versions. -Fixed bug in _shunit_mktempDir() where a failure occurred when the 'od' command -was not present in /usr/bin. +Fixed bug in `_shunit_mktempDir()` where a failure occurred when the 'od' +command was not present in `/usr/bin`. -Renamed shunit_tmpDir variable to SHUNIT_TMPDIR to closer match the standard -TMPDIR variable. +Renamed `shunit_tmpDir` variable to `SHUNIT_TMPDIR` to closer match the standard +`TMPDIR` variable. Added support for calling shunit2 as an executable, in addition to the existing method of sourcing it in as a library. This allows users to keep tests working @@ -32,56 +71,55 @@ distribution. Issue #14: Improved handling of some strange chars (e.g. single and double quotes) in messages. -Issue# 27: Fixed error message for assertSame(). +Issue# 27: Fixed error message for `assertSame()`. Issue# 25: Added check and error message to user when phantom functions are -written to a partition mounted with noexec. +written to a partition mounted with `noexec`. -Issue# 11: Added support for defining functions like 'function someFunction()'. +Issue# 11: Added support for defining functions like `function someFunction()`. -Changes with 2.1.5 ------------------- +## Changes with 2.1.5 Issue# 1: Fixed bug pointed out by R Bernstein in the trap code where certain types of exit conditions did not generate the ending report. -Issue# 2: Added assertNotEquals() assert. +Issue# 2: Added `assertNotEquals()` assert. Issue# 3: Moved check for unset variables out of shUnit2 into the unit tests. Testing poorly written software blows up if this check is in, but it is only -interesting for shUnit2 itself. Added shunit_test_output.sh unit test for this. -Some shells still do not catch such errors properly (e.g. Bourne shell and BASH -2.x). +interesting for shUnit2 itself. Added `shunit_test_output.sh` unit test for +this. Some shells still do not catch such errors properly (e.g. Bourne shell and +BASH 2.x). Added new custom assert in test_helpers to check for output to STDOUT, and none to STDERR. -Replaced fatal message in the temp directory creation with a _shunit_fatal() +Replaced fatal message in the temp directory creation with a `_shunit_fatal()` function call. Fixed test_output unit test so it works now that the 'set -u' stuff was removed for Issue# 3. -Flushed out the coding standards in the README.txt a bit more, and brought the +Flushed out the coding standards in the `README.txt` a bit more, and brought the shunit2 code up to par with the documented standards. Issue# 4: Completely changed the reporting output to be a closer match for JUnit and PyUnit. As a result, tests are counted separately from assertions. -Provide public shunit_tmpDir variable that can be used by unit test scripts that -need automated and guaranteed cleanup. +Provide public `shunit_tmpDir` variable that can be used by unit test scripts +that need automated and guaranteed cleanup. Issue# 7: Fixed duplicated printing of messages passed to asserts. -Per code review, fixed wording of failSame() and failNotSame() messages. +Per code review, fixed wording of `failSame()` and `failNotSame()` messages. -Replaced version_info.sh with versions library and made appropriate changes in +Replaced `version_info.sh` with versions library and made appropriate changes in other scripts to use it. -Added gen_test_results.sh to make releases easier. +Added `gen_test_results.sh` to make releases easier. -Fixed bugs in shlib_relToAbsPath() in shlib. +Fixed bugs in `shlib_relToAbsPath()` in shlib. Converted DocBook documentation to reStructuredText for easier maintenance. The DocBook documentation is now considered obsolete, and will be removed in a @@ -97,10 +135,9 @@ When an invalid number of arguments is passed to a function, the invalid number is returned to the user so they are more aware of what the cause might be. -Changes with 2.1.4 ------------------- +## Changes with 2.1.4 -Removed the _shunit_functionExists() function as it was dead code. +Removed the `_shunit_functionExists()` function as it was dead code. Fixed zsh version number check in version_info. @@ -123,11 +160,10 @@ result. Improved zsh version and option checks. -Renamed the __SHUNIT_VERSION variable to SHUNIT_VERSION. +Renamed the `__SHUNIT_VERSION` variable to `SHUNIT_VERSION`. -Changes with 2.1.3 ------------------- +## Changes with 2.1.3 Added some explicit variable defaults, even though the variables are set, as they sometimes behave strange when the script is canceled. @@ -141,29 +177,27 @@ considered failures, and do not affect the exit code. Changed detection of STDERR output in unit tests. -Changes with 2.1.2 ------------------- +## Changes with 2.1.2 Unset additional variables that were missed. Added checks and workarounds to improve zsh compatibility. -Added some argument count checks ``assertEquals()``, ``assertNull()``, and -``assertSame()`` +Added some argument count checks `assertEquals()`, `assertNull()`, and +`assertSame()`. -Changes with 2.1.1 ------------------- +## Changes with 2.1.1 -Fixed bug where ``fail()`` was not honoring skipping. +Fixed bug where `fail()` was not honoring skipping. -Fixed problem with ``docs-docbook-prep`` target that prevented it from working. +Fixed problem with `docs-docbook-prep` target that prevented it from working. (Thanks to Bryan Larsen for pointing this out.) -Changed the test in ``assertFalse()`` so that any non-zero value registers as +Changed the test in `assertFalse()` so that any non-zero value registers as false. (Credits to Bryan Larsen) -Major fiddling to bring more in line with `JUnit `. Asserts +Major fiddling to bring more in line with [JUnit](http://junit.org/). Asserts give better output when no message is given, and failures now just fail. It was pointed out that the simple 'failed' message for a failed assert was not @@ -172,7 +206,7 @@ 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 +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. @@ -193,29 +227,27 @@ Fixed the method of percent calculation for the report to get achieve better accuracy. -Changes with 2.1.0 (since 2.0.1) --------------------------------- +## Changes with 2.1.0 (since 2.0.1) This release is a branch of the 2.0.1 release. -Moving to `reStructured Text `_ for +Moving to [reStructured Text](http://docutils.sourceforge.net/rst.html) for the documentation. -Fixed problem with ``fail()``. The failure message was not properly printed. +Fixed problem with `fail()`. The failure message was not properly printed. -Fixed the ``Makefile`` so that the DocBook XML and XSLT files would be +Fixed the `Makefile` so that the DocBook XML and XSLT files would be downloaded before parsing can continue. -Renamed the internal ``__SHUNIT_TRUE`` and ``__SHUNIT_FALSE`` variables to -``SHUNIT_TRUE`` and ``SHUNIT_FALSE`` so that unit tests can "use" them. +Renamed the internal `__SHUNIT_TRUE` and `__SHUNIT_FALSE` variables to +`SHUNIT_TRUE` and `SHUNIT_FALSE` so that unit tests can "use" them. Added support for test "skipping". If skipping is turned on with the -``startSkip()`` function, ``assert`` and ``fail`` functions will return -immediately, and the skip will be recorded. +`startSkip()` function, `assert` and `fail` functions will return immediately, +and the skip will be recorded. The report output format was changed to include the percentage for each test result, rather than just those successful. -.. $Revision$ .. vim:fileencoding=latin1:ft=text:spell:tw=80 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.0.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.0.txt similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.0.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.0.txt diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.1.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.1.txt similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.1.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.1.txt diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.2.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.2.txt similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.2.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.2.txt diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.3.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.3.txt similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.3.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.3.txt diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.4.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.4.txt similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.4.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.4.txt diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.5.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.5.txt similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.5.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.5.txt diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.6.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.6.txt similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/RELEASE_NOTES-2.1.6.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.6.txt diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.7.md b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.7.md new file mode 100644 index 0000000..6497942 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/RELEASE_NOTES-2.1.7.md @@ -0,0 +1,62 @@ +# shUnit2 2.1.7 Release Notes + +https://github.com/kward/shunit2 + +This release contains bug fixes and enhancements. It is the first release since moving to GitHub. Users can now clone the latest version at any time. + +See the `CHANGES-2.1.md` file for a full list of changes. + + +## New Features + +Colorized output, based on popular demand. shUnit2 output is now colorized based on the result of the asserts. + + +## Changes and Enhancements + +With the move to GitHub, the shUnit2 unit tests are run on every commit using the [Travis CI][TravisCI] continuous integration framework. Additionally, all code is run through [ShellCheck](http:/www.shellcheck.net/) on every commit. + +[TravisCI]: https://travis-ci.org/kward/shunit2 + +Shell commands in shUnit2 are prefixed with '\' so that they can be stubbed in tests. + + +## Bug Fixes + +shUnit2 no longer exits with an 'OK' result if there were syntax errors due to incorrect usage of the assert commands. + + +## Deprecated Features + +None. + + +## Known Bugs and Issues + +Zsh requires the `shwordsplit` option to be set. See the documentation for examples of how to do this. + +Line numbers in assert messages do not work properly with BASH 2.x. + +The Bourne shell of Solaris, BASH 2.x, and Zsh 3.0.x do not properly catch the +SIGTERM signal. As such, shell interpreter failures due to such things as +unbound variables cannot be caught. (See `shunit_test_misc.sh`) + + +## Tested Platforms + +Continuous integration testing is provided by [Travis CI][TravisCI]. + +Tested OSes: + +- Linux +- macOS + +Tested shells: + +- /bin/sh +- ash +- bash +- dash +- ksh +- pdksh +- zsh diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/TODO.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/TODO.txt similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/TODO.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/TODO.txt diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/contributors.md b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/contributors.md new file mode 100644 index 0000000..7adae22 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/contributors.md @@ -0,0 +1,15 @@ +The original author of shunit2 is Kate Ward. The following people have +contributed in some way or another to shunit2. + +- [Alex Harvey](https://github.com/alexharv074) +- Bryan Larsen +- [David Acacio](https://github.com/dacacioa) +- Kevin Van Horn +- [Maciej Bliziński](https://github.com/automatthias) +- Mario Sparada +- Mathias Goldau +- Richard Jensen +- Rob Holland +- Rocky Bernstein +- [rugk](https://github.com/rugk) +- wood4321 (of code.google.com) diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/design_doc.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/design_doc.txt similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/design_doc.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/design_doc.txt diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/shunit2.html b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/shunit2.html similarity index 99% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/shunit2.html rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/shunit2.html index 3ef771b..4285223 100644 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/shunit2.html +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/shunit2.html @@ -530,7 +530,7 @@ assertTrue "[ 34 -gt 23 ]"

Testing for the ability to read a file can also be done. This particular test will fail.

-assertTrue 'test failed' "[ -r /some/non-existant/file' ]"
+assertTrue 'test failed' "[ -r /some/non-existent/file' ]"
 

As the expressions are standard shell test expressions, it is possible to string multiple expressions together with -a and -o in the standard diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/shunit2.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/shunit2.txt similarity index 98% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/shunit2.txt rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/shunit2.txt index 034c6fc..537e2eb 100644 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/shunit2.txt +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/doc/shunit2.txt @@ -51,9 +51,9 @@ See the appropriate Release Notes for this release Credits / Contributors ---------------------- -A list of contributors to shUnit2 can be found in the source archive in -``doc/contributors.txt``. Many thanks go out to all those who have contributed -to make this a better tool. +A list of contributors to shUnit2 can be found in ``doc/contributors.md``. +Many thanks go out to all those who have contributed to make this a better +tool. shUnit2 is the original product of many hours of work by Kate Ward, the primary author of the code. For other products by her, look up log4sh_ or shFlags_, or @@ -214,7 +214,7 @@ Asserts Testing for the ability to read a file can also be done. This particular test will fail. :: - assertTrue 'test failed' "[ -r /some/non-existant/file' ]" + assertTrue 'test failed' "[ -r /some/non-existent/file' ]" As the expressions are standard shell **test** expressions, it is possible to string multiple expressions together with ``-a`` and ``-o`` in the standard @@ -358,6 +358,8 @@ Predefined User defined ================== =========================================================== +``SHUNIT_COLOR`` Set this flag to control colored output support. Accepted + values are ``always``, ``auto`` (the default), and ``none``. ``SHUNIT_PARENT`` The filename of the shell script containing the tests. This is needed specifically for Zsh support. ================== =========================================================== diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/equality_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/equality_test.sh similarity index 55% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/equality_test.sh rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/equality_test.sh index e0d68a5..7b56640 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/equality_test.sh +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/equality_test.sh @@ -1,10 +1,9 @@ #! /bin/sh # file: examples/equality_test.sh -testEquality() -{ +testEquality() { assertEquals 1 1 } -# load shunit2 -. ../src/shunit2 +# Load and run shUnit2. +. ../shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/lineno_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/lineno_test.sh new file mode 100755 index 0000000..11ddfc8 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/lineno_test.sh @@ -0,0 +1,15 @@ +#! /bin/sh +# file: examples/lineno_test.sh + +testLineNo() { + # This assert will have line numbers included (e.g. "ASSERT:[123] ...") if + # they are supported. + echo "_ASSERT_EQUALS_ macro value: ${_ASSERT_EQUALS_}" + ${_ASSERT_EQUALS_} '"not equal"' 1 2 + + # This assert will not have line numbers included (e.g. "ASSERT: ..."). + assertEquals 'not equal' 1 2 +} + +# Load and run shUnit2. +. ../shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/math.inc b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/math.inc similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/math.inc rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/math.inc diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/math_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/math_test.sh similarity index 64% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/math_test.sh rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/math_test.sh index 41be5ff..c6d0029 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/math_test.sh +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/math_test.sh @@ -1,14 +1,13 @@ #! /bin/sh -# available as examples/math_test.sh +# file: examples/math_test.sh -testAdding() -{ +testAdding() { result=`add_generic 1 2` assertEquals \ "the result of '${result}' was wrong" \ 3 "${result}" - # disable non-generic tests + # Disable non-generic tests. [ -z "${BASH_VERSION:-}" ] && startSkipping result=`add_bash 1 2` @@ -17,11 +16,10 @@ testAdding() 3 "${result}" } -oneTimeSetUp() -{ - # load include to test +oneTimeSetUp() { + # Load include to test. . ./math.inc } -# load and run shUnit2 -. ../src/shunit2 +# Load and run shUnit2. +. ../shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/mkdir_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/mkdir_test.sh similarity index 77% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/mkdir_test.sh rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/mkdir_test.sh index 28d8d94..ca980d9 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/mkdir_test.sh +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/mkdir_test.sh @@ -12,12 +12,7 @@ # example, we will test several aspects of the the mkdir command, but the # techniques could be used for any existing shell script. -#----------------------------------------------------------------------------- -# suite tests -# - -testMissingDirectoryCreation() -{ +testMissingDirectoryCreation() { ${mkdirCmd} "${testDir}" >${stdoutF} 2>${stderrF} rtrn=$? th_assertTrueWithNoOutput ${rtrn} "${stdoutF}" "${stderrF}" @@ -25,12 +20,11 @@ testMissingDirectoryCreation() assertTrue 'directory missing' "[ -d '${testDir}' ]" } -testExistingDirectoryCreationFails() -{ - # create a directory to test against +testExistingDirectoryCreationFails() { + # Create a directory to test against. ${mkdirCmd} "${testDir}" - # test for expected failure while trying to create directory that exists + # Test for expected failure while trying to create directory that exists. ${mkdirCmd} "${testDir}" >${stdoutF} 2>${stderrF} rtrn=$? assertFalse 'expecting return code of 1 (false)' ${rtrn} @@ -40,8 +34,7 @@ testExistingDirectoryCreationFails() assertTrue 'directory missing' "[ -d '${testDir}' ]" } -testRecursiveDirectoryCreation() -{ +testRecursiveDirectoryCreation() { testDir2="${testDir}/test2" ${mkdirCmd} -p "${testDir2}" >${stdoutF} 2>${stderrF} @@ -52,12 +45,7 @@ testRecursiveDirectoryCreation() assertTrue 'second directory missing' "[ -d '${testDir2}' ]" } -#----------------------------------------------------------------------------- -# suite functions -# - -th_assertTrueWithNoOutput() -{ +th_assertTrueWithNoOutput() { th_return_=$1 th_stdout_=$2 th_stderr_=$3 @@ -68,8 +56,7 @@ th_assertTrueWithNoOutput() unset th_return_ th_stdout_ th_stderr_ } -oneTimeSetUp() -{ +oneTimeSetUp() { outputDir="${SHUNIT_TMPDIR}/output" mkdir "${outputDir}" stdoutF="${outputDir}/stdout" @@ -79,11 +66,10 @@ oneTimeSetUp() testDir="${SHUNIT_TMPDIR}/some_test_dir" } -tearDown() -{ +tearDown() { rm -fr "${testDir}" } -# load and run shUnit2 +# Load and run shUnit2. [ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ../src/shunit2 +. ../shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/mock_file.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/mock_file.sh new file mode 100755 index 0000000..812e448 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/mock_file.sh @@ -0,0 +1,80 @@ +#!/bin/sh +# +# shUnit2 example for mocking files. +# +# This example demonstrates two different mechanisms for mocking files on the +# system. The first method is preferred for testing specific aspects of a file, +# and the second method is preferred when multiple tests need access to the +# same mock data. +# +# When mocking files, the key thing of importance is providing the code under +# test with the correct file to read. The best practice for writing code where +# files need to be mocked is either: +# - Pass the filename to be tested into a function and test that function, or +# - Provide a function that returns the name of the filename to be read. +# +# The first case is preferred whenever possible as it allows the unit test to +# be explicit about what is being tested. The second case is useful when the +# first case is not achievable. +# +# For the second case, there are two common methods to mock the filename +# returned by the function: +# - Provide a special value (e.g. a mock variable) that is only available +# during testing, or +# - Override something (e.g. the constant) in the test script. +# +# The first case is preferred as it doesn't require the unit test to alter code +# in any way. Yes, it means that the code itself knows that it is under test, +# and it behaves slightly differently than under normal conditions, but a +# visual inspection of the code by the developer should be sufficient to +# validate proper functionality of such a simple function. + +# Treat unset variables as an error. +set -u + +PASSWD='/etc/passwd' + +# Read the root UID from the passwd filename provided as the first argument. +root_uid_from_passed_filename() { + filename=$1 + root_uid "${filename}" + unset filename +} + + +# Read the root UID from the passwd filename derived by call to the +# passwd_filename() function. +root_uid_from_derived_filename() { + root_uid "$(passwd_filename)" +} + +passwd_filename() { + if [ -n "${MOCK_PASSWD:-}" ]; then + echo "${MOCK_PASSWD}" # Mock file for testing. + return + fi + echo "${PASSWD}" +} + + +# Extract the root UID. +root_uid() { awk -F: 'u==$1{print $3}' u=root "$1"; } + + +main() { + echo "root_uid_from_passed_filename:" + root_uid_from_passed_filename "${PASSWD}" + + echo + + echo "root_uid_from_derived_filename:" + root_uid_from_derived_filename +} + + +# Execute main() if this is run in standalone mode (i.e. not in a unit test). +ARGV0="$(basename "$0")" +argv0="$(echo "${ARGV0}" |sed 's/_test$//;s/_test\.sh$//')" +if [ "${ARGV0}" = "${argv0}" ]; then + main "$@" +fi diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/mock_file_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/mock_file_test.sh new file mode 100755 index 0000000..1da8dd2 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/mock_file_test.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# shUnit2 example for mocking files. + +MOCK_PASSWD='' # This will be overridden in oneTimeSetUp(). + +test_root_uid_from_passed_filename() { + result="$(root_uid_from_passed_filename "${MOCK_PASSWD}")" + assertEquals 'unexpected root uid' '0' "${result}" +} + +test_root_uid_from_derived_filename() { + result="$(root_uid_from_derived_filename)" + assertEquals 'unexpected root uid' '0' "${result}" +} + +oneTimeSetUp() { + # Provide a mock passwd file for testing. This will be cleaned up + # automatically by shUnit2. + MOCK_PASSWD="${SHUNIT_TMPDIR}/passwd" + cat <"${MOCK_PASSWD}" +nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false +root:*:0:0:System Administrator:/var/root:/bin/sh +daemon:*:1:1:System Services:/var/root:/usr/bin/false +EOF + + # Load script under test. + . './mock_file.sh' +} + +# Load and run shUnit2. +[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 +. ../shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/party_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/party_test.sh new file mode 100755 index 0000000..41bd124 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/party_test.sh @@ -0,0 +1,16 @@ +#! /bin/sh +# file: examples/party_test.sh +# +# This test is mostly for fun. Technically, it is a bad example of a unit test +# because of the temporal requirement, namely that the year be 1999. A better +# test would have been to pass in both a known-bad and known-good year into a +# function, and test for the expected result. + +testPartyLikeItIs1999() { + year=`date '+%Y'` + assertEquals "It's not 1999 :-(" \ + '1999' "${year}" +} + +# Load and run shUnit2. +. ../shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/suite_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/suite_test.sh new file mode 100755 index 0000000..278c3a0 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/examples/suite_test.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# file: examples/suite_test.sh +# +# This test demonstrates the use of suites. Note: the suite functionality is +# deprecated as of v2.1.0, and will be removed in a future major release. + +# suite is a special function called by shUnit2 to setup a suite of tests. It +# enables a developer to call a set of functions that contain tests without +# needing to rename the functions to start with "test". +# +# Tests that are to be called from within `suite()` are added to the list of +# executable tests by means of the `suite_addTest()` function. +suite() { + # Add the suite_test_one() function to the list of executable tests. + suite_addTest suite_test_one + + # Call the suite_test_two() function, but note that the test results will not + # be added to the global stats, and therefore not reported at the end of the + # unit test execution. + suite_test_two +} + +suite_test_one() { + assertEquals 1 1 +} + +suite_test_two() { + assertNotEquals 1 2 +} + +# Load and run shUnit2. +. ../shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/gen_test_report.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/gen_test_report.sh new file mode 100755 index 0000000..28da021 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/gen_test_report.sh @@ -0,0 +1,88 @@ +#! /bin/sh +# vim:et:ft=sh:sts=2:sw=2 +# +# This script runs the provided unit tests and sends the output to the +# appropriate file. +# +# Copyright 2008-2017 Kate Ward. All Rights Reserved. +# Released under the Apache 2.0 license. +# +# Author: kate.ward@forestent.com (Kate Ward) +# https://github.com/kward/shunit2 +# +# Source following. +# shellcheck disable=SC1090,SC1091 +# FLAGS variables are dynamically created. +# shellcheck disable=SC2154 +# Disagree with [ p ] && [ q ] vs [ p -a -q ] recommendation. +# shellcheck disable=SC2166 + +# Treat unset variables as an error. +set -u + +die() { + [ $# -gt 0 ] && echo "error: $*" >&2 + exit 1 +} + +BASE_DIR=$(dirname "$0") +LIB_DIR="${BASE_DIR}/lib" + +### Load libraries. +. "${LIB_DIR}/shflags" || die 'unable to load shflags library' +. "${LIB_DIR}/shlib" || die 'unable to load shlib library' +. "${LIB_DIR}/versions" || die 'unable to load versions library' + +# Redefining BASE_DIR now that we have the shlib functions. We need BASE_DIR so +# that we can properly load things, even in the event that this script is called +# from a different directory. +BASE_DIR=$(shlib_relToAbsPath "${BASE_DIR}") + +# Define flags. +os_name=$(versions_osName |sed 's/ /_/g') +os_version=$(versions_osVersion) + +DEFINE_boolean force false 'force overwrite' f +DEFINE_string output_dir "${TMPDIR}" 'output dir' d +DEFINE_string output_file "${os_name}-${os_version}.txt" 'output file' o +DEFINE_string runner 'test_runner' 'unit test runner' r +DEFINE_boolean dry_run false "suppress logging to a file" n + +main() { + # Determine output filename. + # shellcheck disable=SC2154 + output="${FLAGS_output_dir:+${FLAGS_output_dir}/}${FLAGS_output_file}" + output=$(shlib_relToAbsPath "${output}") + + # Checks. + if [ "${FLAGS_dry_run}" -eq "${FLAGS_FALSE}" -a -f "${output}" ]; then + if [ "${FLAGS_force}" -eq "${FLAGS_TRUE}" ]; then + rm -f "${output}" + else + echo "not overwriting '${output}'" >&2 + exit "${FLAGS_ERROR}" + fi + fi + if [ "${FLAGS_dry_run}" -eq "${FLAGS_FALSE}" ]; then + touch "${output}" 2>/dev/null || die "unable to write to '${output}'" + fi + + # Run tests. + ( + if [ "${FLAGS_dry_run}" -eq "${FLAGS_FALSE}" ]; then + "./${FLAGS_runner}" |tee "${output}" + else + "./${FLAGS_runner}" + fi + ) + + if [ "${FLAGS_dry_run}" -eq "${FLAGS_FALSE}" ]; then + echo >&2 + echo "Output written to '${output}'." >&2 + fi +} + +FLAGS "$@" || exit $? +[ "${FLAGS_help}" -eq "${FLAGS_FALSE}" ] || exit +eval set -- "${FLAGS_ARGV}" +main "${@:-}" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/lib/shflags b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/lib/shflags similarity index 70% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/lib/shflags rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/lib/shflags index 9e69e64..70cdea4 100644 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/lib/shflags +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/lib/shflags @@ -1,33 +1,33 @@ -# $Id: shflags 189 2013-01-15 00:13:10Z kate.ward@forestent.com $ # vim:et:ft=sh:sts=2:sw=2 # -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) +# Copyright 2008-2017 Kate Ward. All Rights Reserved. +# Released under the Apache License 2.0 license. +# http://www.apache.org/licenses/LICENSE-2.0 # # shFlags -- Advanced command-line flag library for Unix shell scripts. -# http://code.google.com/p/shflags/ +# https://github.com/kward/shflags # # Author: kate.ward@forestent.com (Kate Ward) # -# This module implements something like the google-gflags library available -# from http://code.google.com/p/google-gflags/. +# This module implements something like the gflags library available +# from https://github.com/gflags/gflags. # # FLAG TYPES: This is a list of the DEFINE_*'s that you can do. All flags take # a name, default value, help-string, and optional 'short' name (one-letter -# name). Some flags have other arguments, which are described with the flag. +# name). Some flags have other arguments, which are described with the flag. # -# DEFINE_string: takes any input, and intreprets it as a string. +# DEFINE_string: takes any input, and interprets it as a string. # # DEFINE_boolean: does not take any arguments. Say --myflag to set # FLAGS_myflag to true, or --nomyflag to set FLAGS_myflag to false. For short # flags, passing the flag on the command-line negates the default value, i.e. # if the default is true, passing the flag sets the value to false. # -# DEFINE_float: takes an input and intreprets it as a floating point number. As +# DEFINE_float: takes an input and interprets it as a floating point number. As # shell does not support floats per-se, the input is merely validated as # being a valid floating point value. # -# DEFINE_integer: takes an input and intreprets it as an integer. +# DEFINE_integer: takes an input and interprets it as an integer. # # SPECIAL FLAGS: There are a few flags that have special meaning: # --help (or -?) prints a list of all the flags in a human-readable fashion @@ -81,28 +81,49 @@ # # Notes: # - lists of strings are space separated, and a null value is the '~' char. +# +### ShellCheck (http://www.shellcheck.net/) +# $() are not fully portable (POSIX != portable). +# shellcheck disable=SC2006 +# [ p -a q ] are well defined enough (vs [ p ] && [ q ]). +# shellcheck disable=SC2166 -# return if FLAGS already loaded +# Return if FLAGS already loaded. [ -n "${FLAGS_VERSION:-}" ] && return 0 -FLAGS_VERSION='1.0.4pre' +FLAGS_VERSION='1.2.3pre' -# return values that scripts can use +# Return values that scripts can use. FLAGS_TRUE=0 FLAGS_FALSE=1 FLAGS_ERROR=2 -# determine some reasonable command defaults -__FLAGS_UNAME_S=`uname -s` -case "${__FLAGS_UNAME_S}" in - BSD) __FLAGS_EXPR_CMD='gexpr' ;; - *) __FLAGS_EXPR_CMD='expr' ;; -esac +# Logging levels. +FLAGS_LEVEL_DEBUG=0 +FLAGS_LEVEL_INFO=1 +FLAGS_LEVEL_WARN=2 +FLAGS_LEVEL_ERROR=3 +FLAGS_LEVEL_FATAL=4 +__FLAGS_LEVEL_DEFAULT=${FLAGS_LEVEL_WARN} -# commands a user can override if needed +# Determine some reasonable command defaults. +__FLAGS_EXPR_CMD='expr --' +__FLAGS_UNAME_S=`uname -s` +if [ "${__FLAGS_UNAME_S}" = 'BSD' ]; then + __FLAGS_EXPR_CMD='gexpr --' +else + _flags_output_=`${__FLAGS_EXPR_CMD} 2>&1` + if [ $? -eq ${FLAGS_TRUE} -a "${_flags_output_}" = '--' ]; then + # We are likely running inside BusyBox. + __FLAGS_EXPR_CMD='expr' + fi + unset _flags_output_ +fi + +# Commands a user can override if desired. FLAGS_EXPR_CMD=${FLAGS_EXPR_CMD:-${__FLAGS_EXPR_CMD}} FLAGS_GETOPT_CMD=${FLAGS_GETOPT_CMD:-getopt} -# specific shell checks +# Specific shell checks. if [ -n "${ZSH_VERSION:-}" ]; then setopt |grep "^shwordsplit$" >/dev/null if [ $? -ne ${FLAGS_TRUE} ]; then @@ -114,7 +135,7 @@ if [ -n "${ZSH_VERSION:-}" ]; then fi fi -# can we use built-ins? +# Can we use built-ins? ( echo "${FLAGS_TRUE#0}"; ) >/dev/null 2>&1 if [ $? -eq ${FLAGS_TRUE} ]; then __FLAGS_USE_BUILTIN=${FLAGS_TRUE} @@ -122,32 +143,32 @@ else __FLAGS_USE_BUILTIN=${FLAGS_FALSE} fi + # -# constants +# Constants. # -# reserved flag names +# Reserved flag names. __FLAGS_RESERVED_LIST=' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE ' __FLAGS_RESERVED_LIST="${__FLAGS_RESERVED_LIST} VERSION " -# getopt version +# Determined getopt version (standard or enhanced). __FLAGS_GETOPT_VERS_STD=0 __FLAGS_GETOPT_VERS_ENH=1 -__FLAGS_GETOPT_VERS_BSD=2 -${FLAGS_GETOPT_CMD} >/dev/null 2>&1 -case $? in - 0) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} ;; # bsd getopt - 2) - # TODO(kward): look into '-T' option to test the internal getopt() version - if [ "`${FLAGS_GETOPT_CMD} --version`" = '-- ' ]; then - __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} - else - __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_ENH} - fi - ;; - *) _flags_fatal 'unable to determine getopt version' ;; -esac +# shellcheck disable=SC2120 +_flags_getopt_vers() { + _flags_getopt_cmd_=${1:-${FLAGS_GETOPT_CMD}} + case "`${_flags_getopt_cmd_} -lfoo '' --foo 2>&1`" in + ' -- --foo') echo ${__FLAGS_GETOPT_VERS_STD} ;; + ' --foo --') echo ${__FLAGS_GETOPT_VERS_ENH} ;; + # Unrecognized output. Assuming standard getopt version. + *) echo ${__FLAGS_GETOPT_VERS_STD} ;; + esac + unset _flags_getopt_cmd_ +} +# shellcheck disable=SC2119 +__FLAGS_GETOPT_VERS=`_flags_getopt_vers` # getopt optstring lengths __FLAGS_OPTSTR_SHORT=0 @@ -155,65 +176,102 @@ __FLAGS_OPTSTR_LONG=1 __FLAGS_NULL='~' -# flag info strings +# Flag info strings. __FLAGS_INFO_DEFAULT='default' __FLAGS_INFO_HELP='help' __FLAGS_INFO_SHORT='short' __FLAGS_INFO_TYPE='type' -# flag lengths +# Flag lengths. __FLAGS_LEN_SHORT=0 __FLAGS_LEN_LONG=1 -# flag types +# Flag types. __FLAGS_TYPE_NONE=0 __FLAGS_TYPE_BOOLEAN=1 __FLAGS_TYPE_FLOAT=2 __FLAGS_TYPE_INTEGER=3 __FLAGS_TYPE_STRING=4 -# set the constants readonly +# Set the constants readonly. __flags_constants=`set |awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'` for __flags_const in ${__flags_constants}; do - # skip certain flags + # Skip certain flags. case ${__flags_const} in FLAGS_HELP) continue ;; FLAGS_PARENT) continue ;; esac - # set flag readonly + # Set flag readonly. if [ -z "${ZSH_VERSION:-}" ]; then - readonly ${__flags_const} - else # handle zsh - case ${ZSH_VERSION} in - [123].*) readonly ${__flags_const} ;; - *) readonly -g ${__flags_const} ;; # declare readonly constants globally - esac + readonly "${__flags_const}" + continue fi + case ${ZSH_VERSION} in + [123].*) readonly "${__flags_const}" ;; + *) readonly -g "${__flags_const}" ;; # Declare readonly constants globally. + esac done unset __flags_const __flags_constants # -# internal variables +# Internal variables. # -# space separated lists -__flags_boolNames=' ' # boolean flag names -__flags_longNames=' ' # long flag names -__flags_shortNames=' ' # short flag names -__flags_definedNames=' ' # defined flag names (used for validation) +# Space separated lists. +__flags_boolNames=' ' # Boolean flag names. +__flags_longNames=' ' # Long flag names. +__flags_shortNames=' ' # Short flag names. +__flags_definedNames=' ' # Defined flag names (used for validation). -__flags_columns='' # screen width in columns -__flags_opts='' # temporary storage for parsed getopt flags +__flags_columns='' # Screen width in columns. +__flags_level=0 # Default logging level. +__flags_opts='' # Temporary storage for parsed getopt flags. #------------------------------------------------------------------------------ -# private functions +# Private functions. # -# logging functions -_flags_debug() { echo "flags:DEBUG $@" >&2; } -_flags_warn() { echo "flags:WARN $@" >&2; } -_flags_error() { echo "flags:ERROR $@" >&2; } -_flags_fatal() { echo "flags:FATAL $@" >&2; exit ${FLAGS_ERROR}; } +# Logging functions. +_flags_debug() { + [ ${__flags_level} -le ${FLAGS_LEVEL_DEBUG} ] || return + echo "flags:DEBUG $*" >&2 +} +_flags_info() { + [ ${__flags_level} -le ${FLAGS_LEVEL_INFO} ] || return + echo "flags:INFO $*" >&2 +} +_flags_warn() { + [ ${__flags_level} -le ${FLAGS_LEVEL_WARN} ] || return + echo "flags:WARN $*" >&2 +} +_flags_error() { + [ ${__flags_level} -le ${FLAGS_LEVEL_ERROR} ] || return + echo "flags:ERROR $*" >&2 +} +_flags_fatal() { + [ ${__flags_level} -le ${FLAGS_LEVEL_FATAL} ] || return + echo "flags:FATAL $*" >&2 + exit ${FLAGS_ERROR} +} + +# Get the logging level. +flags_loggingLevel() { echo ${__flags_level}; } + +# Set the logging level. +# +# Args: +# _flags_level_: integer: new logging level +# Returns: +# nothing +flags_setLoggingLevel() { + [ $# -ne 1 ] && _flags_fatal "flags_setLevel(): logging level missing" + _flags_level_=$1 + [ "${_flags_level_}" -ge "${FLAGS_LEVEL_DEBUG}" \ + -a "${_flags_level_}" -le "${FLAGS_LEVEL_FATAL}" ] \ + || _flags_fatal "Invalid logging level '${_flags_level_}' specified." + __flags_level=$1 + unset _flags_level_ +} # Define a flag. # @@ -226,15 +284,14 @@ _flags_fatal() { echo "flags:FATAL $@" >&2; exit ${FLAGS_ERROR}; } # __flags_flagname_type - the type of flag (one of __FLAGS_TYPE_*) # # Args: -# _flags__type: integer: internal type of flag (__FLAGS_TYPE_*) -# _flags__name: string: long flag name -# _flags__default: default flag value -# _flags__help: string: help string -# _flags__short: string: (optional) short flag name +# _flags_type_: integer: internal type of flag (__FLAGS_TYPE_*) +# _flags_name_: string: long flag name +# _flags_default_: default flag value +# _flags_help_: string: help string +# _flags_short_: string: (optional) short flag name # Returns: # integer: success of operation, or error -_flags_define() -{ +_flags_define() { if [ $# -lt 4 ]; then flags_error='DEFINE error: too few arguments' flags_return=${FLAGS_ERROR} @@ -245,50 +302,54 @@ _flags_define() _flags_type_=$1 _flags_name_=$2 _flags_default_=$3 - _flags_help_=$4 + _flags_help_=${4:-§} # Special value '§' indicates no help string provided. _flags_short_=${5:-${__FLAGS_NULL}} - _flags_return_=${FLAGS_TRUE} - _flags_usName_=`_flags_underscoreName ${_flags_name_}` + _flags_debug "type:${_flags_type_} name:${_flags_name_}" \ + "default:'${_flags_default_}' help:'${_flags_help_}'" \ + "short:${_flags_short_}" - # check whether the flag name is reserved - _flags_itemInList ${_flags_usName_} "${__FLAGS_RESERVED_LIST}" + _flags_return_=${FLAGS_TRUE} + _flags_usName_="`_flags_underscoreName "${_flags_name_}"`" + + # Check whether the flag name is reserved. + _flags_itemInList "${_flags_usName_}" "${__FLAGS_RESERVED_LIST}" if [ $? -eq ${FLAGS_TRUE} ]; then flags_error="flag name (${_flags_name_}) is reserved" _flags_return_=${FLAGS_ERROR} fi - # require short option for getopt that don't support long options + # Require short option for getopt that don't support long options. if [ ${_flags_return_} -eq ${FLAGS_TRUE} \ - -a ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} \ + -a "${__FLAGS_GETOPT_VERS}" -ne "${__FLAGS_GETOPT_VERS_ENH}" \ -a "${_flags_short_}" = "${__FLAGS_NULL}" ] then flags_error="short flag required for (${_flags_name_}) on this platform" _flags_return_=${FLAGS_ERROR} fi - # check for existing long name definition + # Check for existing long name definition. if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then - if _flags_itemInList ${_flags_usName_} ${__flags_definedNames}; then + if _flags_itemInList "${_flags_usName_}" "${__flags_definedNames}"; then flags_error="definition for ([no]${_flags_name_}) already exists" _flags_warn "${flags_error}" _flags_return_=${FLAGS_FALSE} fi fi - # check for existing short name definition + # Check for existing short name definition. if [ ${_flags_return_} -eq ${FLAGS_TRUE} \ -a "${_flags_short_}" != "${__FLAGS_NULL}" ] then - if _flags_itemInList "${_flags_short_}" ${__flags_shortNames}; then + if _flags_itemInList "${_flags_short_}" "${__flags_shortNames}"; then flags_error="flag short name (${_flags_short_}) already defined" _flags_warn "${flags_error}" _flags_return_=${FLAGS_FALSE} fi fi - # handle default value. note, on several occasions the 'if' portion of an - # if/then/else contains just a ':' which does nothing. a binary reversal via + # Handle default value. Note, on several occasions the 'if' portion of an + # if/then/else contains just a ':' which does nothing. A binary reversal via # '!' is not done because it does not work on all shells. if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then case ${_flags_type_} in @@ -322,7 +383,7 @@ _flags_define() fi ;; - ${__FLAGS_TYPE_STRING}) ;; # everything in shell is a valid string + ${__FLAGS_TYPE_STRING}) ;; # Everything in shell is a valid string. *) flags_error="unrecognized flag type '${_flags_type_}'" @@ -332,7 +393,7 @@ _flags_define() fi if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then - # store flag information + # Store flag information. eval "FLAGS_${_flags_usName_}='${_flags_default_}'" eval "__flags_${_flags_usName_}_${__FLAGS_INFO_TYPE}=${_flags_type_}" eval "__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}=\ @@ -343,12 +404,12 @@ _flags_define() # append flag names to name lists __flags_shortNames="${__flags_shortNames}${_flags_short_} " __flags_longNames="${__flags_longNames}${_flags_name_} " - [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \ + [ "${_flags_type_}" -eq "${__FLAGS_TYPE_BOOLEAN}" ] && \ __flags_boolNames="${__flags_boolNames}no${_flags_name_} " - # append flag names to defined names for later validation checks + # Append flag names to defined names for later validation checks. __flags_definedNames="${__flags_definedNames}${_flags_usName_} " - [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \ + [ "${_flags_type_}" -eq "${__FLAGS_TYPE_BOOLEAN}" ] && \ __flags_definedNames="${__flags_definedNames}no${_flags_usName_} " fi @@ -365,9 +426,8 @@ _flags_define() # unnamed: string: log flag name # Output: # string: underscored name -_flags_underscoreName() -{ - echo $1 |tr '-' '_' +_flags_underscoreName() { + echo "$1" |tr '-' '_' } # Return valid getopt options using currently defined list of long options. @@ -381,24 +441,23 @@ _flags_underscoreName() # string: generated option string for getopt # Returns: # boolean: success of operation (always returns True) -_flags_genOptStr() -{ +_flags_genOptStr() { _flags_optStrType_=$1 _flags_opts_='' for _flags_name_ in ${__flags_longNames}; do - _flags_usName_=`_flags_underscoreName ${_flags_name_}` - _flags_type_=`_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}` + _flags_usName_="`_flags_underscoreName "${_flags_name_}"`" + _flags_type_="`_flags_getFlagInfo "${_flags_usName_}" "${__FLAGS_INFO_TYPE}"`" [ $? -eq ${FLAGS_TRUE} ] || _flags_fatal 'call to _flags_type_ failed' case ${_flags_optStrType_} in ${__FLAGS_OPTSTR_SHORT}) - _flags_shortName_=`_flags_getFlagInfo \ - ${_flags_usName_} ${__FLAGS_INFO_SHORT}` + _flags_shortName_="`_flags_getFlagInfo \ + "${_flags_usName_}" "${__FLAGS_INFO_SHORT}"`" if [ "${_flags_shortName_}" != "${__FLAGS_NULL}" ]; then _flags_opts_="${_flags_opts_}${_flags_shortName_}" - # getopt needs a trailing ':' to indicate a required argument - [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \ + # getopt needs a trailing ':' to indicate a required argument. + [ "${_flags_type_}" -ne "${__FLAGS_TYPE_BOOLEAN}" ] && \ _flags_opts_="${_flags_opts_}:" fi ;; @@ -406,7 +465,7 @@ _flags_genOptStr() ${__FLAGS_OPTSTR_LONG}) _flags_opts_="${_flags_opts_:+${_flags_opts_},}${_flags_name_}" # getopt needs a trailing ':' to indicate a required argument - [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \ + [ "${_flags_type_}" -ne "${__FLAGS_TYPE_BOOLEAN}" ] && \ _flags_opts_="${_flags_opts_}:" ;; esac @@ -427,30 +486,39 @@ _flags_genOptStr() # string: value of dereferenced flag variable # Returns: # integer: one of FLAGS_{TRUE|FALSE|ERROR} -_flags_getFlagInfo() -{ - # note: adding gFI to variable names to prevent naming conflicts with calling +_flags_getFlagInfo() { + # Note: adding gFI to variable names to prevent naming conflicts with calling # functions _flags_gFI_usName_=$1 _flags_gFI_info_=$2 + # Example: given argument usName (underscored flag name) of 'my_flag', and + # argument info of 'help', set the _flags_infoValue_ variable to the value of + # ${__flags_my_flag_help}, and see if it is non-empty. _flags_infoVar_="__flags_${_flags_gFI_usName_}_${_flags_gFI_info_}" _flags_strToEval_="_flags_infoValue_=\"\${${_flags_infoVar_}:-}\"" eval "${_flags_strToEval_}" if [ -n "${_flags_infoValue_}" ]; then + # Special value '§' indicates no help string provided. + [ "${_flags_gFI_info_}" = ${__FLAGS_INFO_HELP} \ + -a "${_flags_infoValue_}" = '§' ] && _flags_infoValue_='' flags_return=${FLAGS_TRUE} else - # see if the _flags_gFI_usName_ variable is a string as strings can be + # See if the _flags_gFI_usName_ variable is a string as strings can be # empty... - # note: the DRY principle would say to have this function call itself for + # Note: the DRY principle would say to have this function call itself for # the next three lines, but doing so results in an infinite loop as an # invalid _flags_name_ will also not have the associated _type variable. # Because it doesn't (it will evaluate to an empty string) the logic will # try to find the _type variable of the _type variable, and so on. Not so # good ;-) + # + # Example cont.: set the _flags_typeValue_ variable to the value of + # ${__flags_my_flag_type}, and see if it equals '4'. _flags_typeVar_="__flags_${_flags_gFI_usName_}_${__FLAGS_INFO_TYPE}" _flags_strToEval_="_flags_typeValue_=\"\${${_flags_typeVar_}:-}\"" eval "${_flags_strToEval_}" + # shellcheck disable=SC2154 if [ "${_flags_typeValue_}" = "${__FLAGS_TYPE_STRING}" ]; then flags_return=${FLAGS_TRUE} else @@ -466,7 +534,7 @@ _flags_getFlagInfo() return ${flags_return} } -# Check for presense of item in a list. +# Check for presence of item in a list. # # Passed a string (e.g. 'abc'), this function will determine if the string is # present in the list of strings (e.g. ' foo bar abc '). @@ -480,12 +548,10 @@ _flags_itemInList() { _flags_str_=$1 shift - echo " ${*:-} " |grep " ${_flags_str_} " >/dev/null - if [ $? -eq 0 ]; then - flags_return=${FLAGS_TRUE} - else - flags_return=${FLAGS_FALSE} - fi + case " ${*:-} " in + *\ ${_flags_str_}\ *) flags_return=${FLAGS_TRUE} ;; + *) flags_return=${FLAGS_FALSE} ;; + esac unset _flags_str_ return ${flags_return} @@ -495,22 +561,23 @@ _flags_itemInList() { # # Output: # integer: width in columns of the current screen. -_flags_columns() -{ +_flags_columns() { if [ -z "${__flags_columns}" ]; then - # determine the value and store it if eval stty size >/dev/null 2>&1; then # stty size worked :-) + # shellcheck disable=SC2046 set -- `stty size` - __flags_columns=$2 - elif eval tput cols >/dev/null 2>&1; then - set -- `tput cols` - __flags_columns=$1 - else - __flags_columns=80 # default terminal width + __flags_columns="${2:-}" fi fi - echo ${__flags_columns} + if [ -z "${__flags_columns}" ]; then + if eval tput cols >/dev/null 2>&1; then + # shellcheck disable=SC2046 + set -- `tput cols` + __flags_columns="${1:-}" + fi + fi + echo "${__flags_columns:-80}" } # Validate a boolean. @@ -519,8 +586,7 @@ _flags_columns() # _flags__bool: boolean: value to validate # Returns: # bool: true if the value is a valid boolean -_flags_validBool() -{ +_flags_validBool() { _flags_bool_=$1 flags_return=${FLAGS_TRUE} @@ -540,31 +606,30 @@ _flags_validBool() # _flags_float_: float: value to validate # Returns: # bool: true if the value is a valid integer -_flags_validFloat() -{ +_flags_validFloat() { flags_return=${FLAGS_FALSE} [ -n "$1" ] || return ${flags_return} _flags_float_=$1 - if _flags_validInt ${_flags_float_}; then + if _flags_validInt "${_flags_float_}"; then flags_return=${FLAGS_TRUE} elif _flags_useBuiltin; then _flags_float_whole_=${_flags_float_%.*} _flags_float_fraction_=${_flags_float_#*.} - if _flags_validInt ${_flags_float_whole_:-0} -a \ - _flags_validInt ${_flags_float_fraction_}; then + if _flags_validInt "${_flags_float_whole_:-0}" -a \ + _flags_validInt "${_flags_float_fraction_}"; then flags_return=${FLAGS_TRUE} fi unset _flags_float_whole_ _flags_float_fraction_ else flags_return=${FLAGS_TRUE} case ${_flags_float_} in - -*) # negative floats - _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\ + -*) # Negative floats. + _flags_test_=`${FLAGS_EXPR_CMD} "${_flags_float_}" :\ '\(-[0-9]*\.[0-9]*\)'` ;; - *) # positive floats - _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\ + *) # Positive floats. + _flags_test_=`${FLAGS_EXPR_CMD} "${_flags_float_}" :\ '\([0-9]*\.[0-9]*\)'` ;; esac @@ -582,19 +647,18 @@ _flags_validFloat() # _flags_int_: integer: value to validate # Returns: # bool: true if the value is a valid integer -_flags_validInt() -{ +_flags_validInt() { flags_return=${FLAGS_FALSE} [ -n "$1" ] || return ${flags_return} _flags_int_=$1 case ${_flags_int_} in - -*.*) ;; # ignore negative floats (we'll invalidate them later) - -*) # strip possible leading negative sign + -*.*) ;; # Ignore negative floats (we'll invalidate them later). + -*) # Strip possible leading negative sign. if _flags_useBuiltin; then _flags_int_=${_flags_int_#-} else - _flags_int_=`${FLAGS_EXPR_CMD} -- "${_flags_int_}" : '-\([0-9][0-9]*\)'` + _flags_int_=`${FLAGS_EXPR_CMD} "${_flags_int_}" : '-\([0-9][0-9]*\)'` fi ;; esac @@ -617,14 +681,13 @@ _flags_validInt() # @: varies: command-line options to parse # Returns: # integer: a FLAGS success condition -_flags_getoptStandard() -{ +_flags_getoptStandard() { flags_return=${FLAGS_TRUE} _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}` - # check for spaces in passed options + # Check for spaces in passed options. for _flags_opt_ in "$@"; do - # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06 + # Note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06. _flags_match_=`echo "x${_flags_opt_}x" |sed 's/ //g'` if [ "${_flags_match_}" != "x${_flags_opt_}x" ]; then flags_error='the available getopt does not support spaces in options' @@ -634,7 +697,7 @@ _flags_getoptStandard() done if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then - __flags_opts=`getopt ${_flags_shortOpts_} $@ 2>&1` + __flags_opts=`getopt "${_flags_shortOpts_}" "$@" 2>&1` _flags_rtrn_=$? if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then _flags_warn "${__flags_opts}" @@ -656,8 +719,7 @@ _flags_getoptStandard() # @: varies: command-line options to parse # Returns: # integer: a FLAGS success condition -_flags_getoptEnhanced() -{ +_flags_getoptEnhanced() { flags_return=${FLAGS_TRUE} _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}` _flags_boolOpts_=`echo "${__flags_boolNames}" \ @@ -665,7 +727,7 @@ _flags_getoptEnhanced() _flags_longOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_LONG}` __flags_opts=`${FLAGS_GETOPT_CMD} \ - -o ${_flags_shortOpts_} \ + -o "${_flags_shortOpts_}" \ -l "${_flags_longOpts_},${_flags_boolOpts_}" \ -- "$@" 2>&1` _flags_rtrn_=$? @@ -690,17 +752,18 @@ _flags_getoptEnhanced() # @: varies: output from getopt parsing # Returns: # integer: a FLAGS success condition -_flags_parseGetopt() -{ +_flags_parseGetopt() { _flags_argc_=$1 shift flags_return=${FLAGS_TRUE} - if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then + if [ "${__FLAGS_GETOPT_VERS}" -ne "${__FLAGS_GETOPT_VERS_ENH}" ]; then + # The @$ must be unquoted as it needs to be re-split. + # shellcheck disable=SC2068 set -- $@ else - # note the quotes around the `$@' -- they are essential! + # Note the quotes around the `$@' -- they are essential! eval set -- "$@" fi @@ -710,34 +773,35 @@ _flags_parseGetopt() # arguments. Its usage was replaced by FLAGS_ARGV, and it is being kept only # for backwards compatibility reasons. FLAGS_ARGC=`_flags_math "$# - 1 - ${_flags_argc_}"` + export FLAGS_ARGC - # handle options. note options with values must do an additional shift + # Handle options. note options with values must do an additional shift. while true; do _flags_opt_=$1 _flags_arg_=${2:-} _flags_type_=${__FLAGS_TYPE_NONE} _flags_name_='' - # determine long flag name + # Determine long flag name. case "${_flags_opt_}" in - --) shift; break ;; # discontinue option parsing + --) shift; break ;; # Discontinue option parsing. - --*) # long option + --*) # Long option. if _flags_useBuiltin; then _flags_opt_=${_flags_opt_#*--} else - _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '--\(.*\)'` + _flags_opt_=`${FLAGS_EXPR_CMD} "${_flags_opt_}" : '--\(.*\)'` fi _flags_len_=${__FLAGS_LEN_LONG} - if _flags_itemInList "${_flags_opt_}" ${__flags_longNames}; then + if _flags_itemInList "${_flags_opt_}" "${__flags_longNames}"; then _flags_name_=${_flags_opt_} else - # check for negated long boolean version - if _flags_itemInList "${_flags_opt_}" ${__flags_boolNames}; then + # Check for negated long boolean version. + if _flags_itemInList "${_flags_opt_}" "${__flags_boolNames}"; then if _flags_useBuiltin; then _flags_name_=${_flags_opt_#*no} else - _flags_name_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : 'no\(.*\)'` + _flags_name_=`${FLAGS_EXPR_CMD} "${_flags_opt_}" : 'no\(.*\)'` fi _flags_type_=${__FLAGS_TYPE_BOOLEAN} _flags_arg_=${__FLAGS_NULL} @@ -745,34 +809,34 @@ _flags_parseGetopt() fi ;; - -*) # short option + -*) # Short option. if _flags_useBuiltin; then _flags_opt_=${_flags_opt_#*-} else - _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '-\(.*\)'` + _flags_opt_=`${FLAGS_EXPR_CMD} "${_flags_opt_}" : '-\(.*\)'` fi _flags_len_=${__FLAGS_LEN_SHORT} - if _flags_itemInList "${_flags_opt_}" ${__flags_shortNames}; then - # yes. match short name to long name. note purposeful off-by-one + if _flags_itemInList "${_flags_opt_}" "${__flags_shortNames}"; then + # Yes. Match short name to long name. Note purposeful off-by-one # (too high) with awk calculations. _flags_pos_=`echo "${__flags_shortNames}" \ |awk 'BEGIN{RS=" ";rn=0}$0==e{rn=NR}END{print rn}' \ - e=${_flags_opt_}` + e="${_flags_opt_}"` _flags_name_=`echo "${__flags_longNames}" \ |awk 'BEGIN{RS=" "}rn==NR{print $0}' rn="${_flags_pos_}"` fi ;; esac - # die if the flag was unrecognized + # Die if the flag was unrecognized. if [ -z "${_flags_name_}" ]; then flags_error="unrecognized option (${_flags_opt_})" flags_return=${FLAGS_ERROR} break fi - # set new flag value - _flags_usName_=`_flags_underscoreName ${_flags_name_}` + # Set new flag value. + _flags_usName_=`_flags_underscoreName "${_flags_name_}"` [ ${_flags_type_} -eq ${__FLAGS_TYPE_NONE} ] && \ _flags_type_=`_flags_getFlagInfo \ "${_flags_usName_}" ${__FLAGS_INFO_TYPE}` @@ -788,7 +852,8 @@ _flags_parseGetopt() _flags_strToEval_="_flags_val_=\ \${__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}}" eval "${_flags_strToEval_}" - if [ ${_flags_val_} -eq ${FLAGS_FALSE} ]; then + # shellcheck disable=SC2154 + if [ "${_flags_val_}" -eq ${FLAGS_FALSE} ]; then eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}" else eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}" @@ -821,22 +886,23 @@ _flags_parseGetopt() ;; esac - # handle special case help flag + # Handle special case help flag. if [ "${_flags_usName_}" = 'help' ]; then - if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then + # shellcheck disable=SC2154 + if [ "${FLAGS_help}" -eq ${FLAGS_TRUE} ]; then flags_help flags_error='help requested' - flags_return=${FLAGS_TRUE} + flags_return=${FLAGS_FALSE} break fi fi - # shift the option and non-boolean arguements out. + # Shift the option and non-boolean arguments out. shift - [ ${_flags_type_} != ${__FLAGS_TYPE_BOOLEAN} ] && shift + [ "${_flags_type_}" != ${__FLAGS_TYPE_BOOLEAN} ] && shift done - # give user back non-flag arguments + # Give user back non-flag arguments. FLAGS_ARGV='' while [ $# -gt 0 ]; do FLAGS_ARGV="${FLAGS_ARGV:+${FLAGS_ARGV} }'$1'" @@ -856,19 +922,19 @@ _flags_parseGetopt() # integer: the result # Returns: # bool: success of math evaluation -_flags_math() -{ +_flags_math() { if [ $# -eq 0 ]; then flags_return=${FLAGS_FALSE} elif _flags_useBuiltin; then # Variable assignment is needed as workaround for Solaris Bourne shell, # which cannot parse a bare $((expression)). + # shellcheck disable=SC2016 _flags_expr_='$(($@))' eval echo ${_flags_expr_} flags_return=$? unset _flags_expr_ else - eval expr $@ + eval expr "$@" flags_return=$? fi @@ -883,8 +949,7 @@ _flags_math() # integer: length of string # Returns: # bool: success of strlen evaluation -_flags_strlen() -{ +_flags_strlen() { _flags_str_=${1:-} if [ -z "${_flags_str_}" ]; then @@ -892,12 +957,12 @@ _flags_strlen() elif _flags_useBuiltin; then flags_output=${#_flags_str_} else - flags_output=`${FLAGS_EXPR_CMD} -- "${_flags_str_}" : '.*'` + flags_output=`${FLAGS_EXPR_CMD} "${_flags_str_}" : '.*'` fi flags_return=$? unset _flags_str_ - echo ${flags_output} + echo "${flags_output}" return ${flags_return} } @@ -907,18 +972,15 @@ _flags_strlen() # None # Returns: # bool: true if built-ins should be used -_flags_useBuiltin() -{ - return ${__FLAGS_USE_BUILTIN} -} +_flags_useBuiltin() { return ${__FLAGS_USE_BUILTIN}; } #------------------------------------------------------------------------------ # public functions -# +# # A basic boolean flag. Boolean flags do not take any arguments, and their # value is either 1 (false) or 0 (true). For long flags, the false value is # specified on the command line by prepending the word 'no'. With short flags, -# the presense of the flag toggles the current value between true and false. +# the presence of the flag toggles the current value between true and false. # Specifying a short boolean flag twice on the command results in returning the # value back to the default value. # @@ -941,22 +1003,21 @@ DEFINE_string() { _flags_define ${__FLAGS_TYPE_STRING} "$@"; } # unnamed: list: command-line flags to parse # Returns: # integer: success of operation, or error -FLAGS() -{ - # define a standard 'help' flag if one isn't already defined +FLAGS() { + # Define a standard 'help' flag if one isn't already defined. [ -z "${__flags_help_type:-}" ] && \ DEFINE_boolean 'help' false 'show this help' 'h' - # parse options + # Parse options. if [ $# -gt 0 ]; then - if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then + if [ "${__FLAGS_GETOPT_VERS}" -ne "${__FLAGS_GETOPT_VERS_ENH}" ]; then _flags_getoptStandard "$@" else _flags_getoptEnhanced "$@" fi flags_return=$? else - # nothing passed; won't bother running getopt + # Nothing passed; won't bother running getopt. __flags_opts='--' flags_return=${FLAGS_TRUE} fi @@ -980,13 +1041,12 @@ FLAGS() # debug info that can be included in a bug report # Returns: # nothing -flags_getoptInfo() -{ - # platform info +flags_getoptInfo() { + # Platform info. _flags_debug "uname -a: `uname -a`" _flags_debug "PATH: ${PATH}" - # shell info + # Shell info. if [ -n "${BASH_VERSION:-}" ]; then _flags_debug 'shell: bash' _flags_debug "BASH_VERSION: ${BASH_VERSION}" @@ -995,7 +1055,7 @@ flags_getoptInfo() _flags_debug "ZSH_VERSION: ${ZSH_VERSION}" fi - # getopt info + # getopt info. ${FLAGS_GETOPT_CMD} >/dev/null _flags_getoptReturn=$? _flags_debug "getopt return: ${_flags_getoptReturn}" @@ -1012,9 +1072,8 @@ flags_getoptInfo() # none # Returns: # bool: true if getopt is the enhanced version -flags_getoptIsEnh() -{ - test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} +flags_getoptIsEnh() { + test "${__FLAGS_GETOPT_VERS}" -eq "${__FLAGS_GETOPT_VERS_ENH}" } # Returns whether the detected getopt version is the standard version. @@ -1023,9 +1082,8 @@ flags_getoptIsEnh() # none # Returns: # bool: true if getopt is the standard version -flags_getoptIsStd() -{ - test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} +flags_getoptIsStd() { + test "${__FLAGS_GETOPT_VERS}" -eq "${__FLAGS_GETOPT_VERS_STD}" } # This is effectively a 'usage()' function. It prints usage information and @@ -1037,8 +1095,7 @@ flags_getoptIsStd() # none # Returns: # integer: success of operation (always returns true) -flags_help() -{ +flags_help() { if [ -n "${FLAGS_HELP:-}" ]; then echo "${FLAGS_HELP}" >&2 else @@ -1049,7 +1106,7 @@ flags_help() for flags_name_ in ${__flags_longNames}; do flags_flagStr_='' flags_boolStr_='' - flags_usName_=`_flags_underscoreName ${flags_name_}` + flags_usName_=`_flags_underscoreName "${flags_name_}"` flags_default_=`_flags_getFlagInfo \ "${flags_usName_}" ${__FLAGS_INFO_DEFAULT}` @@ -1063,11 +1120,11 @@ flags_help() [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \ flags_flagStr_="-${flags_short_}" - if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} ]; then + if [ "${__FLAGS_GETOPT_VERS}" -eq "${__FLAGS_GETOPT_VERS_ENH}" ]; then [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \ flags_flagStr_="${flags_flagStr_}," - # add [no] to long boolean flag names, except the 'help' flag - [ ${flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} \ + # Add [no] to long boolean flag names, except the 'help' flag. + [ "${flags_type_}" -eq ${__FLAGS_TYPE_BOOLEAN} \ -a "${flags_usName_}" != 'help' ] && \ flags_boolStr_='[no]' flags_flagStr_="${flags_flagStr_}--${flags_boolStr_}${flags_name_}:" @@ -1075,7 +1132,7 @@ flags_help() case ${flags_type_} in ${__FLAGS_TYPE_BOOLEAN}) - if [ ${flags_default_} -eq ${FLAGS_TRUE} ]; then + if [ "${flags_default_}" -eq ${FLAGS_TRUE} ]; then flags_defaultStr_='true' else flags_defaultStr_='false' @@ -1087,16 +1144,16 @@ flags_help() esac flags_defaultStr_="(default: ${flags_defaultStr_})" - flags_helpStr_=" ${flags_flagStr_} ${flags_help_} ${flags_defaultStr_}" + flags_helpStr_=" ${flags_flagStr_} ${flags_help_:+${flags_help_} }${flags_defaultStr_}" _flags_strlen "${flags_helpStr_}" >/dev/null flags_helpStrLen_=${flags_output} flags_columns_=`_flags_columns` - if [ ${flags_helpStrLen_} -lt ${flags_columns_} ]; then + if [ "${flags_helpStrLen_}" -lt "${flags_columns_}" ]; then echo "${flags_helpStr_}" >&2 else echo " ${flags_flagStr_} ${flags_help_}" >&2 - # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06 + # Note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06 # because it doesn't like empty strings when used in this manner. flags_emptyStr_="`echo \"x${flags_flagStr_}x\" \ |awk '{printf "%"length($0)-2"s", ""}'`" @@ -1104,13 +1161,13 @@ flags_help() _flags_strlen "${flags_helpStr_}" >/dev/null flags_helpStrLen_=${flags_output} - if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} \ - -o ${flags_helpStrLen_} -lt ${flags_columns_} ]; then - # indented to match help string + if [ "${__FLAGS_GETOPT_VERS}" -eq "${__FLAGS_GETOPT_VERS_STD}" \ + -o "${flags_helpStrLen_}" -lt "${flags_columns_}" ]; then + # Indented to match help string. echo "${flags_helpStr_}" >&2 else - # indented four from left to allow for longer defaults as long flag - # names might be used too, making things too long + # Indented four from left to allow for longer defaults as long flag + # names might be used too, making things too long. echo " ${flags_defaultStr_}" >&2 fi fi @@ -1129,10 +1186,9 @@ flags_help() # none # Returns: # nothing -flags_reset() -{ +flags_reset() { for flags_name_ in ${__flags_longNames}; do - flags_usName_=`_flags_underscoreName ${flags_name_}` + flags_usName_=`_flags_underscoreName "${flags_name_}"` flags_strToEval_="unset FLAGS_${flags_usName_}" for flags_type_ in \ ${__FLAGS_INFO_DEFAULT} \ @@ -1143,14 +1199,24 @@ flags_reset() flags_strToEval_=\ "${flags_strToEval_} __flags_${flags_usName_}_${flags_type_}" done - eval ${flags_strToEval_} + eval "${flags_strToEval_}" done - # reset internal variables + # Reset internal variables. __flags_boolNames=' ' __flags_longNames=' ' __flags_shortNames=' ' __flags_definedNames=' ' + # Reset logging level back to default. + flags_setLoggingLevel ${__FLAGS_LEVEL_DEFAULT} + unset flags_name_ flags_type_ flags_strToEval_ flags_usName_ } + +# +# Initialization +# + +# Set the default logging level. +flags_setLoggingLevel ${__FLAGS_LEVEL_DEFAULT} diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/lib/shlib b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/lib/shlib similarity index 100% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/lib/shlib rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/lib/shlib diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/lib/versions b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/lib/versions new file mode 100755 index 0000000..7c3badd --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/lib/versions @@ -0,0 +1,272 @@ +#! /bin/sh +# vim:et:ft=sh:sts=2:sw=2 +# +# Versions determines the versions of all installed shells. +# +# Copyright 2008-2018 Kate Ward. All Rights Reserved. +# Released under the Apache 2.0 License. +# +# Author: kate.ward@forestent.com (Kate Ward) +# https://github.com/kward/shlib +# +# This library provides reusable functions that determine actual names and +# versions of installed shells and the OS. The library can also be run as a +# script if set executable. +# +# Disable checks that aren't fully portable (POSIX != portable). +# shellcheck disable=SC2006 + +ARGV0=`basename "$0"` +LSB_RELEASE='/etc/lsb-release' +VERSIONS_SHELLS='ash /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh /bin/sh /usr/xpg4/bin/sh /sbin/sh' + +true; TRUE=$? +false; FALSE=$? +ERROR=2 + +UNAME_R=`uname -r` +UNAME_S=`uname -s` + +__versions_haveStrings=${ERROR} + +versions_osName() { + os_name_='unrecognized' + os_system_=${UNAME_S} + os_release_=${UNAME_R} + case ${os_system_} in + CYGWIN_NT-*) os_name_='Cygwin' ;; + Darwin) + os_name_=`/usr/bin/sw_vers -productName` + os_version_=`versions_osVersion` + case ${os_version_} in + 10.4|10.4.[0-9]*) os_name_='Mac OS X Tiger' ;; + 10.5|10.5.[0-9]*) os_name_='Mac OS X Leopard' ;; + 10.6|10.6.[0-9]*) os_name_='Mac OS X Snow Leopard' ;; + 10.7|10.7.[0-9]*) os_name_='Mac OS X Lion' ;; + 10.8|10.8.[0-9]*) os_name_='Mac OS X Mountain Lion' ;; + 10.9|10.9.[0-9]*) os_name_='Mac OS X Mavericks' ;; + 10.10|10.10.[0-9]*) os_name_='Mac OS X Yosemite' ;; + 10.11|10.11.[0-9]*) os_name_='Mac OS X El Capitan' ;; + 10.12|10.12.[0-9]*) os_name_='macOS Sierra' ;; + 10.13|10.13.[0-9]*) os_name_='macOS High Sierra' ;; + *) os_name_='macOS' ;; + esac + ;; + FreeBSD) os_name_='FreeBSD' ;; + Linux) os_name_='Linux' ;; + SunOS) + os_name_='SunOS' + if [ -r '/etc/release' ]; then + if grep 'OpenSolaris' /etc/release >/dev/null; then + os_name_='OpenSolaris' + else + os_name_='Solaris' + fi + fi + ;; + esac + + echo ${os_name_} + unset os_name_ os_system_ os_release_ os_version_ +} + +versions_osVersion() { + os_version_='unrecognized' + os_system_=${UNAME_S} + os_release_=${UNAME_R} + case ${os_system_} in + CYGWIN_NT-*) + os_version_=`expr "${os_release_}" : '\([0-9]*\.[0-9]\.[0-9]*\).*'` + ;; + Darwin) + os_version_=`/usr/bin/sw_vers -productVersion` + ;; + FreeBSD) + os_version_=`expr "${os_release_}" : '\([0-9]*\.[0-9]*\)-.*'` + ;; + Linux) + if [ -r '/etc/os-release' ]; then + os_version_=`awk -F= '$1~/PRETTY_NAME/{print $2}' /etc/os-release \ + |sed 's/"//g'` + elif [ -r '/etc/redhat-release' ]; then + os_version_=`cat /etc/redhat-release` + elif [ -r '/etc/SuSE-release' ]; then + os_version_=`head -n 1 /etc/SuSE-release` + elif [ -r "${LSB_RELEASE}" ]; then + if grep -q 'DISTRIB_ID=Ubuntu' "${LSB_RELEASE}"; then + # shellcheck disable=SC2002 + os_version_=`cat "${LSB_RELEASE}" \ + |awk -F= '$1~/DISTRIB_DESCRIPTION/{print $2}' \ + |sed 's/"//g;s/ /-/g'` + fi + fi + ;; + SunOS) + if [ -r '/etc/release' ]; then + if grep 'OpenSolaris' /etc/release >/dev/null; then # OpenSolaris + os_version_=`grep 'OpenSolaris' /etc/release |awk '{print $2"("$3")"}'` + else # Solaris + major_=`echo "${os_release_}" |sed 's/[0-9]*\.\([0-9]*\)/\1/'` + minor_=`grep Solaris /etc/release |sed 's/[^u]*\(u[0-9]*\).*/\1/'` + os_version_="${major_}${minor_}" + fi + fi + ;; + esac + + echo "${os_version_}" + unset os_release_ os_system_ os_version_ major_ minor_ +} + +versions_shellVersion() { + shell_=$1 + + shell_present_=${FALSE} + case "${shell_}" in + ash) [ -x '/bin/busybox' ] && shell_present_=${TRUE} ;; + *) [ -x "${shell_}" ] && shell_present_=${TRUE} ;; + esac + if [ ${shell_present_} -eq ${FALSE} ]; then + echo 'not installed' + return ${FALSE} + fi + + version_='' + case ${shell_} in + /sbin/sh) ;; # SunOS + /usr/xpg4/bin/sh) + version_=`versions_shell_xpg4 "${shell_}"` + ;; # SunOS + */sh) + # This could be one of any number of shells. Try until one fits. + version_='' + [ -z "${version_}" ] && version_=`versions_shell_bash "${shell_}"` + # dash cannot be self determined yet + [ -z "${version_}" ] && version_=`versions_shell_ksh "${shell_}"` + # pdksh is covered in versions_shell_ksh() + [ -z "${version_}" ] && version_=`versions_shell_xpg4 "${shell_}"` + [ -z "${version_}" ] && version_=`versions_shell_zsh "${shell_}"` + ;; + ash) version_=`versions_shell_ash "${shell_}"` ;; + */bash) version_=`versions_shell_bash "${shell_}"` ;; + */dash) + # Assuming Ubuntu Linux until somebody comes up with a better test. The + # following test will return an empty string if dash is not installed. + version_=`versions_shell_dash` + ;; + */ksh) version_=`versions_shell_ksh "${shell_}"` ;; + */pdksh) version_=`versions_shell_pdksh "${shell_}"` ;; + */zsh) version_=`versions_shell_zsh "${shell_}"` ;; + *) version_='invalid' + esac + + echo "${version_:-unknown}" + unset shell_ version_ +} + +# The ash shell is included in BusyBox. +versions_shell_ash() { + busybox --help |head -1 |sed 's/BusyBox v\([0-9.]*\) .*/\1/' +} + +versions_shell_bash() { + $1 --version : 2>&1 |grep 'GNU bash' |sed 's/.*version \([^ ]*\).*/\1/' +} + +versions_shell_dash() { + eval dpkg >/dev/null 2>&1 + [ $? -eq 127 ] && return # Return if dpkg not found. + + dpkg -l |grep ' dash ' |awk '{print $3}' +} + +versions_shell_ksh() { + versions_shell_=$1 + versions_version_='' + + # Try a few different ways to figure out the version. + versions_version_=`${versions_shell_} --version : 2>&1` + # shellcheck disable=SC2181 + if [ $? -eq 0 ]; then + versions_version_=`echo "${versions_version_}" \ + |sed 's/.*\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\).*/\1/'` + else + versions_version_='' + fi + if [ -z "${versions_version_}" ]; then + _versions_have_strings + versions_version_=`strings "${versions_shell_}" 2>&1 \ + |grep Version \ + |sed 's/^.*Version \(.*\)$/\1/;s/ s+ \$$//;s/ /-/g'` + fi + if [ -z "${versions_version_}" ]; then + versions_version_=`versions_shell_pdksh "${versions_shell_}"` + fi + + echo "${versions_version_}" + unset versions_shell_ versions_version_ +} + +versions_shell_pdksh() { + _versions_have_strings + strings "$1" 2>&1 \ + |grep 'PD KSH' \ + |sed -e 's/.*PD KSH \(.*\)/\1/;s/ /-/g' +} + +versions_shell_xpg4() { + _versions_have_strings + strings "$1" 2>&1 \ + |grep 'Version' \ + |sed -e 's/^@(#)Version //' +} + +versions_shell_zsh() { + versions_shell_=$1 + + # Try a few different ways to figure out the version. + # shellcheck disable=SC2016 + versions_version_=`echo 'echo ${ZSH_VERSION}' |${versions_shell_}` + if [ -z "${versions_version_}" ]; then + versions_version_=`${versions_shell_} --version : 2>&1` + # shellcheck disable=SC2181 + if [ $? -eq 0 ]; then + versions_version_=`echo "${versions_version_}" |awk '{print $2}'` + else + versions_version_='' + fi + fi + + echo "${versions_version_}" + unset versions_shell_ versions_version_ +} + +# Determine if the 'strings' binary installed. +_versions_have_strings() { + [ ${__versions_haveStrings} -ne ${ERROR} ] && return + if eval strings /dev/null >/dev/null 2>&1; then + __versions_haveStrings=${TRUE} + return + fi + + echo 'WARN: strings not installed. try installing binutils?' >&2 + __versions_haveStrings=${FALSE} +} + +versions_main() { + # Treat unset variables as an error. + set -u + + os_name=`versions_osName` + os_version=`versions_osVersion` + echo "os: ${os_name} version: ${os_version}" + + for shell in ${VERSIONS_SHELLS}; do + shell_version=`versions_shellVersion "${shell}"` + echo "shell: ${shell} version: ${shell_version}" + done +} + +if [ "${ARGV0}" = 'versions' ]; then + versions_main "$@" +fi diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2 similarity index 60% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2 rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2 index d6e7503..d3d4056 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2 +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2 @@ -1,114 +1,149 @@ #! /bin/sh -# $Id$ # vim:et:ft=sh:sts=2:sw=2 # -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) +# Copyright 2008-2018 Kate Ward. All Rights Reserved. +# Released under the Apache 2.0 license. # # shUnit2 -- Unit testing framework for Unix shell scripts. -# http://code.google.com/p/shunit2/ +# https://github.com/kward/shunit2 # # Author: kate.ward@forestent.com (Kate Ward) # # shUnit2 is a xUnit based unit test framework for Bourne shell scripts. It is # based on the popular JUnit unit testing framework for Java. +# +# $() are not fully portable (POSIX != portable). +# shellcheck disable=SC2006 +# expr may be antiquated, but it is the only solution in some cases. +# shellcheck disable=SC2003 -# return if shunit already loaded -[ -n "${SHUNIT_VERSION:-}" ] && exit 0 -SHUNIT_VERSION='2.1.7pre' +# Return if shunit2 already loaded. +command [ -n "${SHUNIT_VERSION:-}" ] && exit 0 +SHUNIT_VERSION='2.1.8pre' -# return values that scripts can use +# Return values that scripts can use. SHUNIT_TRUE=0 SHUNIT_FALSE=1 SHUNIT_ERROR=2 -# logging functions -_shunit_warn() { echo "shunit2:WARN $@" >&2; } -_shunit_error() { echo "shunit2:ERROR $@" >&2; } -_shunit_fatal() { echo "shunit2:FATAL $@" >&2; exit ${SHUNIT_ERROR}; } +# Logging functions. +_shunit_warn() { + ${__SHUNIT_CMD_ECHO_ESC} \ + "${__shunit_ansi_yellow}shunit2:WARN${__shunit_ansi_none} $*" >&2 +} +_shunit_error() { + ${__SHUNIT_CMD_ECHO_ESC} \ + "${__shunit_ansi_red}shunit2:ERROR${__shunit_ansi_none} $*" >&2 +} +_shunit_fatal() { + ${__SHUNIT_CMD_ECHO_ESC} \ + "${__shunit_ansi_red}shunit2:FATAL${__shunit_ansi_none} $*" >&2 + exit ${SHUNIT_ERROR} +} -# determine some reasonable command defaults +# Determine some reasonable command defaults. __SHUNIT_UNAME_S=`uname -s` case "${__SHUNIT_UNAME_S}" in - BSD) __SHUNIT_EXPR_CMD='gexpr' ;; - *) __SHUNIT_EXPR_CMD='expr' ;; + BSD) __SHUNIT_CMD_EXPR='gexpr' ;; + *) __SHUNIT_CMD_EXPR='expr' ;; esac -# commands a user can override if needed -SHUNIT_EXPR_CMD=${SHUNIT_EXPR_CMD:-${__SHUNIT_EXPR_CMD}} +__SHUNIT_CMD_ECHO_ESC='echo -e' +# shellcheck disable=SC2039 +command [ "`echo -e test`" = '-e test' ] && __SHUNIT_CMD_ECHO_ESC='echo' -# enable strict mode by default -SHUNIT_STRICT=${SHUNIT_STRICT:-${SHUNIT_TRUE}} +# Commands a user can override if needed. +SHUNIT_CMD_EXPR=${SHUNIT_CMD_EXPR:-${__SHUNIT_CMD_EXPR}} -# specific shell checks -if [ -n "${ZSH_VERSION:-}" ]; then +# Enable color output. Options are 'never', 'always', or 'auto'. +SHUNIT_COLOR=${SHUNIT_COLOR:-auto} + +# Specific shell checks. +if command [ -n "${ZSH_VERSION:-}" ]; then setopt |grep "^shwordsplit$" >/dev/null - if [ $? -ne ${SHUNIT_TRUE} ]; then + if command [ $? -ne ${SHUNIT_TRUE} ]; then _shunit_fatal 'zsh shwordsplit option is required for proper operation' fi - if [ -z "${SHUNIT_PARENT:-}" ]; then + if command [ -z "${SHUNIT_PARENT:-}" ]; then _shunit_fatal "zsh does not pass \$0 through properly. please declare \ \"SHUNIT_PARENT=\$0\" before calling shUnit2" fi fi # -# constants +# Constants # -__SHUNIT_ASSERT_MSG_PREFIX='ASSERT:' __SHUNIT_MODE_SOURCED='sourced' __SHUNIT_MODE_STANDALONE='standalone' __SHUNIT_PARENT=${SHUNIT_PARENT:-$0} -# set the constants readonly +# User provided test prefix -- define SHUNIT_TEST_PREFIX variable. +__SHUNIT_TEST_PREFIX=${SHUNIT_TEST_PREFIX:-} + +# ANSI colors. +__SHUNIT_ANSI_NONE='\033[0m' +__SHUNIT_ANSI_RED='\033[1;31m' +__SHUNIT_ANSI_GREEN='\033[1;32m' +__SHUNIT_ANSI_YELLOW='\033[1;33m' +__SHUNIT_ANSI_CYAN='\033[1;36m' + +# Set the constants readonly. __shunit_constants=`set |grep '^__SHUNIT_' |cut -d= -f1` echo "${__shunit_constants}" |grep '^Binary file' >/dev/null && \ __shunit_constants=`set |grep -a '^__SHUNIT_' |cut -d= -f1` for __shunit_const in ${__shunit_constants}; do - if [ -z "${ZSH_VERSION:-}" ]; then - readonly ${__shunit_const} + if command [ -z "${ZSH_VERSION:-}" ]; then + readonly "${__shunit_const}" else case ${ZSH_VERSION} in - [123].*) readonly ${__shunit_const} ;; - *) readonly -g ${__shunit_const} # declare readonly constants globally + [123].*) readonly "${__shunit_const}" ;; + *) readonly -g "${__shunit_const}" # Declare readonly constants globally. esac fi done unset __shunit_const __shunit_constants # -# internal variables +# Internal variables. # -# variables -__shunit_lineno='' # line number of executed test -__shunit_mode=${__SHUNIT_MODE_SOURCED} # operating mode -__shunit_reportGenerated=${SHUNIT_FALSE} # is report generated -__shunit_script='' # filename of unittest script (standalone mode) -__shunit_skip=${SHUNIT_FALSE} # is skipping enabled -__shunit_suite='' # suite of tests to execute +# Variables. +__shunit_lineno='' # Line number of executed test. +__shunit_mode=${__SHUNIT_MODE_SOURCED} # Operating mode. +__shunit_reportGenerated=${SHUNIT_FALSE} # Is report generated. +__shunit_script='' # Filename of unittest script (standalone mode). +__shunit_skip=${SHUNIT_FALSE} # Is skipping enabled. +__shunit_suite='' # Suite of tests to execute. -# counts of tests +# ANSI colors (populated by _shunit_configureColor()). +__shunit_ansi_none='' +__shunit_ansi_red='' +__shunit_ansi_green='' +__shunit_ansi_yellow='' +__shunit_ansi_cyan='' + +# Counts of tests. __shunit_testSuccess=${SHUNIT_TRUE} __shunit_testsTotal=0 __shunit_testsPassed=0 __shunit_testsFailed=0 -# counts of asserts +# Counts of asserts. __shunit_assertsTotal=0 __shunit_assertsPassed=0 __shunit_assertsFailed=0 __shunit_assertsSkipped=0 -# macros -_SHUNIT_LINENO_='eval __shunit_lineno=""; if [ "${1:-}" = "--lineno" ]; then [ -n "$2" ] && __shunit_lineno="[$2] "; shift 2; fi' +# +# Macros. +# + +# shellcheck disable=SC2016,SC2089 +_SHUNIT_LINENO_='eval __shunit_lineno=""; if command [ "${1:-}" = "--lineno" ]; then command [ -n "$2" ] && __shunit_lineno="[$2] "; shift 2; fi' #----------------------------------------------------------------------------- -# private functions - -#----------------------------------------------------------------------------- -# assert functions +# Assertion functions. # # Assert that two values are equal to one another. @@ -119,18 +154,18 @@ _SHUNIT_LINENO_='eval __shunit_lineno=""; if [ "${1:-}" = "--lineno" ]; then [ - # actual: string: actual value # Returns: # integer: success (TRUE/FALSE/ERROR constant) -assertEquals() -{ +assertEquals() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then + if command [ $# -lt 2 -o $# -gt 3 ]; then _shunit_error "assertEquals() requires two or three arguments; $# given" - _shunit_error "1: ${1:+$1} 2: ${2:+$2} 3: ${3:+$3}${4:+ 4: $4}" + _shunit_assertFail return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then + if command [ $# -eq 3 ]; then shunit_message_="${shunit_message_}$1" shift fi @@ -138,7 +173,7 @@ assertEquals() shunit_actual_=$2 shunit_return=${SHUNIT_TRUE} - if [ "${shunit_expected_}" = "${shunit_actual_}" ]; then + if command [ "${shunit_expected_}" = "${shunit_actual_}" ]; then _shunit_assertPass else failNotEquals "${shunit_message_}" "${shunit_expected_}" "${shunit_actual_}" @@ -148,6 +183,7 @@ assertEquals() unset shunit_message_ shunit_expected_ shunit_actual_ return ${shunit_return} } +# shellcheck disable=SC2016,SC2034 _ASSERT_EQUALS_='eval assertEquals --lineno "${LINENO:-}"' # Assert that two values are not equal to one another. @@ -158,17 +194,18 @@ _ASSERT_EQUALS_='eval assertEquals --lineno "${LINENO:-}"' # actual: string: actual value # Returns: # integer: success (TRUE/FALSE/ERROR constant) -assertNotEquals() -{ +assertNotEquals() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then + if command [ $# -lt 2 -o $# -gt 3 ]; then _shunit_error "assertNotEquals() requires two or three arguments; $# given" + _shunit_assertFail return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then + if command [ $# -eq 3 ]; then shunit_message_="${shunit_message_}$1" shift fi @@ -176,7 +213,7 @@ assertNotEquals() shunit_actual_=$2 shunit_return=${SHUNIT_TRUE} - if [ "${shunit_expected_}" != "${shunit_actual_}" ]; then + if command [ "${shunit_expected_}" != "${shunit_actual_}" ]; then _shunit_assertPass else failSame "${shunit_message_}" "$@" @@ -186,6 +223,7 @@ assertNotEquals() unset shunit_message_ shunit_expected_ shunit_actual_ return ${shunit_return} } +# shellcheck disable=SC2016,SC2034 _ASSERT_NOT_EQUALS_='eval assertNotEquals --lineno "${LINENO:-}"' # Assert that a value is null (i.e. an empty string) @@ -195,17 +233,18 @@ _ASSERT_NOT_EQUALS_='eval assertNotEquals --lineno "${LINENO:-}"' # actual: string: actual value # Returns: # integer: success (TRUE/FALSE/ERROR constant) -assertNull() -{ +assertNull() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 1 -o $# -gt 2 ]; then + if command [ $# -lt 1 -o $# -gt 2 ]; then _shunit_error "assertNull() requires one or two arguments; $# given" + _shunit_assertFail return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 2 ]; then + if command [ $# -eq 2 ]; then shunit_message_="${shunit_message_}$1" shift fi @@ -215,6 +254,7 @@ assertNull() unset shunit_message_ return ${shunit_return} } +# shellcheck disable=SC2016,SC2034 _ASSERT_NULL_='eval assertNull --lineno "${LINENO:-}"' # Assert that a value is not null (i.e. a non-empty string) @@ -224,17 +264,18 @@ _ASSERT_NULL_='eval assertNull --lineno "${LINENO:-}"' # actual: string: actual value # Returns: # integer: success (TRUE/FALSE/ERROR constant) -assertNotNull() -{ +assertNotNull() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -gt 2 ]; then # allowing 0 arguments as $1 might actually be null + if command [ $# -gt 2 ]; then # allowing 0 arguments as $1 might actually be null _shunit_error "assertNotNull() requires one or two arguments; $# given" + _shunit_assertFail return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 2 ]; then + if command [ $# -eq 2 ]; then shunit_message_="${shunit_message_}$1" shift fi @@ -246,6 +287,7 @@ assertNotNull() unset shunit_actual_ shunit_message_ return ${shunit_return} } +# shellcheck disable=SC2016,SC2034 _ASSERT_NOT_NULL_='eval assertNotNull --lineno "${LINENO:-}"' # Assert that two values are the same (i.e. equal to one another). @@ -256,17 +298,18 @@ _ASSERT_NOT_NULL_='eval assertNotNull --lineno "${LINENO:-}"' # actual: string: actual value # Returns: # integer: success (TRUE/FALSE/ERROR constant) -assertSame() -{ +assertSame() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then + if command [ $# -lt 2 -o $# -gt 3 ]; then _shunit_error "assertSame() requires two or three arguments; $# given" + _shunit_assertFail return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then + if command [ $# -eq 3 ]; then shunit_message_="${shunit_message_}$1" shift fi @@ -276,6 +319,7 @@ assertSame() unset shunit_message_ return ${shunit_return} } +# shellcheck disable=SC2016,SC2034 _ASSERT_SAME_='eval assertSame --lineno "${LINENO:-}"' # Assert that two values are not the same (i.e. not equal to one another). @@ -286,17 +330,18 @@ _ASSERT_SAME_='eval assertSame --lineno "${LINENO:-}"' # actual: string: actual value # Returns: # integer: success (TRUE/FALSE/ERROR constant) -assertNotSame() -{ +assertNotSame() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then + if command [ $# -lt 2 -o $# -gt 3 ]; then _shunit_error "assertNotSame() requires two or three arguments; $# given" + _shunit_assertFail return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then + if command [ $# -eq 3 ]; then shunit_message_="${shunit_message_:-}$1" shift fi @@ -306,6 +351,7 @@ assertNotSame() unset shunit_message_ return ${shunit_return} } +# shellcheck disable=SC2016,SC2034 _ASSERT_NOT_SAME_='eval assertNotSame --lineno "${LINENO:-}"' # Assert that a value or shell test condition is true. @@ -320,49 +366,50 @@ _ASSERT_NOT_SAME_='eval assertNotSame --lineno "${LINENO:-}"' # The following test will succeed: # assertTrue 0 # assertTrue "[ 34 -gt 23 ]" -# The folloing test will fail with a message: +# The following test will fail with a message: # assertTrue 123 -# assertTrue "test failed" "[ -r '/non/existant/file' ]" +# assertTrue "test failed" "[ -r '/non/existent/file' ]" # # Args: # message: string: failure message [optional] # condition: string: integer value or shell conditional statement # Returns: # integer: success (TRUE/FALSE/ERROR constant) -assertTrue() -{ +assertTrue() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 1 -o $# -gt 2 ]; then + if command [ $# -lt 1 -o $# -gt 2 ]; then _shunit_error "assertTrue() takes one or two arguments; $# given" + _shunit_assertFail return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 2 ]; then + if command [ $# -eq 2 ]; then shunit_message_="${shunit_message_}$1" shift fi shunit_condition_=$1 - # see if condition is an integer, i.e. a return value + # See if condition is an integer, i.e. a return value. shunit_match_=`expr "${shunit_condition_}" : '\([0-9]*\)'` shunit_return=${SHUNIT_TRUE} - if [ -z "${shunit_condition_}" ]; then - # null condition + if command [ -z "${shunit_condition_}" ]; then + # Null condition. shunit_return=${SHUNIT_FALSE} - elif [ -n "${shunit_match_}" -a "${shunit_condition_}" = "${shunit_match_}" ] + elif command [ -n "${shunit_match_}" -a "${shunit_condition_}" = "${shunit_match_}" ] then - # possible return value. treating 0 as true, and non-zero as false. - [ ${shunit_condition_} -ne 0 ] && shunit_return=${SHUNIT_FALSE} + # Possible return value. Treating 0 as true, and non-zero as false. + command [ "${shunit_condition_}" -ne 0 ] && shunit_return=${SHUNIT_FALSE} else - # (hopefully) a condition - ( eval ${shunit_condition_} ) >/dev/null 2>&1 - [ $? -ne 0 ] && shunit_return=${SHUNIT_FALSE} + # Hopefully... a condition. + ( eval "${shunit_condition_}" ) >/dev/null 2>&1 + command [ $? -ne 0 ] && shunit_return=${SHUNIT_FALSE} fi - # record the test - if [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then + # Record the test. + if command [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then _shunit_assertPass else _shunit_assertFail "${shunit_message_}" @@ -371,6 +418,7 @@ assertTrue() unset shunit_message_ shunit_condition_ shunit_match_ return ${shunit_return} } +# shellcheck disable=SC2016,SC2034 _ASSERT_TRUE_='eval assertTrue --lineno "${LINENO:-}"' # Assert that a value or shell test condition is false. @@ -385,7 +433,7 @@ _ASSERT_TRUE_='eval assertTrue --lineno "${LINENO:-}"' # The following test will succeed: # assertFalse 1 # assertFalse "[ 'apples' = 'oranges' ]" -# The folloing test will fail with a message: +# The following test will fail with a message: # assertFalse 0 # assertFalse "test failed" "[ 1 -eq 1 -a 2 -eq 2 ]" # @@ -394,52 +442,54 @@ _ASSERT_TRUE_='eval assertTrue --lineno "${LINENO:-}"' # condition: string: integer value or shell conditional statement # Returns: # integer: success (TRUE/FALSE/ERROR constant) -assertFalse() -{ +assertFalse() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 1 -o $# -gt 2 ]; then + if command [ $# -lt 1 -o $# -gt 2 ]; then _shunit_error "assertFalse() quires one or two arguments; $# given" + _shunit_assertFail return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 2 ]; then + if command [ $# -eq 2 ]; then shunit_message_="${shunit_message_}$1" shift fi shunit_condition_=$1 - # see if condition is an integer, i.e. a return value + # See if condition is an integer, i.e. a return value. shunit_match_=`expr "${shunit_condition_}" : '\([0-9]*\)'` shunit_return=${SHUNIT_TRUE} - if [ -z "${shunit_condition_}" ]; then - # null condition + if command [ -z "${shunit_condition_}" ]; then + # Null condition. shunit_return=${SHUNIT_FALSE} - elif [ -n "${shunit_match_}" -a "${shunit_condition_}" = "${shunit_match_}" ] + elif command [ -n "${shunit_match_}" -a "${shunit_condition_}" = "${shunit_match_}" ] then - # possible return value. treating 0 as true, and non-zero as false. - [ ${shunit_condition_} -eq 0 ] && shunit_return=${SHUNIT_FALSE} + # Possible return value. Treating 0 as true, and non-zero as false. + command [ "${shunit_condition_}" -eq 0 ] && shunit_return=${SHUNIT_FALSE} else - # (hopefully) a condition - ( eval ${shunit_condition_} ) >/dev/null 2>&1 - [ $? -eq 0 ] && shunit_return=${SHUNIT_FALSE} + # Hopefully... a condition. + ( eval "${shunit_condition_}" ) >/dev/null 2>&1 + command [ $? -eq 0 ] && shunit_return=${SHUNIT_FALSE} fi - # record the test - if [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then + # Record the test. + if command [ "${shunit_return}" -eq "${SHUNIT_TRUE}" ]; then _shunit_assertPass else _shunit_assertFail "${shunit_message_}" fi unset shunit_message_ shunit_condition_ shunit_match_ - return ${shunit_return} + return "${shunit_return}" } +# shellcheck disable=SC2016,SC2034 _ASSERT_FALSE_='eval assertFalse --lineno "${LINENO:-}"' #----------------------------------------------------------------------------- -# failure functions +# Failure functions. # # Records a test failure. @@ -448,17 +498,17 @@ _ASSERT_FALSE_='eval assertFalse --lineno "${LINENO:-}"' # message: string: failure message [optional] # Returns: # integer: success (TRUE/FALSE/ERROR constant) -fail() -{ +fail() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -gt 1 ]; then + if command [ $# -gt 1 ]; then _shunit_error "fail() requires zero or one arguments; $# given" return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 1 ]; then + if command [ $# -eq 1 ]; then shunit_message_="${shunit_message_}$1" shift fi @@ -468,6 +518,7 @@ fail() unset shunit_message_ return ${SHUNIT_FALSE} } +# shellcheck disable=SC2016,SC2034 _FAIL_='eval fail --lineno "${LINENO:-}"' # Records a test failure, stating two values were not equal. @@ -478,28 +529,30 @@ _FAIL_='eval fail --lineno "${LINENO:-}"' # actual: string: actual value # Returns: # integer: success (TRUE/FALSE/ERROR constant) -failNotEquals() -{ +failNotEquals() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then + if command [ $# -lt 2 -o $# -gt 3 ]; then _shunit_error "failNotEquals() requires one or two arguments; $# given" return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then + if command [ $# -eq 3 ]; then shunit_message_="${shunit_message_}$1" shift fi shunit_expected_=$1 shunit_actual_=$2 + shunit_message_=${shunit_message_%% } _shunit_assertFail "${shunit_message_:+${shunit_message_} }expected:<${shunit_expected_}> but was:<${shunit_actual_}>" unset shunit_message_ shunit_expected_ shunit_actual_ return ${SHUNIT_FALSE} } +# shellcheck disable=SC2016,SC2034 _FAIL_NOT_EQUALS_='eval failNotEquals --lineno "${LINENO:-}"' # Records a test failure, stating two values should have been the same. @@ -512,24 +565,27 @@ _FAIL_NOT_EQUALS_='eval failNotEquals --lineno "${LINENO:-}"' # integer: success (TRUE/FALSE/ERROR constant) failSame() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then + if command [ $# -lt 2 -o $# -gt 3 ]; then _shunit_error "failSame() requires two or three arguments; $# given" return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then + if command [ $# -eq 3 ]; then shunit_message_="${shunit_message_}$1" shift fi + shunit_message_=${shunit_message_%% } _shunit_assertFail "${shunit_message_:+${shunit_message_} }expected not same" unset shunit_message_ return ${SHUNIT_FALSE} } +# shellcheck disable=SC2016,SC2034 _FAIL_SAME_='eval failSame --lineno "${LINENO:-}"' # Records a test failure, stating two values were not equal. @@ -542,17 +598,17 @@ _FAIL_SAME_='eval failSame --lineno "${LINENO:-}"' # actual: string: actual value # Returns: # integer: success (TRUE/FALSE/ERROR constant) -failNotSame() -{ +failNotSame() { + # shellcheck disable=SC2090 ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then - _shunit_error "failNotEquals() requires one or two arguments; $# given" + if command [ $# -lt 2 -o $# -gt 3 ]; then + _shunit_error "failNotSame() requires one or two arguments; $# given" return ${SHUNIT_ERROR} fi _shunit_shouldSkip && return ${SHUNIT_TRUE} shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then + if command [ $# -eq 3 ]; then shunit_message_="${shunit_message_}$1" shift fi @@ -562,10 +618,11 @@ failNotSame() unset shunit_message_ return ${shunit_return} } +# shellcheck disable=SC2016,SC2034 _FAIL_NOT_SAME_='eval failNotSame --lineno "${LINENO:-}"' #----------------------------------------------------------------------------- -# skipping functions +# Skipping functions. # # Force remaining assert and fail functions to be "skipped". @@ -576,19 +633,13 @@ _FAIL_NOT_SAME_='eval failNotSame --lineno "${LINENO:-}"' # # Args: # None -startSkipping() -{ - __shunit_skip=${SHUNIT_TRUE} -} +startSkipping() { __shunit_skip=${SHUNIT_TRUE}; } # Resume the normal recording behavior of assert and fail calls. # # Args: # None -endSkipping() -{ - __shunit_skip=${SHUNIT_FALSE} -} +endSkipping() { __shunit_skip=${SHUNIT_FALSE}; } # Returns the state of assert and fail call skipping. # @@ -596,13 +647,10 @@ endSkipping() # None # Returns: # boolean: (TRUE/FALSE constant) -isSkipping() -{ - return ${__shunit_skip} -} +isSkipping() { return ${__shunit_skip}; } #----------------------------------------------------------------------------- -# suite functions +# Suite functions. # # Stub. This function should contains all unit test calls to be made. @@ -629,8 +677,7 @@ isSkipping() # # Args: # function: string: name of a function to add to current unit test suite -suite_addTest() -{ +suite_addTest() { shunit_func_=${1:-} __shunit_suite="${__shunit_suite:+${__shunit_suite} }${shunit_func_}" @@ -672,7 +719,7 @@ suite_addTest() # # Args: # None -#setUp() { :; } +#setUp() { :; } # DO NOT UNCOMMENT THIS FUNCTION # Note: see _shunit_mktempFunc() for actual implementation # Stub. This function will be called after each test is run. @@ -687,41 +734,41 @@ suite_addTest() #tearDown() { :; } # DO NOT UNCOMMENT THIS FUNCTION #------------------------------------------------------------------------------ -# internal shUnit2 functions +# Internal shUnit2 functions. # # Create a temporary directory to store various run-time files in. # # This function is a cross-platform temporary directory creation tool. Not all -# OSes have the mktemp function, so one is included here. +# OSes have the `mktemp` function, so one is included here. # # Args: # None # Outputs: # string: the temporary directory that was created -_shunit_mktempDir() -{ - # try the standard mktemp function +_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 + # The standard `mktemp` didn't work. Use our own. + # shellcheck disable=SC2039 + if command [ -r '/dev/urandom' -a -x '/usr/bin/od' ]; then _shunit_random_=`/usr/bin/od -vAn -N4 -tx4 "${_shunit_file_}" + command cat <"${_shunit_file_}" #! /bin/sh exit ${SHUNIT_TRUE} EOF - chmod +x "${_shunit_file_}" + command chmod +x "${_shunit_file_}" done unset _shunit_file_ @@ -752,8 +798,7 @@ EOF # # Args: # name: string: name of the trap called (specified when trap defined) -_shunit_cleanup() -{ +_shunit_cleanup() { _shunit_name_=$1 case ${_shunit_name_} in @@ -761,22 +806,22 @@ _shunit_cleanup() INT) _shunit_signal_=2 ;; TERM) _shunit_signal_=15 ;; *) - _shunit_warn "unrecognized trap value (${_shunit_name_})" + _shunit_error "unrecognized trap value (${_shunit_name_})" _shunit_signal_=0 ;; esac - # do our work - rm -fr "${__shunit_tmpDir}" + # Do our work. + command rm -fr "${__shunit_tmpDir}" - # exit for all non-EXIT signals - if [ ${_shunit_name_} != 'EXIT' ]; then + # Exit for all non-EXIT signals. + if command [ "${_shunit_name_}" != 'EXIT' ]; then _shunit_warn "trapped and now handling the (${_shunit_name_}) signal" - # disable EXIT trap + # Disable EXIT trap. trap 0 - # add 128 to signal and exit - exit `expr ${_shunit_signal_} + 128` - elif [ ${__shunit_reportGenerated} -eq ${SHUNIT_FALSE} ] ; then + # Add 128 to signal and exit. + exit "`expr "${_shunit_signal_}" + 128`" + elif command [ ${__shunit_reportGenerated} -eq ${SHUNIT_FALSE} ] ; then _shunit_assertFail 'Unknown failure encountered running a test' _shunit_generateReport exit ${SHUNIT_ERROR} @@ -785,30 +830,78 @@ _shunit_cleanup() unset _shunit_name_ _shunit_signal_ } +# configureColor based on user color preference. +# +# Args: +# color: string: color mode (one of `always`, `auto`, or `none`). +_shunit_configureColor() { + _shunit_color_=${SHUNIT_FALSE} # By default, no color. + case $1 in + 'always') _shunit_color_=${SHUNIT_TRUE} ;; + 'auto') + ( exec tput >/dev/null 2>&1 ) # Check for existence of tput command. + if command [ $? -lt 127 ]; then + _shunit_tput_=`tput colors` + # shellcheck disable=SC2166,SC2181 + command [ $? -eq 0 -a "${_shunit_tput_}" -ge 16 ] && _shunit_color_=${SHUNIT_TRUE} + fi + ;; + 'none') ;; + *) _shunit_fatal "unrecognized color option '$1'" ;; + esac + + case ${_shunit_color_} in + ${SHUNIT_TRUE}) + __shunit_ansi_none=${__SHUNIT_ANSI_NONE} + __shunit_ansi_red=${__SHUNIT_ANSI_RED} + __shunit_ansi_green=${__SHUNIT_ANSI_GREEN} + __shunit_ansi_yellow=${__SHUNIT_ANSI_YELLOW} + __shunit_ansi_cyan=${__SHUNIT_ANSI_CYAN} + ;; + ${SHUNIT_FALSE}) + __shunit_ansi_none='' + __shunit_ansi_red='' + __shunit_ansi_green='' + __shunit_ansi_yellow='' + __shunit_ansi_cyan='' + ;; + esac + + unset _shunit_color_ _shunit_tput_ +} + # The actual running of the tests happens here. # # Args: # None -_shunit_execSuite() -{ +_shunit_execSuite() { for _shunit_test_ in ${__shunit_suite}; do __shunit_testSuccess=${SHUNIT_TRUE} - # disable skipping + # Disable skipping. endSkipping - # execute the per-test setup function + # Execute the per-test setup function. setUp + command [ $? -eq ${SHUNIT_TRUE} ] \ + || _shunit_fatal "setup() returned non-zero return code." - # execute the test - echo "${_shunit_test_}" - eval ${_shunit_test_} + # Execute the test. + echo "${__SHUNIT_TEST_PREFIX}${_shunit_test_}" + eval "${_shunit_test_}" + if command [ $? -ne ${SHUNIT_TRUE} ]; then + _shunit_error "${_shunit_test_}() returned non-zero return code." + __shunit_testSuccess=${SHUNIT_ERROR} + _shunit_incFailedCount + fi - # execute the per-test tear-down function + # Execute the per-test tear-down function. tearDown + command [ $? -eq ${SHUNIT_TRUE} ] \ + || _shunit_fatal "tearDown() returned non-zero return code." - # update stats - if [ ${__shunit_testSuccess} -eq ${SHUNIT_TRUE} ]; then + # Update stats. + if command [ ${__shunit_testSuccess} -eq ${SHUNIT_TRUE} ]; then __shunit_testsPassed=`expr ${__shunit_testsPassed} + 1` else __shunit_testsFailed=`expr ${__shunit_testsFailed} + 1` @@ -824,42 +917,43 @@ _shunit_execSuite() # None # Output: # string: the report of successful and failed tests, as well as totals. -_shunit_generateReport() -{ +_shunit_generateReport() { _shunit_ok_=${SHUNIT_TRUE} - # if no exit code was provided one, determine an appropriate one - [ ${__shunit_testsFailed} -gt 0 \ + # If no exit code was provided one, determine an appropriate one. + command [ "${__shunit_testsFailed}" -gt 0 \ -o ${__shunit_testSuccess} -eq ${SHUNIT_FALSE} ] \ && _shunit_ok_=${SHUNIT_FALSE} echo - if [ ${__shunit_testsTotal} -eq 1 ]; then - echo "Ran ${__shunit_testsTotal} test." + _shunit_msg_="Ran ${__shunit_ansi_cyan}${__shunit_testsTotal}${__shunit_ansi_none}" + if command [ "${__shunit_testsTotal}" -eq 1 ]; then + ${__SHUNIT_CMD_ECHO_ESC} "${_shunit_msg_} test." else - echo "Ran ${__shunit_testsTotal} tests." + ${__SHUNIT_CMD_ECHO_ESC} "${_shunit_msg_} tests." fi - _shunit_failures_='' - _shunit_skipped_='' - [ ${__shunit_assertsFailed} -gt 0 ] \ + _shunit_failures_=0 + _shunit_skipped_=0 + command [ "${__shunit_assertsFailed}" -gt 0 ] \ && _shunit_failures_="failures=${__shunit_assertsFailed}" - [ ${__shunit_assertsSkipped} -gt 0 ] \ + command [ "${__shunit_assertsSkipped}" -gt 0 ] \ && _shunit_skipped_="skipped=${__shunit_assertsSkipped}" - if [ ${_shunit_ok_} -eq ${SHUNIT_TRUE} ]; then - _shunit_msg_='OK' - [ -n "${_shunit_skipped_}" ] \ - && _shunit_msg_="${_shunit_msg_} (${_shunit_skipped_})" + if command [ ${_shunit_ok_} -eq ${SHUNIT_TRUE} ]; then + _shunit_msg_="${__shunit_ansi_green}OK${__shunit_ansi_none}" + command [ "${_shunit_skipped_}" -gt 0 ] \ + && _shunit_msg_="${_shunit_msg_} (${__shunit_ansi_yellow}${_shunit_skipped_}${__shunit_ansi_none})" else - _shunit_msg_="FAILED (${_shunit_failures_}" - [ -n "${_shunit_skipped_}" ] \ - && _shunit_msg_="${_shunit_msg_},${_shunit_skipped_}" + _shunit_msg_="${__shunit_ansi_red}FAILED${__shunit_ansi_none}" + _shunit_msg_="${_shunit_msg_} (${__shunit_ansi_red}${_shunit_failures_}${__shunit_ansi_none}" + command [ "${_shunit_skipped_}" -gt 0 ] \ + && _shunit_msg_="${_shunit_msg_},${__shunit_ansi_yellow}${_shunit_skipped_}${__shunit_ansi_none}" _shunit_msg_="${_shunit_msg_})" fi echo - echo ${_shunit_msg_} + ${__SHUNIT_CMD_ECHO_ESC} "${_shunit_msg_}" __shunit_reportGenerated=${SHUNIT_TRUE} unset _shunit_failures_ _shunit_msg_ _shunit_ok_ _shunit_skipped_ @@ -871,9 +965,8 @@ _shunit_generateReport() # None # Returns: # boolean: whether the test should be skipped (TRUE/FALSE constant) -_shunit_shouldSkip() -{ - [ ${__shunit_skip} -eq ${SHUNIT_FALSE} ] && return ${SHUNIT_FALSE} +_shunit_shouldSkip() { + command [ ${__shunit_skip} -eq ${SHUNIT_FALSE} ] && return ${SHUNIT_FALSE} _shunit_assertSkip } @@ -881,8 +974,7 @@ _shunit_shouldSkip() # # Args: # None -_shunit_assertPass() -{ +_shunit_assertPass() { __shunit_assertsPassed=`expr ${__shunit_assertsPassed} + 1` __shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1` } @@ -891,26 +983,31 @@ _shunit_assertPass() # # Args: # message: string: failure message to provide user -_shunit_assertFail() -{ - _shunit_msg_=$1 - +_shunit_assertFail() { __shunit_testSuccess=${SHUNIT_FALSE} - __shunit_assertsFailed=`expr ${__shunit_assertsFailed} + 1` - __shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1` - echo "${__SHUNIT_ASSERT_MSG_PREFIX}${_shunit_msg_}" + _shunit_incFailedCount - unset _shunit_msg_ + \[ $# -gt 0 ] && ${__SHUNIT_CMD_ECHO_ESC} \ + "${__shunit_ansi_red}ASSERT:${__shunit_ansi_none}$*" } +# Increment the count of failed asserts. +# +# Args: +# none +_shunit_incFailedCount() { + __shunit_assertsFailed=`expr "${__shunit_assertsFailed}" + 1` + __shunit_assertsTotal=`expr "${__shunit_assertsTotal}" + 1` +} + + # Records a skipped test. # # Args: # None -_shunit_assertSkip() -{ - __shunit_assertsSkipped=`expr ${__shunit_assertsSkipped} + 1` - __shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1` +_shunit_assertSkip() { + __shunit_assertsSkipped=`expr "${__shunit_assertsSkipped}" + 1` + __shunit_assertsTotal=`expr "${__shunit_assertsTotal}" + 1` } # Prepare a script filename for sourcing. @@ -919,8 +1016,7 @@ _shunit_assertSkip() # script: string: path to a script to source # Returns: # string: filename prefixed with ./ (if necessary) -_shunit_prepForSourcing() -{ +_shunit_prepForSourcing() { _shunit_script_=$1 case "${_shunit_script_}" in /*|./*) echo "${_shunit_script_}" ;; @@ -936,17 +1032,16 @@ _shunit_prepForSourcing() # s: string: to escape character in # Returns: # string: with escaped character(s) -_shunit_escapeCharInStr() -{ - [ -n "$2" ] || return # no point in doing work on an empty string +_shunit_escapeCharInStr() { + command [ -n "$2" ] || return # No point in doing work on an empty string. # Note: using shorter variable names to prevent conflicts with # _shunit_escapeCharactersInString(). _shunit_c_=$1 _shunit_s_=$2 - - # escape the character + # Escape the character. + # shellcheck disable=SC1003,SC2086 echo ''${_shunit_s_}'' |sed 's/\'${_shunit_c_}'/\\\'${_shunit_c_}'/g' unset _shunit_c_ _shunit_s_ @@ -958,9 +1053,8 @@ _shunit_escapeCharInStr() # str: string: to escape characters in # Returns: # string: with escaped character(s) -_shunit_escapeCharactersInString() -{ - [ -n "$1" ] || return # no point in doing work on an empty string +_shunit_escapeCharactersInString() { + command [ -n "$1" ] || return # No point in doing work on an empty string. _shunit_str_=$1 @@ -980,13 +1074,13 @@ _shunit_escapeCharactersInString() # script: string: name of script to extract functions from # Returns: # string: of function names -_shunit_extractTestFunctions() -{ +_shunit_extractTestFunctions() { _shunit_script_=$1 - # extract the lines with test function names, strip of anything besides the + # Extract the lines with test function names, strip of anything besides the # function name, and output everything on a single line. _shunit_regex_='^[ ]*(function )*test[A-Za-z0-9_]* *\(\)' + # shellcheck disable=SC2196 egrep "${_shunit_regex_}" "${_shunit_script_}" \ |sed 's/^[^A-Za-z0-9_]*//;s/^function //;s/\([A-Za-z0-9_]*\).*/\1/g' \ |xargs @@ -995,73 +1089,81 @@ _shunit_extractTestFunctions() } #------------------------------------------------------------------------------ -# main +# Main. # -# determine the operating mode -if [ $# -eq 0 ]; then +# Determine the operating mode. +if command [ $# -eq 0 ]; then __shunit_script=${__SHUNIT_PARENT} __shunit_mode=${__SHUNIT_MODE_SOURCED} else __shunit_script=$1 - [ -r "${__shunit_script}" ] || \ + command [ -r "${__shunit_script}" ] || \ _shunit_fatal "unable to read from ${__shunit_script}" __shunit_mode=${__SHUNIT_MODE_STANDALONE} fi -# create a temporary storage location +# Create a temporary storage location. __shunit_tmpDir=`_shunit_mktempDir` -# provide a public temporary directory for unit test scripts -# TODO(kward): document this +# Provide a public temporary directory for unit test scripts. +# TODO(kward): document this. SHUNIT_TMPDIR="${__shunit_tmpDir}/tmp" -mkdir "${SHUNIT_TMPDIR}" +command mkdir "${SHUNIT_TMPDIR}" -# setup traps to clean up after ourselves +# 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 +# Create phantom functions to work around issues with Cygwin. _shunit_mktempFunc PATH="${__shunit_tmpDir}:${PATH}" -# make sure phantom functions are executable. this will bite if /tmp (or the -# current $TMPDIR) points to a path on a partition that was mounted with the -# 'noexec' option. the noexec command was created with _shunit_mktempFunc(). +# Make sure phantom functions are executable. This will bite if `/tmp` (or the +# current `$TMPDIR`) points to a path on a partition that was mounted with the +# 'noexec' option. The noexec command was created with `_shunit_mktempFunc()`. noexec 2>/dev/null || _shunit_fatal \ - 'please declare TMPDIR with path on partition with exec permission' + 'Please declare TMPDIR with path on partition with exec permission.' -# we must manually source the tests in standalone mode -if [ "${__shunit_mode}" = "${__SHUNIT_MODE_STANDALONE}" ]; then - . "`_shunit_prepForSourcing \"${__shunit_script}\"`" +# We must manually source the tests in standalone mode. +if command [ "${__shunit_mode}" = "${__SHUNIT_MODE_STANDALONE}" ]; then + # shellcheck disable=SC1090 + command . "`_shunit_prepForSourcing \"${__shunit_script}\"`" fi -# execute the oneTimeSetUp function (if it exists) -oneTimeSetUp +# Configure default output coloring behavior. +_shunit_configureColor "${SHUNIT_COLOR}" -# execute the suite function defined in the parent test script -# deprecated as of 2.1.0 +# Execute the oneTimeSetUp function (if it exists). +oneTimeSetUp +command [ $? -eq ${SHUNIT_TRUE} ] \ + || _shunit_fatal "oneTimeSetUp() returned non-zero return code." + +# Execute the suite function defined in the parent test script. +# DEPRECATED as of 2.1.0. suite -# if no suite function was defined, dynamically build a list of functions -if [ -z "${__shunit_suite}" ]; then +# If no suite function was defined, dynamically build a list of functions. +if command [ -z "${__shunit_suite}" ]; then shunit_funcs_=`_shunit_extractTestFunctions "${__shunit_script}"` for shunit_func_ in ${shunit_funcs_}; do - suite_addTest ${shunit_func_} + suite_addTest "${shunit_func_}" done fi unset shunit_func_ shunit_funcs_ -# execute the tests +# Execute the suite of unit tests. _shunit_execSuite -# execute the oneTimeTearDown function (if it exists) +# Execute the oneTimeTearDown function (if it exists). oneTimeTearDown +command [ $? -eq ${SHUNIT_TRUE} ] \ + || _shunit_fatal "oneTimeTearDown() returned non-zero return code." -# generate the report +# Generate a report summary. _shunit_generateReport -# that's it folks -[ ${__shunit_testsFailed} -eq 0 ] +# That's it folks. +command [ "${__shunit_testsFailed}" -eq 0 ] exit $? diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_asserts.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_asserts_test.sh similarity index 88% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_asserts.sh rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_asserts_test.sh index 38647ec..959ad98 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_asserts.sh +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_asserts_test.sh @@ -1,23 +1,25 @@ #! /bin/sh -# $Id$ # vim:et:ft=sh:sts=2:sw=2 # -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) +# shunit2 unit test for assert functions. +# +# Copyright 2008-2017 Kate Ward. All Rights Reserved. +# Released under the Apache 2.0 license. # # Author: kate.ward@forestent.com (Kate Ward) +# https://github.com/kward/shunit2 # -# shUnit2 unit test for assert functions +# Disable source following. +# shellcheck disable=SC1090,SC1091 -# load test helpers +# These variables will be overridden by the test helpers. +stdoutF="${TMPDIR:-/tmp}/STDOUT" +stderrF="${TMPDIR:-/tmp}/STDERR" + +# Load test helpers. . ./shunit2_test_helpers -#------------------------------------------------------------------------------ -# suite tests -# - -commonEqualsSame() -{ +commonEqualsSame() { fn=$1 ( ${fn} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) @@ -42,8 +44,7 @@ commonEqualsSame() th_assertFalseWithError 'too many arguments' $? "${stdoutF}" "${stderrF}" } -commonNotEqualsSame() -{ +commonNotEqualsSame() { fn=$1 ( ${fn} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) @@ -65,28 +66,23 @@ commonNotEqualsSame() th_assertFalseWithError 'too many arguments' $? "${stdoutF}" "${stderrF}" } -testAssertEquals() -{ +testAssertEquals() { commonEqualsSame 'assertEquals' } -testAssertNotEquals() -{ +testAssertNotEquals() { commonNotEqualsSame 'assertNotEquals' } -testAssertSame() -{ +testAssertSame() { commonEqualsSame 'assertSame' } -testAssertNotSame() -{ +testAssertNotSame() { commonNotEqualsSame 'assertNotSame' } -testAssertNull() -{ +testAssertNull() { ( assertNull '' >"${stdoutF}" 2>"${stderrF}" ) th_assertTrueWithNoOutput 'null' $? "${stdoutF}" "${stderrF}" @@ -119,6 +115,7 @@ testAssertNotNull() th_assertTrueWithNoOutput 'not null, with single-quote' $? \ "${stdoutF}" "${stderrF}" + # shellcheck disable=SC2016 ( assertNotNull 'x$b' >"${stdoutF}" 2>"${stderrF}" ) th_assertTrueWithNoOutput 'not null, with dollar' $? \ "${stdoutF}" "${stderrF}" @@ -130,14 +127,13 @@ testAssertNotNull() ( assertNotNull '' >"${stdoutF}" 2>"${stderrF}" ) th_assertFalseWithOutput 'null' $? "${stdoutF}" "${stderrF}" - # there is no test for too few arguments as $1 might actually be null + # There is no test for too few arguments as $1 might actually be null. ( assertNotNull arg1 arg2 arg3 >"${stdoutF}" 2>"${stderrF}" ) th_assertFalseWithError 'too many arguments' $? "${stdoutF}" "${stderrF}" } -testAssertTrue() -{ +testAssertTrue() { ( assertTrue 0 >"${stdoutF}" 2>"${stderrF}" ) th_assertTrueWithNoOutput 'true' $? "${stdoutF}" "${stderrF}" @@ -163,8 +159,7 @@ testAssertTrue() th_assertFalseWithError 'too many arguments' $? "${stdoutF}" "${stderrF}" } -testAssertFalse() -{ +testAssertFalse() { ( assertFalse 1 >"${stdoutF}" 2>"${stderrF}" ) th_assertTrueWithNoOutput 'false' $? "${stdoutF}" "${stderrF}" @@ -190,17 +185,13 @@ testAssertFalse() th_assertFalseWithError 'too many arguments' $? "${stdoutF}" "${stderrF}" } -#------------------------------------------------------------------------------ -# suite functions -# - -oneTimeSetUp() -{ +oneTimeSetUp() { th_oneTimeSetUp MSG='This is a test message' } -# load and run shUnit2 +# Load and run shunit2. +# shellcheck disable=SC2034 [ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ${TH_SHUNIT} +. "${TH_SHUNIT}" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_failures.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_failures_test.sh similarity index 83% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_failures.sh rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_failures_test.sh index 933a0b1..97ade24 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_failures.sh +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_failures_test.sh @@ -1,23 +1,25 @@ #! /bin/sh -# $Id$ # vim:et:ft=sh:sts=2:sw=2 # -# Copyright 2008 Kate Ward. All Rights Reserved. +# shUnit2 unit test for failure functions +# +# Copyright 2008-2017 Kate Ward. All Rights Reserved. # Released under the LGPL (GNU Lesser General Public License) # # Author: kate.ward@forestent.com (Kate Ward) +# https://github.com/kward/shunit2 # -# shUnit2 unit test for failure functions +# Disable source following. +# shellcheck disable=SC1090,SC1091 -# load common unit-test functions +# These variables will be overridden by the test helpers. +stdoutF="${TMPDIR:-/tmp}/STDOUT" +stderrF="${TMPDIR:-/tmp}/STDERR" + +# Load test helpers. . ./shunit2_test_helpers -#----------------------------------------------------------------------------- -# suite tests -# - -testFail() -{ +testFail() { ( fail >"${stdoutF}" 2>"${stderrF}" ) th_assertFalseWithOutput 'fail' $? "${stdoutF}" "${stderrF}" @@ -28,8 +30,7 @@ testFail() th_assertFalseWithOutput 'too many arguments' $? "${stdoutF}" "${stderrF}" } -testFailNotEquals() -{ +testFailNotEquals() { ( failNotEquals 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) th_assertFalseWithOutput 'same' $? "${stdoutF}" "${stderrF}" @@ -49,8 +50,7 @@ testFailNotEquals() th_assertFalseWithError 'too many arguments' $? "${stdoutF}" "${stderrF}" } -testFailSame() -{ +testFailSame() { ( failSame 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) th_assertFalseWithOutput 'same' $? "${stdoutF}" "${stderrF}" @@ -70,17 +70,13 @@ testFailSame() th_assertFalseWithError 'too many arguments' $? "${stdoutF}" "${stderrF}" } -#----------------------------------------------------------------------------- -# suite functions -# - -oneTimeSetUp() -{ +oneTimeSetUp() { th_oneTimeSetUp MSG='This is a test message' } -# load and run shUnit2 +# Load and run shUnit2. +# shellcheck disable=SC2034 [ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ${TH_SHUNIT} +. "${TH_SHUNIT}" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_macros.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_macros_test.sh similarity index 60% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_macros.sh rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_macros_test.sh index ce57b14..bf1e468 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_macros.sh +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_macros_test.sh @@ -1,108 +1,110 @@ #! /bin/sh -# $Id$ # vim:et:ft=sh:sts=2:sw=2 # -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# Author: kate.ward@forestent.com (Kate Ward) +# shunit2 unit test for macros. # -# shUnit2 unit test for macros. +# Copyright 2008-2017 Kate Ward. All Rights Reserved. +# Released under the Apache 2.0 license. +# +# Author: kate.ward@forestent.com (Kate Ward) +# https://github.com/kward/shunit2 +# +### ShellCheck http://www.shellcheck.net/ +# Disable source following. +# shellcheck disable=SC1090,SC1091 +# Presence of LINENO variable is checked. +# shellcheck disable=SC2039 -# load test helpers +# These variables will be overridden by the test helpers. +stdoutF="${TMPDIR:-/tmp}/STDOUT" +stderrF="${TMPDIR:-/tmp}/STDERR" + +# Load test helpers. . ./shunit2_test_helpers -#------------------------------------------------------------------------------ -# suite tests -# - -testAssertEquals() -{ - # start skipping if LINENO not available +testAssertEquals() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_EQUALS_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_EQUALS_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_EQUALS_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } -testAssertNotEquals() -{ - # start skipping if LINENO not available +testAssertNotEquals() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_NOT_EQUALS_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_EQUALS_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_NOT_EQUALS_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_EQUALS_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } -testSame() -{ - # start skipping if LINENO not available +testSame() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_SAME_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_SAME_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_SAME_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } -testNotSame() -{ - # start skipping if LINENO not available +testNotSame() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_NOT_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_SAME_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_NOT_SAME_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_SAME_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } -testNull() -{ - # start skipping if LINENO not available +testNull() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_NULL_} 'x' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NULL_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_NULL_} '"some msg"' 'x' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NULL_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } testNotNull() @@ -114,68 +116,64 @@ testNotNull() grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_NULL_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_NOT_NULL_} '"some msg"' '""' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_NULL_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stdoutF}" "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stdoutF}" "${stderrF}" >&2 } -testAssertTrue() -{ - # start skipping if LINENO not available +testAssertTrue() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping - ( ${_ASSERT_TRUE_} ${SHUNIT_FALSE} >"${stdoutF}" 2>"${stderrF}" ) + ( ${_ASSERT_TRUE_} "${SHUNIT_FALSE}" >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_TRUE_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 - - ( ${_ASSERT_TRUE_} '"some msg"' ${SHUNIT_FALSE} >"${stdoutF}" 2>"${stderrF}" ) + ( ${_ASSERT_TRUE_} '"some msg"' "${SHUNIT_FALSE}" >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_TRUE_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } -testAssertFalse() -{ - # start skipping if LINENO not available +testAssertFalse() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping - ( ${_ASSERT_FALSE_} ${SHUNIT_TRUE} >"${stdoutF}" 2>"${stderrF}" ) + ( ${_ASSERT_FALSE_} "${SHUNIT_TRUE}" >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_FALSE_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 - ( ${_ASSERT_FALSE_} '"some msg"' ${SHUNIT_TRUE} >"${stdoutF}" 2>"${stderrF}" ) + ( ${_ASSERT_FALSE_} '"some msg"' "${SHUNIT_TRUE}" >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_FALSE_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } -testFail() -{ - # start skipping if LINENO not available +testFail() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping ( ${_FAIL_} >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_FAIL_} '"some msg"' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } testFailNotEquals() @@ -187,60 +185,57 @@ testFailNotEquals() grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_NOT_EQUALS_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_FAIL_NOT_EQUALS_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_NOT_EQUALS_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } -testFailSame() -{ - # start skipping if LINENO not available +testFailSame() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping ( ${_FAIL_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_SAME_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_FAIL_SAME_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_SAME_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } -testFailNotSame() -{ - # start skipping if LINENO not available +testFailNotSame() { + # Start skipping if LINENO not available. [ -z "${LINENO:-}" ] && startSkipping ( ${_FAIL_NOT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_NOT_SAME_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_FAIL_NOT_SAME_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_NOT_SAME_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 + [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 } -#------------------------------------------------------------------------------ -# suite functions -# - -oneTimeSetUp() -{ +oneTimeSetUp() { th_oneTimeSetUp } -# load and run shUnit2 -[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ${TH_SHUNIT} +# Disable output coloring as it breaks the tests. +SHUNIT_COLOR='none'; export SHUNIT_COLOR + +# Load and run shUnit2. +# shellcheck disable=SC2034 +[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT="$0" +. "${TH_SHUNIT}" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_misc_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_misc_test.sh new file mode 100755 index 0000000..6fa2de3 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_misc_test.sh @@ -0,0 +1,262 @@ +#! /bin/sh +# vim:et:ft=sh:sts=2:sw=2 +# +# shUnit2 unit tests of miscellaneous things +# +# Copyright 2008-2018 Kate Ward. All Rights Reserved. +# Released under the Apache 2.0 license. +# +# Author: kate.ward@forestent.com (Kate Ward) +# https://github.com/kward/shunit2 +# +### ShellCheck http://www.shellcheck.net/ +# $() are not fully portable (POSIX != portable). +# shellcheck disable=SC2006 +# Disable source following. +# shellcheck disable=SC1090,SC1091 +# Not wanting to escape single quotes. +# shellcheck disable=SC1003 + +# These variables will be overridden by the test helpers. +stdoutF="${TMPDIR:-/tmp}/STDOUT" +stderrF="${TMPDIR:-/tmp}/STDERR" + +# Load test helpers. +. ./shunit2_test_helpers + +# Note: the test script is prefixed with '#' chars so that shUnit2 does not +# incorrectly interpret the embedded functions as real functions. +testUnboundVariable() { + unittestF="${SHUNIT_TMPDIR}/unittest" + sed 's/^#//' >"${unittestF}" <"${stdoutF}" 2>"${stderrF}" ) + assertFalse 'expected a non-zero exit value' $? + grep '^ASSERT:Unknown failure' "${stdoutF}" >/dev/null + assertTrue 'assert message was not generated' $? + grep '^Ran [0-9]* test' "${stdoutF}" >/dev/null + assertTrue 'test count message was not generated' $? + grep '^FAILED' "${stdoutF}" >/dev/null + assertTrue 'failure message was not generated' $? +} + +# assertEquals repeats message argument. +# https://github.com/kward/shunit2/issues/7 +testIssue7() { + # Disable coloring so 'ASSERT:' lines can be matched correctly. + _shunit_configureColor 'none' + + ( assertEquals 'Some message.' 1 2 >"${stdoutF}" 2>"${stderrF}" ) + diff "${stdoutF}" - >/dev/null < but was:<2> +EOF + rtrn=$? + assertEquals "${SHUNIT_TRUE}" "${rtrn}" + [ "${rtrn}" -eq "${SHUNIT_TRUE}" ] || cat "${stderrF}" >&2 +} + +# Support prefixes on test output. +# https://github.com/kward/shunit2/issues/29 +testIssue29() { + unittestF="${SHUNIT_TMPDIR}/unittest" + sed 's/^#//' >"${unittestF}" <"${stdoutF}" 2>"${stderrF}" ) + grep '^--- test_assert' "${stdoutF}" >/dev/null + rtrn=$? + assertEquals "${SHUNIT_TRUE}" "${rtrn}" + [ "${rtrn}" -eq "${SHUNIT_TRUE}" ] || cat "${stdoutF}" >&2 +} + +# shUnit2 should not exit with 0 when it has syntax errors. +# https://github.com/kward/shunit2/issues/69 +testIssue69() { + unittestF="${SHUNIT_TMPDIR}/unittest" + + for t in Equals NotEquals Null NotNull Same NotSame True False; do + assert="assert${t}" + sed 's/^#//' >"${unittestF}" <"${stdoutF}" 2>"${stderrF}" ) + grep '^FAILED' "${stdoutF}" >/dev/null + assertTrue "failure message for ${assert} was not generated" $? + done +} + +# Ensure that test fails if setup/teardown functions fail. +testIssue77() { + unittestF="${SHUNIT_TMPDIR}/unittest" + for func in oneTimeSetUp setUp tearDown oneTimeTearDown; do + sed 's/^#//' >"${unittestF}" <"${stdoutF}" 2>"${stderrF}" ) + grep '^FAILED' "${stdoutF}" >/dev/null + assertTrue "failure of ${func}() did not end test" $? + done +} + +# Ensure a test failure is recorded for code containing syntax errors. +# https://github.com/kward/shunit2/issues/84 +testIssue84() { + unittestF="${SHUNIT_TMPDIR}/unittest" + sed 's/^#//' >"${unittestF}" <<\EOF +## Function with syntax error. +#syntax_error() { ${!#3442} -334 a$@2[1]; } +#test_syntax_error() { +# syntax_error +# assertTrue ${SHUNIT_TRUE} +#} +#SHUNIT_COLOR='none' +#SHUNIT_TEST_PREFIX='--- ' +#. ${TH_SHUNIT} +EOF + ( exec "${SHUNIT_SHELL:-sh}" "${unittestF}" >"${stdoutF}" 2>"${stderrF}" ) + grep '^FAILED' "${stdoutF}" >/dev/null + assertTrue "failure message for ${assert} was not generated" $? +} + +testPrepForSourcing() { + assertEquals '/abc' "`_shunit_prepForSourcing '/abc'`" + assertEquals './abc' "`_shunit_prepForSourcing './abc'`" + assertEquals './abc' "`_shunit_prepForSourcing 'abc'`" +} + +testEscapeCharInStr() { + while read -r desc char str want; do + got=`_shunit_escapeCharInStr "${char}" "${str}"` + assertEquals "${desc}" "${want}" "${got}" + done <<'EOF' +backslash \ '' '' +backslash_pre \ \def \\def +backslash_mid \ abc\def abc\\def +backslash_post \ abc\ abc\\ +quote " '' '' +quote_pre " "def \"def +quote_mid " abc"def abc\"def +quote_post " abc" abc\" +string $ '' '' +string_pre $ $def \$def +string_mid $ abc$def abc\$def +string_post $ abc$ abc\$ +EOF + + # TODO(20170924:kward) fix or remove. +# actual=`_shunit_escapeCharInStr "'" ''` +# assertEquals '' "${actual}" +# assertEquals "abc\\'" `_shunit_escapeCharInStr "'" "abc'"` +# assertEquals "abc\\'def" `_shunit_escapeCharInStr "'" "abc'def"` +# assertEquals "\\'def" `_shunit_escapeCharInStr "'" "'def"` + +# # Must put the backtick in a variable so the shell doesn't misinterpret it +# # while inside a backticked sequence (e.g. `echo '`'` would fail). +# backtick='`' +# actual=`_shunit_escapeCharInStr ${backtick} ''` +# assertEquals '' "${actual}" +# assertEquals '\`abc' \ +# `_shunit_escapeCharInStr "${backtick}" ${backtick}'abc'` +# assertEquals 'abc\`' \ +# `_shunit_escapeCharInStr "${backtick}" 'abc'${backtick}` +# assertEquals 'abc\`def' \ +# `_shunit_escapeCharInStr "${backtick}" 'abc'${backtick}'def'` +} + +testEscapeCharInStr_specialChars() { + # Make sure our forward slash doesn't upset sed. + assertEquals '/' "`_shunit_escapeCharInStr '\' '/'`" + + # Some shells escape these differently. + # TODO(20170924:kward) fix or remove. + #assertEquals '\\a' `_shunit_escapeCharInStr '\' '\a'` + #assertEquals '\\b' `_shunit_escapeCharInStr '\' '\b'` +} + +# Test the various ways of declaring functions. +# +# Prefixing (then stripping) with comment symbol so these functions aren't +# treated as real functions by shUnit2. +testExtractTestFunctions() { + f="${SHUNIT_TMPDIR}/extract_test_functions" + sed 's/^#//' <"${f}" +## Function on a single line. +#testABC() { echo 'ABC'; } +## Multi-line function with '{' on next line. +#test_def() +# { +# echo 'def' +#} +## Multi-line function with '{' on first line. +#testG3 () { +# echo 'G3' +#} +## Function with numerical values in name. +#function test4() { echo '4'; } +## Leading space in front of function. +# test5() { echo '5'; } +## Function with '_' chars in name. +#some_test_function() { echo 'some func'; } +## Function that sets variables. +#func_with_test_vars() { +# testVariable=1234 +#} +EOF + + actual=`_shunit_extractTestFunctions "${f}"` + assertEquals 'testABC test_def testG3 test4 test5' "${actual}" +} + +# Test that certain external commands sometimes "stubbed" by users +# are escaped. See Issue #54. +testProtectedCommands() { + for c in mkdir rm cat chmod; do + grep "^[^#]*${c} " "${TH_SHUNIT}" | grep -qv "command ${c}" + assertFalse "external call to ${c} not protected somewhere" $? + done + grep '^[^#]*[^ ] *\[' "${TH_SHUNIT}" | grep -qv 'command \[' + assertFalse "call to [ ... ] not protected somewhere" $? + grep '^[^#]* *\.' "${TH_SHUNIT}" | grep -qv 'command \.' + assertFalse "call to . not protected somewhere" $? +} + +setUp() { + for f in "${stdoutF}" "${stderrF}"; do + cp /dev/null "${f}" + done + + # Reconfigure coloring as some tests override default behavior. + _shunit_configureColor "${SHUNIT_COLOR_DEFAULT}" +} + +oneTimeSetUp() { + SHUNIT_COLOR_DEFAULT="${SHUNIT_COLOR}" + th_oneTimeSetUp +} + +# Load and run shUnit2. +# shellcheck disable=SC2034 +[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 +. "${TH_SHUNIT}" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_standalone.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_standalone_test.sh similarity index 53% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_standalone.sh rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_standalone_test.sh index 2ac4725..2109d8f 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_standalone.sh +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_standalone_test.sh @@ -1,41 +1,38 @@ #! /bin/sh -# $Id$ # vim:et:ft=sh:sts=2:sw=2 # -# Copyright 2010 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# Author: kate.ward@forestent.com (Kate Ward) -# # shUnit2 unit test for standalone operation. # +# Copyright 2010-2017 Kate Ward. All Rights Reserved. +# Released under the Apache 2.0 license. +# +# Author: kate.ward@forestent.com (Kate Ward) +# https://github.com/kward/shunit2 +# # This unit test is purely to test that calling shunit2 directly, while passing # the name of a unit test script, works. When run, this script determines if it # is running as a standalone program, and calls main() if it is. +# +### ShellCheck http://www.shellcheck.net/ +# $() are not fully portable (POSIX != portable). +# shellcheck disable=SC2006 +# Disable source following. +# shellcheck disable=SC1090,SC1091 -ARGV0=`basename "$0"` +ARGV0="`basename "$0"`" -# load test helpers +# Load test helpers. . ./shunit2_test_helpers -#------------------------------------------------------------------------------ -# suite tests -# - -testStandalone() -{ - assertTrue ${SHUNIT_TRUE} +testStandalone() { + assertTrue "${SHUNIT_TRUE}" } -#------------------------------------------------------------------------------ -# main -# - -main() -{ +main() { ${TH_SHUNIT} "${ARGV0}" } -# are we running as a standalone? +# Are we running as a standalone? if [ "${ARGV0}" = 'shunit2_test_standalone.sh' ]; then if [ $# -gt 0 ]; then main "$@"; else main; fi fi diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_helpers b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_test_helpers similarity index 54% rename from .zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_helpers rename to .zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_test_helpers index a9989d6..7ff4c9c 100644 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_helpers +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/shunit2_test_helpers @@ -1,104 +1,112 @@ -# $Id$ # vim:et:ft=sh:sts=2:sw=2 # +# shUnit2 unit test common functions +# # Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) +# Released under the Apache 2.0 license. # # Author: kate.ward@forestent.com (Kate Ward) +# https://github.com/kward/shunit2 # -# shUnit2 unit test common functions +### ShellCheck (http://www.shellcheck.net/) +# Commands are purposely escaped so they can be mocked outside shUnit2. +# shellcheck disable=SC1001,SC1012 +# expr may be antiquated, but it is the only solution in some cases. +# shellcheck disable=SC2003 +# $() are not fully portable (POSIX != portable). +# shellcheck disable=SC2006 -# treat unset variables as an error when performing parameter expansion +# Treat unset variables as an error when performing parameter expansion. set -u -# set shwordsplit for zsh -[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit +# Set shwordsplit for zsh. +\[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit # -# constants +# Constants. # -# path to shUnit2 library. can be overridden by setting SHUNIT_INC -TH_SHUNIT=${SHUNIT_INC:-./shunit2} +# Path to shUnit2 library. Can be overridden by setting SHUNIT_INC. +TH_SHUNIT=${SHUNIT_INC:-./shunit2}; export TH_SHUNIT -# configure debugging. set the DEBUG environment variable to any +# Configure debugging. Set the DEBUG environment variable to any # non-empty value to enable debug output, or TRACE to enable trace # output. TRACE=${TRACE:+'th_trace '} -[ -n "${TRACE}" ] && DEBUG=1 -[ -z "${TRACE}" ] && TRACE=':' +\[ -n "${TRACE}" ] && DEBUG=1 +\[ -z "${TRACE}" ] && TRACE=':' DEBUG=${DEBUG:+'th_debug '} -[ -z "${DEBUG}" ] && DEBUG=':' +\[ -z "${DEBUG}" ] && DEBUG=':' # -# variables +# Variables. # th_RANDOM=0 # -# functions +# Functions. # -# message functions -th_trace() { echo "${MY_NAME}:TRACE $@" >&2; } -th_debug() { echo "${MY_NAME}:DEBUG $@" >&2; } -th_info() { echo "${MY_NAME}:INFO $@" >&2; } -th_warn() { echo "${MY_NAME}:WARN $@" >&2; } -th_error() { echo "${MY_NAME}:ERROR $@" >&2; } -th_fatal() { echo "${MY_NAME}:FATAL $@" >&2; } +# Logging functions. +th_trace() { echo "${MY_NAME}:TRACE $*" >&2; } +th_debug() { echo "${MY_NAME}:DEBUG $*" >&2; } +th_info() { echo "${MY_NAME}:INFO $*" >&2; } +th_warn() { echo "${MY_NAME}:WARN $*" >&2; } +th_error() { echo "${MY_NAME}:ERROR $*" >&2; } +th_fatal() { echo "${MY_NAME}:FATAL $*" >&2; } -# output subtest name -th_subtest() { echo " $@" >&2; } +# Output subtest name. +th_subtest() { echo " $*" >&2; } -th_oneTimeSetUp() -{ - # these files will be cleaned up automatically by shUnit2 +th_oneTimeSetUp() { + # These files will be cleaned up automatically by shUnit2. stdoutF="${SHUNIT_TMPDIR}/stdout" stderrF="${SHUNIT_TMPDIR}/stderr" returnF="${SHUNIT_TMPDIR}/return" expectedF="${SHUNIT_TMPDIR}/expected" + export stdoutF stderrF returnF expectedF } -# generate a random number -th_generateRandom() -{ +# Generate a random number. +th_generateRandom() { tfgr_random=${th_RANDOM} - while [ "${tfgr_random}" = "${th_RANDOM}" ]; do - if [ -n "${RANDOM:-}" ]; then + while \[ "${tfgr_random}" = "${th_RANDOM}" ]; do + # shellcheck disable=SC2039 + if \[ -n "${RANDOM:-}" ]; then # $RANDOM works + # shellcheck disable=SC2039 tfgr_random=${RANDOM}${RANDOM}${RANDOM}$$ - elif [ -r '/dev/urandom' ]; then + elif \[ -r '/dev/urandom' ]; then tfgr_random=`od -vAn -N4 -tu4 >> STDOUT' >&2 - cat "${_th_stdout_}" >&2 + \cat "${_th_stdout_}" >&2 fi - if [ -n "${_th_stderr_}" -a -s "${_th_stderr_}" ]; then + if \[ -n "${_th_stderr_}" -a -s "${_th_stderr_}" ]; then echo '>>> STDERR' >&2 - cat "${_th_stderr_}" >&2 + \cat "${_th_stderr_}" >&2 fi - if [ -n "${_th_stdout_}" -o -n "${_th_stderr_}" ]; then + if \[ -n "${_th_stdout_}" -o -n "${_th_stderr_}" ]; then echo '<<< end output' >&2 fi fi @@ -222,7 +227,7 @@ _th_showOutput() } # -# main +# Main. # ${TRACE} 'trace output enabled' diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/Makefile b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/Makefile deleted file mode 100644 index effbcca..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/Makefile +++ /dev/null @@ -1,89 +0,0 @@ -# $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) diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/docbookPrep.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/docbookPrep.sh deleted file mode 100755 index eb7c270..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/docbookPrep.sh +++ /dev/null @@ -1,97 +0,0 @@ -#! /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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/extractDocs.pl b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/extractDocs.pl deleted file mode 100755 index a803526..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/extractDocs.pl +++ /dev/null @@ -1,40 +0,0 @@ -#! /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() { - 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); diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/which b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/which deleted file mode 100755 index 9d7cc9f..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/bin/which +++ /dev/null @@ -1,36 +0,0 @@ -#! /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}" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/CHANGES-2.0.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/CHANGES-2.0.txt deleted file mode 100644 index 97ea3db..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/CHANGES-2.0.txt +++ /dev/null @@ -1,68 +0,0 @@ -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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/LGPL-2.1 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/LGPL-2.1 deleted file mode 100644 index b1e3f5a..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/LGPL-2.1 +++ /dev/null @@ -1,504 +0,0 @@ - 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. - - - Copyright (C) - - 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. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/README.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/README.txt deleted file mode 100644 index 538f4f4..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/README.txt +++ /dev/null @@ -1,153 +0,0 @@ -#------------------------------------------------------------------------------ -# 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 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$ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.0.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.0.txt deleted file mode 100644 index 947eea9..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.0.txt +++ /dev/null @@ -1,71 +0,0 @@ -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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.1.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.1.txt deleted file mode 100644 index 110a37a..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.1.txt +++ /dev/null @@ -1,73 +0,0 @@ -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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.2.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.2.txt deleted file mode 100644 index e7bcad6..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.2.txt +++ /dev/null @@ -1,71 +0,0 @@ -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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.3.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.3.txt deleted file mode 100644 index 7e12684..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.3.txt +++ /dev/null @@ -1,60 +0,0 @@ -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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.4.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.4.txt deleted file mode 100644 index 64fb417..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/RELEASE_NOTES-2.0.4.txt +++ /dev/null @@ -1,51 +0,0 @@ -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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/TODO.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/TODO.txt deleted file mode 100644 index 7fd6314..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/TODO.txt +++ /dev/null @@ -1,5 +0,0 @@ -Make it possible to execute a single test by passing the name of the test on -the command line - - -$Revision$ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/contributors.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/contributors.txt deleted file mode 100644 index 69da654..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/contributors.txt +++ /dev/null @@ -1,10 +0,0 @@ -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$ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/design_doc.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/design_doc.txt deleted file mode 100644 index 2849e55..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/design_doc.txt +++ /dev/null @@ -1,54 +0,0 @@ -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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/shunit2.html b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/shunit2.html deleted file mode 100644 index 6690867..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/shunit2.html +++ /dev/null @@ -1,218 +0,0 @@ -<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>shUnit2

shUnit2 version 2.0.3

Kate Ward


-            
-          

2007-07-12

Revision History
Revision 2.0.32007-07-12Kate Ward <kate.ward@forestent.com>
Revision 2.0.22007-04-22Kate Ward <kate.ward@forestent.com>
Revision 2.0.12007-02-21Kate Ward <kate.ward@forestent.com>
Revision 2.0.02007-02-20Kate Ward <kate.ward@forestent.com>

Abstract

shUnit2 is a unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to JUnit, PyUnit, etc.


List of Tables

3.1. asserts
3.2. failures
3.3. suites

Chapter 1. Introduction

shUnit2 is a unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to JUnit, PyUnit, etc.

shUnit2 was originally developed to provide a consistent testing solution for log4sh, 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 (/bin/bash on Linux to be specific), and then not working under another shell (/bin/sh 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.

Tested Operating Systems

Tested Shells

  • Bourne Shell (sh)

  • BASH - GNU Bourne Again SHell (bash)

  • DASH (dash)

  • Korn Shell (ksh)

  • pdksh - Public Domain Korn Shell (pdksh)

See the appropriate Release Notes (doc/RELEASE_NOTES-X.X.X.txt) for this release for the actual versions tested.

1. Credits / Contributors

A list of contributors to shUnit2 can be found in the source archive as doc/contributors.txt. I want to personally thank all those who have contributed to make this a better tool.

2. Feedback

Feedback is most certainly welcome for this document. Send your additions, comments and criticisms to the following email address: .

Chapter 2. Quickstart

This chapter will give a very quick start to running unit tests with shUnit2. More information is located in other chapters.

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.

-
-#! /bin/sh
-
-testEquality()
-{
-  assertEquals 1 1
-}
-
-# load shunit2
-. ./shunit2
-
-  

Running the unit test should give results similar to the following.

-
-#
-# Performing tests
-#
-testEquality
-
-#
-# Test report
-#
-tests passed: 1
-tests failed: 0
-tests total:  1
-success rate: 100%
-
-  

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.

When shUnit2 is sourced, it first looks to see if a suite() 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 test, 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.

Before any tests are executed, shUnit2 again looks for a function, this time one named oneTimeSetUp(). 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 oneTimeTearDown() function that does the same thing, but once all the tests have been completed. It is good for removing temporary directories, etc.

shUnit2 is now ready to run tests. Before doing so though, it again looks for another function that might be declared, one named setUp(). 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 tearDown(). 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.

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.

We should now try adding a test that fails. Change your unit test to look like this.

-
-#! /bin/sh
-
-testEquality()
-{
-  assertEquals 1 1
-}
-
-testPartyLikeItIs1999()
-{
-  year=`date '+%Y'`
-  assertEquals "It's not 1999 :-( This is ${year}." \
-      '1999' "${year}"
-}
-
-# load shunit2
-. ./shunit2
-
-  

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.

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 log4sh. 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.

Chapter 3. Function Reference

1. asserts

Table 3.1. asserts

- void - -
- assertEquals - ([message],  
 expected,  
 actual); 
string  [message];
string  expected;
string  actual;
-

Asserts that expected and - actual are equal to one another. The message is - optional.

-
- void - -
- assertNull - ([message],  
 value); 
string  [message];
string  value;
-

Asserts that value is null, - or in shell terms a zero-length string. The message is optional.

-
- void - -
- assertNotNull - ([message],  
 value); 
string  [message];
string  value;
-

Asserts that value is notnull, or in shell terms not - a zero-length string. The message is optional.

-
- void - -
- assertSame - ([message],  
 expected,  
 actual); 
string  [message];
string  expected;
string  actual;
-

This function is functionally equivalent to - assertEquals.

-
- void - -
- assertNotSame - ([message],  
 unexpected,  
 actual); 
string  [message];
string  unexpected;
string  actual;
-

Asserts that unexpected and - actual are not - equal to one another. The message is optional.

-
- void - -
- assertTrue - ([message],  
 condition); 
string  [message];
string  condition;
-

Asserts that a given shell test condition is true. The message is - optional.

-

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.

-
- The following test will succeed:
assertTrue "[ 34 -gt 23 ]"
- The folloing test will fail with a message:
assertTrue "test failed" "[ -r '/non/existant/file' ]"
-
- void - -
- assertFalse - ([message],  
 condition); 
string  [message];
string  condition;
-

Asserts that a given shell test condition is false. The message is - optional.

-

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.

-
- The following test will succeed:
assertFalse "[ 'apples' = 'oranges' ]"
- The folloing test will fail with a message:
assertFalse "test failed" "[ 1 -eq 1 -a 2 -eq 2 ]"
-

2. failures

Table 3.2. failures

- void - -
- fail - ([message]); 
string  [message];
-

Fails the test immediately, with the optional message.

-
- void - -
- failNotEquals - ([message],  
 unexpected,  
 actual); 
string  [message];
string  unexpected;
string  actual;
-

Fails the test if unexpected and - actual are not - equal to one another. The message is optional.

-
- void - -
- failSame - ([message]); 
string  [message];
-

Indicate test failure because arguments were not the same. The - message is optional.

-
- void - -
- failNotSame - ([message],  
 expected,  
 actual); 
string  [message];
string  expected;
string  actual;
-

Fails the test if expected and - actual are equal to one another. The message is - optional.

-

3. suites

Table 3.3. suites

- void - -
- suite - (); 
 ;
-

This function can be optionally overridden by the user in their test - suite.

-

If this function exists, it will be called when - shunit2 is sourced. If it does not exist, shUnit2 will - search the parent script for all functions beginning with the word - test, and they will be added dynamically to the test - suite.

-
- void - -
- suite_addTest - (function); 
string  function;
-

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 suite() function.

-
- void - -
- oneTimeSetUp - (); 
 ;
-

This function can be be optionally overridden by the user in their - test suite.

-

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.

-
- void - -
- oneTimeTearDown - (); 
 ;
-

This function can be be optionally overridden by the user in their - test suite.

-

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.

-
- void - -
- setUp - (); 
 ;
-

This function can be be optionally overridden by the user in their - test suite.

-

If this function exists, it will be called before each test is run. - It is useful to reset the environment before each test.

-
- void - -
- tearDown - (); 
 ;
-

This function can be be optionally overridden by the user in their - test suite.

-

If this function exists, it will be called after each test completes. - It is useful to clean up the environment after each test.

-

diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/style.css b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/style.css deleted file mode 100644 index c1d2f43..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/doc/style.css +++ /dev/null @@ -1,33 +0,0 @@ -/* $Id$ */ -/* - style.css -*/ - - -body { - -/* - Style the HMTL 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; -} diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/lib/sh/shlib b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/lib/sh/shlib deleted file mode 100644 index 00aadcb..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/lib/sh/shlib +++ /dev/null @@ -1,23 +0,0 @@ -# $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 -} diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/docbook/tldp-xsl/21MAR2004/fo/tldp-print.xsl b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/docbook/tldp-xsl/21MAR2004/fo/tldp-print.xsl deleted file mode 100644 index b7a7d43..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/docbook/tldp-xsl/21MAR2004/fo/tldp-print.xsl +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - -start - - - - - - - - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/docbook/tldp-xsl/21MAR2004/html/tldp-common.xsl b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/docbook/tldp-xsl/21MAR2004/html/tldp-common.xsl deleted file mode 100644 index f8cf7b1..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/docbook/tldp-xsl/21MAR2004/html/tldp-common.xsl +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - -text/css - - - - - - - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/docbook/tldp-xsl/21MAR2004/html/tldp-one-page.xsl b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/docbook/tldp-xsl/21MAR2004/html/tldp-one-page.xsl deleted file mode 100644 index 16994ad..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/docbook/tldp-xsl/21MAR2004/html/tldp-one-page.xsl +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/resources/shelldoc.xslt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/resources/shelldoc.xslt deleted file mode 100644 index 45d5f92..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/share/resources/shelldoc.xslt +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - Function Reference - - - -
- shelldoc-section- - <xsl:value-of select="@group"/> - - shelldoc-function- - <xsl:value-of select="@group"/> - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - - - - - -
diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/functions.xml b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/functions.xml deleted file mode 100644 index c960e55..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/functions.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - Functions - 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. - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/introduction.xml b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/introduction.xml deleted file mode 100644 index d71b091..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/introduction.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - Introduction - shUnit2 is a unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to JUnit, PyUnit, etc. - - shUnit2 was originally developed to provide a consistent testing solution for log4sh, 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 (/bin/bash on Linux to be specific), and then not working under another shell (/bin/sh 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. - -
Tested Operating Systems - - Cygwin - FreeBSD (user supported) - Linux (Gentoo, Ubuntu) - Mac OS X - Solaris 8, 9, 10 - -
- -
Tested Shells - - Bourne Shell (sh) - BASH - GNU Bourne Again SHell (bash) - DASH (dash) - Korn Shell (ksh) - pdksh - Public Domain Korn Shell (pdksh) - -
- - See the appropriate Release Notes (doc/RELEASE_NOTES-X.X.X.txt) for this release for the actual versions tested. - - -
Credits / Contributors - A list of contributors to shUnit2 can be found in the source archive as doc/contributors.txt. I want to personally thank all those who have contributed to make this a better tool. -
- - -
Feedback - Feedback is most certainly welcome for this document. Send your additions, comments and criticisms to the following email address: &myEmail;. -
- -
diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/quickstart.xml b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/quickstart.xml deleted file mode 100644 index d009cb6..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/quickstart.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - Quickstart - - This chapter will give a very quick start to running unit tests with shUnit2. More information is located in other chapters. - - 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. - - - - - - Running the unit test should give results similar to the following. - - - - - - 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. - - When shUnit2 is sourced, it first looks to see if a suite() 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 test, 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. - - Before any tests are executed, shUnit2 again looks for a function, this time one named oneTimeSetUp(). 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 oneTimeTearDown() function that does the same thing, but once all the tests have been completed. It is good for removing temporary directories, etc. - - shUnit2 is now ready to run tests. Before doing so though, it again looks for another function that might be declared, one named setUp(). 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 tearDown(). 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. - - 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. - - We should now try adding a test that fails. Change your unit test to look like this. - - - - - - 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. - - 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 log4sh. 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. - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/shunit2.xml b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/shunit2.xml deleted file mode 100644 index 25b3fed..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/docbook/shunit2.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - shunit2"> -]> - -shUnit2 - - shUnit2 version 2.0.3 - - - KateWard - -
- &myEmail; -
-
-
-
- - - &isoDate; - - - - - - - 2.0.3 - 2007-07-12 - Kate Ward <&myEmail;> - - - - 2.0.2 - 2007-04-22 - Kate Ward <&myEmail;> - - - - 2.0.1 - 2007-02-21 - Kate Ward <&myEmail;> - - - - 2.0.0 - 2007-02-20 - Kate Ward <&myEmail;> - - - - - - shUnit2 is a unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to JUnit, PyUnit, etc. - -
- - &introduction; - &quickstart; - &functions; -
diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/shell/shunit2 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/shell/shunit2 deleted file mode 100644 index 4e82e5b..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/shell/shunit2 +++ /dev/null @@ -1,799 +0,0 @@ -# $Id$ -# vim:syntax=sh:sts=2 -# vim:foldmethod=marker:foldmarker=/**,*/ -# -#/** -# -# -# -# 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 -# -#*/ - -# 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 -# - -#/** -# -# -# void -# -# -# -# -# assertEquals -# string [message] -# string expected -# string actual -# -# -# Asserts that expected and -# actual are equal to one another. The message is -# optional. -# -# -#*/ -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} -} - -#/** -# -# -# void -# -# -# -# -# assertNull -# string [message] -# string value -# -# -# Asserts that value is null, -# or in shell terms a zero-length string. The message is optional. -# -# -#*/ -assertNull() -{ - if [ $# -eq 2 ]; then - assertTrue "$1" "[ -z '$2' ]" - else - assertTrue "[ -z '${1:-}' ]" - fi -} - -#/** -# -# -# void -# -# -# -# -# assertNotNull -# string [message] -# string value -# -# -# Asserts that value is not null, or in shell terms not -# a zero-length string. The message is optional. -# -# -#*/ -assertNotNull() -{ - if [ $# -eq 2 ]; then - assertTrue "$1" "[ -n '$2' ]" - else - assertTrue "[ -n '${1:-}' ]" - fi -} - -#/** -# -# -# void -# -# -# -# -# assertSame -# string [message] -# string expected -# string actual -# -# -# This function is functionally equivalent to -# assertEquals. -# -# -#*/ -assertSame() -{ - assertEquals "${@:-}" -} - -#/** -# -# -# void -# -# -# -# -# assertNotSame -# string [message] -# string unexpected -# string actual -# -# -# Asserts that unexpected and -# actual are not -# equal to one another. The message is optional. -# -# -#*/ -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} -} - -#/** -# -# -# void -# -# -# -# -# assertTrue -# string [message] -# string condition -# -# -# Asserts that a given shell test condition is true. The message is -# optional. -# 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. -# -# The following test will succeed: assertTrue "[ 34 -gt 23 ]" -# The folloing test will fail with a message: assertTrue "test failed" "[ -r '/non/existant/file' ]" -# -# -# -#*/ -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} -} - -#/** -# -# -# void -# -# -# -# -# assertFalse -# string [message] -# string condition -# -# -# Asserts that a given shell test condition is false. The message is -# optional. -# 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. -# -# The following test will succeed: assertFalse "[ 'apples' = 'oranges' ]" -# The folloing test will fail with a message: assertFalse "test failed" "[ 1 -eq 1 -a 2 -eq 2 ]" -# -# -# -#*/ -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 -# - -#/** -# -# -# void -# -# -# -# -# fail -# string [message] -# -# -# Fails the test immediately, with the optional message. -# -# -#*/ -fail() -{ - _su_message=${1:-} - - _shunit_testFailed "${_su_message}" - - unset _su_message -} - -#/** -# -# -# void -# -# -# -# -# failNotEquals -# string [message] -# string unexpected -# string actual -# -# -# Fails the test if unexpected and -# actual are not -# equal to one another. The message is optional. -# -# -#*/ -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 -} - -#/** -# -# -# void -# -# -# -# -# failSame -# string [message] -# -# -# Indicate test failure because arguments were not the same. The -# message is optional. -# -# -#*/ -failSame() -{ - _su_message=${1:-} - - _shunit_testFailed "${_su_message:+${_su_message} }expected not same" - - unset _su_message -} - -#/** -# -# -# void -# -# -# -# -# failNotSame -# string [message] -# string expected -# string actual -# -# -# Fails the test if expected and -# actual are equal to one another. The message is -# optional. -# -# -#*/ -failNotSame() -{ - failNotEquals "${@:-}" -} - -#----------------------------------------------------------------------------- -# suite functions -# - -#/** -# -# -# void -# -# -# -# -# suite -# -# -# -# This function can be optionally overridden by the user in their test -# suite. -# If this function exists, it will be called when -# shunit2 is sourced. If it does not exist, shUnit2 will -# search the parent script for all functions beginning with the word -# test, and they will be added dynamically to the test -# suite. -# -# -#*/ -# Note: see _shunit_mktempFunc() for actual implementation -# suite() { :; } - -#/** -# -# -# void -# -# -# -# -# suite_addTest -# string function -# -# -# 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 suite() function. -# -# -#*/ -suite_addTest() -{ - _su_func=${1:-} - - __shunit_suite="${__shunit_suite:+${__shunit_suite} }${_su_func}" - - unset _su_func -} - -#/** -# -# -# void -# -# -# -# -# oneTimeSetUp -# -# -# -# This function can be be optionally overridden by the user in their -# test suite. -# 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. -# -# -#*/ -# Note: see _shunit_mktempFunc() for actual implementation -# oneTimeSetUp() { :; } - -#/** -# -# -# void -# -# -# -# -# oneTimeTearDown -# -# -# -# This function can be be optionally overridden by the user in their -# test suite. -# 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. -# -# -#*/ -# Note: see _shunit_mktempFunc() for actual implementation -# oneTimeTearDown() { :; } - -#/** -# -# -# void -# -# -# -# -# setUp -# -# -# -# This function can be be optionally overridden by the user in their -# test suite. -# If this function exists, it will be called before each test is run. -# It is useful to reset the environment before each test. -# -# -#*/ -# Note: see _shunit_mktempFunc() for actual implementation -# setUp() { :; } - -#/** -# -# -# void -# -# -# -# -# tearDown -# -# -# -# This function can be be optionally overridden by the user in their -# test suite. -# If this function exists, it will be called after each test completes. -# It is useful to clean up the environment after each test. -# -# -#*/ -# 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 </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 &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 <"${_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 - -#/** -# -#*/ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/run-test-suite b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/run-test-suite deleted file mode 100755 index 8710a36..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/run-test-suite +++ /dev/null @@ -1,116 +0,0 @@ -#! /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 <&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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/test-functions.inc b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/test-functions.inc deleted file mode 100644 index 88764c5..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/test-functions.inc +++ /dev/null @@ -1,84 +0,0 @@ -# $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 -# -# 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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testFailures b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testFailures deleted file mode 100755 index 9410510..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testFailures +++ /dev/null @@ -1,89 +0,0 @@ -#! /bin/sh -# $Id$ -# vim: expandtab -# author: Kate Ward -# -# 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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testInternalFx b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testInternalFx deleted file mode 100755 index 9409dc2..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testInternalFx +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh -# $Id$ -# vim: expandtab -# author: Kate Ward -# -# Self-testing unit tests for shUnit2 internal functions -# - -#----------------------------------------------------------------------------- -# suite tests -# - -testGenerateReport() -{ - : -} - -#----------------------------------------------------------------------------- -# suite functions -# - -# load and run shUnit2 -. ./shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testSuiteFx b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testSuiteFx deleted file mode 100755 index c0e6ab8..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.0/src/test/testSuiteFx +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh -# $Id$ -# vim: expandtab -# author: Kate Ward -# -# Self-testing unit tests for shUnit2 suite functions -# - -#----------------------------------------------------------------------------- -# suite tests -# - -testAddTest() -{ - : -} - -#----------------------------------------------------------------------------- -# suite functions -# - -# load and run shUnit2 -. ./shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/gen_test_results.flags b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/gen_test_results.flags deleted file mode 100644 index 18495de..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/gen_test_results.flags +++ /dev/null @@ -1,12 +0,0 @@ -# $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 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/gen_test_results.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/gen_test_results.sh deleted file mode 100755 index 3f55493..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/gen_test_results.sh +++ /dev/null @@ -1,88 +0,0 @@ -#! /bin/sh -# $Id: gen_test_results.sh 187 2013-01-15 00:01:51Z kate.ward@forestent.com $ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# This script runs the provided unit tests and sends the output to the -# appropriate file. -# - -# treat unset variables as an error -set -u - -die() -{ - [ $# -gt 0 ] && echo "error: $@" >&2 - exit 1 -} - -BASE_DIR="`dirname $0`/.." -LIB_DIR="${BASE_DIR}/lib" - -# load libraries -. ${LIB_DIR}/shflags || die 'unable to load shflags library' -. ${LIB_DIR}/shlib || die 'unable to load shlib library' -. ${LIB_DIR}/versions || die 'unable to load versions library' - -# redefining BASE_DIR now that we have the shlib functions -BASE_DIR=`shlib_relToAbsPath "${BASE_DIR}"` -BIN_DIR="${BASE_DIR}/bin" -SRC_DIR="${BASE_DIR}/src" - -os_name=`versions_osName |sed 's/ /_/g'` -os_version=`versions_osVersion` - -# load external flags -. ${BIN_DIR}/gen_test_results.flags - -# define flags -DEFINE_boolean force false 'force overwrite' f -DEFINE_string output_dir "`pwd`" 'output dir' d -DEFINE_string output_file "${os_name}-${os_version}.txt" 'output file' o -DEFINE_boolean dry_run false "supress logging to a file" n - -main() -{ - # determine output filename - output="${FLAGS_output_dir:+${FLAGS_output_dir}/}${FLAGS_output_file}" - output=`shlib_relToAbsPath "${output}"` - - # checks - [ -n "${FLAGS_suite:-}" ] || die 'suite flag missing' - - if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} -a -f "${output}" ]; then - if [ ${FLAGS_force} -eq ${FLAGS_TRUE} ]; then - rm -f "${output}" - else - echo "not overwriting '${output}'" >&2 - exit ${FLAGS_ERROR} - fi - fi - if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} ]; then - touch "${output}" 2>/dev/null || die "unable to write to '${output}'" - fi - - # run tests - ( - cd "${SRC_DIR}"; - if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} ]; then - ./${FLAGS_suite} |tee "${output}" - else - ./${FLAGS_suite} - fi - ) - - if [ ! ${FLAGS_dry_run} ]; then - echo >&2 - echo "output written to '${output}'" >&2 - fi -} - -FLAGS "$@" || exit $? -[ ${FLAGS_help} -eq ${FALSE} ] || exit -eval set -- "${FLAGS_ARGV}" -main "${@:-}" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/which b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/which deleted file mode 100755 index 9d7cc9f..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/bin/which +++ /dev/null @@ -1,36 +0,0 @@ -#! /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}" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/README.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/README.txt deleted file mode 100644 index 0e71fa2..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/README.txt +++ /dev/null @@ -1,212 +0,0 @@ -==================== -shUnit2 2.1.x README -==================== - -code.google.com -=============== - -This project is stored on code.google.com as http://code.google.com/p/shunit2/. -All releases as of 2.1.4 and full source are available there. Documentation is -included as part of the source and each release. Source code is stored in -Subversion and can be accessed using the following information. - -Browse the code in a web browser: - -- http://code.google.com/p/shunit2/source/browse -- svn > trunk > source > 2.1 - -Check out the code locally :: - - $ svn checkout http://shunit2.googlecode.com/svn/trunk/ shflags-read-only - - -SourceForge -=========== - -DEPRECATED - -This project is stored on SourceForge as http://sf.net/projects/shunit2. The -source code is stored in Subversion and can be accessed using the following -information. - -Check out the code locally :: - - $ svn co https://shunit2.svn.sourceforge.net/svnroot/shunit2/trunk/source/2.1 shunit2 - -Browse the code in a web browser: - -- http://shunit2.svn.sourceforge.net/viewvc/shunit2/trunk/source/2.1/ -- http://shunit2.svn.sourceforge.net/svnroot/shunit2/trunk/source/2.1/ - - -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 explanatory. Use one of the release notes from a -previous release as an example. - -The versions of the various platforms and shells are included when the -master unit test script is run, or when ``bin/gen_test_results.sh`` is -used. To determine the versions of the installed shells by hand, use the -``lib/versions`` script. - -Alternatively, do the following: - -+-------+---------+-----------------------------------------------------------+ -| Shell | OS | Notes | -+=======+=========+===========================================================+ -| bash | | ``$ bash --version`` | -+-------+---------+-----------------------------------------------------------+ -| dash | Linux | ``$ dpkg -l |grep dash`` | -+-------+---------+-----------------------------------------------------------+ -| ksh | | ``$ ksh --version`` | -| | | -or- | -| | | ``$ echo 'echo $KSH_VERSION' |ksh`` | -| +---------+-----------------------------------------------------------+ -| | Cygwin | see pdksh | -| +---------+-----------------------------------------------------------+ -| | Solaris | ``$ strings /usr/bin/ksh |grep 'Version'`` | -+-------+---------+-----------------------------------------------------------+ -| pdksh | | ``$ strings /bin/pdksh |grep 'PD KSH'`` | -| +---------+-----------------------------------------------------------+ -| | Cygwin | look in the downloaded Cygwin directory | -+-------+---------+-----------------------------------------------------------+ -| sh | Solaris | not possible | -+-------+---------+-----------------------------------------------------------+ -| zsh | | ``$ zsh --version`` | -+-------+---------+-----------------------------------------------------------+ - -Update Version --------------- - -Edit ``src/shell/shunit2`` and change the version number in the comment, as well -as in the ``SHUNIT_VERSION`` variable. - -Finish Documentation --------------------- - -Make sure that any remaining changes get put into the ``CHANGES-X.X.txt`` file. - -Finish writing the ``RELEASE_NOTES-X.X.X.txt``. If necessary, run it -through the **fmt** command to make it pretty (hopefully it is already). :: - - $ 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.1 - $ cd doc - $ RST2HTML_OPTS='--stylesheet-path=rst2html.css' - $ rst2html ${RST2HTML_OPTS} shunit2.txt >shunit2.html - -Check In All the Code ---------------------- - -This step is pretty self-explanatory :: - - $ pwd - .../shunit2/source/2.0 - $ svn ci -m "finalizing release" - -Tag the Release ---------------- -:: - - $ pwd - .../shunit2/source - $ ls - 2.0 2.1 - $ svn cp -m "Release 2.0.0" 2.0 https://shunit2.googlecode.com/svn/tags/source/2.0.0 - -Export the Release ------------------- -:: - - $ pwd - .../shunit2/builds - $ svn export https://shunit2.googlecode.com/svn/tags/source/2.0.0 shunit2-2.0.0 - -Create Tarball --------------- -:: - - $ tar cfz ../releases/shunit2-2.0.0.tgz shunit2-2.0.0 - -Sign the Tarball with gpg -------------------------- -:: - - $ cd ../releases - $ gpg --default-key kate.ward@forestent.com --detach-sign shunit2-2.0.0.tgz - -Update Website --------------- - -Again, pretty self-explanatory. Make sure to copy the GPG signature file. Once -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.googlecode.com/svn/tags/website/20060916 - -Now, update the website. It too is held in Subversion, so **ssh** into the web -server and use ``svn up`` to grab the latest version. - -Post to code.google.com and Freshmeat -------------------------------------- - -- http://code.google.com/p/shunit2/ -- http://freshmeat.net/ - - -Related Documentation -===================== - -Docbook: - http://www.docbook.org/ - -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/ -reStructuredText: - http://docutils.sourceforge.net/docs/user/rst/quickstart.html - -.. generate HTML using rst2html from Docutils of -.. http://docutils.sourceforge.net/ -.. -.. vim:fileencoding=latin1:ft=rst:spell:tw=80 -.. $Revision$ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/coding_standards.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/coding_standards.txt deleted file mode 100644 index e5dee4f..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/coding_standards.txt +++ /dev/null @@ -1,74 +0,0 @@ -Coding Standards -================ - -Variable and Function Names ---------------------------- - -All shUnit2 specific constants, variables, and functions will be prefixed -appropriately with 'shunit'. This is to distinguish usage in the shUnit2 code -from users own scripts so that the shell name space remains predictable to -users. The exceptions here are the standard ``assertEquals``, etc. functions. - -All non-builtin constants and variables will be surrouned with squiggle -brackets, e.g. '${shunit_someVariable}' to improve code readability. - -Due to some shells not supporting local variables in functions, care in the -naming and use of variables, both public and private, is very important. -Accidental overriding of the variables can occur easily if care is not taken as -all variables are technically global variables in some shells. - -+----------------------------------+---------------------------+ -| *type* | *sample* | -+==================================+===========================+ -| global public constant | ``SHUNIT_TRUE`` | -+----------------------------------+---------------------------+ -| global private constant | ``__SHUNIT_SHELL_FLAGS`` | -+----------------------------------+---------------------------+ -| global public variable | not used | -+----------------------------------+---------------------------+ -| global private variable | ``__shunit_someVariable`` | -+----------------------------------+---------------------------+ -| global macro | ``_SHUNIT_SOME_MACRO_`` | -+----------------------------------+---------------------------+ -| public function | ``assertEquals`` | -+----------------------------------+---------------------------+ -| public function, local variable | ``shunit_someVariable_`` | -+----------------------------------+---------------------------+ -| private function | ``_shunit_someFunction`` | -+----------------------------------+---------------------------+ -| private function, local variable | ``_shunit_someVariable_`` | -+----------------------------------+---------------------------+ - -Where it makes sense, variables can have the first letter of the second and -later words capitalized. For example, the local variable name for the total -number of test cases seen might be ``shunit_totalTestsSeen_``. - -Local Variable Cleanup ----------------------- - -As many shells do not support local variables, no support for cleanup of -variables is present either. As such, all variables local to a function must be -cleared up with the ``unset`` command at the end of each function. - -Indentation ------------ - -Code block indentation is two (2) spaces, and tabs may not be used. :: - - if [ -z 'some string' ]; then - someFunction - fi - -Lines of code should be no longer than 80 characters unless absolutely -necessary. When lines are wrapped using the backslash character '\', subsequent -lines should be indented with four (4) spaces so as to differentiate from the -standard spacing of two characters. Tabs may *not* be used. :: - - for x in some set of very long set of arguments that make for a very long \ - that extends much too long for one line - do - echo ${x} - done - -.. vim:fileencoding=latin1:ft=rst:spell:tw=80 -.. $Revision$ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/contributors.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/contributors.txt deleted file mode 100644 index 7623c66..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/contributors.txt +++ /dev/null @@ -1,14 +0,0 @@ -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 -Maciej Bliziński -Mario Sparada -Mathias Goldau -Richard Jensen -Rob Holland -Rocky Bernstein -wood4321 (of code.google.com) - -$Revision$ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/lgpl-2.1.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/lgpl-2.1.txt deleted file mode 100644 index 4362b49..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/lgpl-2.1.txt +++ /dev/null @@ -1,502 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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. - - - Copyright (C) - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/rst2html.css b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/rst2html.css deleted file mode 100644 index 01983a5..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/doc/rst2html.css +++ /dev/null @@ -1,292 +0,0 @@ -/* -:Author: David Goodger -:Contact: goodger@users.sourceforge.net -:Date: $Date: 2007-04-11 11:48:16 +0100 (Wed, 11 Apr 2007) $ -:Revision: $Revision: 2791 $ -:Copyright: This stylesheet has been placed in the public domain. -:Modified by: Kate Ward - -Default cascading style sheet for the HTML output of Docutils. - -See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to -customize this style sheet. -*/ - -/* used to remove borders from tables and images */ -.borderless, table.borderless td, table.borderless th { - border: 0 } - -table.borderless td, table.borderless th { - /* Override padding for "table.docutils td" with "! important". - The right padding separates the table cells. */ - padding: 0 0.5em 0 0 ! important } - -.first { - /* Override more specific margin styles with "! important". */ - margin-top: 0 ! important } - -.last, .with-subtitle { - margin-bottom: 0 ! important } - -.hidden { - display: none } - -a.toc-backref { - text-decoration: none ; - color: black } - -blockquote.epigraph { - margin: 2em 5em ; } - -dl.docutils dd { - margin-bottom: 0.5em } - -/* Uncomment (and remove this text!) to get bold-faced definition list terms -dl.docutils dt { - font-weight: bold } -*/ - -div.abstract { - margin: 2em 5em } - -div.abstract p.topic-title { - font-weight: bold ; - text-align: center } - -div.admonition, div.attention, div.caution, div.danger, div.error, -div.hint, div.important, div.note, div.tip, div.warning { - margin: 2em ; - border: medium outset ; - padding: 1em } - -div.admonition p.admonition-title, div.hint p.admonition-title, -div.important p.admonition-title, div.note p.admonition-title, -div.tip p.admonition-title { - font-weight: bold ; - font-family: sans-serif } - -div.attention p.admonition-title, div.caution p.admonition-title, -div.danger p.admonition-title, div.error p.admonition-title, -div.warning p.admonition-title { - color: red ; - font-weight: bold ; - font-family: sans-serif } - -/* Uncomment (and remove this text!) to get reduced vertical space in - compound paragraphs. -div.compound .compound-first, div.compound .compound-middle { - margin-bottom: 0.5em } - -div.compound .compound-last, div.compound .compound-middle { - margin-top: 0.5em } -*/ - -div.dedication { - margin: 2em 5em ; - text-align: center ; - font-style: italic } - -div.dedication p.topic-title { - font-weight: bold ; - font-style: normal } - -div.figure { - margin-left: 2em ; - margin-right: 2em } - -div.footer, div.header { - clear: both; - font-size: smaller } - -div.line-block { - display: block ; - margin-top: 1em ; - margin-bottom: 1em } - -div.line-block div.line-block { - margin-top: 0 ; - margin-bottom: 0 ; - margin-left: 1.5em } - -div.sidebar { - margin-left: 1em ; - border: medium outset ; - padding: 1em ; - background-color: #ffffee ; - width: 40% ; - float: right ; - clear: right } - -div.sidebar p.rubric { - font-family: sans-serif ; - font-size: medium } - -div.system-messages { - margin: 5em } - -div.system-messages h1 { - color: red } - -div.system-message { - border: medium outset ; - padding: 1em } - -div.system-message p.system-message-title { - color: red ; - font-weight: bold } - -div.topic { - margin: 2em } - -h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, -h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { - margin-top: 0.4em } - -h1.title { - text-align: center } - -h2.subtitle { - text-align: center } - -hr.docutils { - width: 75% } - -img.align-left { - clear: left } - -img.align-right { - clear: right } - -ol.simple, ul.simple { - margin-bottom: 1em } - -ol.arabic { - list-style: decimal } - -ol.loweralpha { - list-style: lower-alpha } - -ol.upperalpha { - list-style: upper-alpha } - -ol.lowerroman { - list-style: lower-roman } - -ol.upperroman { - list-style: upper-roman } - -p.attribution { - text-align: right ; - margin-left: 50% } - -p.caption { - font-style: italic } - -p.credits { - font-style: italic ; - font-size: smaller } - -p.label { - white-space: nowrap } - -p.rubric { - font-weight: bold ; - font-size: larger ; - color: maroon ; - text-align: center } - -p.sidebar-title { - font-family: sans-serif ; - font-weight: bold ; - font-size: larger } - -p.sidebar-subtitle { - font-family: sans-serif ; - font-weight: bold } - -p.topic-title { - font-weight: bold } - -pre.address { - margin-bottom: 0 ; - margin-top: 0 ; - font-family: serif ; - font-size: 100% } - -pre.literal-block, pre.doctest-block { - margin-left: 2em ; - margin-right: 2em ; - background-color: #eeeeee } - -span.classifier { - font-family: sans-serif ; - font-style: oblique } - -span.classifier-delimiter { - font-family: sans-serif ; - font-weight: bold } - -span.interpreted { - font-family: sans-serif } - -span.option { - white-space: nowrap } - -span.pre { - white-space: pre } - -span.problematic { - color: red } - -span.section-subtitle { - /* font-size relative to parent (h1..h6 element) */ - font-size: 80% } - -table.citation { - border-left: solid 1px gray; - margin-left: 1px } - -table.docinfo { - margin: 2em 4em } - -/* -table.docutils { - margin-top: 0.5em ; - margin-bottom: 0.5em } -*/ - -table.footnote { - border-left: solid 1px black; - margin-left: 1px ; - font-size: 80% } - } - -table.docutils td, table.docutils th, -table.docinfo td, table.docinfo th { - padding-left: 0.5em ; - padding-right: 0.5em ; - vertical-align: top } - -table.docutils th.field-name, table.docinfo th.docinfo-name { - font-weight: bold ; - text-align: left ; - white-space: nowrap ; - padding-left: 0 } - -h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, -h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { - font-size: 100% } - -/* -tt.docutils { - background-color: #eeeeee } -*/ - -ul.auto-toc { - list-style-type: none } - -/* customizations by kward */ - -h1 { font-size: 133%; border-top:1px solid #CCCCFF; } -h1.title { font-size: 150%; border-top:0px; padding-top: 1em; } -/* div.document { font-size: 90% } */ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/lineno_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/lineno_test.sh deleted file mode 100755 index 9c05f1e..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/lineno_test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/sh -# file: examples/lineno_test.sh - -testLineNo() -{ - # this assert will have line numbers included (e.g. "ASSERT:[123] ...") if - # they are supported. - echo "_ASSERT_EQUALS_ macro value: ${_ASSERT_EQUALS_}" - ${_ASSERT_EQUALS_} 'not equal' 1 2 - - # this assert will not have line numbers included (e.g. "ASSERT: ...") - assertEquals 'not equal' 1 2 -} - -# load shunit2 -. ../src/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/party_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/party_test.sh deleted file mode 100755 index 5ca2583..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/party_test.sh +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh -# file: examples/party_test.sh - -testEquality() -{ - assertEquals 1 1 -} - -testPartyLikeItIs1999() -{ - year=`date '+%Y'` - assertEquals "It's not 1999 :-(" \ - '1999' "${year}" -} - -# load shunit2 -. ../src/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/lib/versions b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/lib/versions deleted file mode 100755 index e03f4f4..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/lib/versions +++ /dev/null @@ -1,239 +0,0 @@ -#! /bin/sh -# $Id: versions 175 2013-01-14 22:16:01Z kate.ward@forestent.com $ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# This library provides reusable functions that determine actual names and -# versions of installed shells and the OS. The library can also be run as a -# script if set execuatable. - -ARGV0=`basename "$0"` -LSB_RELEASE='/etc/lsb-release' -VERSIONS_SHELLS="/bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/sh /bin/zsh" - -TRUE=0 -FALSE=1 -ERROR=2 - -UNAME_R=`uname -r` -UNAME_S=`uname -s` - -__versions_haveStrings=${ERROR} - -#------------------------------------------------------------------------------ -# functions -# - -versions_osName() -{ - os_name_='unrecognized' - os_system_=${UNAME_S} - case ${os_system_} in - CYGWIN_NT-*) os_name_='Cygwin' ;; - Darwin) os_name_='Mac OS X' ;; - FreeBSD) os_name_='FreeBSD' ;; - Linux) os_name_='Linux' ;; - SunOS) - if grep 'OpenSolaris' /etc/release >/dev/null; then - os_name_='OpenSolaris' - else - os_name_='Solaris' - fi - ;; - esac - - echo ${os_name_} - unset os_name_ os_system_ -} - -versions_osVersion() -{ - os_version_='unrecognized' - os_system_=${UNAME_S} - os_release_=${UNAME_R} - case ${os_system_} in - CYGWIN_NT-*) - os_version_=`expr "${os_release_}" : '\([0-9]*\.[0-9]\.[0-9]*\).*'` - ;; - Darwin) - major_='10' - sub_=`echo ${os_release_} |sed 's/^[0-9]*\.\([0-9]*\)\.[0-9]*$/\1/'` - case ${os_release_} in - 8.*) minor_='4' ;; - 9.*) minor_='5' ;; - 10.*) minor_='6' ;; - 11.*) minor_='7' ;; - 12.*) minor_='8' ;; - *) minor_='X'; sub_='X' ;; - esac - os_version_="${major_}.${minor_}.${sub_}" - ;; - FreeBSD) - os_version_=`expr "${os_release_}" : '\([0-9]*\.[0-9]*\)-.*'` - ;; - Linux) - if [ -r "${LSB_RELEASE}" ]; then - if grep -q 'DISTRIB_ID=Ubuntu' "${LSB_RELEASE}"; then - os_version_=`cat "${LSB_RELEASE}" \ - |awk -F= '$1~/DISTRIB_DESCRIPTION/{print $2}' \ - |sed 's/"//g;s/ /-/g'` - fi - elif [ -r '/etc/redhat-release' ]; then - os_version_=`cat /etc/redhat-release` - fi - ;; - SunOS) - if grep 'OpenSolaris' /etc/release >/dev/null; then - os_version_=`grep 'OpenSolaris' /etc/release |awk '{print $2"("$3")"}'` - else - major_=`echo ${os_release_} |sed 's/[0-9]*\.\([0-9]*\)/\1/'` - minor_=`grep Solaris /etc/release |sed 's/[^u]*\(u[0-9]*\).*/\1/'` - os_version_="${major_}${minor_}" - fi - ;; - esac - - echo ${os_version_} - unset os_name_ os_release_ os_version_ major_ minor_ sub_ -} - -versions_shellVersion() -{ - shell_=$1 - - if [ ! -x "${shell_}" ]; then - echo 'not installed' - return - fi - - version_='' - case ${shell_} in - */sh) - # TODO(kward): fix this - ## this could be one of any number of shells. try until one fits. - #version_=`versions_shell_bash ${shell_}` - ## dash cannot be self determined yet - #[ -z "${version_}" ] && version_=`versions_shell_ksh ${shell_}` - ## pdksh is covered in versions_shell_ksh() - #[ -z "${version_}" ] && version_=`versions_shell_zsh ${shell_}` - ;; - */bash) version_=`versions_shell_bash ${shell_}` ;; - */dash) - # simply assuming Ubuntu Linux until somebody comes up with a better - # test. the following test will return an empty string if dash is not - # installed. - version_=`versions_shell_dash` - ;; - */ksh) version_=`versions_shell_ksh ${shell_}` ;; - */pdksh) version_=`versions_shell_pdksh ${shell_}` ;; - */zsh) version_=`versions_shell_zsh ${shell_}` ;; - *) version_='invalid' - esac - - echo ${version_:-unknown} - unset shell_ version_ -} - -versions_shell_bash() -{ - $1 --version 2>&1 |grep 'GNU bash' |sed 's/.*version \([^ ]*\).*/\1/' -} - -versions_shell_dash() -{ - eval dpkg >/dev/null 2>&1 - [ $? -eq 127 ] && return # return if dpkg not found - - dpkg -l |grep ' dash ' |awk '{print $3}' -} - -versions_shell_ksh() -{ - versions_shell_=$1 - - # try a few different ways to figure out the version - versions_version_=`${versions_shell_} --version : 2>&1` - if [ $? -eq 0 ]; then - versions_version_=`echo "${versions_version_}" \ - |sed 's/.*\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\).*/\1/'` - else - versions_version_='' - fi - - if [ -z "${versions_version_}" ]; then - _versions_have_strings - versions_version_=`strings ${versions_shell_} 2>&1 \ - |grep Version \ - |sed 's/^.*Version \(.*\)$/\1/;s/ s+ \$$//;s/ /-/g'` - fi - - if [ -z "${versions_version_}" ]; then - versions_version_=`versions_shell_pdksh ${versions_shell_}` - fi - - echo ${versions_version_} - unset versions_shell_ versions_version_ -} - -versions_shell_pdksh() -{ - _versions_have_strings - strings $1 2>&1 \ - |grep 'PD KSH' \ - |sed -e 's/.*PD KSH \(.*\)/\1/;s/ /-/g' -} - -versions_shell_zsh() -{ - versions_shell_=$1 - - # try a few different ways to figure out the version - versions_version_=`echo 'echo ${ZSH_VERSION}' |${versions_shell_}` - - if [ -z "${versions_version_}" ]; then - versions_version_=`${versions_shell_} --version 2>&1 |awk '{print $2}'` - fi - - echo ${versions_version_} - unset versions_shell_ versions_version_ -} - -# Determine if the 'strings' binary installed. -_versions_have_strings() -{ - [ ${__versions_haveStrings} -ne ${ERROR} ] && return - eval strings /dev/null >/dev/null 2>&1 - if [ $? -eq 0 ]; then - __versions_haveStrings=${TRUE} - else - echo 'WARN: strings not installed. try installing binutils?' >&2 - __versions_haveStrings=${FALSE} - fi -} - -#------------------------------------------------------------------------------ -# main -# - -versions_main() -{ - # treat unset variables as an error - set -u - - os_name=`versions_osName` - os_version=`versions_osVersion` - echo "os: ${os_name} version: ${os_version}" - - for shell in ${VERSIONS_SHELLS}; do - shell_version=`versions_shellVersion ${shell}` - echo "shell: ${shell} version: ${shell_version}" - done -} - -if [ "${ARGV0}" = 'versions' ]; then - versions_main "$@" -fi diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test.sh deleted file mode 100755 index d8f5a9c..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test.sh +++ /dev/null @@ -1,124 +0,0 @@ -#! /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# Author: kate.ward@forestent.com (Kate Ward) -# -# shUnit2 unit test suite runner. -# -# This script runs all the unit tests that can be found, and generates a nice -# report of the tests. - -MY_NAME=`basename $0` -MY_PATH=`dirname $0` - -PREFIX='shunit2_test_' -SHELLS='/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh' -TESTS='' -for test in ${PREFIX}[a-z]*.sh; do - TESTS="${TESTS} ${test}" -done - -# load common unit test functions -. ../lib/versions -. ./shunit2_test_helpers - -usage() -{ - echo "usage: ${MY_NAME} [-e key=val ...] [-s shell(s)] [-t test(s)]" -} - -env='' - -# process command line flags -while getopts 'e:hs:t:' opt; do - case ${opt} in - e) # set an environment variable - 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 ;; # output help - s) shells=${OPTARG} ;; # list of shells to run - t) tests=${OPTARG} ;; # list of tests to run - *) 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 - th_error 'no tests found to run; exiting' - exit 1 -fi - -cat <&1; ) - done -done diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_misc.sh b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_misc.sh deleted file mode 100755 index d264628..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/src/shunit2_test_misc.sh +++ /dev/null @@ -1,160 +0,0 @@ -#! /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# shUnit2 unit tests of miscellaneous things - -# load test helpers -. ./shunit2_test_helpers - -#------------------------------------------------------------------------------ -# suite tests -# - -# Note: the test script is prefixed with '#' chars so that shUnit2 does not -# incorrectly interpret the embedded functions as real functions. -testUnboundVariable() -{ - unittestF="${SHUNIT_TMPDIR}/unittest" - sed 's/^#//' >"${unittestF}" <"${stdoutF}" 2>"${stderrF}" ) - assertFalse 'expected a non-zero exit value' $? - grep '^ASSERT:Unknown failure' "${stdoutF}" >/dev/null - assertTrue 'assert message was not generated' $? - grep '^Ran [0-9]* test' "${stdoutF}" >/dev/null - assertTrue 'test count message was not generated' $? - grep '^FAILED' "${stdoutF}" >/dev/null - assertTrue 'failure message was not generated' $? -} - -testIssue7() -{ - ( assertEquals 'Some message.' 1 2 >"${stdoutF}" 2>"${stderrF}" ) - diff "${stdoutF}" - >/dev/null < but was:<2> -EOF - rtrn=$? - assertEquals ${SHUNIT_TRUE} ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testPrepForSourcing() -{ - assertEquals '/abc' `_shunit_prepForSourcing '/abc'` - assertEquals './abc' `_shunit_prepForSourcing './abc'` - assertEquals './abc' `_shunit_prepForSourcing 'abc'` -} - -testEscapeCharInStr() -{ - actual=`_shunit_escapeCharInStr '\' ''` - assertEquals '' "${actual}" - assertEquals 'abc\\' `_shunit_escapeCharInStr '\' 'abc\'` - assertEquals 'abc\\def' `_shunit_escapeCharInStr '\' 'abc\def'` - assertEquals '\\def' `_shunit_escapeCharInStr '\' '\def'` - - actual=`_shunit_escapeCharInStr '"' ''` - assertEquals '' "${actual}" - assertEquals 'abc\"' `_shunit_escapeCharInStr '"' 'abc"'` - assertEquals 'abc\"def' `_shunit_escapeCharInStr '"' 'abc"def'` - assertEquals '\"def' `_shunit_escapeCharInStr '"' '"def'` - - actual=`_shunit_escapeCharInStr '$' ''` - assertEquals '' "${actual}" - assertEquals 'abc\$' `_shunit_escapeCharInStr '$' 'abc$'` - assertEquals 'abc\$def' `_shunit_escapeCharInStr '$' 'abc$def'` - assertEquals '\$def' `_shunit_escapeCharInStr '$' '$def'` - -# actual=`_shunit_escapeCharInStr "'" ''` -# assertEquals '' "${actual}" -# assertEquals "abc\\'" `_shunit_escapeCharInStr "'" "abc'"` -# assertEquals "abc\\'def" `_shunit_escapeCharInStr "'" "abc'def"` -# assertEquals "\\'def" `_shunit_escapeCharInStr "'" "'def"` - -# # must put the backtick in a variable so the shell doesn't misinterpret it -# # while inside a backticked sequence (e.g. `echo '`'` would fail). -# backtick='`' -# actual=`_shunit_escapeCharInStr ${backtick} ''` -# assertEquals '' "${actual}" -# assertEquals '\`abc' \ -# `_shunit_escapeCharInStr "${backtick}" ${backtick}'abc'` -# assertEquals 'abc\`' \ -# `_shunit_escapeCharInStr "${backtick}" 'abc'${backtick}` -# assertEquals 'abc\`def' \ -# `_shunit_escapeCharInStr "${backtick}" 'abc'${backtick}'def'` -} - -testEscapeCharInStr_specialChars() -{ - # make sure our forward slash doesn't upset sed - assertEquals '/' `_shunit_escapeCharInStr '\' '/'` - - # some shells escape these differently - #assertEquals '\\a' `_shunit_escapeCharInStr '\' '\a'` - #assertEquals '\\b' `_shunit_escapeCharInStr '\' '\b'` -} - -# Test the various ways of declaring functions. -# -# Prefixing (then stripping) with comment symbol so these functions aren't -# treated as real functions by shUnit2. -testExtractTestFunctions() -{ - f="${SHUNIT_TMPDIR}/extract_test_functions" - sed 's/^#//' <"${f}" -#testABC() { echo 'ABC'; } -#test_def() { -# echo 'def' -#} -#testG3 () -#{ -# echo 'G3' -#} -#function test4() { echo '4'; } -# test5() { echo '5'; } -#some_test_function() { echo 'some func'; } -#func_with_test_vars() { -# testVariable=1234 -#} -EOF - - actual=`_shunit_extractTestFunctions "${f}"` - assertEquals 'testABC test_def testG3 test4 test5' "${actual}" -} - -#------------------------------------------------------------------------------ -# suite functions -# - -setUp() -{ - for f in ${expectedF} ${stdoutF} ${stderrF}; do - cp /dev/null ${f} - done -} - -oneTimeSetUp() -{ - th_oneTimeSetUp -} - -# load and run shUnit2 -[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ${TH_SHUNIT} diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/test_runner b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/test_runner new file mode 100755 index 0000000..415cc8b --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/test_runner @@ -0,0 +1,165 @@ +#! /bin/sh +# vim:et:ft=sh:sts=2:sw=2 +# +# Unit test suite runner. +# +# Copyright 2008-2017 Kate Ward. All Rights Reserved. +# Released under the Apache 2.0 license. +# +# Author: kate.ward@forestent.com (Kate Ward) +# https://github.com/kward/shlib +# +# This script runs all the unit tests that can be found, and generates a nice +# report of the tests. +# +### ShellCheck (http://www.shellcheck.net/) +# Disable source following. +# shellcheck disable=SC1090,SC1091 +# expr may be antiquated, but it is the only solution in some cases. +# shellcheck disable=SC2003 +# $() are not fully portable (POSIX != portable). +# shellcheck disable=SC2006 + +# Return if test_runner already loaded. +[ -z "${RUNNER_LOADED:-}" ] || return 0 +RUNNER_LOADED=0 + +RUNNER_ARGV0=`basename "$0"` +RUNNER_SHELLS='/bin/sh ash /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh' +RUNNER_TEST_SUFFIX='_test.sh' + +runner_warn() { echo "runner:WARN $*" >&2; } +runner_error() { echo "runner:ERROR $*" >&2; } +runner_fatal() { echo "runner:FATAL $*" >&2; exit 1; } + +runner_usage() { + echo "usage: ${RUNNER_ARGV0} [-e key=val ...] [-s shell(s)] [-t test(s)]" +} + +_runner_tests() { echo ./*${RUNNER_TEST_SUFFIX} |sed 's#./##g'; } +_runner_testName() { + # shellcheck disable=SC1117 + _runner_testName_=`expr "${1:-}" : "\(.*\)${RUNNER_TEST_SUFFIX}"` + if [ -n "${_runner_testName_}" ]; then + echo "${_runner_testName_}" + else + echo 'unknown' + fi + unset _runner_testName_ +} + +main() { + # Find and load versions library. + for _runner_dir_ in . ${LIB_DIR:-lib}; do + if [ -r "${_runner_dir_}/versions" ]; then + _runner_lib_dir_="${_runner_dir_}" + break + fi + done + [ -n "${_runner_lib_dir_}" ] || runner_fatal 'Unable to find versions library.' + . "${_runner_lib_dir_}/versions" || runner_fatal 'Unable to load versions library.' + unset _runner_dir_ _runner_lib_dir_ + + # Process command line flags. + env='' + while getopts 'e:hs:t:' opt; do + case ${opt} in + e) # set an environment variable + key=`expr "${OPTARG}" : '\([^=]*\)='` + val=`expr "${OPTARG}" : '[^=]*=\(.*\)'` + # shellcheck disable=SC2166 + if [ -z "${key}" -o -z "${val}" ]; then + runner_usage + exit 1 + fi + eval "${key}='${val}'" + eval "export ${key}" + env="${env:+${env} }${key}" + ;; + h) runner_usage; exit 0 ;; # help output + s) shells=${OPTARG} ;; # list of shells to run + t) tests=${OPTARG} ;; # list of tests to run + *) runner_usage; exit 1 ;; + esac + done + shift "`expr ${OPTIND} - 1`" + + # Fill shells and/or tests. + shells=${shells:-${RUNNER_SHELLS}} + [ -z "${tests}" ] && tests=`_runner_tests` + + # Error checking. + if [ -z "${tests}" ]; then + runner_error 'no tests found to run; exiting' + exit 1 + fi + + cat <&1; ) + done + done +} + +# Execute main() if this is run in standalone mode (i.e. not from a unit test). +[ -z "${SHUNIT_VERSION}" ] && main "$@" diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/README.html b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/README.html deleted file mode 100644 index 0ee9e34..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/README.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - -

Please visit the shUnit2 website at http://code.google.com/p/shunit2/.

- - - - - - - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.0.tgz.md5 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.0.tgz.md5 deleted file mode 100644 index 6821d75..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.0.tgz.md5 +++ /dev/null @@ -1 +0,0 @@ -bdede699570ba09a8c820af2c0c3db34 shunit2-2.0.0.tgz diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.0.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.0.tgz.sig deleted file mode 100644 index e1c65e8..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.0.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.1.tgz.md5 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.1.tgz.md5 deleted file mode 100644 index 6f64c39..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.1.tgz.md5 +++ /dev/null @@ -1 +0,0 @@ -0741e65e1261285e1676e487077b0bf2 shunit2-2.0.1.tgz diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.1.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.1.tgz.sig deleted file mode 100644 index 4d2a403..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.1.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.2.tgz.md5 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.2.tgz.md5 deleted file mode 100644 index e31a8e0..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.2.tgz.md5 +++ /dev/null @@ -1 +0,0 @@ -ab8ba8a532da33645c9a6b8ee6783f3c shunit2-2.0.2.tgz diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.2.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.2.tgz.sig deleted file mode 100644 index d1d6d77..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.2.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.3.tgz.md5 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.3.tgz.md5 deleted file mode 100644 index 8c8c1f7..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.3.tgz.md5 +++ /dev/null @@ -1 +0,0 @@ -9c947dc31e53c7008b3e665c1e6057e0 shunit2-2.0.3.tgz diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.3.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.3.tgz.sig deleted file mode 100644 index 4f0d907..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.0.3.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.0.tgz.md5 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.0.tgz.md5 deleted file mode 100644 index 02dda5c..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.0.tgz.md5 +++ /dev/null @@ -1 +0,0 @@ -8d0e775f811d2a936c5994e5a4add170 shunit2-2.1.0.tgz diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.0.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.0.tgz.sig deleted file mode 100644 index c8e726c..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.0.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.1.tgz.md5 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.1.tgz.md5 deleted file mode 100644 index c74bb34..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.1.tgz.md5 +++ /dev/null @@ -1 +0,0 @@ -4e6aa6d54a6beac8435bfddad8d97db3 shunit2-2.1.1.tgz diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.1.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.1.tgz.sig deleted file mode 100644 index 729adf1..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.1.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.2.tgz.md5 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.2.tgz.md5 deleted file mode 100644 index 51376c0..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.2.tgz.md5 +++ /dev/null @@ -1 +0,0 @@ -6f7355ba449f421320045337c62652a3 shunit2-2.1.2.tgz diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.2.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.2.tgz.sig deleted file mode 100644 index a90ec02..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.2.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.3.tgz.md5 b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.3.tgz.md5 deleted file mode 100644 index ee8b080..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.3.tgz.md5 +++ /dev/null @@ -1 +0,0 @@ -156a2491925a269fe09b70562deae091 shunit2-2.1.3.tgz diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.3.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.3.tgz.sig deleted file mode 100644 index c8a3617..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.3.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.4.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.4.tgz.sig deleted file mode 100644 index 88ff460..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.4.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.5.tgz.sig b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.5.tgz.sig deleted file mode 100644 index f97dab2..0000000 Binary files a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/releases/shunit2-2.1.5.tgz.sig and /dev/null differ diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Linux-Ubuntu_Dapper-6.04.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Linux-Ubuntu_Dapper-6.04.txt deleted file mode 100644 index 2886741..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Linux-Ubuntu_Dapper-6.04.txt +++ /dev/null @@ -1,236 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests="testAsserts testFailures" - -# system info -$ date -Mon Dec 31 00:51:14 GMT 2007 -$ uname -mprsv -Linux 2.6.18.5-gg19workstation-mixed64-32 #1 SMP Tue Nov 20 16:02:52 PST 2007 x86_64 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu) -Copyright (C) 2005 Free Software Foundation, Inc. - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - -run-test-suite:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -zsh 4.2.5 (i686-pc-linux-gnu) - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Linux-Ubuntu_Gutsy-7.10.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Linux-Ubuntu_Gutsy-7.10.txt deleted file mode 100644 index b8546b9..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Linux-Ubuntu_Gutsy-7.10.txt +++ /dev/null @@ -1,278 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests="testAsserts testFailures" - -# system info -$ date -Mon Dec 24 21:45:53 GMT 2007 -$ uname -mprsv -Linux 2.6.22-14-server #1 SMP Tue Dec 18 08:31:40 UTC 2007 i686 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.2.25(1)-release (i486-pc-linux-gnu) -Copyright (C) 2005 Free Software Foundation, Inc. - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - - version sh (AT&T Labs Research) 1993-12-28 r - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -zsh 4.3.4 (i686-pc-linux-gnu) - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Mac_OS_X-10.4.1.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Mac_OS_X-10.4.1.txt deleted file mode 100644 index af4ce02..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Mac_OS_X-10.4.1.txt +++ /dev/null @@ -1,195 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests="testAsserts testFailures" - -# system info -$ date -Mon Dec 31 00:47:18 GMT 2007 -$ uname -mprsv -Darwin 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin8.0) -Copyright (C) 2002 Free Software Foundation, Inc. - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - -run-test-suite:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - - version sh (AT&T Labs Research) 1993-12-28 p - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - -run-test-suite:WARN unable to run tests with the /bin/pdksh shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -zsh 4.2.3 (powerpc-apple-darwin8.0) - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Solaris-10-U3-x86.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Solaris-10-U3-x86.txt deleted file mode 100644 index 1e8d440..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.2/Solaris-10-U3-x86.txt +++ /dev/null @@ -1,196 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests="testAsserts testFailures" - -# system info -$ date -Mon Dec 31 00:48:41 GMT 2007 -$ uname -mprsv -SunOS 5.10 Generic_127112-05 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.00.16(1)-release (i386-pc-solaris2.10) -Copyright (C) 2004 Free Software Foundation, Inc. - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - -run-test-suite:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - -run-test-suite:WARN unable to run tests with the /bin/pdksh shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -zsh 4.2.1 (i386-pc-solaris2.10) - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Cygwin.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Cygwin.txt deleted file mode 100755 index 7a1ed7d..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Cygwin.txt +++ /dev/null @@ -1,180 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests="testAsserts testFailures" - -# system info -$ date -Sun May 11 00:16:31 GMTDT 2008 -$ uname -mprsv -CYGWIN_NT-5.1 1.5.25(0.156/4/2) 2008-03-05 19:27 i686 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.2.33(18)-release (i686-pc-cygwin) -Copyright (C) 2007 Free Software Foundation, Inc. - -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - -# -# Performing tests -# -testAssertEquals -testAssertSame -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - -# -# Performing tests -# -testAssertEquals -testAssertSame -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Linux-Ubuntu_Hardy-8.04.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Linux-Ubuntu_Hardy-8.04.txt deleted file mode 100644 index f8e3820..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Linux-Ubuntu_Hardy-8.04.txt +++ /dev/null @@ -1,278 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests="testAsserts testFailures" - -# system info -$ date -Sat May 10 22:07:59 UTC 2008 -$ uname -mprsv -Linux 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.2.33(1)-release (i486-pc-linux-gnu) -Copyright (C) 2007 Free Software Foundation, Inc. - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - - version sh (AT&T Research) 1993-12-28 s+ - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -zsh 4.3.4 (i686-pc-linux-gnu) - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Mac_OS_X-10.5.2.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Mac_OS_X-10.5.2.txt deleted file mode 100644 index 62a678e..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Mac_OS_X-10.5.2.txt +++ /dev/null @@ -1,164 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests="testAsserts testFailures" - -# system info -$ date -Sat May 10 23:03:34 IST 2008 -$ uname -mprsv -Darwin 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386 i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0) -Copyright (C) 2005 Free Software Foundation, Inc. - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - -run-test-suite:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - - version sh (AT&T Research) 1993-12-28 s+ - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - -run-test-suite:WARN unable to run tests with the /bin/pdksh shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -zsh 4.3.4 (i386-apple-darwin9.0) - ---- Executing the 'Asserts' test suite --- -shunit2:FATAL zsh does not pass $0 through properly. please declare' "SHUNIT_PARENT=$0" before calling shUnit2 - ---- Executing the 'Failures' test suite --- -shunit2:FATAL zsh does not pass $0 through properly. please declare' "SHUNIT_PARENT=$0" before calling shUnit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Solaris-11-x86.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Solaris-11-x86.txt deleted file mode 100644 index 4852cee..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.3/Solaris-11-x86.txt +++ /dev/null @@ -1,196 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests="testAsserts testFailures" - -# system info -$ date -Mon Apr 21 12:01:47 GMT 2008 -$ uname -mprsv -SunOS 5.11 snv_77 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.2.25(1)-release (i386-pc-solaris2.11) -Copyright (C) 2005 Free Software Foundation, Inc. - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - -run-test-suite:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -ASSERT:null values; failure -shunit2:ERROR assertEquals()/assertSame() require at least two arguments -ASSERT:expected no output to STDERR -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 76 97% -tests failed: 2 3% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% - -run-test-suite:WARN unable to run tests with the /bin/pdksh shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -zsh 4.3.4 (i386-pc-solaris2.11) - ---- Executing the 'Asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 78 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 78 100% - ---- Executing the 'Failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame -testFailNotSame - -# -# Test report -# -tests passed: 17 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 17 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Cygwin-Windows_XP.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Cygwin-Windows_XP.txt deleted file mode 100644 index 697111e..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Cygwin-Windows_XP.txt +++ /dev/null @@ -1,295 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh" - -# system info -$ date -Fri Jul 11 12:58:40 GMTDT 2008 -$ uname -mprsv -CYGWIN_NT-5.1 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.2.39(19)-release (i686-pc-cygwin) -Copyright (C) 2007 Free Software Foundation, Inc. - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - -shunit2_test.sh:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -version: 4.3.4 - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Linux-Ubuntu_Dapper-6.06.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Linux-Ubuntu_Dapper-6.06.txt deleted file mode 100644 index ec89b5a..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Linux-Ubuntu_Dapper-6.06.txt +++ /dev/null @@ -1,295 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh" - -# system info -$ date -Fri Jul 11 12:51:35 IST 2008 -$ uname -mprsv -Linux 2.6.18.5-gg34workstation-mixed64-32 #1 SMP Thu May 8 01:31:23 UTC 2008 x86_64 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu) -Copyright (C) 2005 Free Software Foundation, Inc. - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - -shunit2_test.sh:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -version: 4.2.5 - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Linux-Ubuntu_Hardy-8.04.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Linux-Ubuntu_Hardy-8.04.txt deleted file mode 100644 index 9fb145f..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Linux-Ubuntu_Hardy-8.04.txt +++ /dev/null @@ -1,350 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh" - -# system info -$ date -Fri Jul 11 11:54:41 GMT 2008 -$ uname -mprsv -Linux 2.6.24-19-server #1 SMP Wed Jun 18 15:18:00 UTC 2008 i686 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 0 0% -tests failed: 0 0% -tests skipped: 12 100% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu) -Copyright (C) 2007 Free Software Foundation, Inc. - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 0 0% -tests failed: 0 0% -tests skipped: 12 100% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - -version: version sh (AT&T Research) 1993-12-28 s+ - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -version: 4.3.4 - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Mac_OS_X-10.5.4.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Mac_OS_X-10.5.4.txt deleted file mode 100644 index 3e9a834..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Mac_OS_X-10.5.4.txt +++ /dev/null @@ -1,244 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh" - -# system info -$ date -Fri Jul 11 12:47:23 IST 2008 -$ uname -mprsv -Darwin 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386 i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0) -Copyright (C) 2005 Free Software Foundation, Inc. - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - -shunit2_test.sh:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - -version: version sh (AT&T Research) 1993-12-28 s+ - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - -shunit2_test.sh:WARN unable to run tests with the /bin/pdksh shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -version: 4.3.4 - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Solaris-9-U6-x86.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Solaris-9-U6-x86.txt deleted file mode 100644 index 4dcc56f..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Solaris-9-U6-x86.txt +++ /dev/null @@ -1,266 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh" - -# system info -$ date -Fri Jul 11 12:06:35 GMT 2008 -$ uname -mprsv -SunOS 5.9 Generic_117172-08 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 0 0% -tests failed: 0 0% -tests skipped: 12 100% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 2.05.0(1)-release (i386-pc-solaris2.9) -Copyright 2000 Free Software Foundation, Inc. - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo -ASSERT:_ASSERT_EQUALS_ failure -ASSERT:[-19][-19] expected: but was: -ASSERT:_ASSERT_NULL_ failure -ASSERT:[-970] -ASSERT:_ASSERT_NOT_NULL_ failure -ASSERT:[-970] -ASSERT:_ASSERT_SAME_ failure -ASSERT:[-970][-970] expected: but was: -ASSERT:_ASSERT_NOT_SAME_ failure -ASSERT:[-970][-970] expected not same -ASSERT:_ASSERT_TRUE_ failure -ASSERT:[-970] -ASSERT:_ASSERT_FALSE_ failure -ASSERT:[-970] -ASSERT:_ASSERT_FALSE_ failure -ASSERT:[-970] -ASSERT:_FAIL_ failure -ASSERT:[-970] -ASSERT:_FAIL_NOT_EQUALS_ failure -ASSERT:[-970] expected: but was: -ASSERT:_FAIL_SAME_ failure -ASSERT:[-970] expected not same -ASSERT:_FAIL_NOT_SAME_ failure -ASSERT:[-970] expected: but was: - -# -# Test report -# -tests passed: 0 0% -tests failed: 12 100% -tests skipped: 0 0% -tests total: 12 100% - -shunit2_test.sh:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - -shunit2_test.sh:WARN unable to run tests with the /bin/pdksh shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -version: 3.0.8 - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Solaris-nv-77-x86.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Solaris-nv-77-x86.txt deleted file mode 100644 index ee8df72..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.4/Solaris-nv-77-x86.txt +++ /dev/null @@ -1,242 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh" - -# system info -$ date -Fri Jul 11 12:01:03 GMT 2008 -$ uname -mprsv -SunOS 5.11 snv_77 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 0 0% -tests failed: 0 0% -tests skipped: 12 100% -tests total: 12 100% - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - -GNU bash, version 3.2.25(1)-release (i386-pc-solaris2.11) -Copyright (C) 2005 Free Software Foundation, Inc. - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - -shunit2_test.sh:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% - -shunit2_test.sh:WARN unable to run tests with the /bin/pdksh shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# - -version: 4.3.4 - ---- Executing the 'asserts' test suite --- -# -# Performing tests -# -testAssertEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -# -# Test report -# -tests passed: 138 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 138 100% - ---- Executing the 'failures' test suite --- -# -# Performing tests -# -testFail -testFailNotEquals -testFailSame - -# -# Test report -# -tests passed: 45 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 45 100% - ---- Executing the 'macros' test suite --- -# -# Performing tests -# -testLineNo - -# -# Test report -# -tests passed: 12 100% -tests failed: 0 0% -tests skipped: 0 0% -tests total: 12 100% diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Cygwin-5.1.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Cygwin-5.1.txt deleted file mode 100755 index 391bdb4..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Cygwin-5.1.txt +++ /dev/null @@ -1,295 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh" - -# system info -$ date -Wed Oct 29 00:37:38 GMTST 2008 -$ uname -mprsv -CYGWIN_NT-5.1 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.39(20)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - -shunit2_test.sh:WARN unable to run tests with the /bin/dash shell - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.4 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Linux-Ubuntu-6.06.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Linux-Ubuntu-6.06.txt deleted file mode 100644 index e609394..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Linux-Ubuntu-6.06.txt +++ /dev/null @@ -1,294 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh" - -# system info -$ date -Tue Oct 28 19:28:31 GMT 2008 -$ uname -mprsv -Linux 2.6.18.5-gg38server-xenU-3.1 #1 SMP Fri Jul 18 13:02:34 IST 2008 x86_64 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.1.17(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-1993-12-28-r--$ - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.2.5 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Linux-Ubuntu-8.04.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Linux-Ubuntu-8.04.txt deleted file mode 100644 index 2e88cec..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Linux-Ubuntu-8.04.txt +++ /dev/null @@ -1,349 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh" - -# system info -$ date -Mon Oct 27 18:34:47 UTC 2008 -$ uname -mprsv -Linux 2.6.24-21-generic #1 SMP Mon Aug 25 17:32:09 UTC 2008 i686 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.39(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.4-8ubuntu1 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-1993-12-28 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.4 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Mac_OS_X-10.5.5.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Mac_OS_X-10.5.5.txt deleted file mode 100644 index 6159b4a..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Mac_OS_X-10.5.5.txt +++ /dev/null @@ -1,239 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh" - -# system info -$ date -Mon Oct 27 18:32:53 GMT 2008 -$ uname -mprsv -Darwin 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386 i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.17(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-1993-12-28 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.4 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 - -Ran 2 tests. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Solaris-11.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Solaris-11.txt deleted file mode 100644 index 4012ef1..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Solaris-11.txt +++ /dev/null @@ -1,251 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh" - -# system info -$ date -Sat Jul 12 11:43:59 GMT 2008 -$ uname -mprsv -SunOS 5.11 snv_77 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 - -Ran 2 tests. - -FAILED (failures=3) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.25(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 - -Ran 2 tests. - -FAILED (failures=3) - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-11/16/88i - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 - -Ran 2 tests. - -FAILED (failures=3) - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.4 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 - -Ran 2 tests. - -FAILED (failures=3) diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Solaris-9.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Solaris-9.txt deleted file mode 100644 index 3e22e94..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.5/Solaris-9.txt +++ /dev/null @@ -1,276 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh" - -# system info -$ date -Tue Oct 28 23:46:44 GMT 2008 -$ uname -mprsv -SunOS 5.9 Generic_117172-08 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 - -Ran 2 tests. - -FAILED (failures=3) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 2.05.0(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -ASSERT:_ASSERT_EQUALS_ failure -ASSERT:_ASSERT_EQUALS_ w/ msg failure -testAssertNotEquals -ASSERT:_ASSERT_NOT_EQUALS_ failure -ASSERT:_ASSERT_NOT_EQUALS_ w/ msg failure -testSame -ASSERT:_ASSERT_SAME_ failure -ASSERT:_ASSERT_SAME_ w/ msg failure -testNotSame -ASSERT:_ASSERT_NOT_SAME_ failure -ASSERT:_ASSERT_NOT_SAME_ w/ msg failure -testNull -ASSERT:_ASSERT_NULL_ failure -ASSERT:_ASSERT_NULL_ w/ msg failure -testNotNull -ASSERT:_ASSERT_NOT_NULL_ failure -ASSERT:_ASSERT_NOT_NULL_ w/ msg failure -ASSERT:[-1045] some msg -testAssertTrue -ASSERT:_ASSERT_TRUE_ failure -ASSERT:_ASSERT_TRUE_ w/ msg failure -testAssertFalse -ASSERT:_ASSERT_FALSE_ failure -ASSERT:_ASSERT_FALSE_ w/ msg failure -testFail -ASSERT:_FAIL_ failure -ASSERT:_FAIL_ w/ msg failure -testFailNotEquals -ASSERT:_FAIL_NOT_EQUALS_ failure -ASSERT:_FAIL_NOT_EQUALS_ w/ msg failure -testFailSame -ASSERT:_FAIL_SAME_ failure -ASSERT:_FAIL_SAME_ w/ msg failure -testFailNotSame -ASSERT:_FAIL_NOT_SAME_ failure -ASSERT:_FAIL_NOT_SAME_ w/ msg failure - -Ran 12 tests. - -FAILED (failures=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 - -Ran 2 tests. - -FAILED (failures=3) - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-11/16/88i - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 - -Ran 2 tests. - -FAILED (failures=3) - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 3.0.8 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 - -Ran 2 tests. - -FAILED (failures=3) diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Cygwin-1.7.9.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Cygwin-1.7.9.txt deleted file mode 100644 index 757c5b1..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Cygwin-1.7.9.txt +++ /dev/null @@ -1,416 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Thu Apr 28 00:23:02 GMTDT 2011 - -$ uname -mprsv -CYGWIN_NT-5.1 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 4.1.10(4)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.11 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Linux-Ubuntu-10.04.2-LTS.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Linux-Ubuntu-10.04.2-LTS.txt deleted file mode 100644 index d450c3c..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Linux-Ubuntu-10.04.2-LTS.txt +++ /dev/null @@ -1,416 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Wed Apr 27 23:40:39 UTC 2011 - -$ uname -mprsv -Linux 2.6.32-31-server #61-Ubuntu SMP Fri Apr 8 19:44:42 UTC 2011 x86_64 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 4.1.5(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.5.1-3ubuntu2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: JM-93t+-2009-05-01-$ - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.10 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Linux-Ubuntu-6.06.2-LTS.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Linux-Ubuntu-6.06.2-LTS.txt deleted file mode 100644 index c48a7a5..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Linux-Ubuntu-6.06.2-LTS.txt +++ /dev/null @@ -1,416 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Wed Apr 27 16:24:19 MDT 2011 - -$ uname -mprsv -Linux 2.6.15-57-server #1 SMP Mon Feb 28 22:43:23 UTC 2011 i686 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.1.17(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.3-1ubuntu1 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.2.5 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Linux-Ubuntu-8.04.4-LTS.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Linux-Ubuntu-8.04.4-LTS.txt deleted file mode 100644 index 9865b16..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Linux-Ubuntu-8.04.4-LTS.txt +++ /dev/null @@ -1,416 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Wed Apr 27 17:24:17 CDT 2011 - -$ uname -mprsv -Linux 2.6.24-29-server #1 SMP Wed Mar 16 19:04:28 UTC 2011 x86_64 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.39(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.4-8ubuntu1.1 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-1993-12-28 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.4 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Mac_OS_X-10.6.7.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Mac_OS_X-10.6.7.txt deleted file mode 100644 index c706bc4..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Mac_OS_X-10.6.7.txt +++ /dev/null @@ -1,284 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Thu Apr 28 00:42:17 IST 2011 - -$ uname -mprsv -Darwin 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386 i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.48(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-1993-12-28 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.9 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/OpenSolaris-2009.06.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/OpenSolaris-2009.06.txt deleted file mode 100644 index 9d1a309..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/OpenSolaris-2009.06.txt +++ /dev/null @@ -1,227 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Thu Apr 28 01:49:38 IST 2011 - -$ uname -mprsv -SunOS 5.11 snv_111b i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:expected a non-zero exit value -ASSERT:assert message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.25(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:expected a non-zero exit value -ASSERT:assert message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: 2008-11-04 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:expected a non-zero exit value -ASSERT:assert message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Solaris-8u7.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Solaris-8u7.txt deleted file mode 100644 index a41cc06..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Solaris-8u7.txt +++ /dev/null @@ -1,321 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Wed Apr 27 23:37:38 IST 2011 - -$ uname -mprsv -SunOS 5.8 Generic_108529-13 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 2.03.0(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -ASSERT:_ASSERT_EQUALS_ failure -ASSERT:_ASSERT_EQUALS_ w/ msg failure -testAssertNotEquals -ASSERT:_ASSERT_NOT_EQUALS_ failure -ASSERT:_ASSERT_NOT_EQUALS_ w/ msg failure -testSame -ASSERT:_ASSERT_SAME_ failure -ASSERT:_ASSERT_SAME_ w/ msg failure -testNotSame -ASSERT:_ASSERT_NOT_SAME_ failure -ASSERT:_ASSERT_NOT_SAME_ w/ msg failure -testNull -ASSERT:_ASSERT_NULL_ failure -ASSERT:_ASSERT_NULL_ w/ msg failure -testNotNull -ASSERT:_ASSERT_NOT_NULL_ failure -ASSERT:_ASSERT_NOT_NULL_ w/ msg failure -ASSERT:[-875] some msg -testAssertTrue -ASSERT:_ASSERT_TRUE_ failure -ASSERT:_ASSERT_TRUE_ w/ msg failure -testAssertFalse -ASSERT:_ASSERT_FALSE_ failure -ASSERT:_ASSERT_FALSE_ w/ msg failure -testFail -ASSERT:_FAIL_ failure -ASSERT:_FAIL_ w/ msg failure -testFailNotEquals -ASSERT:_FAIL_NOT_EQUALS_ failure -ASSERT:_FAIL_NOT_EQUALS_ w/ msg failure -testFailSame -ASSERT:_FAIL_SAME_ failure -ASSERT:_FAIL_SAME_ w/ msg failure -testFailNotSame -ASSERT:_FAIL_NOT_SAME_ failure -ASSERT:_FAIL_NOT_SAME_ w/ msg failure - -Ran 12 tests. - -FAILED (failures=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-11/16/88i - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 3.0.6 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Solaris-9u6.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Solaris-9u6.txt deleted file mode 100644 index 11daebb..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Solaris-9u6.txt +++ /dev/null @@ -1,321 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Wed Apr 27 23:17:50 GMT 2011 - -$ uname -mprsv -SunOS 5.9 Generic_117172-08 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 2.05.0(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -ASSERT:_ASSERT_EQUALS_ failure -ASSERT:_ASSERT_EQUALS_ w/ msg failure -testAssertNotEquals -ASSERT:_ASSERT_NOT_EQUALS_ failure -ASSERT:_ASSERT_NOT_EQUALS_ w/ msg failure -testSame -ASSERT:_ASSERT_SAME_ failure -ASSERT:_ASSERT_SAME_ w/ msg failure -testNotSame -ASSERT:_ASSERT_NOT_SAME_ failure -ASSERT:_ASSERT_NOT_SAME_ w/ msg failure -testNull -ASSERT:_ASSERT_NULL_ failure -ASSERT:_ASSERT_NULL_ w/ msg failure -testNotNull -ASSERT:_ASSERT_NOT_NULL_ failure -ASSERT:_ASSERT_NOT_NULL_ w/ msg failure -ASSERT:[-875] some msg -testAssertTrue -ASSERT:_ASSERT_TRUE_ failure -ASSERT:_ASSERT_TRUE_ w/ msg failure -testAssertFalse -ASSERT:_ASSERT_FALSE_ failure -ASSERT:_ASSERT_FALSE_ w/ msg failure -testFail -ASSERT:_FAIL_ failure -ASSERT:_FAIL_ w/ msg failure -testFailNotEquals -ASSERT:_FAIL_NOT_EQUALS_ failure -ASSERT:_FAIL_NOT_EQUALS_ w/ msg failure -testFailSame -ASSERT:_FAIL_SAME_ failure -ASSERT:_FAIL_SAME_ w/ msg failure -testFailNotSame -ASSERT:_FAIL_NOT_SAME_ failure -ASSERT:_FAIL_NOT_SAME_ w/ msg failure - -Ran 12 tests. - -FAILED (failures=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-11/16/88i - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 3.0.8 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Solaris-9u8.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Solaris-9u8.txt deleted file mode 100644 index db2661c..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.6/Solaris-9u8.txt +++ /dev/null @@ -1,321 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Fri Apr 22 11:25:16 GMT 2011 - -$ uname -mprsv -SunOS 5.9 Generic_118559-11 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 2.05.0(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -ASSERT:_ASSERT_EQUALS_ failure -ASSERT:_ASSERT_EQUALS_ w/ msg failure -testAssertNotEquals -ASSERT:_ASSERT_NOT_EQUALS_ failure -ASSERT:_ASSERT_NOT_EQUALS_ w/ msg failure -testSame -ASSERT:_ASSERT_SAME_ failure -ASSERT:_ASSERT_SAME_ w/ msg failure -testNotSame -ASSERT:_ASSERT_NOT_SAME_ failure -ASSERT:_ASSERT_NOT_SAME_ w/ msg failure -testNull -ASSERT:_ASSERT_NULL_ failure -ASSERT:_ASSERT_NULL_ w/ msg failure -testNotNull -ASSERT:_ASSERT_NOT_NULL_ failure -ASSERT:_ASSERT_NOT_NULL_ w/ msg failure -ASSERT:[-875] some msg -testAssertTrue -ASSERT:_ASSERT_TRUE_ failure -ASSERT:_ASSERT_TRUE_ w/ msg failure -testAssertFalse -ASSERT:_ASSERT_FALSE_ failure -ASSERT:_ASSERT_FALSE_ w/ msg failure -testFail -ASSERT:_FAIL_ failure -ASSERT:_FAIL_ w/ msg failure -testFailNotEquals -ASSERT:_FAIL_NOT_EQUALS_ failure -ASSERT:_FAIL_NOT_EQUALS_ w/ msg failure -testFailSame -ASSERT:_FAIL_SAME_ failure -ASSERT:_FAIL_SAME_ w/ msg failure -testFailNotSame -ASSERT:_FAIL_NOT_SAME_ failure -ASSERT:_FAIL_NOT_SAME_ w/ msg failure - -Ran 12 tests. - -FAILED (failures=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-11/16/88i - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 3.0.8 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Linux-Ubuntu-10.04.4-LTS.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Linux-Ubuntu-10.04.4-LTS.txt deleted file mode 100644 index 699662f..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Linux-Ubuntu-10.04.4-LTS.txt +++ /dev/null @@ -1,416 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Mon May 20 17:55:52 CEST 2013 - -$ uname -mprsv -Linux 2.6.32-45-server #101-Ubuntu SMP Mon Dec 3 15:54:27 UTC 2012 x86_64 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 4.1.5(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.5.1-3ubuntu2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: JM-93t+-2009-05-01-$ - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.10 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Linux-Ubuntu-12.04.2-LTS.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Linux-Ubuntu-12.04.2-LTS.txt deleted file mode 100644 index 857fb74..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Linux-Ubuntu-12.04.2-LTS.txt +++ /dev/null @@ -1,416 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Mon May 20 16:57:14 CEST 2013 - -$ uname -mprsv -Linux 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:10 UTC 2013 x86_64 x86_64 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 4.2.25(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.7-2ubuntu2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: JM-93u-2011-02-08-$ - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.17 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Linux-Ubuntu-8.04.4-LTS.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Linux-Ubuntu-8.04.4-LTS.txt deleted file mode 100644 index e3ec84e..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Linux-Ubuntu-8.04.4-LTS.txt +++ /dev/null @@ -1,416 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Mon May 20 17:55:54 CEST 2013 - -$ uname -mprsv -Linux 2.6.24-32-server #1 SMP Mon Dec 3 15:54:12 UTC 2012 x86_64 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.39(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.4-8ubuntu1.1 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-1993-12-28 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.4 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -OK - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/OpenSolaris-2009.06(snv_111b).txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/OpenSolaris-2009.06(snv_111b).txt deleted file mode 100644 index e4df26e..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/OpenSolaris-2009.06(snv_111b).txt +++ /dev/null @@ -1,227 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Mon May 20 17:55:59 CEST 2013 - -$ uname -mprsv -SunOS 5.11 snv_111b i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:expected a non-zero exit value -ASSERT:assert message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.25(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:expected a non-zero exit value -ASSERT:assert message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:expected a non-zero exit value -ASSERT:assert message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - diff --git a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Solaris-10u10.txt b/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Solaris-10u10.txt deleted file mode 100644 index 9367c5f..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/shunit2/website/testresults/2.1.7/Solaris-10u10.txt +++ /dev/null @@ -1,296 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells: /bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh -tests: shunit2_test_asserts.sh shunit2_test_failures.sh shunit2_test_macros.sh shunit2_test_misc.sh shunit2_test_standalone.sh - -# system info -$ date -Mon May 20 17:56:24 CEST 2013 - -$ uname -mprsv -SunOS 5.10 Generic_147441-01 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK (skipped=24) - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.51(1)-release - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-11/16/88i - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK - - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.2.1 - ---- Executing the 'asserts' test suite --- -testAssertEquals -testAssertNotEquals -testAssertSame -testAssertNotSame -testAssertNull -testAssertNotNull -testAssertTrue -testAssertFalse - -Ran 8 tests. - -OK - ---- Executing the 'failures' test suite --- -testFail -testFailNotEquals -testFailSame - -Ran 3 tests. - -OK - ---- Executing the 'macros' test suite --- -testAssertEquals -testAssertNotEquals -testSame -testNotSame -testNull -testNotNull -testAssertTrue -testAssertFalse -testFail -testFailNotEquals -testFailSame -testFailNotSame - -Ran 12 tests. - -OK - ---- Executing the 'misc' test suite --- -testUnboundVariable -ASSERT:assert message was not generated -ASSERT:test count message was not generated -ASSERT:failure message was not generated -testIssue7 -testPrepForSourcing -testEscapeCharInStr -testEscapeCharInStr_specialChars -testExtractTestFunctions - -Ran 6 tests. - -FAILED (failures=3) - ---- Executing the 'standalone' test suite --- -testStandalone - -Ran 1 test. - -OK diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test-in-docker b/.zprezto/modules/prompt/external/powerlevel9k/test-in-docker index 3c7255e..0ed1254 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test-in-docker +++ b/.zprezto/modules/prompt/external/powerlevel9k/test-in-docker @@ -2,10 +2,12 @@ set -eu -# The default ZSH to use. -default_version='4.3.11' +# The default ZSH to use; it can just be the first few characters. +# This should be the oldest version we support. +default_version='4.' setopt extended_glob glob_subst numeric_glob_sort +setopt warn_create_global warn_nested_var 2> /dev/null cd "${${(%):-%x}:A:h}" # TODO: Crazy Logic to munge TERM to something supported in Ubuntu 14.04 @@ -15,13 +17,18 @@ term=screen-256color # ...see Modifiers in zshexpn(1) for details. # List of ZSH versions -typeset -a versions +typeset -aU versions versions=( docker/base-*/Dockerfile(N.on:h:t:s/base-//) ) +typeset -r versions # List of frameworks -typeset -a frameworks +typeset -aU frameworks frameworks=( docker/*/Dockerfile(N.on:h:t) ) -frameworks=${(@)frameworks:#base-*} +for i in {$#frameworks..1}; do + # Remove all base entries + [[ "${frameworks[$i]}" == base-* ]] && frameworks[$i]=() +done +typeset -r frameworks # Known Issues typeset -A known_issues @@ -30,6 +37,7 @@ known_issues["4.3.11-zim"]="BROKEN: Zim wants ZSH 5.2 or newer." known_issues["5.0.3-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer." known_issues["5.1.1-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer." known_issues["4.3.11-zulu"]="Zulu doesn't work; it needs a newer version of git." +typeset -r known_issues err() { @@ -65,6 +73,14 @@ check_for_known_issues() { fi } +cmd() { + if (( dry_run )); then + echo "${(@q)*}" 1>&2 + else + "${(@)*}" + fi +} + build_and_run() { local version="$1" local framework="$2" @@ -75,14 +91,14 @@ build_and_run() { print -P "%F{green}Preparing containers...%f" echo -n "p9k:base-${version}: " - docker build \ + cmd docker build \ --quiet \ --tag "p9k:base-${version}" \ --file "docker/base-${version}/Dockerfile" \ . echo -n "p9k:${version}-${framework}: " - docker build \ + cmd docker build \ --quiet \ --build-arg="base=base-${version}" \ --tag "p9k:${version}-${framework}" \ @@ -90,7 +106,7 @@ build_and_run() { . print -P "%F{green}Starting ${name} container...%f" - exec docker run \ + cmd docker run \ --rm \ --interactive \ --tty \ @@ -105,9 +121,10 @@ show_help() { echo echo "Loads up a docker image with powershell9k configured in " echo - echo " --frameworks Lists all available frameworks, newline separated." - echo " --versions Lists all available ZSH versions, newline separated." - echo " --zsh VER Uses ZSH with version VER." + echo " -f --frameworks Lists all available frameworks, newline separated." + echo " -v --versions Lists all available ZSH versions, newline separated." + echo " -z --zsh VER Uses ZSH with version VER." + echo " -n --dry-run Just prints the docker commands that would be run." echo " --help You're soaking in it." echo echo "ZSH versions:" @@ -128,8 +145,9 @@ if (( $# == 0 )); then fi # Parse flags and such. -use_version=$default_version -use_framework= +asked_for_version=$default_version +asked_for_framework= +dry_run=0 while (( $# > 0 )); do case "$1" in -f | --frameworks ) @@ -142,13 +160,9 @@ while (( $# > 0 )); do ;; -z | --zsh ) shift - local v="$(resolve_version "$1")" - if [[ -n "$v" ]]; then - use_version=$v - else - err "No such ZSH version '${1}'" - fi + asked_for_version=$1 ;; + -n | --dry-run ) dry_run=1 ;; -h | --help ) show_help exit @@ -159,21 +173,28 @@ while (( $# > 0 )); do exit 1 ;; * ) - if [[ -z "$use_framework" ]]; then - local f="$(resolve_framework "$1")" - if [[ -n "$f" ]]; then - use_framework=$f - else - err "No such framework '${1}'" - fi + if [[ -z "$asked_for_framework" ]]; then + asked_for_framework=$1 else - err "You can only specify one framework at a time; you already specified '${use_framework}'" + err "You can only specify one framework at a time; you already specified '${asked_for_framework}'" fi ;; esac shift done +typeset -r asked_for_version asked_for_framework + +typeset -r use_version="$(resolve_version "${asked_for_version}")" +if [[ -z "$use_version" ]]; then + err "No such ZSH version '${asked_for_version}'" +fi + +typeset -r use_framework="$(resolve_framework "${asked_for_framework}")" +if [[ -z "$use_framework" ]]; then + err "No such framework '${asked_for_framework}'" +fi + build_and_run "$use_version" "$use_framework" # EOF diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/core/color_overriding.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/core/color_overriding.spec new file mode 100755 index 0000000..f2c3d89 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/core/color_overriding.spec @@ -0,0 +1,62 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + # Load Powerlevel9k + source powerlevel9k.zsh-theme +} + +function testDynamicColoringOfSegmentsWork() { + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(date) + local POWERLEVEL9K_DATE_ICON="date-icon" + local POWERLEVEL9K_DATE_BACKGROUND='red' + + assertEquals "%K{001} %F{000}date-icon %f%F{000}%D{%d.%m.%y} %k%F{001}%f " "$(build_left_prompt)" +} + +function testDynamicColoringOfVisualIdentifiersWork() { + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(date) + local POWERLEVEL9K_DATE_ICON="date-icon" + local POWERLEVEL9K_DATE_VISUAL_IDENTIFIER_COLOR='green' + + assertEquals "%K{007} %F{002}date-icon %f%F{000}%D{%d.%m.%y} %k%F{007}%f " "$(build_left_prompt)" +} + +function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() { + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(date) + local POWERLEVEL9K_DATE_ICON="date-icon" + local POWERLEVEL9K_DATE_VISUAL_IDENTIFIER_COLOR='green' + local POWERLEVEL9K_DATE_FOREGROUND='red' + local POWERLEVEL9K_DATE_BACKGROUND='yellow' + + assertEquals "%K{003} %F{002}date-icon %f%F{001}%D{%d.%m.%y} %k%F{003}%f " "$(build_left_prompt)" +} + +function testColorOverridingOfStatefulSegment() { + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(host) + local POWERLEVEL9K_SSH_ICON="ssh-icon" + local POWERLEVEL9K_HOST_REMOTE_BACKGROUND='red' + local POWERLEVEL9K_HOST_REMOTE_FOREGROUND='green' + # Provoke state + local SSH_CLIENT="x" + + assertEquals "%K{001} %F{002}ssh-icon %f%F{002}%m %k%F{001}%f " "$(build_left_prompt)" +} + +function testColorOverridingOfCustomSegment() { + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local POWERLEVEL9K_CUSTOM_WORLD_ICON='CW' + local POWERLEVEL9K_CUSTOM_WORLD_VISUAL_IDENTIFIER_COLOR='green' + local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND='red' + local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND='red' + + assertEquals "%K{001} %F{002}CW %f%F{001}world %k%F{001}%f " "$(build_left_prompt)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/core/joining_segments.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/core/joining_segments.spec new file mode 100755 index 0000000..18213a5 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/core/joining_segments.spec @@ -0,0 +1,187 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + # Load Powerlevel9k + source powerlevel9k.zsh-theme +} + +function testLeftNormalSegmentsShouldNotBeJoined() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3 custom_world4_joined custom_world5 custom_world6) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" + local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" + local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD6="echo world6" + + assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world2 %K{007}%F{000} %F{000}world4 %K{007}%F{000} %F{000}world6 %k%F{007}%f " "$(build_left_prompt)" +} + +function testLeftJoinedSegments() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" + + assertEquals "%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %k%F{007}%f " "$(build_left_prompt)" +} + +function testLeftTransitiveJoinedSegments() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined custom_world3_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" + local POWERLEVEL9K_CUSTOM_WORLD3="echo world3" + + assertEquals "%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %K{007}%F{000}%F{000}world3 %k%F{007}%f " "$(build_left_prompt)" +} + +function testLeftTransitiveJoiningWithConditionalJoinedSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined custom_world3_joined custom_world4_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" + local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" + + assertEquals "%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %K{007}%F{000}%F{000}world4 %k%F{007}%f " "$(build_left_prompt)" +} + +function testLeftPromotingSegmentWithConditionalPredecessor() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD3="echo world3" + + assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world3 %k%F{007}%f " "$(build_left_prompt)" +} + +function testLeftPromotingSegmentWithJoinedConditionalPredecessor() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined custom_world4_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" + + assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world4 %k%F{007}%f " "$(build_left_prompt)" +} + +function testLeftPromotingSegmentWithDeepJoinedConditionalPredecessor() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined custom_world4_joined custom_world5_joined custom_world6_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" + local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD6="echo world6" + + assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world4 %K{007}%F{000}%F{000}world6 %k%F{007}%f " "$(build_left_prompt)" +} + +function testLeftJoiningBuiltinSegmentWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version php_version_joined) + alias php="echo PHP 1.2.3" + + assertEquals "%K{013} %F{255}PHP 1.2.3 %K{013}%F{255}%F{255}PHP 1.2.3 %k%F{013}%f " "$(build_left_prompt)" + + unalias php +} + +function testRightNormalSegmentsShouldNotBeJoined() { + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3 custom_world4 custom_world5_joined custom_world6) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" + local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" + local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD6="echo world6" + + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world2 %f%F{000}%f%K{007}%F{000} world4 %f%F{000}%f%K{007}%F{000} world6%E" "$(build_right_prompt)" +} + +function testRightJoinedSegments() { + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" + + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2%E" "$(build_right_prompt)" +} + +function testRightTransitiveJoinedSegments() { + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined custom_world3_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" + local POWERLEVEL9K_CUSTOM_WORLD3="echo world3" + + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2 %f%K{007}%F{000}world3%E" "$(build_right_prompt)" +} + +function testRightTransitiveJoiningWithConditionalJoinedSegment() { + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined custom_world3_joined custom_world4_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" + local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" + + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2 %f%K{007}%F{000}world4%E" "$(build_right_prompt)" +} + +function testRightPromotingSegmentWithConditionalPredecessor() { + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD3="echo world3" + + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world3%E" "$(build_right_prompt)" +} + +function testRightPromotingSegmentWithJoinedConditionalPredecessor() { + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined custom_world4_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" + + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world4%E" "$(build_right_prompt)" +} + +function testRightPromotingSegmentWithDeepJoinedConditionalPredecessor() { + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined custom_world4_joined custom_world5_joined custom_world6_joined) + local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" + local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" + local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions + local POWERLEVEL9K_CUSTOM_WORLD6="echo world6" + + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world4 %f%K{007}%F{000}world6%E" "$(build_right_prompt)" +} + +function testRightJoiningBuiltinSegmentWorks() { + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(php_version php_version_joined) + alias php="echo PHP 1.2.3" + + assertEquals "%F{013}%f%K{013}%F{255} PHP 1.2.3 %f%K{013}%F{255}PHP 1.2.3%E" "$(build_right_prompt)" + + unalias php +} +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/core/prompt.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/core/prompt.spec new file mode 100755 index 0000000..47d3ac7 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/core/prompt.spec @@ -0,0 +1,104 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + # Load Powerlevel9k + source powerlevel9k.zsh-theme +} + +function testSegmentOnRightSide() { + # Reset RPROMPT, so a running P9K does not interfere with the test + local RPROMPT= + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + local POWERLEVEL9K_CUSTOM_WORLD2='echo world2' + + powerlevel9k_prepare_prompts + + local reset_attributes=$'\e[00m' + assertEquals "%f%b%k%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world2%E%{${reset_attributes}%}" "${(e)RPROMPT}" +} + +function testDisablingRightPrompt() { + # Reset RPROMPT, so a running P9K does not interfere with the test + local RPROMPT= + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + local POWERLEVEL9K_CUSTOM_WORLD2='echo world2' + local POWERLEVEL9K_DISABLE_RPROMPT=true + + powerlevel9k_prepare_prompts + + assertEquals "" "${(e)RPROMPT}" +} + +function testLeftMultilinePrompt() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + local POWERLEVEL9K_PROMPT_ON_NEWLINE=true + + powerlevel9k_prepare_prompts + + local nl=$'\n' + assertEquals "╭─%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}╰─ " "${(e)PROMPT}" +} + +function testRightPromptOnSameLine() { + # Reset RPROMPT, so a running P9K does not interfere with the test + local RPROMPT= + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + + local POWERLEVEL9K_PROMPT_ON_NEWLINE=true + local POWERLEVEL9K_RPROMPT_ON_NEWLINE=false # We want the RPROMPT on the same line as our left prompt + + # Skip test, as this cannot be tested properly. + # The "go one line up" instruction does not get + # printed as real characters in RPROMPT. + # On command line the assert statement produces + # a visually identical output as we expect, but + # it fails anyway. :( + startSkipping + + powerlevel9k_prepare_prompts + assertEquals "%{\e[1A%}%F{007}%f%K{007}%F{000} world1 %f%{\e[1B%}" "${(e)RPROMPT}" +} + +function testPrefixingFirstLineOnLeftPrompt() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + + local POWERLEVEL9K_PROMPT_ON_NEWLINE=true + local POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='XXX' + + powerlevel9k_prepare_prompts + + local nl=$'\n' + assertEquals "XXX%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}╰─ " "${(e)PROMPT}" +} + +function testPrefixingSecondLineOnLeftPrompt() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + + local POWERLEVEL9K_PROMPT_ON_NEWLINE=true + local POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='XXX' + + powerlevel9k_prepare_prompts + + local nl=$'\n' + assertEquals "╭─%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}XXX" "${(e)PROMPT}" +} + +source shunit2/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/core/visual_identifier.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/core/visual_identifier.spec new file mode 100755 index 0000000..c6c6bef --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/core/visual_identifier.spec @@ -0,0 +1,60 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + source functions/* +} + +function testOverwritingIconsWork() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here' + + assertEquals "%K{007} %F{000}icon-here %f%F{000}world1 %k%F{007}%f " "$(build_left_prompt)" +} + +function testVisualIdentifierAppearsBeforeSegmentContentOnLeftSegments() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here' + + assertEquals "%K{007} %F{000}icon-here %f%F{000}world1 %k%F{007}%f " "$(build_left_prompt)" +} + +function testVisualIdentifierAppearsAfterSegmentContentOnRightSegments() { + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here' + + assertEquals "%F{007}%f%K{007}%F{000} world1%F{000} icon-here%f%E" "$(build_right_prompt)" +} + +function testVisualIdentifierPrintsNothingIfNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + + assertEquals "%K{007} %F{000}world1 %k%F{007}%f " "$(build_left_prompt)" +} + +function testVisualIdentifierIsPrintedInNumericalColorCode() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1) + local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' + local POWERLEVEL9K_CUSTOM_WORLD1_ICON="xxx" + local POWERLEVEL9K_CUSTOM_WORLD1_VISUAL_IDENTIFIER_COLOR="purple3" + + assertEquals "%K{007} %F{056}xxx %f%F{000}world1 %k%F{007}%f " "$(build_left_prompt)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/functions/colors.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/functions/colors.spec index 61a4008..4ee7120 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/functions/colors.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/functions/colors.spec @@ -22,6 +22,10 @@ function testGetColorCodeWithNumericalColor() { assertEquals '002' "$(getColorCode '002')" } +function testGetColorCodeWithNoneColor() { + assertEquals 'none' "$(getColorCode 'NONE')" +} + function testIsSameColorComparesAnsiForegroundAndNumericalColorCorrectly() { assertTrue "isSameColor 'green' '002'" } @@ -30,13 +34,34 @@ function testIsSameColorComparesAnsiBackgroundAndNumericalColorCorrectly() { assertTrue "isSameColor 'bg-green' '002'" } -function testIsSameColorComparesNumericalBackgroundAndNumericalColorCorrectly() { - assertTrue "isSameColor '010' '2'" +function testIsSameColorComparesShortCodesCorrectly() { + assertTrue "isSameColor '002' '2'" } function testIsSameColorDoesNotYieldNotEqualColorsTruthy() { assertFalse "isSameColor 'green' '003'" } +function testIsSameColorHandlesNoneCorrectly() { + assertTrue "isSameColor 'none' 'NOnE'" +} -source shunit2/source/2.1/src/shunit2 +function testIsSameColorCompareTwoNoneColorsCorrectly() { + assertTrue "isSameColor 'none' 'none'" +} + +function testIsSameColorComparesColorWithNoneCorrectly() { + assertFalse "isSameColor 'green' 'none'" +} + +function testBrightColorsWork() { + # We had some code in the past that equalized bright colors + # with normal ones. This code is now gone, and this test should + # ensure that all input channels for bright colors are handled + # correctly. + assertTrue "isSameColor 'cyan' '006'" + assertEquals '006' "$(getColorCode 'cyan')" + assertEquals '006' "$(getColor 'cyan')" +} + +source shunit2/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/functions/icons.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/functions/icons.spec index c8d8864..ec0cb1f 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/functions/icons.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/functions/icons.spec @@ -10,21 +10,15 @@ function setUp() { _OLD_LC_CTYPE="${LC_CTYPE}" # Reset actual LC_CTYPE unset LC_CTYPE - - # Store old P9K mode - _OLD_P9K_MODE="${POWERLEVEL9K_MODE}" } function tearDown() { # Restore LC_CTYPE LC_CTYPE="${_OLD_LC_CTYPE}" - - # Restore old P9K mode - POWERLEVEL9K_MODE="${_OLD_P9K_MODE}" } function testLcCtypeIsSetCorrectlyInDefaultMode() { - POWERLEVEL9K_MODE="default" + local POWERLEVEL9K_MODE="default" # Load Powerlevel9k source functions/icons.zsh @@ -32,7 +26,7 @@ function testLcCtypeIsSetCorrectlyInDefaultMode() { } function testLcCtypeIsSetCorrectlyInAwesomePatchedMode() { - POWERLEVEL9K_MODE="awesome-patched" + local POWERLEVEL9K_MODE="awesome-patched" # Load Powerlevel9k source functions/icons.zsh @@ -40,7 +34,7 @@ function testLcCtypeIsSetCorrectlyInAwesomePatchedMode() { } function testLcCtypeIsSetCorrectlyInAwesomeFontconfigMode() { - POWERLEVEL9K_MODE="awesome-fontconfig" + local POWERLEVEL9K_MODE="awesome-fontconfig" # Load Powerlevel9k source functions/icons.zsh @@ -48,7 +42,7 @@ function testLcCtypeIsSetCorrectlyInAwesomeFontconfigMode() { } function testLcCtypeIsSetCorrectlyInNerdfontFontconfigMode() { - POWERLEVEL9K_MODE="nerdfont-fontconfig" + local POWERLEVEL9K_MODE="nerdfont-fontconfig" # Load Powerlevel9k source functions/icons.zsh @@ -56,7 +50,7 @@ function testLcCtypeIsSetCorrectlyInNerdfontFontconfigMode() { } function testLcCtypeIsSetCorrectlyInFlatMode() { - POWERLEVEL9K_MODE="flat" + local POWERLEVEL9K_MODE="flat" # Load Powerlevel9k source functions/icons.zsh @@ -64,7 +58,7 @@ function testLcCtypeIsSetCorrectlyInFlatMode() { } function testLcCtypeIsSetCorrectlyInCompatibleMode() { - POWERLEVEL9K_MODE="compatible" + local POWERLEVEL9K_MODE="compatible" # Load Powerlevel9k source functions/icons.zsh @@ -76,7 +70,7 @@ function testLcCtypeIsSetCorrectlyInCompatibleMode() { function testAllIconsAreDefinedLikeInDefaultMode() { # Always compare against this mode local _P9K_TEST_MODE="default" - POWERLEVEL9K_MODE="${_P9K_TEST_MODE}" + local POWERLEVEL9K_MODE="${_P9K_TEST_MODE}" source functions/icons.zsh # _ICONS_UNDER_TEST is an array of just the keys of $icons. # We later check via (r) "subscript" flag that our key @@ -121,6 +115,15 @@ function testAllIconsAreDefinedLikeInDefaultMode() { assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" done + # Switch to "nerdfont-complete" mode + POWERLEVEL9K_MODE="nerdfont-complete" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + # Switch to "flat" mode POWERLEVEL9K_MODE="flat" source functions/icons.zsh @@ -148,7 +151,7 @@ function testAllIconsAreDefinedLikeInDefaultMode() { function testAllIconsAreDefinedLikeInAwesomePatchedMode() { # Always compare against this mode local _P9K_TEST_MODE="awesome-patched" - POWERLEVEL9K_MODE="$_P9K_TEST_MODE" + local POWERLEVEL9K_MODE="$_P9K_TEST_MODE" source functions/icons.zsh # _ICONS_UNDER_TEST is an array of just the keys of $icons. # We later check via (r) "subscript" flag that our key @@ -193,6 +196,15 @@ function testAllIconsAreDefinedLikeInAwesomePatchedMode() { assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" done + # Switch to "nerdfont-complete" mode + POWERLEVEL9K_MODE="nerdfont-complete" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + # Switch to "flat" mode POWERLEVEL9K_MODE="flat" source functions/icons.zsh @@ -220,7 +232,7 @@ function testAllIconsAreDefinedLikeInAwesomePatchedMode() { function testAllIconsAreDefinedLikeInAwesomeFontconfigMode() { # Always compare against this mode local _P9K_TEST_MODE="awesome-fontconfig" - POWERLEVEL9K_MODE="$_P9K_TEST_MODE" + local POWERLEVEL9K_MODE="$_P9K_TEST_MODE" source functions/icons.zsh # _ICONS_UNDER_TEST is an array of just the keys of $icons. # We later check via (r) "subscript" flag that our key @@ -265,6 +277,15 @@ function testAllIconsAreDefinedLikeInAwesomeFontconfigMode() { assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" done + # Switch to "nerdfont-complete" mode + POWERLEVEL9K_MODE="nerdfont-complete" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + # Switch to "flat" mode POWERLEVEL9K_MODE="flat" source functions/icons.zsh @@ -292,7 +313,7 @@ function testAllIconsAreDefinedLikeInAwesomeFontconfigMode() { function testAllIconsAreDefinedLikeInNerdfontFontconfigMode() { # Always compare against this mode local _P9K_TEST_MODE="nerdfont-fontconfig" - POWERLEVEL9K_MODE="$_P9K_TEST_MODE" + local POWERLEVEL9K_MODE="$_P9K_TEST_MODE" source functions/icons.zsh # _ICONS_UNDER_TEST is an array of just the keys of $icons. # We later check via (r) "subscript" flag that our key @@ -337,6 +358,15 @@ function testAllIconsAreDefinedLikeInNerdfontFontconfigMode() { assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" done + # Switch to "nerdfont-complete" mode + POWERLEVEL9K_MODE="nerdfont-complete" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + # Switch to "flat" mode POWERLEVEL9K_MODE="flat" source functions/icons.zsh @@ -359,4 +389,85 @@ function testAllIconsAreDefinedLikeInNerdfontFontconfigMode() { unset _ICONS_UNDER_TEST } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +# Go through all icons defined in nerdfont-complete mode, and +# check if all of them are defined in the other modes. +function testAllIconsAreDefinedLikeInNerdfontCompleteMode() { + # Always compare against this mode + local _P9K_TEST_MODE="nerdfont-complete" + local POWERLEVEL9K_MODE="$_P9K_TEST_MODE" + source functions/icons.zsh + # _ICONS_UNDER_TEST is an array of just the keys of $icons. + # We later check via (r) "subscript" flag that our key + # is in the values of our flat array. + typeset -ah _ICONS_UNDER_TEST + _ICONS_UNDER_TEST=(${(k)icons[@]}) + + # Switch to "default" mode + POWERLEVEL9K_MODE="default" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + # Iterate over all keys found in the _ICONS_UNDER_TEST + # array and compare it with the icons array of the + # current POWERLEVEL9K_MODE. + # Use parameter expansion, to directly check if the + # key exists in the flat current array of keys. That + # is quite complicated, but there seems no easy way + # to check the mere existance of a key in an array. + # The usual way would always return the value, so that + # would do the wrong thing as we have some (on purpose) + # empty values. + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + + # Switch to "awesome-patched" mode + POWERLEVEL9K_MODE="awesome-patched" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + + # Switch to "awesome-fontconfig" mode + POWERLEVEL9K_MODE="awesome-fontconfig" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + + # Switch to "nerdfont-fontconfig" mode + POWERLEVEL9K_MODE="nerdfont-fontconfig" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + + # Switch to "flat" mode + POWERLEVEL9K_MODE="flat" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + + # Switch to "compatible" mode + POWERLEVEL9K_MODE="compatible" + source functions/icons.zsh + typeset -ah current_icons + current_icons=(${(k)icons[@]}) + for key in ${_ICONS_UNDER_TEST}; do + assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))" + done + + unset current_icons + unset _ICONS_UNDER_TEST +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/functions/utilities.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/functions/utilities.spec index a9bd67e..b727c1f 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/functions/utilities.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/functions/utilities.spec @@ -106,4 +106,4 @@ function testSegmentShouldNotBeJoinedIfPredecessingSegmentIsNotJoinedButConditio unset segments } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/powerlevel9k.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/powerlevel9k.spec index 0ddf36c..586c2b2 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/powerlevel9k.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/powerlevel9k.spec @@ -17,68 +17,66 @@ function setUp() { } function testJoinedSegments() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_joined) cd /tmp - assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black}%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp %K{004}%F{000}%F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS cd - } function testTransitiveJoinedSegments() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir root_indicator_joined dir_joined) cd /tmp - assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black}%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp %K{004}%F{000}%F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS cd - } function testJoiningWithConditionalSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir background_jobs dir_joined) cd /tmp - assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp %K{004}%F{000} %F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS cd - } function testDynamicColoringOfSegmentsWork() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) - POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red' + local POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red' cd /tmp - assertEquals "%K{red} %F{black}/tmp %k%F{red}%f " "$(build_left_prompt)" + assertEquals "%K{001} %F{000}/tmp %k%F{001}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_DIR_DEFAULT_BACKGROUND cd - } function testDynamicColoringOfVisualIdentifiersWork() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) - POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR='green' - POWERLEVEL9K_FOLDER_ICON="icon-here" + local POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR='green' + local POWERLEVEL9K_FOLDER_ICON="icon-here" cd /tmp - assertEquals "%K{blue} %F{green%}icon-here %f%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{002}icon-here %f%F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR - unset POWERLEVEL9K_FOLDER_ICON cd - } function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) - POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR='green' - POWERLEVEL9K_DIR_DEFAULT_FOREGROUND='red' - POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='yellow' - POWERLEVEL9K_FOLDER_ICON="icon-here" + local POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR='green' + local POWERLEVEL9K_DIR_DEFAULT_FOREGROUND='red' + local POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='yellow' + local POWERLEVEL9K_FOLDER_ICON="icon-here" # Re-Source the icons, as the POWERLEVEL9K_MODE is directly # evaluated there. @@ -86,19 +84,15 @@ function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() { cd /tmp - assertEquals "%K{yellow} %F{green%}icon-here %f%F{red}/tmp %k%F{yellow}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{002}icon-here %f%F{001}/tmp %k%F{003}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR - unset POWERLEVEL9K_DIR_DEFAULT_FOREGROUND - unset POWERLEVEL9K_DIR_DEFAULT_BACKGROUND - unset POWERLEVEL9K_FOLDER_ICON cd - } function testOverwritingIconsWork() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) - POWERLEVEL9K_FOLDER_ICON='icon-here' + local POWERLEVEL9K_FOLDER_ICON='icon-here' #local testFolder=$(mktemp -d -p p9k) # Move testFolder under home folder #mv testFolder ~ @@ -106,31 +100,24 @@ function testOverwritingIconsWork() { #cd ~/$testFolder cd /tmp - assertEquals "%K{blue} %F{black%}icon-here %f%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}icon-here %f%F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_DIR_FOLDER_ICON cd - # rm -fr ~/$testFolder } function testNewlineOnRpromptCanBeDisabled() { - POWERLEVEL9K_PROMPT_ON_NEWLINE=true - POWERLEVEL9K_RPROMPT_ON_NEWLINE=false - POWERLEVEL9K_CUSTOM_WORLD='echo world' - POWERLEVEL9K_CUSTOM_RWORLD='echo rworld' + local POWERLEVEL9K_PROMPT_ON_NEWLINE=true + local POWERLEVEL9K_RPROMPT_ON_NEWLINE=false + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local POWERLEVEL9K_CUSTOM_RWORLD='echo rworld' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_rworld) powerlevel9k_prepare_prompts assertEquals '$(print_icon MULTILINE_FIRST_PROMPT_PREFIX) world  $(print_icon MULTILINE_LAST_PROMPT_PREFIX) rworld' "$(print -P ${PROMPT}${RPROMPT})" - - unset POWERLEVEL9K_PROMPT_ON_NEWLINE - unset POWERLEVEL9K_RPROMPT_ON_NEWLINE - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS - unset POWERLEVEL9K_CUSTOM_WORLD - unset POWERLEVEL9K_CUSTOM_RWORLD } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/anaconda.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/anaconda.spec new file mode 100755 index 0000000..efcfc03 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/anaconda.spec @@ -0,0 +1,69 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" +} + +function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() { + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda custom_world) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + # Unset anacona variables + unset CONDA_ENV_PATH + unset CONDA_PREFIX + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda) + local POWERLEVEL9K_PYTHON_ICON="icon-here" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + CONDA_ENV_PATH=/tmp + unset CONDA_PREFIX + + assertEquals "%K{004} %F{000}icon-here %f%F{000}(tmp) %k%F{004}%f " "$(build_left_prompt)" +} + +function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda) + local POWERLEVEL9K_PYTHON_ICON="icon-here" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + unset CONDA_ENV_PATH + local CONDA_PREFIX="test" + + assertEquals "%K{004} %F{000}icon-here %f%F{000}(test) %k%F{004}%f " "$(build_left_prompt)" +} + +function testAnacondaSegmentWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda) + local POWERLEVEL9K_PYTHON_ICON="icon-here" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + local CONDA_ENV_PATH=/tmp + local CONDA_PREFIX="test" + + assertEquals "%K{004} %F{000}icon-here %f%F{000}(tmptest) %k%F{004}%f " "$(build_left_prompt)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/aws_eb_env.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/aws_eb_env.spec new file mode 100755 index 0000000..99b418e --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/aws_eb_env.spec @@ -0,0 +1,61 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" +} + +function testAwsEbEnvSegmentPrintsNothingIfNoElasticBeanstalkEnvironmentIsSet() { + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env custom_world) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk + echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml + cd /tmp/powerlevel9k-test + + assertEquals "%K{000} %F{002}🌱 %f%F{002}test %k%F{000}%f " "$(build_left_prompt)" + + rm -fr /tmp/powerlevel9k-test + cd - +} + +function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirectory() { + # Skip test, because currently we cannot detect + # if the configuration is in a parent directory + startSkipping # Skip test + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk + mkdir -p /tmp/powerlevel9k-test/1/12/123/1234/12345 + echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml + cd /tmp/powerlevel9k-test/1/12/123/1234/12345 + + assertEquals "%K{000} %F{002}🌱 %f%F{002}test %k%F{000}%f " "$(build_left_prompt)" + + rm -fr /tmp/powerlevel9k-test + cd - +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/background_jobs.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/background_jobs.spec new file mode 100755 index 0000000..3d83e17 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/background_jobs.spec @@ -0,0 +1,78 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" +} + +function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() { + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs custom_world) + alias jobs="nojobs 2>/dev/null" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias jobs +} + +function testBackgroundJobsSegmentWorksWithOneBackgroundJob() { + unset POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs) + jobs() { + echo '[1] + 30444 suspended nvim xx' + } + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{006}⚙%f %k%F{000}%f " "$(build_left_prompt)" + + unfunction jobs +} + +function testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() { + local POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs) + jobs() { + echo "[1] 31190 suspended nvim xx" + echo "[2] - 31194 suspended nvim xx2" + echo "[3] + 31206 suspended nvim xx3" + } + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{006}⚙%f %k%F{000}%f " "$(build_left_prompt)" + + unfunction jobs +} + +function testBackgroundJobsSegmentWithVerboseMode() { + local POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs) + jobs() { + echo "[1] 31190 suspended nvim xx" + echo "[2] - 31194 suspended nvim xx2" + echo "[3] + 31206 suspended nvim xx3" + } + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{006}⚙ %f%F{006}3 %k%F{000}%f " "$(build_left_prompt)" + + unfunction jobs +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/battery.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/battery.spec new file mode 100755 index 0000000..79e25d6 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/battery.spec @@ -0,0 +1,177 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder + FOLDER=/tmp/powerlevel9k-test + mkdir -p "${FOLDER}" + cd $FOLDER + + # Prepare folder for pmset (OSX) + PMSET_PATH=$FOLDER/usr/bin + mkdir -p $PMSET_PATH + # Prepare folder for $BATTERY (Linux) + BATTERY_PATH=$FOLDER/sys/class/power_supply + mkdir -p $BATTERY_PATH + mkdir -p $BATTERY_PATH/BAT0 + mkdir -p $BATTERY_PATH/BAT1 +} + +function tearDown() { + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" &>/dev/null + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test &>/dev/null + unset PMSET_PATH + unset BATTERY_PATH + unset FOLDER + unset P9K_HOME +} + +# Mock Battery +# For mocking pmset on OSX this function takes one argument (the +# content that pmset should echo). +# For mocking the battery on Linux this function takes two +# arguments: $1 is the capacity; $2 the battery status. +function makeBatterySay() { + if [[ -z "${FOLDER}" ]]; then + echo "Fake root path is not correctly set!" + exit 1 + fi + # OSX + echo "#!/bin/sh" > $PMSET_PATH/pmset + echo "echo \"$1\"" >> $PMSET_PATH/pmset + chmod +x $PMSET_PATH/pmset + + # Linux + local capacity="$1" + echo "$capacity" > $BATTERY_PATH/BAT0/capacity + echo "$capacity" > $BATTERY_PATH/BAT1/capacity + local battery_status="$2" + echo "$battery_status" > $BATTERY_PATH/BAT0/status + echo "$battery_status" > $BATTERY_PATH/BAT1/status +} + +function testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() { + local OS='OSX' # Fake OSX + makeBatterySay "Now drawing from 'Battery Power' + -InternalBattery-0 (id=1234567) 4%; discharging; 0:05 remaining present: true" + + assertEquals "%K{000} %F{001}🔋 %f%F{001}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() { + local OS='OSX' # Fake OSX + makeBatterySay "Now drawing from 'Battery Power' + -InternalBattery-0 (id=1234567) 4%; charging; 0:05 remaining present: true" + + assertEquals "%K{000} %F{003}🔋 %f%F{003}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() { + local OS='OSX' # Fake OSX + makeBatterySay "Now drawing from 'Battery Power' + -InternalBattery-0 (id=1234567) 98%; discharging; 3:57 remaining present: true" + + assertEquals "%K{000} %F{007}🔋 %f%F{007}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() { + local OS='OSX' # Fake OSX + makeBatterySay "Now drawing from 'Battery Power' + -InternalBattery-0 (id=1234567) 98%; charging; 3:57 remaining present: true" + + assertEquals "%K{000} %F{003}🔋 %f%F{003}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsFullOnOSX() { + local OS='OSX' # Fake OSX + makeBatterySay "Now drawing from 'AC Power' + -InternalBattery-0 (id=1234567) 99%; charged; 0:00 remaining present: true" + + assertEquals "%K{000} %F{002}🔋 %f%F{002}99%% " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsCalculatingOnOSX() { + local OS='OSX' # Fake OSX + makeBatterySay "Now drawing from 'Battery Power' + -InternalBattery-0 (id=1234567) 99%; discharging; (no estimate) present: true" + + assertEquals "%K{000} %F{007}🔋 %f%F{007}99%% (...) " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() { + local OS='Linux' # Fake Linux + makeBatterySay "4" "Discharging" + + assertEquals "%K{000} %F{001}🔋 %f%F{001}4%% " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() { + local OS='Linux' # Fake Linux + makeBatterySay "4" "Charging" + + assertEquals "%K{000} %F{003}🔋 %f%F{003}4%% " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() { + local OS='Linux' # Fake Linux + makeBatterySay "10" "Discharging" + + assertEquals "%K{000} %F{007}🔋 %f%F{007}10%% " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() { + local OS='Linux' # Fake Linux + makeBatterySay "10" "Charging" + + assertEquals "%K{000} %F{003}🔋 %f%F{003}10%% " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsFullOnLinux() { + local OS='Linux' # Fake Linux + makeBatterySay "100" "Full" + + assertEquals "%K{000} %F{002}🔋 %f%F{002}100%% " "$(prompt_battery left 1 false ${FOLDER})" +} + +function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() { + local OS='Linux' # Fake Linux + makeBatterySay "50" "Discharging" + echo "echo 'Batter 0: Discharging, 50%, 01:38:54 remaining'" > ${FOLDER}/usr/bin/acpi + chmod +x ${FOLDER}/usr/bin/acpi + # For running on Mac, we need to mock date :( + [[ -f /usr/local/bin/gdate ]] && alias date=gdate + + assertEquals "%K{000} %F{007}🔋 %f%F{007}50%% (1:38) " "$(prompt_battery left 1 false ${FOLDER})" + + unalias date &>/dev/null + # unaliasing date fails where it was never aliased (e.g. on Linux). + # This causes the whole test to fail, because the return code is + # non-zero. + return 0 +} + +function testBatterySegmentIfBatteryIsCalculatingWithAcpiEnabledOnLinux() { + local OS='Linux' # Fake Linux + makeBatterySay "50" "Discharging" + # Todo: Include real acpi output! + echo "echo 'Batter 0: Discharging, 50%, rate remaining'" > ${FOLDER}/usr/bin/acpi + chmod +x ${FOLDER}/usr/bin/acpi + + assertEquals "%K{000} %F{007}🔋 %f%F{007}50%% (...) " "$(prompt_battery left 1 false ${FOLDER})" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/command_execution_time.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/command_execution_time.spec index d3588d8..b7c3fae 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/command_execution_time.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/command_execution_time.spec @@ -7,90 +7,98 @@ SHUNIT_PARENT=$0 function setUp() { export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme } function testCommandExecutionTimeIsNotShownIfTimeIsBelowThreshold() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world command_execution_time) - POWERLEVEL9K_CUSTOM_WORLD='echo world' - _P9K_COMMAND_DURATION=2 + local POWERLEVEL9K_CUSTOM_WORLD='echo world' - assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_CUSTOM_WORLD - unset _P9K_COMMAND_DURATION + # Override payload + local _P9K_COMMAND_DURATION=2 + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testCommandExecutionTimeThresholdCouldBeChanged() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time) - POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1 - _P9K_COMMAND_DURATION=2.03 + local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1 - assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}2.03 %k%F{red}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset _P9K_COMMAND_DURATION - unset POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD + # Override payload + local _P9K_COMMAND_DURATION=2.03 + + assertEquals "%K{001} %F{226}Dur %f%F{226}2.03 %k%F{001}%f " "$(build_left_prompt)" } function testCommandExecutionTimeThresholdCouldBeSetToZero() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time) - POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0 - _P9K_COMMAND_DURATION=0.03 + local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0 + local _P9K_COMMAND_DURATION=0.03 - assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}0.03 %k%F{red}%f " "$(build_left_prompt)" - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset _P9K_COMMAND_DURATION - unset POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD + assertEquals "%K{001} %F{226}Dur %f%F{226}0.03 %k%F{001}%f " "$(build_left_prompt)" } function testCommandExecutionTimePrecisionCouldBeChanged() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time) - POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0 - POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=4 - _P9K_COMMAND_DURATION=0.0001 + local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0 + local POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=4 - assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}0.0001 %k%F{red}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset _P9K_COMMAND_DURATION - unset POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION - unset POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD + # Override payload + local _P9K_COMMAND_DURATION=0.0001 + + assertEquals "%K{001} %F{226}Dur %f%F{226}0.0001 %k%F{001}%f " "$(build_left_prompt)" } function testCommandExecutionTimePrecisionCouldBeSetToZero() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time) - POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 - _P9K_COMMAND_DURATION=23.5001 + local POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 - assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}23 %k%F{red}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset _P9K_COMMAND_DURATION - unset POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION + # Override payload + local _P9K_COMMAND_DURATION=23.5001 + + assertEquals "%K{001} %F{226}Dur %f%F{226}23 %k%F{001}%f " "$(build_left_prompt)" } function testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time) - _P9K_COMMAND_DURATION=180 - assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}03:00 %k%F{red}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset _P9K_COMMAND_DURATION + # Override payload + local _P9K_COMMAND_DURATION=180 + + assertEquals "%K{001} %F{226}Dur %f%F{226}03:00 %k%F{001}%f " "$(build_left_prompt)" } function testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time) - _P9K_COMMAND_DURATION=7200 - assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}02:00:00 %k%F{red}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset _P9K_COMMAND_DURATION + # Override payload + local _P9K_COMMAND_DURATION=7200 + + assertEquals "%K{001} %F{226}Dur %f%F{226}02:00:00 %k%F{001}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/context.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/context.spec new file mode 100755 index 0000000..0730037 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/context.spec @@ -0,0 +1,113 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + # Test specific settings + OLD_DEFAULT_USER=$DEFAULT_USER + unset DEFAULT_USER +} + +function tearDown() { + # Restore old variables + [[ -n "$OLD_DEFAULT_USER" ]] && DEFAULT_USER=$OLD_DEFAULT_USER + + return 0 +} + +function testContextSegmentDoesNotGetRenderedWithDefaultUser() { + local DEFAULT_USER=$(whoami) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context custom_world) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() { + function sudo() { + return 0 + } + local SSH_CLIENT="putty" + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}%n@%m %k%F{000}%f " "$(build_left_prompt)" + + unfunction sudo +} + +function testContextSegmentWithForeignUser() { + function sudo() { + return 0 + } + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}%n@%m %k%F{000}%f " "$(build_left_prompt)" + + unfunction sudo +} + +# TODO: How to test root? +function testContextSegmentWithRootUser() { + startSkipping # Skip test + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}%n@%m %k%F{000}%f " "$(build_left_prompt)" +} + +function testOverridingContextTemplate() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + local POWERLEVEL9K_CONTEXT_TEMPLATE=xx + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}xx %k%F{000}%f " "$(build_left_prompt)" +} + +function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + local POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true + local DEFAULT_USER=$(whoami) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}%n@%m %k%F{000}%f " "$(build_left_prompt)" +} + +function testContextSegmentIsShownIfForced() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + local POWERLEVEL9K_ALWAYS_SHOW_USER=true + local DEFAULT_USER=$(whoami) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}$(whoami) %k%F{000}%f " "$(build_left_prompt)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/custom.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/custom.spec new file mode 100755 index 0000000..0f66c82 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/custom.spec @@ -0,0 +1,86 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" +} + +function testCustomDirectOutputSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local POWERLEVEL9K_CUSTOM_WORLD="echo world" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testCustomClosureSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + function p9k_hello_world() { + echo "world" + } + local POWERLEVEL9K_CUSTOM_WORLD='p9k_hello_world' + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testSettingBackgroundForCustomSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local POWERLEVEL9K_CUSTOM_WORLD="echo world" + local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND="yellow" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{000}world %k%F{003}%f " "$(build_left_prompt)" +} + +function testSettingForegroundForCustomSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local POWERLEVEL9K_CUSTOM_WORLD="echo world" + local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND="red" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{001}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testSettingVisualIdentifierForCustomSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local POWERLEVEL9K_CUSTOM_WORLD="echo world" + local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}hw %f%F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testSettingVisualIdentifierForegroundColorForCustomSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local POWERLEVEL9K_CUSTOM_WORLD="echo world" + local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw" + local POWERLEVEL9K_CUSTOM_WORLD_VISUAL_IDENTIFIER_COLOR="red" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{001}hw %f%F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/detect_virt.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/detect_virt.spec new file mode 100755 index 0000000..910f52e --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/detect_virt.spec @@ -0,0 +1,83 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + # Load Powerlevel9k + source powerlevel9k.zsh-theme +} + +function testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias systemd-detect-virt="novirt" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias systemd-detect-virt +} + +function testDetectVirtSegmentIfSystemdReturnsPlainName() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt) + alias systemd-detect-virt="echo 'xxx'" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}xxx %k%F{000}%f " "$(build_left_prompt)" + + unalias systemd-detect-virt +} + +function testDetectVirtSegmentIfRootFsIsOnExpectedInode() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt) + # Well. This is a weak test, as it fixates the implementation, + # but it is necessary, as the implementation relys on the root + # directory having the inode number "2".. + alias systemd-detect-virt="echo 'none'" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + # The original command in the implementation is "ls -di / | grep -o 2", + # which translates to: Show the inode number of "/" and test if it is "2". + alias ls="echo '2'" + + assertEquals "%K{000} %F{003}none %k%F{000}%f " "$(build_left_prompt)" + + unalias ls + unalias systemd-detect-virt +} + +function testDetectVirtSegmentIfRootFsIsNotOnExpectedInode() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt) + # Well. This is a weak test, as it fixates the implementation, + # but it is necessary, as the implementation relys on the root + # directory having the inode number "2".. + alias systemd-detect-virt="echo 'none'" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + # The original command in the implementation is "ls -di / | grep -o 2", + # which translates to: Show the inode number of "/" and test if it is "2". + alias ls="echo '3'" + + assertEquals "%K{000} %F{003}chroot %k%F{000}%f " "$(build_left_prompt)" + + unalias ls + unalias systemd-detect-virt +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/dir.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/dir.spec index b5fce59..7e65cb7 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/dir.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/dir.spec @@ -7,179 +7,199 @@ SHUNIT_PARENT=$0 function setUp() { export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme - # Every test should at least use the dir segment - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + P9K_HOME="${PWD}" } function tearDown() { - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + unset P9K_HOME } function testDirPathAbsoluteWorks() { - POWERLEVEL9K_DIR_PATH_ABSOLUTE=true + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_ABSOLUTE=true + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme cd ~ - assertEquals "%K{blue} %F{black}/home/travis %k%F{blue}%f " "$(build_left_prompt)" + + # Unfortunately, we cannot fake Linux or OSX here, because + # of /home or /Users path.. That is why we change the test + # according to the OS of the host. + if [[ "${OS}" == 'Linux' ]]; then + assertEquals "%K{004} %F{000}/home/${USER} %k%F{004}%f " "$(build_left_prompt)" + elif [[ "${OS}" == 'OSX' ]]; then + assertEquals "%K{004} %F{000}/Users/${USER} %k%F{004}%f " "$(build_left_prompt)" + fi cd - - unset POWERLEVEL9K_DIR_PATH_ABSOLUTE } function testTruncateFoldersWorks() { - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders' - FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}…/12345678/123456789 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}…/12345678/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - - unset FOLDER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testTruncateFolderWithHomeDirWorks() { - POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 - CURRENT_DIR=$(pwd) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 + local CURRENT_DIR=$(pwd) + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme cd ~ - FOLDER="powerlevel9k-test-${RANDOM}" + local FOLDER="powerlevel9k-test-${RANDOM}" mkdir -p $FOLDER cd $FOLDER # Switch back to home folder as this causes the problem. cd .. - assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}~ %k%F{004}%f " "$(build_left_prompt)" rmdir $FOLDER cd ${CURRENT_DIR} - - unset CURRENT_DIR - unset FOLDER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH } function testTruncateMiddleWorks() { - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle' - FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}/tmp/po…st/1/12/123/1234/12…45/12…56/12…67/12…78/123456789 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/po…st/1/12/123/1234/12…45/12…56/12…67/12…78/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - - unset FOLDER - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testTruncationFromRightWorks() { - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right' - FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - - unset FOLDER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testTruncateToLastWorks() { - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_last" + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_last" - FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}123456789 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - - unset FOLDER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testTruncateToFirstAndLastWorks() { - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_first_and_last" + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_first_and_last" - FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}/tmp/powerlevel9k-test/…/…/…/…/…/…/…/12345678/123456789 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/powerlevel9k-test/…/…/…/…/…/…/…/12345678/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - - unset FOLDER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testTruncateAbsoluteWorks() { - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY="truncate_absolute" + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_absolute" - FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}…89 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}…89 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - - unset FOLDER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testTruncationFromRightWithEmptyDelimiter() { - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_DELIMITER="" - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_DELIMITER="" + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right' - FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - - unset FOLDER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_DELIMITER - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testTruncateWithFolderMarkerWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) - POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker" + local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker" + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme local BASEFOLDER=/tmp/powerlevel9k-test local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567 @@ -187,20 +207,20 @@ function testTruncateWithFolderMarkerWorks() { # Setup folder marker touch $BASEFOLDER/1/12/.shorten_folder_marker cd $FOLDER - assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr $BASEFOLDER - unset BASEFOLDER - unset FOLDER - unset POWERLEVEL9K_SHORTEN_STRATEGY - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS } function testTruncateWithFolderMarkerWithChangedFolderMarker() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) - POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker" - POWERLEVEL9K_SHORTEN_FOLDER_MARKER='.xxx' + local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker" + local POWERLEVEL9K_SHORTEN_FOLDER_MARKER='.xxx' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme local BASEFOLDER=/tmp/powerlevel9k-test local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567 @@ -208,15 +228,10 @@ function testTruncateWithFolderMarkerWithChangedFolderMarker() { # Setup folder marker touch $BASEFOLDER/1/12/.xxx cd $FOLDER - assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr $BASEFOLDER - unset BASEFOLDER - unset FOLDER - unset POWERLEVEL9K_SHORTEN_FOLDER_MARKER - unset POWERLEVEL9K_SHORTEN_STRATEGY - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS } function testTruncateWithPackageNameWorks() { @@ -237,18 +252,19 @@ function testTruncateWithPackageNameWorks() { # Go back to deeper folder cd "${FOLDER}" + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name' + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name' - assertEquals "%K{blue} %F{black}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{blue}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{004} %F{000}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{004}%f " "$(build_left_prompt)" # Go back cd $p9kFolder rm -fr $BASEFOLDER - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_SHORTEN_STRATEGY - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH } function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() { @@ -276,18 +292,19 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() { # Go to deep folder inside linked repo cd linked-repo/asdfasdf/qwerqwer + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name' + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name' - assertEquals "%K{blue} %F{black}My_Package/as…/qwerqwer %k%F{blue}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{004} %F{000}My_Package/as…/qwerqwer %k%F{004}%f " "$(build_left_prompt)" # Go back cd $p9kFolder rm -fr $BASEFOLDER - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_SHORTEN_STRATEGY - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH } function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() { @@ -311,123 +328,162 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() { cd linked-repo/.git/refs/heads + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name' + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name' - assertEquals "%K{blue} %F{black}My_Package/.g…/re…/heads %k%F{blue}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{004} %F{000}My_Package/.g…/re…/heads %k%F{004}%f " "$(build_left_prompt)" # Go back cd $p9kFolder rm -fr $BASEFOLDER - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_SHORTEN_STRATEGY - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH } function testHomeFolderDetectionWorks() { - POWERLEVEL9K_HOME_ICON='home-icon' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_HOME_ICON='home-icon' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme cd ~ - assertEquals "%K{blue} %F{black%}home-icon %f%F{black}~ %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}home-icon %f%F{000}~ %k%F{004}%f " "$(build_left_prompt)" cd - - unset POWERLEVEL9K_HOME_ICON } function testHomeSubfolderDetectionWorks() { - POWERLEVEL9K_HOME_SUB_ICON='sub-icon' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_HOME_SUB_ICON='sub-icon' - FOLDER=~/powerlevel9k-test + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + local FOLDER=~/powerlevel9k-test mkdir $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black%}sub-icon %f%F{black}~/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}sub-icon %f%F{000}~/powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr $FOLDER - unset FOLDER - unset POWERLEVEL9K_HOME_SUB_ICON } function testOtherFolderDetectionWorks() { - POWERLEVEL9K_FOLDER_ICON='folder-icon' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_FOLDER_ICON='folder-icon' - FOLDER=/tmp/powerlevel9k-test + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + local FOLDER=/tmp/powerlevel9k-test mkdir $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}/tmp/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}folder-icon %f%F{000}/tmp/powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr $FOLDER - unset FOLDER - unset POWERLEVEL9K_FOLDER_ICON } function testChangingDirPathSeparator() { - POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local FOLDER="/tmp/powerlevel9k-test/1/2" mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - - unset FOLDER rm -fr /tmp/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_SEPARATOR } function testHomeFolderAbbreviation() { - local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) local dir=$PWD cd ~/ # default - POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~' - assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)" + local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{004} %F{000}~ %k%F{004}%f " "$(build_left_prompt)" # substituted - POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq' - assertEquals "%K{blue} %F{black}qQq %k%F{blue}%f " "$(build_left_prompt)" + local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{004} %F{000}qQq %k%F{004}%f " "$(build_left_prompt)" cd /tmp # default - POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~' - assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" + local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{004} %F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" # substituted - POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq' - assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" + local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{004} %F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" cd "$dir" } function testOmittingFirstCharacterWorks() { - POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true - POWERLEVEL9K_FOLDER_ICON='folder-icon' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true + local POWERLEVEL9K_FOLDER_ICON='folder-icon' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + cd /tmp - assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}tmp %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}folder-icon %f%F{000}tmp %k%F{004}%f " "$(build_left_prompt)" cd - - unset POWERLEVEL9K_FOLDER_ICON - unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER } function testOmittingFirstCharacterWorksWithChangingPathSeparator() { - POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true - POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' - POWERLEVEL9K_FOLDER_ICON='folder-icon' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true + local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' + local POWERLEVEL9K_FOLDER_ICON='folder-icon' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p /tmp/powerlevel9k-test/1/2 cd /tmp/powerlevel9k-test/1/2 - assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}folder-icon %f%F{000}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - unset POWERLEVEL9K_FOLDER_ICON - unset POWERLEVEL9K_DIR_PATH_SEPARATOR - unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER } # This test makes it obvious that combining a truncation strategy @@ -438,210 +494,278 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparator() { # But it does more sense in combination with other truncation # strategies. function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTruncation() { - POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true - POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true + local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p /tmp/powerlevel9k-test/1/2 cd /tmp/powerlevel9k-test/1/2 - assertEquals "%K{blue} %F{black}xXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}xXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_SEPARATOR - unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTruncation() { - POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true - POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true + local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p /tmp/powerlevel9k-test/1/2 cd /tmp/powerlevel9k-test/1/2 - assertEquals "%K{blue} %F{black}tmpxXxpo…stxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}tmpxXxpo…stxXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_SEPARATOR - unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncation() { - POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true - POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true + local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p /tmp/powerlevel9k-test/1/2 cd /tmp/powerlevel9k-test/1/2 - assertEquals "%K{blue} %F{black}tmpxXxpo…xXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}tmpxXxpo…xXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_SEPARATOR - unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testTruncateToUniqueWorks() { - POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true - POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' - POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 - POWERLEVEL9K_SHORTEN_STRATEGY='truncate_to_unique' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true + local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' + local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_to_unique' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p /tmp/powerlevel9k-test/adam/devl mkdir -p /tmp/powerlevel9k-test/alice/devl mkdir -p /tmp/powerlevel9k-test/alice/docs mkdir -p /tmp/powerlevel9k-test/bob/docs cd /tmp/powerlevel9k-test/alice/devl - assertEquals "%K{blue} %F{black}txXxpxXxalxXxde %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}txXxpxXxalxXxde %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_SEPARATOR - unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER - unset POWERLEVEL9K_SHORTEN_DIR_LENGTH - unset POWERLEVEL9K_SHORTEN_STRATEGY } function testBoldHomeDirWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + cd ~ - assertEquals "%K{blue} %F{black}%B~%b %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%B~%b %k%F{004}%f " "$(build_left_prompt)" cd - - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD } function testBoldHomeSubdirWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p ~/powerlevel9k-test cd ~/powerlevel9k-test - assertEquals "%K{blue} %F{black}~/%Bpowerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}~/%Bpowerlevel9k-test%b %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr ~/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD } function testBoldRootDirWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + cd / - assertEquals "%K{blue} %F{black}%B/%b %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%B/%b %k%F{004}%f " "$(build_left_prompt)" cd - - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD } function testBoldRootSubdirWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + cd /tmp - assertEquals "%K{blue} %F{black}/%Btmp%b %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/%Btmp%b %k%F{004}%f " "$(build_left_prompt)" cd - - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD } function testBoldRootSubSubdirWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p /tmp/powerlevel9k-test cd /tmp/powerlevel9k-test - assertEquals "%K{blue} %F{black}/tmp/%Bpowerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/%Bpowerlevel9k-test%b %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD } function testHighlightHomeWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + cd ~ - assertEquals "%K{blue} %F{black}%F{red}~ %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%F{red}~ %k%F{004}%f " "$(build_left_prompt)" cd - - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND } function testHighlightHomeSubdirWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p ~/powerlevel9k-test cd ~/powerlevel9k-test - assertEquals "%K{blue} %F{black}~/%F{red}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}~/%F{red}powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr ~/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND } function testHighlightRootWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + cd / - assertEquals "%K{blue} %F{black}%F{red}/ %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%F{red}/ %k%F{004}%f " "$(build_left_prompt)" cd - - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND } function testHighlightRootSubdirWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + cd /tmp - assertEquals "%K{blue} %F{black}/%F{red}tmp %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/%F{red}tmp %k%F{004}%f " "$(build_left_prompt)" cd - - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND } function testHighlightRootSubSubdirWorks() { - POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir /tmp/powerlevel9k-test cd /tmp/powerlevel9k-test - assertEquals "%K{blue} %F{black}/tmp/%F{red}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/%F{red}powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND } function testDirSeparatorColorHomeSubdirWorks() { - POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p ~/powerlevel9k-test cd ~/powerlevel9k-test - assertEquals "%K{blue} %F{black}~%F{red}/%F{black}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}~%F{red}/%F{black}powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr ~/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND } function testDirSeparatorColorRootSubSubdirWorks() { - POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + local POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + mkdir -p /tmp/powerlevel9k-test cd /tmp/powerlevel9k-test - assertEquals "%K{blue} %F{black}%F{red}/%F{black}tmp%F{red}/%F{black}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%F{red}/%F{black}tmp%F{red}/%F{black}powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test - unset POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/disk_usage.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/disk_usage.spec new file mode 100755 index 0000000..ebafe31 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/disk_usage.spec @@ -0,0 +1,131 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + # Test specific + P9K_HOME=$(pwd) + FOLDER=/tmp/powerlevel9k-test + mkdir -p $FOLDER + cd $FOLDER +} + +function tearDown() { + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test + unset FOLDER + unset P9K_HOME + + # Remove IP cache file + rm -f ${POWERLEVEL9K_PUBLIC_IP_FILE} +} + +function testDiskUsageSegmentWhenDiskIsAlmostFull() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) + df() { + echo "Filesystem 1K-blocks Used Available Use% Mounted on +/dev/disk1 487219288 471466944 15496344 97% /" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{001} %F{007}hdd %f%F{007}97%% %k%F{001}%f " "$(build_left_prompt)" + + unfunction df +} + +function testDiskUsageSegmentWhenDiskIsVeryFull() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) + df() { + echo "Filesystem 1K-blocks Used Available Use% Mounted on +/dev/disk1 487219288 471466944 15496344 94% /" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{000}hdd %f%F{000}94%% %k%F{003}%f " "$(build_left_prompt)" + + unfunction df +} + +function testDiskUsageSegmentWhenDiskIsQuiteEmpty() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) + df() { + echo "Filesystem 1K-blocks Used Available Use% Mounted on +/dev/disk1 487219288 471466944 15496344 4% /" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}hdd %f%F{003}4%% %k%F{000}%f " "$(build_left_prompt)" + + unfunction df +} + +function testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShouldBeDisplayed() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage custom_world) + df() { + echo "Filesystem 1K-blocks Used Available Use% Mounted on +/dev/disk1 487219288 471466944 15496344 4% /" + } + + local POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=true + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unfunction df +} + +function testDiskUsageSegmentWarningLevelCouldBeAdjusted() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) + local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=10 + df() { + echo "Filesystem 1K-blocks Used Available Use% Mounted on +/dev/disk1 487219288 471466944 15496344 11% /" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{000}hdd %f%F{000}11%% %k%F{003}%f " "$(build_left_prompt)" + + unfunction df +} + +function testDiskUsageSegmentCriticalLevelCouldBeAdjusted() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) + local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=5 + local POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=10 + df() { + echo "Filesystem 1K-blocks Used Available Use% Mounted on +/dev/disk1 487219288 471466944 15496344 11% /" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{001} %F{007}hdd %f%F{007}11%% %k%F{001}%f " "$(build_left_prompt)" + + unfunction df +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/go_version.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/go_version.spec index 9104ac8..d7a1c2c 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/go_version.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/go_version.spec @@ -7,8 +7,6 @@ SHUNIT_PARENT=$0 function setUp() { export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme } function mockGo() { @@ -35,52 +33,56 @@ function mockGoEmptyGopath() { function testGo() { alias go=mockGo - POWERLEVEL9K_GO_ICON="" + local POWERLEVEL9K_GO_ICON="" + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(go_version) - PWD="$HOME/go/src/github.com/bhilburn/powerlevel9k" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - assertEquals "%K{green} %F{grey93%} %f%F{grey93}go1.5.3 %k%F{green}%f " "$(build_left_prompt)" + local PWD="$HOME/go/src/github.com/bhilburn/powerlevel9k" + + assertEquals "%K{002} %F{255} %f%F{255}go1.5.3 %k%F{002}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_GO_ICON - unset PWD - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unalias go } function testGoSegmentPrintsNothingIfEmptyGopath() { - alias go=mockGoEmptyGopath - POWERLEVEL9K_CUSTOM_WORLD='echo world' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world go_version) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias go=mockGoEmptyGopath - assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_CUSTOM_WORLD + # Load Powerlevel9k + source powerlevel9k.zsh-theme + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testGoSegmentPrintsNothingIfNotInGopath() { - alias go=mockGo - POWERLEVEL9K_CUSTOM_WORLD='echo world' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world go_version) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias go=mockGo - assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_CUSTOM_WORLD + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testGoSegmentPrintsNothingIfGoIsNotAvailable() { - alias go=noGo - POWERLEVEL9K_CUSTOM_WORLD='echo world' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world go_version) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias go=noGo - assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_CUSTOM_WORLD unalias go } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/ip.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/ip.spec new file mode 100755 index 0000000..254f11c --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/ip.spec @@ -0,0 +1,231 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" +} + +function testIpSegmentPrintsNothingOnOsxIfNotConnected() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) + alias networksetup='echo "not connected"' + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local OS="OSX" # Fake OSX + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias networksetup +} + +function testIpSegmentPrintsNothingOnLinuxIfNotConnected() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) + alias ip='echo "not connected"' + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local OS="Linux" # Fake Linux + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias ip +} + +function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled. +(1) Ethernet +(Hardware Port: Ethernet, Device: en0) + +(2) FireWire +(Hardware Port: FireWire, Device: fw0) + +(3) Wi-Fi +(Hardware Port: Wi-Fi, Device: en1) + +(4) Bluetooth PAN +(Hardware Port: Bluetooth PAN, Device: en3) + +(5) Thunderbolt Bridge +(Hardware Port: Thunderbolt Bridge, Device: bridge0) + +(6) Apple USB Ethernet Adapter +(Hardware Port: Apple USB Ethernet Adapter, Device: en4) +'" + + alias ipconfig="_(){ echo '1.2.3.4'; };_" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local OS='OSX' # Fake OSX + + assertEquals "%K{006} %F{000}IP %f%F{000}1.2.3.4 %k%F{006}%f " "$(build_left_prompt)" + + unalias ipconfig + unalias networksetup +} + +# There could be more than one confiured network interfaces. +# `networksetup -listnetworkserviceorder` lists the interfaces +# in hierarchical order, but from outside this is not obvious +# (implementation detail). So we need a test for this case. +function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled. +(1) Ethernet +(Hardware Port: Ethernet, Device: en0) + +(2) FireWire +(Hardware Port: FireWire, Device: fw0) + +(3) Wi-Fi +(Hardware Port: Wi-Fi, Device: en1) + +(4) Bluetooth PAN +(Hardware Port: Bluetooth PAN, Device: en3) + +(5) Thunderbolt Bridge +(Hardware Port: Thunderbolt Bridge, Device: bridge0) + +(6) Apple USB Ethernet Adapter +(Hardware Port: Apple USB Ethernet Adapter, Device: en4) +'" + + # Return a unique IP address for every interface + ipconfig() { + case "${2}" { + en0) + echo 1.2.3.4 + ;; + fw0) + echo 2.3.4.5 + ;; + en1) + echo 3.4.5.6 + ;; + en3) + echo 4.5.6.7 + ;; + } + } + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local OS='OSX' # Fake OSX + + assertEquals "%K{006} %F{000}IP %f%F{000}1.2.3.4 %k%F{006}%f " "$(build_left_prompt)" + + unfunction ipconfig + unalias networksetup +} + +function testIpSegmentWorksOnOsxWithInterfaceSpecified() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + local POWERLEVEL9K_IP_INTERFACE='xxx' + alias ipconfig="_(){ echo '1.2.3.4'; };_" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local OS='OSX' # Fake OSX + + assertEquals "%K{006} %F{000}IP %f%F{000}1.2.3.4 %k%F{006}%f " "$(build_left_prompt)" + + unalias ipconfig +} + +function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() { + setopt aliases + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + # That command is harder to test, as it is used at first + # to get all relevant network interfaces and then for + # getting the configuration of that segment.. + ip(){ + if [[ "$*" == 'link ls up' ]]; then + echo "1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +2: eth0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 + link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff"; + fi + + if [[ "$*" == '-4 a show eth0' ]]; then + echo '2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 + inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0 + valid_lft forever preferred_lft forever'; + fi + } + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local OS='Linux' # Fake Linux + + assertEquals "%K{006} %F{000}IP %f%F{000}10.0.2.15 %k%F{006}%f " "$(build_left_prompt)" + + unfunction ip +} + +function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() { + setopt aliases + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + # That command is harder to test, as it is used at first + # to get all relevant network interfaces and then for + # getting the configuration of that segment.. + ip(){ + if [[ "$*" == 'link ls up' ]]; then + echo "1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +2: eth0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 + link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff +3: eth1: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 + link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff +4: wlan0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 + link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff"; + fi + + if [[ "$*" == '-4 a show eth1' ]]; then + echo '3: eth1: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 + inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0 + valid_lft forever preferred_lft forever'; + fi + } + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local OS='Linux' # Fake Linux + + assertEquals "%K{006} %F{000}IP %f%F{000}10.0.2.15 %k%F{006}%f " "$(build_left_prompt)" + + unfunction ip +} + +function testIpSegmentWorksOnLinuxWithInterfaceSpecified() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + local POWERLEVEL9K_IP_INTERFACE='xxx' + ip(){ + echo '2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 +inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0 + valid_lft forever preferred_lft forever'; + } + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local OS='Linux' # Fake Linux + + assertEquals "%K{006} %F{000}IP %f%F{000}10.0.2.15 %k%F{006}%f " "$(build_left_prompt)" + + unfunction ip +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/kubecontext.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/kubecontext.spec index 6381037..76b35c3 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/kubecontext.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/kubecontext.spec @@ -7,8 +7,6 @@ SHUNIT_PARENT=$0 function setUp() { export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme } function mockKubectl() { @@ -66,33 +64,41 @@ function mockKubectlOtherNamespace() { } function testKubeContext() { - alias kubectl=mockKubectl + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext) + alias kubectl=mockKubectl - assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/default %k%F{magenta}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{005} %F{007}⎈ %f%F{007}minikube/default %k%F{005}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unalias kubectl } function testKubeContextOtherNamespace() { - alias kubectl=mockKubectlOtherNamespace + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext) + alias kubectl=mockKubectlOtherNamespace - assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/kube-system %k%F{magenta}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{005} %F{007}⎈ %f%F{007}minikube/kube-system %k%F{005}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unalias kubectl } function testKubeContextPrintsNothingIfKubectlNotAvailable() { - alias kubectl=noKubectl - POWERLEVEL9K_CUSTOM_WORLD='echo world' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world kubecontext) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias kubectl=noKubectl - assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_CUSTOM_WORLD unalias kubectl } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/laravel_version.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/laravel_version.spec index 40b130d..c4f09e5 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/laravel_version.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/laravel_version.spec @@ -7,63 +7,66 @@ SHUNIT_PARENT=$0 function setUp() { export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme } function mockLaravelVersion() { case "$1" in "artisan") - echo "Laravel Framework version 5.4.23" + # artisan --version follows the format Laravel Framework + echo "Laravel Framework 5.4.23" ;; default) esac } function mockNoLaravelVersion() { - # This should output some error - >&2 echo "Artisan not available" - return 1 + # When php can't find a file it will output a message + echo "Could not open input file: artisan" + return 0 } function testLaravelVersionSegment() { - alias php=mockLaravelVersion - POWERLEVEL9K_LARAVEL_ICON='x' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(laravel_version) + local POWERLEVEL9K_LARAVEL_ICON='x' + alias php=mockLaravelVersion - assertEquals "%K{001} %F{white%}x %f%F{white}5.4.23 %k%F{maroon}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{009} %F{007}x %f%F{007}5.4.23 %k%F{009}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_LARAVEL_ICON unalias php } function testLaravelVersionSegmentIfArtisanIsNotAvailable() { - alias php=mockNoLaravelVersion - POWERLEVEL9K_CUSTOM_WORLD='echo world' - POWERLEVEL9K_LARAVEL_ICON='x' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world laravel_version) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local POWERLEVEL9K_LARAVEL_ICON='x' + alias php=mockNoLaravelVersion - assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_LARAVEL_ICON - unset POWERLEVEL9K_CUSTOM_WORLD unalias php } function testLaravelVersionSegmentPrintsNothingIfPhpIsNotAvailable() { - alias php=noPhp - POWERLEVEL9K_CUSTOM_WORLD='echo world' - POWERLEVEL9K_LARAVEL_ICON='x' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world laravel_version) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local POWERLEVEL9K_LARAVEL_ICON='x' + alias php=noPhp - assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_LARAVEL_ICON - unset POWERLEVEL9K_CUSTOM_WORLD unalias php } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/load.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/load.spec new file mode 100755 index 0000000..0f8ee33 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/load.spec @@ -0,0 +1,149 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and git init it. + FOLDER=/tmp/powerlevel9k-test/load-test + mkdir -p "${FOLDER}" + cd $FOLDER +} + +function tearDown() { + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test +} + +function testLoadSegmentWorksOnOsx() { + sysctl() { + if [[ "$*" == 'vm.loadavg' ]]; then + echo "vm.loadavg: { 1,38 1,45 2,16 }"; + fi + + if [[ "$*" == '-n hw.logicalcpu' ]]; then + echo "4"; + fi + } + + local POWERLEVEL9K_LOAD_WHICH=1 + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="OSX" # Fake OSX + + assertEquals "%K{002} %F{000}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})" + + unfunction sysctl +} + +function testLoadSegmentWorksOnBsd() { + sysctl() { + if [[ "$*" == 'vm.loadavg' ]]; then + echo "vm.loadavg: { 1,38 1,45 2,16 }"; + fi + + if [[ "$*" == '-n hw.ncpu' ]]; then + echo "4"; + fi + } + + local POWERLEVEL9K_LOAD_WHICH=1 + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="BSD" # Fake BSD + + assertEquals "%K{002} %F{000}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})" + + unfunction sysctl +} + +function testLoadSegmentWorksOnLinux() { + # Prepare loadavg + mkdir proc + echo "1.38 0.01 0.05 1/87 8641" > proc/loadavg + + alias nproc="echo 4" + local POWERLEVEL9K_LOAD_WHICH=1 + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="Linux" # Fake Linux + + assertEquals "%K{002} %F{000}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})" + + unalias nproc +} + +# Test normal state. This test is not OS specific. +# We test it as the Linux version, but that +# does not matter here. +function testLoadSegmentNormalState() { + # Prepare loadavg + mkdir proc + echo "1.00 0.01 0.05 1/87 8641" > proc/loadavg + + alias nproc="echo 4" + local POWERLEVEL9K_LOAD_WHICH=1 + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="Linux" # Fake Linux + + assertEquals "%K{002} %F{000}L %f%F{000}1.00 " "$(prompt_load left 1 false ${FOLDER})" + + unalias nproc +} + +# Test warning state. This test is not OS specific. +# We test it as the Linux version, but that +# does not matter here. +function testLoadSegmentWarningState() { + # Prepare loadavg + mkdir proc + echo "2.01 0.01 0.05 1/87 8641" > proc/loadavg + + alias nproc="echo 4" + local POWERLEVEL9K_LOAD_WHICH=1 + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="Linux" # Fake Linux + + assertEquals "%K{003} %F{000}L %f%F{000}2.01 " "$(prompt_load left 1 false ${FOLDER})" + + unalias nproc +} + +# Test critical state. This test is not OS specific. +# We test it as the Linux version, but that +# does not matter here. +function testLoadSegmentCriticalState() { + # Prepare loadavg + mkdir proc + echo "2.81 0.01 0.05 1/87 8641" > proc/loadavg + + alias nproc="echo 4" + local POWERLEVEL9K_LOAD_WHICH=1 + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="Linux" # Fake Linux + + assertEquals "%K{001} %F{000}L %f%F{000}2.81 " "$(prompt_load left 1 false ${FOLDER})" + + unalias nproc +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/node_version.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/node_version.spec new file mode 100755 index 0000000..69b9cbb --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/node_version.spec @@ -0,0 +1,41 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" +} + +function testNodeVersionSegmentPrintsNothingWithoutNode() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias node="nonode 2>/dev/null" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias node +} + +function testNodeVersionSegmentWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version) + node() { + echo "v1.2.3" + } + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{007}⬢ %f%F{007}1.2.3 %k%F{002}%f " "$(build_left_prompt)" + + unfunction node +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/nodeenv.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/nodeenv.spec new file mode 100755 index 0000000..2e9d779 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/nodeenv.spec @@ -0,0 +1,99 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + # Test specfic + # unset all possible user specified variables + unset NODE_VIRTUAL_ENV_DISABLE_PROMPT + unset NODE_VIRTUAL_ENV +} + +function testNodeenvSegmentPrintsNothingWithoutNode() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias node="nonode 2>/dev/null" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias node +} + +function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + node() { + echo "v1.2.3" + } + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unfunction node +} + +function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvDisablePromptIsSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + node() { + echo "v1.2.3" + } + NODE_VIRTUAL_ENV="node-env" + NODE_VIRTUAL_ENV_DISABLE_PROMPT=true + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unset NODE_VIRTUAL_ENV_DISABLE_PROMPT + unset NODE_VIRTUAL_ENV + unfunction node +} + +function testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv) + alias node="nonode 2>/dev/null" + NODE_VIRTUAL_ENV="node-env" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{002}⬢ %f%F{002}[node-env] %k%F{000}%f " "$(build_left_prompt)" + + unset NODE_VIRTUAL_ENV + unalias node +} + +function testNodeenvSegmentWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv) + node() { + echo "v1.2.3" + } + NODE_VIRTUAL_ENV="node-env" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{002}⬢ %f%F{002}v1.2.3[node-env] %k%F{000}%f " "$(build_left_prompt)" + + unfunction node + unset NODE_VIRTUAL_ENV +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/nvm.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/nvm.spec new file mode 100755 index 0000000..c9ed430 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/nvm.spec @@ -0,0 +1,72 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and git init it. + FOLDER=/tmp/powerlevel9k-test/nvm-test + mkdir -p "${FOLDER}/bin" + OLD_PATH=$PATH + PATH=${FOLDER}/bin:$PATH + cd $FOLDER +} + +function tearDown() { + # Restore old path + PATH="${OLD_PATH}" + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test +} + +function testNvmSegmentPrintsNothingIfNvmIsNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testNvmSegmentWorksWithoutHavingADefaultAlias() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm) + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + function nvm_version() { + [[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v1.4.0' + } + + assertEquals "%K{005} %F{000}⬢ %f%F{000}4.6.0 %k%F{005}%f " "$(build_left_prompt)" +} + +function testNvmSegmentPrintsNothingWhenOnDefaultVersion() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + function nvm_version() { + [[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v4.6.0' + } + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/php_version.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/php_version.spec new file mode 100755 index 0000000..6d64c57 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/php_version.spec @@ -0,0 +1,42 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" +} + +function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias php="nophp" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias php +} + +function testPhpVersionSegmentWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version) + alias php="echo 'PHP 5.6.27 (cli) (built: Oct 23 2016 11:47:58) +Copyright (c) 1997-2016 The PHP Group +Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies +'" + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{013} %F{255}PHP 5.6.27 %k%F{013}%f " "$(build_left_prompt)" + + unalias php +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/public_ip.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/public_ip.spec new file mode 100755 index 0000000..334a642 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/public_ip.spec @@ -0,0 +1,222 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + # Test specific + P9K_HOME=$(pwd) + FOLDER=/tmp/powerlevel9k-test + mkdir -p $FOLDER + cd $FOLDER + + # Change cache file, so that the users environment don't + # interfere with the tests. + POWERLEVEL9K_PUBLIC_IP_FILE=$FOLDER/public_ip_file +} + +function tearDown() { + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test + unset FOLDER + unset P9K_HOME + + # Unset cache file + unset POWERLEVEL9K_PUBLIC_IP_FILE +} + +function testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip custom_world) + local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz' + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + # We need to overwrite dig, as this is a fallback method that + # uses an alternative host. + alias dig='nodig' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias dig +} + +function testPublicIpSegmentPrintsNoticeIfNotConnected() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz' + local POWERLEVEL9K_PUBLIC_IP_NONE="disconnected" + # We need to overwrite dig, as this is a fallback method that + # uses an alternative host. + alias dig='nodig' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{007}disconnected %k%F{000}%f " "$(build_left_prompt)" + + unalias dig +} + +function testPublicIpSegmentWorksWithWget() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + alias dig='nodig' + alias curl='nocurl' + wget() { + echo "wget 1.2.3.4" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{007}wget 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)" + + unfunction wget + unalias dig + unalias curl +} + +function testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + alias dig='nodig' + alias wget='nowget' + curl() { + echo "curl 1.2.3.4" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{007}curl 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)" + + unfunction curl + unalias dig + unalias wget +} + +function testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + alias curl='nocurl' + alias wget='nowget' + dig() { + echo "dig 1.2.3.4" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{007}dig 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)" + + unfunction dig + unalias curl + unalias wget +} + +function testPublicIpSegmentCachesFile() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + dig() { + echo "first" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{007}first %k%F{000}%f " "$(build_left_prompt)" + + dig() { + echo "second" + } + + # Segment should not have changed! + assertEquals "%K{000} %F{007}first %k%F{000}%f " "$(build_left_prompt)" + + unfunction dig +} + +function testPublicIpSegmentRefreshesCachesFileAfterTimeout() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local POWERLEVEL9K_PUBLIC_IP_TIMEOUT=2 + dig() { + echo "first" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{007}first %k%F{000}%f " "$(build_left_prompt)" + + sleep 3 + dig() { + echo "second" + } + + # Segment should not have changed! + assertEquals "%K{000} %F{007}second %k%F{000}%f " "$(build_left_prompt)" + + unfunction dig +} + +function testPublicIpSegmentRefreshesCachesFileIfEmpty() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + dig() { + echo "first" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{007}first %k%F{000}%f " "$(build_left_prompt)" + + # Truncate cache file + echo "" >! $POWERLEVEL9K_PUBLIC_IP_FILE + + dig() { + echo "second" + } + + # Segment should not have changed! + assertEquals "%K{000} %F{007}second %k%F{000}%f " "$(build_left_prompt)" + + unfunction dig +} + +function testPublicIpSegmentWhenGoingOnline() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local POWERLEVEL9K_PUBLIC_IP_METHODS="dig" + local POWERLEVEL9K_PUBLIC_IP_NONE="disconnected" + alias dig="nodig" + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{007}disconnected %k%F{000}%f " "$(build_left_prompt)" + + unalias dig + + dig() { + echo "second" + } + + # Segment should not have changed! + assertEquals "%K{000} %F{007}second %k%F{000}%f " "$(build_left_prompt)" + + unfunction dig +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/ram.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/ram.spec new file mode 100755 index 0000000..2c9f169 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/ram.spec @@ -0,0 +1,66 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and git init it. + FOLDER=/tmp/powerlevel9k-test/ram-test + mkdir -p "${FOLDER}" + cd $FOLDER +} + +function tearDown() { + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test +} + +function testRamSegmentWorksOnOsx() { + alias vm_stat="echo 'Mach Virtual Memory Statistics: (page size of 4096 bytes) +Pages free: 299687. +Pages active: 1623792. +Pages inactive: 1313411. +'" + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="OSX" # Fake OSX + + assertEquals "%K{003} %F{000}RAM %f%F{000}6.15G " "$(prompt_ram left 1 false ${FOLDER})" + + unalias vm_stat +} + +function testRamSegmentWorksOnBsd() { + mkdir -p var/run + echo "avail memory 5678B 299687 4444G 299" > var/run/dmesg.boot + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="BSD" # Fake BSD + + assertEquals "%K{003} %F{000}RAM %f%F{000}0.29M " "$(prompt_ram left 1 false ${FOLDER})" +} + +function testRamSegmentWorksOnLinux() { + mkdir proc + echo "MemAvailable: 299687" > proc/meminfo + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="Linux" # Fake Linux + + assertEquals "%K{003} %F{000}RAM %f%F{000}0.29G " "$(prompt_ram left 1 false ${FOLDER})" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/rust_version.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/rust_version.spec index 34883a1..07331ed 100755 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/rust_version.spec +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/rust_version.spec @@ -14,8 +14,6 @@ function setUp() { PATH="${RUST_TEST_FOLDER}:${PATH}" export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme } function tearDown() { @@ -29,22 +27,25 @@ function mockRust() { } function testRust() { - mockRust + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version) + mockRust - assertEquals "%K{208} %F{black%}Rust %f%F{black}0.4.1a-alpha %k%F{darkorange}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + assertEquals "%K{208} %F{000}Rust %f%F{000}0.4.1a-alpha %k%F{208}%f " "$(build_left_prompt)" } function testRustPrintsNothingIfRustIsNotAvailable() { - POWERLEVEL9K_CUSTOM_WORLD='echo world' + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world rust_version) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' - assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source powerlevel9k.zsh-theme - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_CUSTOM_WORLD + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/ssh.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/ssh.spec new file mode 100755 index 0000000..3245231 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/ssh.spec @@ -0,0 +1,80 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" +} + +function testSshSegmentPrintsNothingIfNoSshConnection() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo "world"' + local POWERLEVEL9K_SSH_ICON="ssh-icon" + # Weak test: Emulate No SSH connection by unsetting + # $SSH_CLIENT and $SSH_TTY + unset SSH_CLIENT + unset SSH_TTY + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testSshSegmentWorksIfOnlySshClientIsSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh) + local POWERLEVEL9K_SSH_ICON="ssh-icon" + # Weak test: Emulate No SSH connection by unsetting + # $SSH_CLIENT and $SSH_TTY + SSH_CLIENT='ssh-client' + unset SSH_TTY + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)" + + unset SSH_CLIENT +} + +function testSshSegmentWorksIfOnlySshTtyIsSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh) + local POWERLEVEL9K_SSH_ICON="ssh-icon" + # Weak test: Emulate No SSH connection by unsetting + # $SSH_CLIENT and $SSH_TTY + SSH_TTY='ssh-tty' + unset SSH_CLIENT + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)" + + unset SSH_TTY +} + +function testSshSegmentWorksIfAllNecessaryVariablesAreSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh) + local POWERLEVEL9K_SSH_ICON="ssh-icon" + # Weak test: Emulate No SSH connection by unsetting + # $SSH_CLIENT and $SSH_TTY + SSH_CLIENT='ssh-client' + SSH_TTY='ssh-tty' + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{003}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)" + + unset SSH_TTY + unset SSH_CLIENT +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/status.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/status.spec new file mode 100755 index 0000000..9fb34e0 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/status.spec @@ -0,0 +1,113 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + ### Test specific + # Resets if someone has set these in his/hers env + unset POWERLEVEL9K_STATUS_VERBOSE + unset POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE +} + +function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local POWERLEVEL9K_STATUS_VERBOSE=false + local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local POWERLEVEL9K_STATUS_VERBOSE=true + local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false + local POWERLEVEL9K_STATUS_HIDE_SIGNAME=true + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{002}✔%f %k%F{000}%f " "$(build_left_prompt)" +} + +function testStatusInGeneralErrorCase() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local POWERLEVEL9K_STATUS_VERBOSE=true + local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local RETVAL=1 + + assertEquals "%K{001} %F{226}↵ %f%F{226}1 %k%F{001}%f " "$(build_left_prompt)" +} + +function testPipestatusInErrorCase() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local POWERLEVEL9K_STATUS_VERBOSE=true + local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local -a RETVALS + RETVALS=(0 0 1 0) + + assertEquals "%K{001} %F{226}↵ %f%F{226}0|0|1|0 %k%F{001}%f " "$(build_left_prompt)" +} + +function testStatusCrossWinsOverVerbose() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false + local POWERLEVEL9K_STATUS_VERBOSE=true + local POWERLEVEL9K_STATUS_CROSS=true + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local RETVAL=1 + + assertEquals "%K{000} %F{001}✘%f %k%F{000}%f " "$(build_left_prompt)" +} + +function testStatusShowsSignalNameInErrorCase() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false + local POWERLEVEL9K_STATUS_VERBOSE=true + local POWERLEVEL9K_STATUS_HIDE_SIGNAME=false + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + local RETVAL=132 + + assertEquals "%K{001} %F{226}↵ %f%F{226}SIGILL(4) %k%F{001}%f " "$(build_left_prompt)" +} + +function testStatusSegmentIntegrated() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() + local POWERLEVEL9K_STATUS_CROSS=true + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + false; powerlevel9k_prepare_prompts + + assertEquals "%f%b%k%K{000} %F{001}✘%f %k%F{000}%f " "${(e)PROMPT}" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/swap.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/swap.spec new file mode 100755 index 0000000..7db5416 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/swap.spec @@ -0,0 +1,58 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and git init it. + FOLDER=/tmp/powerlevel9k-test/swap-test + mkdir -p "${FOLDER}" + cd $FOLDER +} + +function tearDown() { + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test +} + +function testSwapSegmentWorksOnOsx() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap) + sysctl() { + echo "vm.swapusage: total = 3072,00M used = 1620,50M free = 1451,50M (encrypted)" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="OSX" # Fake OSX + + assertEquals "%K{003} %F{000}SWP %f%F{000}1.58G " "$(prompt_swap left 1 false ${FOLDER})" + + unfunction sysctl +} + +function testSwapSegmentWorksOnLinux() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap) + mkdir proc + echo "SwapTotal: 1000000" > proc/meminfo + echo "SwapFree: 1000" >> proc/meminfo + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + local OS="Linux" # Fake Linux + + assertEquals "%K{003} %F{000}SWP %f%F{000}0.95G " "$(prompt_swap left 1 false ${FOLDER})" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/swift_version.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/swift_version.spec new file mode 100755 index 0000000..47fc0b7 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/swift_version.spec @@ -0,0 +1,57 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and git init it. + FOLDER=/tmp/powerlevel9k-test + mkdir -p "${FOLDER}" + cd $FOLDER +} + +function tearDown() { + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test +} + +function testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias swift="noswift" + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias swift +} + +function testSwiftSegmentWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version) + function swift() { + echo "Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)\nTarget: x86_64-apple-macosx10.9" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{005} %F{007}Swift %f%F{007}3.0.1 %k%F{005}%f " "$(build_left_prompt)" + + unfunction swift +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/symfony_version.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/symfony_version.spec new file mode 100755 index 0000000..cb48072 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/symfony_version.spec @@ -0,0 +1,117 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and git init it. + FOLDER=/tmp/powerlevel9k-test + mkdir -p "${FOLDER}" + cd $FOLDER +} + +function tearDown() { + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test +} + +function testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + alias php="nophp" + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unalias php +} + +function testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world) + # "Symfony" is not a command, but rather a framework. + # To sucessfully execute this test, we just need to + # navigate into a folder that does not contain symfony. + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + mkdir app + touch app/AppKernel.php + function php() { + echo "Warning: Unsupported declare strict_types in /Users/dr/Privat/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php on line 19 + + Parse error: parse error, expecting `;´ or `{´ in /Users/dr/Privat/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php on line 97" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" + + unfunction php +} + +function testSymfonyVersionSegmentWorks() { + startSkipping # Skip test + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version) + mkdir app + touch app/AppKernel.php + + function php() { + echo "Symfony version 3.1.4 - app/dev/debug" + } + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{240} %F{000}SF %f%F{000}3.1.4 %k%F{240}%f " "$(build_left_prompt)" + + unfunction php +} + +function testSymfonyVersionSegmentWorksInNestedFolder() { + startSkipping # Skip test + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version) + mkdir app + touch app/AppKernel.php + + function php() { + echo "Symfony version 3.1.4 - app/dev/debug" + } + + mkdir -p src/P9K/AppBundle + cd src/P9K/AppBundle + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{240} %F{000}SF %f%F{000}3.1.4 %k%F{240}%f " "$(build_left_prompt)" + + unfunction php +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/todo.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/todo.spec new file mode 100755 index 0000000..875c45f --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/todo.spec @@ -0,0 +1,58 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and git init it. + FOLDER=/tmp/powerlevel9k-test + mkdir -p "${FOLDER}" + mkdir ${FOLDER}/bin + OLD_PATH=$PATH + PATH=${FOLDER}/bin:$PATH + cd $FOLDER +} + +function tearDown() { + # Reset PATH + PATH=$OLD_PATH + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test +} + +function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" +} + +function testTodoSegmentWorksAsExpected() { + # TODO: Skript in den PATH legen! + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo) + echo '#!/bin/sh' > ${FOLDER}/bin/todo.sh + echo 'echo "TODO: 34 of 100 tasks shown";' >> ${FOLDER}/bin/todo.sh + chmod +x ${FOLDER}/bin/todo.sh + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{244} %F{000}☑ %f%F{000}100 %k%F{244}%f " "$(build_left_prompt)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vcs-git.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vcs-git.spec new file mode 100755 index 0000000..bddecf6 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vcs-git.spec @@ -0,0 +1,378 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and git init it. + FOLDER=/tmp/powerlevel9k-test/vcs-test + mkdir -p "${FOLDER}" + cd $FOLDER + + # Set username and email + OLD_GIT_AUTHOR_NAME=$GIT_AUTHOR_NAME + GIT_AUTHOR_NAME="Testing Tester" + OLD_GIT_AUTHOR_EMAIL=$GIT_AUTHOR_EMAIL + GIT_AUTHOR_EMAIL="test@powerlevel9k.theme" + + # Set default username if not already set! + if [[ -z $(git config user.name) ]]; then + GIT_AUTHOR_NAME_SET_BY_TEST=true + git config --global user.name "${GIT_AUTHOR_NAME}" + fi + # Set default email if not already set! + if [[ -z $(git config user.email) ]]; then + GIT_AUTHOR_EMAIL_SET_BY_TEST=true + git config --global user.email "${GIT_AUTHOR_EMAIL}" + fi + + # Initialize FOLDER as git repository + git init 1>/dev/null +} + +function tearDown() { + if [[ -n "${OLD_GIT_AUTHOR_NAME}" ]]; then + GIT_AUTHOR_NAME=$OLD_GIT_AUTHOR + unset OLD_GIT_AUTHOR_NAME + else + unset GIT_AUTHOR_NAME + fi + + if [[ -n "${OLD_GIT_AUTHOR_EMAIL}" ]]; then + GIT_AUTHOR_EMAIL=$OLD_GIT_AUTHOR_EMAIL + unset OLD_GIT_AUTHOR_EMAIL + else + unset GIT_AUTHOR_EMAIL + fi + + if [[ "${GIT_AUTHOR_NAME_SET_BY_TEST}" == "true" ]]; then + git config --global --unset user.name + fi + if [[ "${GIT_AUTHOR_EMAIL_SET_BY_TEST}" == "true" ]]; then + git config --global --unset user.email + fi + + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test + unset FOLDER +} + +function testColorOverridingForCleanStateWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan' + local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{006} master %k%F{007}%f " "$(build_left_prompt)" +} + +function testColorOverridingForModifiedStateWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red' + local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow' + + touch testfile + git add testfile + git commit -m "test" 1>/dev/null + echo "test" > testfile + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{001} master ● %k%F{003}%f " "$(build_left_prompt)" +} + +function testColorOverridingForUntrackedStateWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='cyan' + local POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow' + + touch testfile + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{006} master ? %k%F{003}%f " "$(build_left_prompt)" +} + +function testGitIconWorks() { + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_GIT_ICON='Git-Icon' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000}Git-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)" +} + +function testGitlabIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_GIT_GITLAB_ICON='GL-Icon' + + # Add a GitLab project as remote origin. This is + # sufficient to show the GitLab-specific icon. + git remote add origin https://gitlab.com/dritter/gitlab-test-project.git + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000}GL-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)" +} + +function testBitbucketIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON='BB-Icon' + + # Add a BitBucket project as remote origin. This is + # sufficient to show the BitBucket-specific icon. + git remote add origin https://dritter@bitbucket.org/dritter/dr-test.git + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000}BB-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)" +} + +function testGitHubIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_GIT_GITHUB_ICON='GH-Icon' + + # Add a GitHub project as remote origin. This is + # sufficient to show the GitHub-specific icon. + git remote add origin https://github.com/dritter/test.git + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000}GH-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)" +} + +function testUntrackedFilesIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_UNTRACKED_ICON='?' + + # Create untracked file + touch "i-am-untracked.txt" + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)" +} + +function testStagedFilesIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_STAGED_ICON='+' + + # Create staged file + touch "i-am-added.txt" + git add i-am-added.txt &>/dev/null + git commit -m "initial commit" &>/dev/null + echo "xx" >> i-am-added.txt + git add i-am-added.txt &>/dev/null + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{000} master + %k%F{003}%f " "$(build_left_prompt)" +} + +function testUnstagedFilesIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_UNSTAGED_ICON='M' + + # Create unstaged (modified, but not added to index) file + touch "i-am-modified.txt" + git add i-am-modified.txt + git commit -m "Add File" 1>/dev/null + echo "xx" > i-am-modified.txt + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{000} master M %k%F{003}%f " "$(build_left_prompt)" +} + +function testStashIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_STASH_ICON='S' + + # Create modified file + touch "i-am-modified.txt" + git add i-am-modified.txt + git commit -m "Add File" 1>/dev/null + echo "xx" > i-am-modified.txt + git stash 1>/dev/null + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000} master S1 %k%F{002}%f " "$(build_left_prompt)" +} + +function testTagIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_TAG_ICON='T' + + touch "file.txt" + git add file.txt + git commit -m "Add File" 1>/dev/null + git tag "v0.0.1" + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000} master Tv0.0.1 %k%F{002}%f " "$(build_left_prompt)" +} + +function testTagIconInDetachedHeadState() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_TAG_ICON='T' + + touch "file.txt" + git add file.txt + git commit -m "Add File" &>/dev/null + git tag "v0.0.1" + touch "file2.txt" + git add file2.txt + git commit -m "Add File2" &>/dev/null + git checkout v0.0.1 &>/dev/null + local hash=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD) + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000} ${hash} Tv0.0.1 %k%F{002}%f " "$(build_left_prompt)" +} + +function testActionHintWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + + touch "i-am-modified.txt" + git add i-am-modified.txt + git commit -m "Add File" &>/dev/null + + git clone . ../vcs-test2 &>/dev/null + echo "xx" >> i-am-modified.txt + git commit -a -m "Modified file" &>/dev/null + + cd ../vcs-test2 + echo "yy" >> i-am-modified.txt + git commit -a -m "Provoke conflict" &>/dev/null + git pull &>/dev/null + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{000} master %F{red}| merge%f %k%F{003}%f " "$(build_left_prompt)" +} + +function testIncomingHintWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='I' + + touch "i-am-modified.txt" + git add i-am-modified.txt + git commit -m "Add File" &>/dev/null + + git clone . ../vcs-test2 &>/dev/null + echo "xx" >> i-am-modified.txt + git commit -a -m "Modified file" &>/dev/null + + cd ../vcs-test2 + git fetch &>/dev/null + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000} master I1 %k%F{002}%f " "$(build_left_prompt)" +} + +function testOutgoingHintWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='o' + + touch "i-am-modified.txt" + git add i-am-modified.txt + git commit -m "Add File" &>/dev/null + + git clone . ../vcs-test2 &>/dev/null + + cd ../vcs-test2 + + echo "xx" >> i-am-modified.txt + git commit -a -m "Modified file" &>/dev/null + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000} master o1 %k%F{002}%f " "$(build_left_prompt)" +} + +function testShorteningCommitHashWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_SHOW_CHANGESET=true + local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4' + + touch "file.txt" + git add file.txt + git commit -m "Add File" 1>/dev/null + local hash=$(git rev-list -n 1 --abbrev-commit --abbrev=3 HEAD) + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + # This test needs to call powerlevel9k_vcs_init, where + # the changeset is truncated. + powerlevel9k_vcs_init + assertEquals "%K{002} %F{000}${hash}  master %k%F{002}%f " "$(build_left_prompt)" +} + +function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_SHOW_CHANGESET=false + local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4' + + touch "file.txt" + git add file.txt + git commit -m "Add File" 1>/dev/null + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + # This test needs to call powerlevel9k_vcs_init, where + # the changeset is truncated. + powerlevel9k_vcs_init + assertEquals "%K{002} %F{000} master %k%F{002}%f " "$(build_left_prompt)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vcs-hg.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vcs-hg.spec new file mode 100755 index 0000000..2903f54 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vcs-hg.spec @@ -0,0 +1,207 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and hg init it. + FOLDER=/tmp/powerlevel9k-test/vcs-test + mkdir -p "${FOLDER}" + cd $FOLDER + + export HGUSER="Test bot " + + hg init 1>/dev/null +} + +function tearDown() { + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" &>/dev/null + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test &>/dev/null + unset FOLDER + unset HGUSER +} + +function testColorOverridingForCleanStateWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan' + local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{007} %F{006} default %k%F{007}%f " "$(build_left_prompt)" +} + +function testColorOverridingForModifiedStateWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red' + local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow' + + touch testfile + hg add testfile + hg commit -m "test" 1>/dev/null + echo "test" > testfile + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{001} default ● %k%F{003}%f " "$(build_left_prompt)" +} + +# There is no staging area in mercurial, therefore there are no "untracked" +# files.. In case there are added files, we show the VCS segment with a +# yellow background. +# This may be improved in future versions, to be a bit more consistent with +# the git part. +function testAddedFilesIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + touch "myfile.txt" + hg add myfile.txt + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{000} default ● %k%F{003}%f " "$(build_left_prompt)" +} + +# We don't support tagging in mercurial right now.. +function testTagIconWorks() { + startSkipping # Skip test + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_TAG_ICON='T' + + touch "file.txt" + hg add file.txt + hg commit -m "Add File" 1>/dev/null + hg tag "v0.0.1" + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000} default Tv0.0.1 %k%F{002}%f " "$(build_left_prompt)" +} + +function testTagIconInDetachedHeadState() { + startSkipping # Skip test + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_TAG_ICON='T' + + touch "file.txt" + hg add file.txt + hg commit -m "Add File" &>/dev/null + hg tag "v0.0.1" + touch "file2.txt" + hg add file2.txt + hg commit -m "Add File2" &>/dev/null + hg checkout v0.0.1 &>/dev/null + local hash=$(hg id) + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000} ${hash} Tv0.0.1 %k%F{002}%f " "$(build_left_prompt)" +} + +function testActionHintWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + touch "i-am-modified.txt" + hg add i-am-modified.txt + hg commit -m "Add File" &>/dev/null + + hg clone . ../vcs-test2 &>/dev/null + echo "xx" >> i-am-modified.txt + hg commit -m "Modified file" &>/dev/null + + cd ../vcs-test2 + echo "yy" >> i-am-modified.txt + hg commit -m "Provoke conflict" 2>/dev/null + hg pull 1>/dev/null + hg merge --tool internal:merge >/dev/null 2>&1 + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{003} %F{000} default %F{red}| merging%f %k%F{003}%f " "$(build_left_prompt)" +} + +function testShorteningCommitHashWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_SHOW_CHANGESET=true + local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4' + + touch "file.txt" + hg add file.txt + hg commit -m "Add File" 1>/dev/null + local hash=$(hg id | head -c ${POWERLEVEL9K_CHANGESET_HASH_LENGTH}) + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + # This test needs to call powerlevel9k_vcs_init, where + # the changeset is truncated. + powerlevel9k_vcs_init + + assertEquals "%K{002} %F{000}${hash}  default %k%F{002}%f " "$(build_left_prompt)" +} + +function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_SHOW_CHANGESET=false + local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4' + + touch "file.txt" + hg add file.txt + hg commit -m "Add File" 1>/dev/null + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + # This test needs to call powerlevel9k_vcs_init, where + # the changeset is truncated. + powerlevel9k_vcs_init + + assertEquals "%K{002} %F{000} default %k%F{002}%f " "$(build_left_prompt)" +} + +function testMercurialIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_HG_ICON='HG-Icon' + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000}HG-Icon %f%F{000} default %k%F{002}%f " "$(build_left_prompt)" +} + +function testBookmarkIconWorks() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local POWERLEVEL9K_VCS_BOOKMARK_ICON='B' + hg bookmark "initial" + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{002} %F{000} default Binitial %k%F{002}%f " "$(build_left_prompt)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vcs.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vcs.spec deleted file mode 100755 index f6474f6..0000000 --- a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vcs.spec +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env zsh -#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 - -# Required for shunit2 to run correctly -setopt shwordsplit -SHUNIT_PARENT=$0 - -function setUp() { - export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme -} - -function testColorOverridingForCleanStateWorks() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan' - POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white' - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - - assertEquals "%K{white} %F{cyan} master %k%F{white}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_CLEAN_FOREGROUND - unset POWERLEVEL9K_VCS_CLEAN_BACKGROUND -} - -function testColorOverridingForModifiedStateWorks() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red' - POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow' - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - git config user.email "test@powerlevel9k.theme" - git config user.name "Testing Tester" - touch testfile - git add testfile - git commit -m "test" 1>/dev/null - echo "test" > testfile - - assertEquals "%K{yellow} %F{red} master ● %k%F{yellow}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_MODIFIED_FOREGROUND - unset POWERLEVEL9K_VCS_MODIFIED_BACKGROUND -} - -function testColorOverridingForUntrackedStateWorks() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='cyan' - POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow' - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - touch testfile - - assertEquals "%K{yellow} %F{cyan} master ? %k%F{yellow}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND - unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND -} - -function testBranchNameTruncatingShortenLength() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_SHORTEN_LENGTH=6 - POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=3 - POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_from_right" - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - touch testfile - - assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)" - - POWERLEVEL9K_VCS_SHORTEN_LENGTH=3 - assertEquals "%K{green} %F{black} mas… ? %k%F{green}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_SHORTEN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_STRATEGY -} - -function testBranchNameTruncatingMinLength() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_SHORTEN_LENGTH=3 - POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=6 - POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_from_right" - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - touch testfile - - assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)" - - POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=7 - - assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_SHORTEN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_STRATEGY -} - -function testBranchNameTruncatingShortenStrategy() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_SHORTEN_LENGTH=3 - POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=3 - POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_from_right" - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - touch testfile - - assertEquals "%K{green} %F{black} mas… ? %k%F{green}%f " "$(build_left_prompt)" - - POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_middle" - - assertEquals "%K{green} %F{black} mas…ter ? %k%F{green}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_SHORTEN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_STRATEGY -} - -source shunit2/source/2.1/src/shunit2 diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vi_mode.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vi_mode.spec new file mode 100755 index 0000000..6a3a07b --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/segments/vi_mode.spec @@ -0,0 +1,48 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" +} + +function testViInsertModeWorks() { + local KEYMAP='viins' + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{004}INSERT " "$(prompt_vi_mode left 1 false)" +} + +function testViInsertModeWorksWhenLabeledAsMain() { + local KEYMAP='main' + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{004}INSERT " "$(prompt_vi_mode left 1 false)" +} + +function testViCommandModeWorks() { + local KEYMAP='vicmd' + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{007}NORMAL " "$(prompt_vi_mode left 1 false)" +} + +function testViInsertModeStringIsCustomizable() { + local KEYMAP='viins' + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + assertEquals "%K{000} %F{004}INSERT " "$(prompt_vi_mode left 1 false)" +} + +source shunit2/shunit2 \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/powerlevel9k/test/suite.spec b/.zprezto/modules/prompt/external/powerlevel9k/test/suite.spec new file mode 100755 index 0000000..0e51d32 --- /dev/null +++ b/.zprezto/modules/prompt/external/powerlevel9k/test/suite.spec @@ -0,0 +1,17 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +local failed=false + +for test in **/*.spec; do + echo + echo "Now executing ${test}" + if [[ "${test}" == "test/suite.spec" ]]; then + continue; + fi + ./${test} || failed=true +done + +if [[ "${failed}" == "true" ]]; then + exit 1 +fi \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/pure/package.json b/.zprezto/modules/prompt/external/pure/package.json index 0d5a8cc..467f8f4 100644 --- a/.zprezto/modules/prompt/external/pure/package.json +++ b/.zprezto/modules/prompt/external/pure/package.json @@ -1,6 +1,6 @@ { "name": "pure-prompt", - "version": "1.7.0", + "version": "1.8.0", "description": "Pretty, minimal and fast ZSH prompt", "license": "MIT", "repository": "sindresorhus/pure", diff --git a/.zprezto/modules/prompt/external/pure/pure.plugin.zsh b/.zprezto/modules/prompt/external/pure/pure.plugin.zsh deleted file mode 100644 index 2fd19e8..0000000 --- a/.zprezto/modules/prompt/external/pure/pure.plugin.zsh +++ /dev/null @@ -1,486 +0,0 @@ -# Pure -# by Sindre Sorhus -# https://github.com/sindresorhus/pure -# MIT License - -# For my own and others sanity -# git: -# %b => current branch -# %a => current action (rebase/merge) -# prompt: -# %F => color dict -# %f => reset color -# %~ => current path -# %* => time -# %n => username -# %m => shortname host -# %(?..) => prompt conditional - %(condition.true.false) -# terminal codes: -# \e7 => save cursor position -# \e[2A => move cursor 2 lines up -# \e[1G => go to position 1 in terminal -# \e8 => restore cursor position -# \e[K => clears everything after the cursor on the current line -# \e[2K => clear everything on the current line - - -# turns seconds into human readable time -# 165392 => 1d 21h 56m 32s -# https://github.com/sindresorhus/pretty-time-zsh -prompt_pure_human_time_to_var() { - local human total_seconds=$1 var=$2 - local days=$(( total_seconds / 60 / 60 / 24 )) - local hours=$(( total_seconds / 60 / 60 % 24 )) - local minutes=$(( total_seconds / 60 % 60 )) - local seconds=$(( total_seconds % 60 )) - (( days > 0 )) && human+="${days}d " - (( hours > 0 )) && human+="${hours}h " - (( minutes > 0 )) && human+="${minutes}m " - human+="${seconds}s" - - # store human readable time in variable as specified by caller - typeset -g "${var}"="${human}" -} - -# stores (into prompt_pure_cmd_exec_time) the exec time of the last command if set threshold was exceeded -prompt_pure_check_cmd_exec_time() { - integer elapsed - (( elapsed = EPOCHSECONDS - ${prompt_pure_cmd_timestamp:-$EPOCHSECONDS} )) - typeset -g prompt_pure_cmd_exec_time= - (( elapsed > ${PURE_CMD_MAX_EXEC_TIME:-5} )) && { - prompt_pure_human_time_to_var $elapsed "prompt_pure_cmd_exec_time" - } -} - -prompt_pure_set_title() { - setopt localoptions noshwordsplit - - # emacs terminal does not support settings the title - (( ${+EMACS} )) && return - - case $TTY in - # Don't set title over serial console. - /dev/ttyS[0-9]*) return;; - esac - - # tell the terminal we are setting the title - print -n '\e]0;' - # show hostname if connected through ssh - [[ -n $SSH_CONNECTION ]] && print -Pn '(%m) ' - case $1 in - expand-prompt) - print -Pn $2;; - ignore-escape) - print -rn $2;; - esac - # end set title - print -n '\a' -} - -prompt_pure_preexec() { - if [[ -n $prompt_pure_git_fetch_pattern ]]; then - # detect when git is performing pull/fetch (including git aliases). - local -H MATCH MBEGIN MEND match mbegin mend - if [[ $2 =~ (git|hub)\ (.*\ )?($prompt_pure_git_fetch_pattern)(\ .*)?$ ]]; then - # we must flush the async jobs to cancel our git fetch in order - # to avoid conflicts with the user issued pull / fetch. - async_flush_jobs 'prompt_pure' - fi - fi - - typeset -g prompt_pure_cmd_timestamp=$EPOCHSECONDS - - # shows the current dir and executed command in the title while a process is active - prompt_pure_set_title 'ignore-escape' "$PWD:t: $2" - - # Disallow python virtualenv from updating the prompt, set it to 12 if - # untouched by the user to indicate that Pure modified it. Here we use - # magic number 12, same as in psvar. - export VIRTUAL_ENV_DISABLE_PROMPT=${VIRTUAL_ENV_DISABLE_PROMPT:-12} -} - -# string length ignoring ansi escapes -prompt_pure_string_length_to_var() { - local str=$1 var=$2 length - # perform expansion on str and check length - length=$(( ${#${(S%%)str//(\%([KF1]|)\{*\}|\%[Bbkf])}} )) - - # store string length in variable as specified by caller - typeset -g "${var}"="${length}" -} - -prompt_pure_preprompt_render() { - setopt localoptions noshwordsplit - - # Set color for git branch/dirty status, change color if dirty checking has - # been delayed. - local git_color=242 - [[ -n ${prompt_pure_git_last_dirty_check_timestamp+x} ]] && git_color=red - - # Initialize the preprompt array. - local -a preprompt_parts - - # Set the path. - preprompt_parts+=('%F{blue}%~%f') - - # Add git branch and dirty status info. - typeset -gA prompt_pure_vcs_info - if [[ -n $prompt_pure_vcs_info[branch] ]]; then - preprompt_parts+=("%F{$git_color}"'${prompt_pure_vcs_info[branch]}${prompt_pure_git_dirty}%f') - fi - # Git pull/push arrows. - if [[ -n $prompt_pure_git_arrows ]]; then - preprompt_parts+=('%F{cyan}${prompt_pure_git_arrows}%f') - fi - - # Username and machine, if applicable. - [[ -n $prompt_pure_username ]] && preprompt_parts+=('$prompt_pure_username') - # Execution time. - [[ -n $prompt_pure_cmd_exec_time ]] && preprompt_parts+=('%F{yellow}${prompt_pure_cmd_exec_time}%f') - - local cleaned_ps1=$PROMPT - local -H MATCH MBEGIN MEND - if [[ $PROMPT = *$prompt_newline* ]]; then - # When the prompt contains newlines, we keep everything before the first - # and after the last newline, leaving us with everything except the - # preprompt. This is needed because some software prefixes the prompt - # (e.g. virtualenv). - cleaned_ps1=${PROMPT%%${prompt_newline}*}${PROMPT##*${prompt_newline}} - fi - unset MATCH MBEGIN MEND - - # Construct the new prompt with a clean preprompt. - local -ah ps1 - ps1=( - $prompt_newline # Initial newline, for spaciousness. - ${(j. .)preprompt_parts} # Join parts, space separated. - $prompt_newline # Separate preprompt and prompt. - $cleaned_ps1 - ) - - PROMPT="${(j..)ps1}" - - # Expand the prompt for future comparision. - local expanded_prompt - expanded_prompt="${(S%%)PROMPT}" - - if [[ $1 != precmd ]] && [[ $prompt_pure_last_prompt != $expanded_prompt ]]; then - # Redraw the prompt. - zle && zle .reset-prompt - fi - - typeset -g prompt_pure_last_prompt=$expanded_prompt -} - -prompt_pure_precmd() { - # check exec time and store it in a variable - prompt_pure_check_cmd_exec_time - unset prompt_pure_cmd_timestamp - - # shows the full path in the title - prompt_pure_set_title 'expand-prompt' '%~' - - # preform async git dirty check and fetch - prompt_pure_async_tasks - - # Check if we should display the virtual env, we use a sufficiently high - # index of psvar (12) here to avoid collisions with user defined entries. - psvar[12]= - # When VIRTUAL_ENV_DISABLE_PROMPT is empty, it was unset by the user and - # Pure should take back control. - if [[ -n $VIRTUAL_ENV ]] && [[ -z $VIRTUAL_ENV_DISABLE_PROMPT || $VIRTUAL_ENV_DISABLE_PROMPT = 12 ]]; then - psvar[12]="${VIRTUAL_ENV:t}" - export VIRTUAL_ENV_DISABLE_PROMPT=12 - fi - - # print the preprompt - prompt_pure_preprompt_render "precmd" -} - -prompt_pure_async_git_aliases() { - setopt localoptions noshwordsplit - local dir=$1 - local -a gitalias pullalias - - # we enter repo to get local aliases as well. - builtin cd -q $dir - - # list all aliases and split on newline. - gitalias=(${(@f)"$(command git config --get-regexp "^alias\.")"}) - for line in $gitalias; do - parts=(${(@)=line}) # split line on spaces - aliasname=${parts[1]#alias.} # grab the name (alias.[name]) - shift parts # remove aliasname - - # check alias for pull or fetch (must be exact match). - if [[ $parts =~ ^(.*\ )?(pull|fetch)(\ .*)?$ ]]; then - pullalias+=($aliasname) - fi - done - - print -- ${(j:|:)pullalias} # join on pipe (for use in regex). -} - -prompt_pure_async_vcs_info() { - setopt localoptions noshwordsplit - builtin cd -q $1 2>/dev/null - - # configure vcs_info inside async task, this frees up vcs_info - # to be used or configured as the user pleases. - zstyle ':vcs_info:*' enable git - zstyle ':vcs_info:*' use-simple true - # only export two msg variables from vcs_info - zstyle ':vcs_info:*' max-exports 2 - # export branch (%b) and git toplevel (%R) - zstyle ':vcs_info:git*' formats '%b' '%R' - zstyle ':vcs_info:git*' actionformats '%b|%a' '%R' - - vcs_info - - local -A info - info[top]=$vcs_info_msg_1_ - info[branch]=$vcs_info_msg_0_ - - print -r - ${(@kvq)info} -} - -# fastest possible way to check if repo is dirty -prompt_pure_async_git_dirty() { - setopt localoptions noshwordsplit - local untracked_dirty=$1 dir=$2 - - # use cd -q to avoid side effects of changing directory, e.g. chpwd hooks - builtin cd -q $dir - - if [[ $untracked_dirty = 0 ]]; then - command git diff --no-ext-diff --quiet --exit-code - else - test -z "$(command git status --porcelain --ignore-submodules -unormal)" - fi - - return $? -} - -prompt_pure_async_git_fetch() { - setopt localoptions noshwordsplit - # use cd -q to avoid side effects of changing directory, e.g. chpwd hooks - builtin cd -q $1 - - # set GIT_TERMINAL_PROMPT=0 to disable auth prompting for git fetch (git 2.3+) - export GIT_TERMINAL_PROMPT=0 - # set ssh BachMode to disable all interactive ssh password prompting - export GIT_SSH_COMMAND=${GIT_SSH_COMMAND:-"ssh -o BatchMode=yes"} - - command git -c gc.auto=0 fetch &>/dev/null || return 99 - - # check arrow status after a successful git fetch - prompt_pure_async_git_arrows $1 -} - -prompt_pure_async_git_arrows() { - setopt localoptions noshwordsplit - builtin cd -q $1 - command git rev-list --left-right --count HEAD...@'{u}' -} - -prompt_pure_async_tasks() { - setopt localoptions noshwordsplit - - # initialize async worker - ((!${prompt_pure_async_init:-0})) && { - async_start_worker "prompt_pure" -u -n - async_register_callback "prompt_pure" prompt_pure_async_callback - typeset -g prompt_pure_async_init=1 - } - - typeset -gA prompt_pure_vcs_info - - local -H MATCH MBEGIN MEND - if ! [[ $PWD = ${prompt_pure_vcs_info[pwd]}* ]]; then - # stop any running async jobs - async_flush_jobs "prompt_pure" - - # reset git preprompt variables, switching working tree - unset prompt_pure_git_dirty - unset prompt_pure_git_last_dirty_check_timestamp - unset prompt_pure_git_arrows - unset prompt_pure_git_fetch_pattern - prompt_pure_vcs_info[branch]= - prompt_pure_vcs_info[top]= - fi - unset MATCH MBEGIN MEND - - async_job "prompt_pure" prompt_pure_async_vcs_info $PWD - - # # only perform tasks inside git working tree - [[ -n $prompt_pure_vcs_info[top] ]] || return - - prompt_pure_async_refresh -} - -prompt_pure_async_refresh() { - setopt localoptions noshwordsplit - - if [[ -z $prompt_pure_git_fetch_pattern ]]; then - # we set the pattern here to avoid redoing the pattern check until the - # working three has changed. pull and fetch are always valid patterns. - typeset -g prompt_pure_git_fetch_pattern="pull|fetch" - async_job "prompt_pure" prompt_pure_async_git_aliases $working_tree - fi - - async_job "prompt_pure" prompt_pure_async_git_arrows $PWD - - # do not preform git fetch if it is disabled or working_tree == HOME - if (( ${PURE_GIT_PULL:-1} )) && [[ $working_tree != $HOME ]]; then - # tell worker to do a git fetch - async_job "prompt_pure" prompt_pure_async_git_fetch $PWD - fi - - # if dirty checking is sufficiently fast, tell worker to check it again, or wait for timeout - integer time_since_last_dirty_check=$(( EPOCHSECONDS - ${prompt_pure_git_last_dirty_check_timestamp:-0} )) - if (( time_since_last_dirty_check > ${PURE_GIT_DELAY_DIRTY_CHECK:-1800} )); then - unset prompt_pure_git_last_dirty_check_timestamp - # check check if there is anything to pull - async_job "prompt_pure" prompt_pure_async_git_dirty ${PURE_GIT_UNTRACKED_DIRTY:-1} $PWD - fi -} - -prompt_pure_check_git_arrows() { - setopt localoptions noshwordsplit - local arrows left=${1:-0} right=${2:-0} - - (( right > 0 )) && arrows+=${PURE_GIT_DOWN_ARROW:-⇣} - (( left > 0 )) && arrows+=${PURE_GIT_UP_ARROW:-⇡} - - [[ -n $arrows ]] || return - typeset -g REPLY=$arrows -} - -prompt_pure_async_callback() { - setopt localoptions noshwordsplit - local job=$1 code=$2 output=$3 exec_time=$4 next_pending=$6 - local do_render=0 - - case $job in - prompt_pure_async_vcs_info) - local -A info - typeset -gA prompt_pure_vcs_info - - # parse output (z) and unquote as array (Q@) - info=("${(Q@)${(z)output}}") - local -H MATCH MBEGIN MEND - # check if git toplevel has changed - if [[ $info[top] = $prompt_pure_vcs_info[top] ]]; then - # if stored pwd is part of $PWD, $PWD is shorter and likelier - # to be toplevel, so we update pwd - if [[ $prompt_pure_vcs_info[pwd] = ${PWD}* ]]; then - prompt_pure_vcs_info[pwd]=$PWD - fi - else - # store $PWD to detect if we (maybe) left the git path - prompt_pure_vcs_info[pwd]=$PWD - fi - unset MATCH MBEGIN MEND - - # update has a git toplevel set which means we just entered a new - # git directory, run the async refresh tasks - [[ -n $info[top] ]] && [[ -z $prompt_pure_vcs_info[top] ]] && prompt_pure_async_refresh - - # always update branch and toplevel - prompt_pure_vcs_info[branch]=$info[branch] - prompt_pure_vcs_info[top]=$info[top] - - do_render=1 - ;; - prompt_pure_async_git_aliases) - if [[ -n $output ]]; then - # append custom git aliases to the predefined ones. - prompt_pure_git_fetch_pattern+="|$output" - fi - ;; - prompt_pure_async_git_dirty) - local prev_dirty=$prompt_pure_git_dirty - if (( code == 0 )); then - unset prompt_pure_git_dirty - else - typeset -g prompt_pure_git_dirty="*" - fi - - [[ $prev_dirty != $prompt_pure_git_dirty ]] && do_render=1 - - # When prompt_pure_git_last_dirty_check_timestamp is set, the git info is displayed in a different color. - # To distinguish between a "fresh" and a "cached" result, the preprompt is rendered before setting this - # variable. Thus, only upon next rendering of the preprompt will the result appear in a different color. - (( $exec_time > 5 )) && prompt_pure_git_last_dirty_check_timestamp=$EPOCHSECONDS - ;; - prompt_pure_async_git_fetch|prompt_pure_async_git_arrows) - # prompt_pure_async_git_fetch executes prompt_pure_async_git_arrows - # after a successful fetch. - if (( code == 0 )); then - local REPLY - prompt_pure_check_git_arrows ${(ps:\t:)output} - if [[ $prompt_pure_git_arrows != $REPLY ]]; then - typeset -g prompt_pure_git_arrows=$REPLY - do_render=1 - fi - elif (( code != 99 )); then - # Unless the exit code is 99, prompt_pure_async_git_arrows - # failed with a non-zero exit status, meaning there is no - # upstream configured. - if [[ -n $prompt_pure_git_arrows ]]; then - unset prompt_pure_git_arrows - do_render=1 - fi - fi - ;; - esac - - if (( next_pending )); then - (( do_render )) && typeset -g prompt_pure_async_render_requested=1 - return - fi - - [[ ${prompt_pure_async_render_requested:-$do_render} = 1 ]] && prompt_pure_preprompt_render - unset prompt_pure_async_render_requested -} - -prompt_pure_setup() { - # Prevent percentage showing up if output doesn't end with a newline. - export PROMPT_EOL_MARK='' - - prompt_opts=(subst percent) - - # borrowed from promptinit, sets the prompt options in case pure was not - # initialized via promptinit. - setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}" - - if [[ -z $prompt_newline ]]; then - # This variable needs to be set, usually set by promptinit. - typeset -g prompt_newline=$'\n%{\r%}' - fi - - zmodload zsh/datetime - zmodload zsh/zle - zmodload zsh/parameter - - autoload -Uz add-zsh-hook - autoload -Uz vcs_info - autoload -Uz async && async - - add-zsh-hook precmd prompt_pure_precmd - add-zsh-hook preexec prompt_pure_preexec - - # show username@host if logged in through SSH - [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%F{242}%n@%m%f' - - # show username@host if root, with username in white - [[ $UID -eq 0 ]] && prompt_pure_username='%F{white}%n%f%F{242}@%m%f' - - # if a virtualenv is activated, display it in grey - PROMPT='%(12V.%F{242}%12v%f .)' - - # prompt turns red if the previous command didn't exit with 0 - PROMPT+='%(?.%F{magenta}.%F{red})${PURE_PROMPT_SYMBOL:-❯}%f ' -} - -prompt_pure_setup "$@" diff --git a/.zprezto/modules/prompt/external/pure/pure.plugin.zsh b/.zprezto/modules/prompt/external/pure/pure.plugin.zsh new file mode 120000 index 0000000..f5f60e7 --- /dev/null +++ b/.zprezto/modules/prompt/external/pure/pure.plugin.zsh @@ -0,0 +1 @@ +pure.zsh \ No newline at end of file diff --git a/.zprezto/modules/prompt/external/pure/pure.zsh b/.zprezto/modules/prompt/external/pure/pure.zsh index 2fd19e8..429cbbf 100644 --- a/.zprezto/modules/prompt/external/pure/pure.zsh +++ b/.zprezto/modules/prompt/external/pure/pure.zsh @@ -63,18 +63,22 @@ prompt_pure_set_title() { /dev/ttyS[0-9]*) return;; esac - # tell the terminal we are setting the title - print -n '\e]0;' - # show hostname if connected through ssh - [[ -n $SSH_CONNECTION ]] && print -Pn '(%m) ' + # Show hostname if connected via ssh. + local hostname= + if [[ -n $prompt_pure_state[username] ]]; then + # Expand in-place in case ignore-escape is used. + hostname="${(%):-(%m) }" + fi + + local -a opts case $1 in - expand-prompt) - print -Pn $2;; - ignore-escape) - print -rn $2;; + expand-prompt) opts=(-P);; + ignore-escape) opts=(-r);; esac - # end set title - print -n '\a' + + # Set title atomically in one print statement so that it works + # when XTRACE is enabled. + print -n $opts $'\e]0;'${hostname}${2}$'\a' } prompt_pure_preexec() { @@ -99,16 +103,6 @@ prompt_pure_preexec() { export VIRTUAL_ENV_DISABLE_PROMPT=${VIRTUAL_ENV_DISABLE_PROMPT:-12} } -# string length ignoring ansi escapes -prompt_pure_string_length_to_var() { - local str=$1 var=$2 length - # perform expansion on str and check length - length=$(( ${#${(S%%)str//(\%([KF1]|)\{*\}|\%[Bbkf])}} )) - - # store string length in variable as specified by caller - typeset -g "${var}"="${length}" -} - prompt_pure_preprompt_render() { setopt localoptions noshwordsplit @@ -134,25 +128,22 @@ prompt_pure_preprompt_render() { fi # Username and machine, if applicable. - [[ -n $prompt_pure_username ]] && preprompt_parts+=('$prompt_pure_username') + [[ -n $prompt_pure_state[username] ]] && preprompt_parts+=('${prompt_pure_state[username]}') # Execution time. [[ -n $prompt_pure_cmd_exec_time ]] && preprompt_parts+=('%F{yellow}${prompt_pure_cmd_exec_time}%f') local cleaned_ps1=$PROMPT local -H MATCH MBEGIN MEND if [[ $PROMPT = *$prompt_newline* ]]; then - # When the prompt contains newlines, we keep everything before the first - # and after the last newline, leaving us with everything except the - # preprompt. This is needed because some software prefixes the prompt - # (e.g. virtualenv). - cleaned_ps1=${PROMPT%%${prompt_newline}*}${PROMPT##*${prompt_newline}} + # Remove everything from the prompt until the newline. This + # removes the preprompt and only the original PROMPT remains. + cleaned_ps1=${PROMPT##*${prompt_newline}} fi unset MATCH MBEGIN MEND # Construct the new prompt with a clean preprompt. local -ah ps1 ps1=( - $prompt_newline # Initial newline, for spaciousness. ${(j. .)preprompt_parts} # Join parts, space separated. $prompt_newline # Separate preprompt and prompt. $cleaned_ps1 @@ -164,7 +155,10 @@ prompt_pure_preprompt_render() { local expanded_prompt expanded_prompt="${(S%%)PROMPT}" - if [[ $1 != precmd ]] && [[ $prompt_pure_last_prompt != $expanded_prompt ]]; then + if [[ $1 == precmd ]]; then + # Initial newline, for spaciousness. + print + elif [[ $prompt_pure_last_prompt != $expanded_prompt ]]; then # Redraw the prompt. zle && zle .reset-prompt fi @@ -193,8 +187,17 @@ prompt_pure_precmd() { export VIRTUAL_ENV_DISABLE_PROMPT=12 fi + # Make sure VIM prompt is reset. + prompt_pure_reset_vim_prompt + # print the preprompt prompt_pure_preprompt_render "precmd" + + if [[ -n $ZSH_THEME ]]; then + print "WARNING: Oh My Zsh themes are enabled (ZSH_THEME='${ZSH_THEME}'). Pure might not be working correctly." + print "For more information, see: https://github.com/sindresorhus/pure#oh-my-zsh" + unset ZSH_THEME # Only show this warning once. + fi } prompt_pure_async_git_aliases() { @@ -269,9 +272,37 @@ prompt_pure_async_git_fetch() { # set GIT_TERMINAL_PROMPT=0 to disable auth prompting for git fetch (git 2.3+) export GIT_TERMINAL_PROMPT=0 # set ssh BachMode to disable all interactive ssh password prompting - export GIT_SSH_COMMAND=${GIT_SSH_COMMAND:-"ssh -o BatchMode=yes"} + export GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-"ssh"} -o BatchMode=yes" - command git -c gc.auto=0 fetch &>/dev/null || return 99 + # Default return code, indicates Git fetch failure. + local fail_code=99 + + # Guard against all forms of password prompts. By setting the shell into + # MONITOR mode we can notice when a child process prompts for user input + # because it will be suspended. Since we are inside an async worker, we + # have no way of transmitting the password and the only option is to + # kill it. If we don't do it this way, the process will corrupt with the + # async worker. + setopt localtraps monitor + + # Make sure local HUP trap is unset to allow for signal propagation when + # the async worker is flushed. + trap - HUP + + trap ' + # Unset trap to prevent infinite loop + trap - CHLD + if [[ $jobstates = suspended* ]]; then + # Set fail code to password prompt and kill the fetch. + fail_code=98 + kill %% + fi + ' CHLD + + command git -c gc.auto=0 fetch >/dev/null & + wait $! || return $fail_code + + unsetopt monitor # check arrow status after a successful git fetch prompt_pure_async_git_arrows $1 @@ -416,22 +447,27 @@ prompt_pure_async_callback() { prompt_pure_async_git_fetch|prompt_pure_async_git_arrows) # prompt_pure_async_git_fetch executes prompt_pure_async_git_arrows # after a successful fetch. - if (( code == 0 )); then - local REPLY - prompt_pure_check_git_arrows ${(ps:\t:)output} - if [[ $prompt_pure_git_arrows != $REPLY ]]; then - typeset -g prompt_pure_git_arrows=$REPLY - do_render=1 - fi - elif (( code != 99 )); then - # Unless the exit code is 99, prompt_pure_async_git_arrows - # failed with a non-zero exit status, meaning there is no - # upstream configured. - if [[ -n $prompt_pure_git_arrows ]]; then - unset prompt_pure_git_arrows - do_render=1 - fi - fi + case $code in + 0) + local REPLY + prompt_pure_check_git_arrows ${(ps:\t:)output} + if [[ $prompt_pure_git_arrows != $REPLY ]]; then + typeset -g prompt_pure_git_arrows=$REPLY + do_render=1 + fi + ;; + 99|98) + # Git fetch failed. + ;; + *) + # Non-zero exit status from prompt_pure_async_git_arrows, + # indicating that there is no upstream configured. + if [[ -n $prompt_pure_git_arrows ]]; then + unset prompt_pure_git_arrows + do_render=1 + fi + ;; + esac ;; esac @@ -444,6 +480,67 @@ prompt_pure_async_callback() { unset prompt_pure_async_render_requested } +prompt_pure_update_vim_prompt() { + setopt localoptions noshwordsplit + prompt_pure_state[prompt]=${${KEYMAP/vicmd/${PURE_PROMPT_VICMD_SYMBOL:-❮}}/(main|viins)/${PURE_PROMPT_SYMBOL:-❯}} + zle && zle .reset-prompt +} + +prompt_pure_reset_vim_prompt() { + setopt localoptions noshwordsplit + prompt_pure_state[prompt]=${PURE_PROMPT_SYMBOL:-❯} + zle && zle .reset-prompt +} + +prompt_pure_state_setup() { + setopt localoptions noshwordsplit + + # Check SSH_CONNECTION and the current state. + local ssh_connection=${SSH_CONNECTION:-$PROMPT_PURE_SSH_CONNECTION} + local username + if [[ -z $ssh_connection ]] && (( $+commands[who] )); then + # When changing user on a remote system, the $SSH_CONNECTION + # environment variable can be lost, attempt detection via who. + local who_out + who_out=$(who -m 2>/dev/null) + if (( $? )); then + # Who am I not supported, fallback to plain who. + who_out=$(who 2>/dev/null | grep ${TTY#/dev/}) + fi + + local reIPv6='(([0-9a-fA-F]+:)|:){2,}[0-9a-fA-F]+' # Simplified, only checks partial pattern. + local reIPv4='([0-9]{1,3}\.){3}[0-9]+' # Simplified, allows invalid ranges. + # Here we assume two non-consecutive periods represents a + # hostname. This matches foo.bar.baz, but not foo.bar. + local reHostname='([.][^. ]+){2}' + + # Usually the remote address is surrounded by parenthesis, but + # not on all systems (e.g. busybox). + local -H MATCH MBEGIN MEND + if [[ $who_out =~ "\(?($reIPv4|$reIPv6|$reHostname)\)?\$" ]]; then + ssh_connection=$MATCH + + # Export variable to allow detection propagation inside + # shells spawned by this one (e.g. tmux does not always + # inherit the same tty, which breaks detection). + export PROMPT_PURE_SSH_CONNECTION=$ssh_connection + fi + unset MATCH MBEGIN MEND + fi + + # show username@host if logged in through SSH + [[ -n $ssh_connection ]] && username='%F{242}%n@%m%f' + + # show username@host if root, with username in white + [[ $UID -eq 0 ]] && username='%F{white}%n%f%F{242}@%m%f' + + typeset -gA prompt_pure_state + prompt_pure_state=( + username "$username" + prompt "${PURE_PROMPT_SYMBOL:-❯}" + ) +} + prompt_pure_setup() { # Prevent percentage showing up if output doesn't end with a newline. export PROMPT_EOL_MARK='' @@ -467,20 +564,56 @@ prompt_pure_setup() { autoload -Uz vcs_info autoload -Uz async && async + # The add-zle-hook-widget function is not guaranteed + # to be available, it was added in Zsh 5.3. + autoload -Uz +X add-zle-hook-widget 2>/dev/null + add-zsh-hook precmd prompt_pure_precmd add-zsh-hook preexec prompt_pure_preexec - # show username@host if logged in through SSH - [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%F{242}%n@%m%f' + prompt_pure_state_setup - # show username@host if root, with username in white - [[ $UID -eq 0 ]] && prompt_pure_username='%F{white}%n%f%F{242}@%m%f' + zle -N prompt_pure_update_vim_prompt + zle -N prompt_pure_reset_vim_prompt + if (( $+functions[add-zle-hook-widget] )); then + add-zle-hook-widget zle-line-finish prompt_pure_reset_vim_prompt + add-zle-hook-widget zle-keymap-select prompt_pure_update_vim_prompt + fi # if a virtualenv is activated, display it in grey PROMPT='%(12V.%F{242}%12v%f .)' # prompt turns red if the previous command didn't exit with 0 - PROMPT+='%(?.%F{magenta}.%F{red})${PURE_PROMPT_SYMBOL:-❯}%f ' + PROMPT+='%(?.%F{magenta}.%F{red})${prompt_pure_state[prompt]}%f ' + + # Store prompt expansion symbols for in-place expansion via (%). For + # some reason it does not work without storing them in a variable first. + typeset -ga prompt_pure_debug_depth + prompt_pure_debug_depth=('%e' '%N' '%x') + + # Compare is used to check if %N equals %x. When they differ, the main + # prompt is used to allow displaying both file name and function. When + # they match, we use the secondary prompt to avoid displaying duplicate + # information. + local -A ps4_parts + ps4_parts=( + depth '%F{yellow}${(l:${(%)prompt_pure_debug_depth[1]}::+:)}%f' + compare '${${(%)prompt_pure_debug_depth[2]}:#${(%)prompt_pure_debug_depth[3]}}' + main '%F{blue}${${(%)prompt_pure_debug_depth[3]}:t}%f%F{242}:%I%f %F{242}@%f%F{blue}%N%f%F{242}:%i%f' + secondary '%F{blue}%N%f%F{242}:%i' + prompt '%F{242}>%f ' + ) + # Combine the parts with conditional logic. First the `:+` operator is + # used to replace `compare` either with `main` or an ampty string. Then + # the `:-` operator is used so that if `compare` becomes an empty + # string, it is replaced with `secondary`. + local ps4_symbols='${${'${ps4_parts[compare]}':+"'${ps4_parts[main]}'"}:-"'${ps4_parts[secondary]}'"}' + + # Improve the debug prompt (PS4), show depth by repeating the +-sign and + # add colors to highlight essential parts like file and function name. + PROMPT4="${ps4_parts[depth]} ${ps4_symbols}${ps4_parts[prompt]}" + + unset ZSH_THEME # Guard against Oh My Zsh themes overriding Pure. } prompt_pure_setup "$@" diff --git a/.zprezto/modules/prompt/external/pure/readme.md b/.zprezto/modules/prompt/external/pure/readme.md index e3d9958..9c93517 100644 --- a/.zprezto/modules/prompt/external/pure/readme.md +++ b/.zprezto/modules/prompt/external/pure/readme.md @@ -19,6 +19,7 @@ Most prompts are cluttered, ugly and slow. I wanted something visually pleasing - Command execution time will be displayed if it exceeds the set threshold. - Username and host only displayed when in an SSH session. - Shows the current path in the title and the [current folder & command](screenshot-title-cmd.png) when a process is running. +- Support VI-mode indication by reverse prompt symbol (Zsh 5.3+). - Makes an excellent starting point for your own custom prompt. @@ -41,7 +42,7 @@ That's it. Skip to [Getting started](#getting-started). - add it as a submodule, or - just download [`pure.zsh`](pure.zsh) and [`async.zsh`](async.zsh) -2. Symlink `pure.zsh` to somewhere in [`$fpath`](http://www.refining-linux.org/archives/46/ZSH-Gem-12-Autoloading-functions/) with the name `prompt_pure_setup`. +2. Symlink `pure.zsh` to somewhere in [`$fpath`](https://www.refining-linux.org/archives/46-ZSH-Gem-12-Autoloading-functions.html) with the name `prompt_pure_setup`. 3. Symlink `async.zsh` in `$fpath` with the name `async`. @@ -81,33 +82,16 @@ prompt pure ## Options -### `PURE_CMD_MAX_EXEC_TIME` - -The max execution time of a process before its run time is shown when it exits. Defaults to `5` seconds. - -### `PURE_GIT_PULL` - -Set `PURE_GIT_PULL=0` to prevent Pure from checking whether the current Git remote has been updated. - -### `PURE_GIT_UNTRACKED_DIRTY` - -Set `PURE_GIT_UNTRACKED_DIRTY=0` to not include untracked files in dirtiness check. Only really useful on extremely huge repos like the WebKit repo. - -### `PURE_GIT_DELAY_DIRTY_CHECK` - -Time in seconds to delay git dirty checking for large repositories (git status takes > 5 seconds). The check is performed asynchronously, this is to save CPU. Defaults to `1800` seconds. - -### `PURE_PROMPT_SYMBOL` - -Defines the prompt symbol. The default value is `❯`. - -### `PURE_GIT_DOWN_ARROW` - -Defines the git down arrow symbol. The default value is `⇣`. - -### `PURE_GIT_UP_ARROW` - -Defines the git up arrow symbol. The default value is `⇡`. +| Option | Description | Default value | +| :------------------------------- | :--------------------------------------------------------------------------------------------- | :------------- | +| **`PURE_CMD_MAX_EXEC_TIME`** | The max execution time of a process before its run time is shown when it exits. | `5` seconds | +| **`PURE_GIT_PULL=0`** | Prevents Pure from checking whether the current Git remote has been updated. | | +| **`PURE_GIT_UNTRACKED_DIRTY=0`** | Do not include untracked files in dirtiness check. Mostly useful on large repos (like WebKit). | | +| **`PURE_GIT_DELAY_DIRTY_CHECK`** | Time in seconds to delay git dirty checking when `git status` takes > 5 seconds. | `1800` seconds | +| **`PURE_PROMPT_SYMBOL`** | Defines the prompt symbol. | `❯` | +| **`PURE_PROMPT_VICMD_SYMBOL`** | Defines the prompt symbol used when the `vicmd` keymap is active (VI-mode). | `❮` | +| **`PURE_GIT_DOWN_ARROW`** | Defines the git down arrow symbol. | `⇣` | +| **`PURE_GIT_UP_ARROW`** | Defines the git up arrow symbol. | `⇡` | ## Example @@ -139,6 +123,7 @@ To have commands colorized as seen in the screenshot, install [zsh-syntax-highli 1. Set `ZSH_THEME=""` in your `.zshrc` to disable oh-my-zsh themes. 2. Follow the Pure [Install](#install) instructions. +3. Do not enable the following (incompatible) plugins: `vi-mode`, `virtualenv`. **NOTE:** `oh-my-zsh` overrides the prompt so Pure must be activated *after* `source $ZSH/oh-my-zsh.sh`. @@ -192,26 +177,9 @@ zplugin light sindresorhus/pure ## FAQ -### I am stuck in a shell loop in my terminal that asks me to authenticate. What should I do? - -[This is a known issue](https://github.com/sindresorhus/pure/issues/76). -Using `git pull` when you get the username prompt should help you to break the loop by giving you a real prompt for this. **[This has been fixed in git 2.3](https://github.com/sindresorhus/pure/commit/f43ab97e1cf4a276b7a6e33eac055ee16610be15)** - -### I am seeing the error `zpty: can't open pseudo terminal: bad file descriptor`. - -[This is a known issue](https://github.com/sindresorhus/pure/issues/117). `zsh/zpty` requires either legacy bsd ptys or access to `/dev/ptmx`. Here are some known solutions. - -#### Gentoo - -```console -$ sudo sh -c "echo 'SANDBOX_WRITE=\"/dev/ptmx\"' > /etc/sandbox.d/10zsh" -$ sudo emerge -1 zsh -``` - -#### FreeBSD 10.1 - -On a default setup, running the command `kldload pty` should do the trick. If you have a custom kernel, you might need to add `device pty` to the configuration file ([example](https://github.com/nbari/freebsd/blob/58646a9c3c4aaabf6f6467ff505f27f09e29dc75/kernels/xen.kernel#L188)). +There are currently no FAQs. +See [FAQ Archive](https://github.com/sindresorhus/pure/wiki/FAQ-Archive) for previous FAQs. ## Ports diff --git a/.zprezto/modules/prompt/functions/async b/.zprezto/modules/prompt/functions/async deleted file mode 100644 index 1257029..0000000 --- a/.zprezto/modules/prompt/functions/async +++ /dev/null @@ -1,499 +0,0 @@ -#!/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 ( ). - 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 -# -# 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 [] -# -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 -# -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 -# -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 -# -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 [-u] [-n] [-p ] -# -# 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 [] -# -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 "$@" diff --git a/.zprezto/modules/prompt/functions/async b/.zprezto/modules/prompt/functions/async new file mode 120000 index 0000000..ae0ec55 --- /dev/null +++ b/.zprezto/modules/prompt/functions/async @@ -0,0 +1 @@ +../external/async/async.zsh \ No newline at end of file diff --git a/.zprezto/modules/prompt/functions/prompt_agnoster_setup b/.zprezto/modules/prompt/functions/prompt_agnoster_setup deleted file mode 100644 index 4eceafd..0000000 --- a/.zprezto/modules/prompt/functions/prompt_agnoster_setup +++ /dev/null @@ -1,165 +0,0 @@ -# vim:ft=zsh ts=2 sw=2 sts=2 -# -# agnoster's Theme - https://gist.github.com/3712874 -# A Powerline-inspired theme for ZSH -# -# # README -# -# In order for this theme to render correctly, you will need a -# [Powerline-patched font](https://gist.github.com/1595572). -# -# In addition, I recommend the -# [Solarized theme](https://github.com/altercation/solarized/) and, if you're -# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - -# it has significantly better color fidelity. -# -# # Goals -# -# The aim of this theme is to only show you *relevant* information. Like most -# prompts, it will only show git information when in a git working directory. -# However, it goes a step further: everything from the current user and -# hostname to whether the last call exited with an error to whether background -# jobs are running in this shell will all be displayed automatically when -# appropriate. - -### Segment drawing -# A few utility functions to make it easy and re-usable to draw segmented prompts - -CURRENT_BG='NONE' -if [[ -z "$PRIMARY_FG" ]]; then - PRIMARY_FG=black -fi - -# Characters -SEGMENT_SEPARATOR="\ue0b0" -PLUSMINUS="\u00b1" -BRANCH="\ue0a0" -DETACHED="\u27a6" -CROSS="\u2718" -LIGHTNING="\u26a1" -GEAR="\u2699" - -# Begin a segment -# Takes two arguments, background and foreground. Both can be omitted, -# rendering default background/foreground. -prompt_segment() { - local bg fg - [[ -n $1 ]] && bg="%K{$1}" || bg="%k" - [[ -n $2 ]] && fg="%F{$2}" || fg="%f" - if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then - print -n "%{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%}" - else - print -n "%{$bg%}%{$fg%}" - fi - CURRENT_BG=$1 - [[ -n $3 ]] && print -n $3 -} - -# End the prompt, closing any open segments -prompt_end() { - if [[ -n $CURRENT_BG ]]; then - print -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" - else - print -n "%{%k%}" - fi - print -n "%{%f%}" - CURRENT_BG='' -} - -### Prompt components -# Each component will draw itself, and hide itself if no information needs to be shown - -# Context: user@hostname (who am I and where am I) -prompt_context() { - local user=`whoami` - - if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CONNECTION" ]]; then - prompt_segment $PRIMARY_FG default " %(!.%{%F{yellow}%}.)$user@%m " - fi -} - -# Git: branch/detached head, dirty status -prompt_git() { - local color ref - is_dirty() { - test -n "$(git status --porcelain --ignore-submodules)" - } - ref="$vcs_info_msg_0_" - if [[ -n "$ref" ]]; then - if is_dirty; then - color=yellow - ref="${ref} $PLUSMINUS" - else - color=green - ref="${ref} " - fi - if [[ "${ref/.../}" == "$ref" ]]; then - ref="$BRANCH $ref" - else - ref="$DETACHED ${ref/.../}" - fi - prompt_segment $color $PRIMARY_FG - print -n " $ref" - fi -} - -# Dir: current working directory -prompt_dir() { - prompt_segment blue $PRIMARY_FG ' %~ ' -} - -# Status: -# - was there an error -# - am I root -# - are there background jobs? -prompt_status() { - local symbols - symbols=() - [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}$CROSS" - [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}$LIGHTNING" - [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}$GEAR" - - [[ -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 -} - -prompt_agnoster_precmd() { - vcs_info - PROMPT='%{%f%b%k%}$(prompt_agnoster_main) ' -} - -prompt_agnoster_setup() { - autoload -Uz add-zsh-hook - autoload -Uz vcs_info - - prompt_opts=(cr subst percent) - - add-zsh-hook precmd prompt_agnoster_precmd - - zstyle ':vcs_info:*' enable git - zstyle ':vcs_info:*' check-for-changes false - zstyle ':vcs_info:git*' formats '%b' - zstyle ':vcs_info:git*' actionformats '%b (%a)' -} - -prompt_agnoster_setup "$@" diff --git a/.zprezto/modules/prompt/functions/prompt_agnoster_setup b/.zprezto/modules/prompt/functions/prompt_agnoster_setup new file mode 120000 index 0000000..34d8bc6 --- /dev/null +++ b/.zprezto/modules/prompt/functions/prompt_agnoster_setup @@ -0,0 +1 @@ +../external/agnoster/agnoster.zsh-theme \ No newline at end of file diff --git a/.zprezto/modules/prompt/functions/prompt_minimal_setup b/.zprezto/modules/prompt/functions/prompt_minimal_setup index 7456ffd..b600768 100644 --- a/.zprezto/modules/prompt/functions/prompt_minimal_setup +++ b/.zprezto/modules/prompt/functions/prompt_minimal_setup @@ -47,4 +47,13 @@ function prompt_minimal_setup { RPROMPT='' } +function prompt_minimal_preview { + local +h PROMPT='' + local +h RPROMPT='' + local +h SPROMPT='' + + editor-info 2> /dev/null + prompt_preview_theme 'minimal' +} + prompt_minimal_setup "$@" diff --git a/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup b/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup deleted file mode 100755 index c1ea754..0000000 --- a/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup +++ /dev/null @@ -1,1912 +0,0 @@ -# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 -################################################################ -# powerlevel9k Theme -# https://github.com/bhilburn/powerlevel9k -# -# This theme was inspired by agnoster's Theme: -# https://gist.github.com/3712874 -################################################################ - -################################################################ -# For basic documentation, please refer to the README.md in the top-level -# directory. For more detailed documentation, refer to the project wiki, hosted -# on Github: https://github.com/bhilburn/powerlevel9k/wiki -# -# There are a lot of easy ways you can customize your prompt segments and -# theming with simple variables defined in your `~/.zshrc`. -################################################################ - -## Turn on for Debugging -#PS4='%s%f%b%k%F{blue}%{λ%}%L %F{240}%N:%i%(?.. %F{red}%?) %1(_.%F{yellow}%-1_ .)%s%f%b%k ' -#zstyle ':vcs_info:*+*:*' debug true -#set -o xtrace - -# Try to set the installation path -if [[ -n "$POWERLEVEL9K_INSTALLATION_DIR" ]]; then - p9k_directory=${POWERLEVEL9K_INSTALLATION_DIR:A} -else - if [[ "${(%):-%N}" == '(eval)' ]]; then - if [[ "$0" == '-antigen-load' ]] && [[ -r "${PWD}/powerlevel9k.zsh-theme" ]]; then - # Antigen uses eval to load things so it can change the plugin (!!) - # https://github.com/zsh-users/antigen/issues/581 - p9k_directory=$PWD - else - print -P "%F{red}You must set POWERLEVEL9K_INSTALLATION_DIR work from within an (eval).%f" - return 1 - fi - else - # Get the path to file this code is executing in; then - # get the absolute path and strip the filename. - # See https://stackoverflow.com/a/28336473/108857 - p9k_directory=${${(%):-%x}:A:h} - fi -fi - -################################################################ -# Source icon functions -################################################################ - -source "${p9k_directory}/functions/icons.zsh" - -################################################################ -# Source utility functions -################################################################ - -source "${p9k_directory}/functions/utilities.zsh" - -################################################################ -# Source color functions -################################################################ - -source "${p9k_directory}/functions/colors.zsh" - -################################################################ -# Source VCS_INFO hooks / helper functions -################################################################ - -source "${p9k_directory}/functions/vcs.zsh" - -# cleanup temporary variables. -unset p9k_directory - -################################################################ -# Color Scheme -################################################################ - -if [[ "$POWERLEVEL9K_COLOR_SCHEME" == "light" ]]; then - DEFAULT_COLOR=white - DEFAULT_COLOR_INVERTED=black -else - DEFAULT_COLOR=black - DEFAULT_COLOR_INVERTED=white -fi - -################################################################ -# Prompt Segment Constructors -# -# Methodology behind user-defined variables overwriting colors: -# The first parameter to the segment constructors is the calling function's -# name. From this function name, we strip the "prompt_"-prefix and -# uppercase it. This is then prefixed with "POWERLEVEL9K_" and suffixed -# with either "_BACKGROUND" or "_FOREGROUND", thus giving us the variable -# name. So each new segment is user-overwritten by a variable following -# this naming convention. -################################################################ - -# The `CURRENT_BG` variable is used to remember what the last BG color used was -# when building the left-hand prompt. Because the RPROMPT is created from -# right-left but reads the opposite, this isn't necessary for the other side. -CURRENT_BG='NONE' - -# Begin a left prompt segment -# Takes four arguments: -# * $1: Name of the function that was originally invoked (mandatory). -# Necessary, to make the dynamic color-overwrite mechanism work. -# * $2: The array index of the current segment -# * $3: Background color -# * $4: Foreground color -# * $5: The segment content -# * $6: An identifying icon (must be a key of the icons array) -# The latter three can be omitted, -set_default last_left_element_index 1 -set_default POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS " " -left_prompt_segment() { - local current_index=$2 - # Check if the segment should be joined with the previous one - local joined - segmentShouldBeJoined $current_index $last_left_element_index "$POWERLEVEL9K_LEFT_PROMPT_ELEMENTS" && joined=true || joined=false - - # Overwrite given background-color by user defined variable for this segment. - local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND - local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE} - [[ -n $BG_COLOR_MODIFIER ]] && 3="$BG_COLOR_MODIFIER" - - # Overwrite given foreground-color by user defined variable for this segment. - local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND - local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE} - [[ -n $FG_COLOR_MODIFIER ]] && 4="$FG_COLOR_MODIFIER" - - local bg fg - [[ -n "$3" ]] && bg="$(backgroundColor $3)" || bg="$(backgroundColor)" - [[ -n "$4" ]] && fg="$(foregroundColor $4)" || fg="$(foregroundColor)" - - if [[ $CURRENT_BG != 'NONE' ]] && ! isSameColor "$3" "$CURRENT_BG"; then - echo -n "$bg%F{$CURRENT_BG}" - if [[ $joined == false ]]; then - # Middle segment - echo -n "$(print_icon 'LEFT_SEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" - fi - elif isSameColor "$CURRENT_BG" "$3"; then - # Middle segment with same color as previous segment - # We take the current foreground color as color for our - # subsegment (or the default color). This should have - # enough contrast. - local complement - [[ -n "$4" ]] && complement="$fg" || complement="$(foregroundColor $DEFAULT_COLOR)" - echo -n "${bg}${complement}" - if [[ $joined == false ]]; then - echo -n "$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" - fi - else - # First segment - echo -n "${bg}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" - fi - - local visual_identifier - if [[ -n $6 ]]; then - visual_identifier="$(print_icon $6)" - if [[ -n "$visual_identifier" ]]; then - # Add an whitespace if we print more than just the visual identifier. - # To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st), - # we need to color both the visual identifier and the whitespace. - [[ -n "$5" ]] && visual_identifier="$visual_identifier " - # Allow users to overwrite the color for the visual identifier only. - local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR - set_default $visual_identifier_color_variable $4 - visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f" - fi - fi - - # Print the visual identifier - echo -n "${visual_identifier}" - # Print the content of the segment, if there is any - [[ -n "$5" ]] && echo -n "${fg}${5}" - echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}" - - CURRENT_BG=$3 - last_left_element_index=$current_index -} - -# End the left prompt, closes the final segment. -left_prompt_end() { - if [[ -n $CURRENT_BG ]]; then - echo -n "%k%F{$CURRENT_BG}$(print_icon 'LEFT_SEGMENT_SEPARATOR')" - else - echo -n "%k" - fi - echo -n "%f$(print_icon 'LEFT_SEGMENT_END_SEPARATOR')" - CURRENT_BG='' -} - -CURRENT_RIGHT_BG='NONE' - -# Begin a right prompt segment -# Takes four arguments: -# * $1: Name of the function that was originally invoked (mandatory). -# Necessary, to make the dynamic color-overwrite mechanism work. -# * $2: The array index of the current segment -# * $3: Background color -# * $4: Foreground color -# * $5: The segment content -# * $6: An identifying icon (must be a key of the icons array) -# No ending for the right prompt segment is needed (unlike the left prompt, above). -set_default last_right_element_index 1 -set_default POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS " " -right_prompt_segment() { - local current_index=$2 - - # Check if the segment should be joined with the previous one - local joined - segmentShouldBeJoined $current_index $last_right_element_index "$POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS" && joined=true || joined=false - - # Overwrite given background-color by user defined variable for this segment. - local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND - local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE} - [[ -n $BG_COLOR_MODIFIER ]] && 3="$BG_COLOR_MODIFIER" - - # Overwrite given foreground-color by user defined variable for this segment. - local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND - local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE} - [[ -n $FG_COLOR_MODIFIER ]] && 4="$FG_COLOR_MODIFIER" - - local bg fg - [[ -n "$3" ]] && bg="$(backgroundColor $3)" || bg="$(backgroundColor)" - [[ -n "$4" ]] && fg="$(foregroundColor $4)" || fg="$(foregroundColor)" - - # If CURRENT_RIGHT_BG is "NONE", we are the first right segment. - - if [[ "$CURRENT_RIGHT_BG" != "NONE" ]]; then - # This is the closing whitespace for the previous segment - echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}%f" - fi - - if [[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]]; then - if isSameColor "$CURRENT_RIGHT_BG" "$3"; then - # Middle segment with same color as previous segment - # We take the current foreground color as color for our - # subsegment (or the default color). This should have - # enough contrast. - local complement - [[ -n "$4" ]] && complement="$fg" || complement="$(foregroundColor $DEFAULT_COLOR)" - echo -n "$complement$(print_icon 'RIGHT_SUBSEGMENT_SEPARATOR')%f" - else - # Use the new BG color for the foreground with separator - echo -n "$(foregroundColor $3)$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f" - fi - fi - - local visual_identifier - if [[ -n "$6" ]]; then - visual_identifier="$(print_icon $6)" - if [[ -n "$visual_identifier" ]]; then - # Add an whitespace if we print more than just the visual identifier. - # To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st), - # we need to color both the visual identifier and the whitespace. - [[ -n "$5" ]] && visual_identifier=" $visual_identifier" - # Allow users to overwrite the color for the visual identifier only. - local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR - set_default $visual_identifier_color_variable $4 - visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f" - fi - fi - - echo -n "${bg}${fg}" - - # Print whitespace only if segment is not joined or first right segment - [[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]] && echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}" - - # Print segment content if there is any - [[ -n "$5" ]] && echo -n "${5}" - # Print the visual identifier - echo -n "${visual_identifier}" - - CURRENT_RIGHT_BG=$3 - last_right_element_index=$current_index -} - -################################################################ -# Prompt Segment Definitions -################################################################ - -# The `CURRENT_BG` variable is used to remember what the last BG color used was -# when building the left-hand prompt. Because the RPROMPT is created from -# right-left but reads the opposite, this isn't necessary for the other side. -CURRENT_BG='NONE' - -################################################################ -# Anaconda Environment -prompt_anaconda() { - # Depending on the conda version, either might be set. This - # variant works even if both are set. - local _path=$CONDA_ENV_PATH$CONDA_PREFIX - if ! [ -z "$_path" ]; then - # config - can be overwritten in users' zshrc file. - set_default POWERLEVEL9K_ANACONDA_LEFT_DELIMITER "(" - set_default POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER ")" - "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" 'PYTHON_ICON' - fi -} - -################################################################ -# AWS Profile -prompt_aws() { - local aws_profile="${AWS_PROFILE:-$AWS_DEFAULT_PROFILE}" - - if [[ -n "$aws_profile" ]]; then - "$1_prompt_segment" "$0" "$2" red white "$aws_profile" 'AWS_ICON' - fi -} - -################################################################ -# Current Elastic Beanstalk environment -prompt_aws_eb_env() { - local eb_env=$(grep environment .elasticbeanstalk/config.yml 2> /dev/null | awk '{print $2}') - - if [[ -n "$eb_env" ]]; then - "$1_prompt_segment" "$0" "$2" black green "$eb_env" 'AWS_EB_ICON' - fi -} - -################################################################ -# Segment to indicate background jobs with an icon. -set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true -set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS false -prompt_background_jobs() { - local background_jobs_number=${$(jobs -l | wc -l)// /} - local wrong_lines=`jobs -l | awk '/pwd now/{ count++ } END {print count}'` - if [[ wrong_lines -gt 0 ]]; then - background_jobs_number=$(( $background_jobs_number - $wrong_lines )) - fi - if [[ background_jobs_number -gt 0 ]]; then - local background_jobs_number_print="" - if [[ "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE" == "true" ]] && ([[ "$background_jobs_number" -gt 1 ]] || [[ "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS" == "true" ]]); then - background_jobs_number_print="$background_jobs_number" - fi - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "cyan" "$background_jobs_number_print" 'BACKGROUND_JOBS_ICON' - fi -} - -################################################################ -# A newline in your prompt, so you can segments on multiple lines. -prompt_newline() { - local lws newline - [[ "$1" == "right" ]] && return - newline=$'\n' - lws=$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS - if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then - newline="${newline}$(print_icon 'MULTILINE_NEWLINE_PROMPT_PREFIX')" - fi - POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS= - "$1_prompt_segment" \ - "$0" \ - "$2" \ - "NONE" "NONE" "${newline}" - POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=$lws -} - -################################################################ -# Segment that indicates usage level of current partition. -set_default POWERLEVEL9K_DISK_USAGE_ONLY_WARNING false -set_default POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL 90 -set_default POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL 95 -prompt_disk_usage() { - local current_state="unknown" - typeset -AH hdd_usage_forecolors - hdd_usage_forecolors=( - 'normal' 'yellow' - 'warning' "$DEFAULT_COLOR" - 'critical' 'white' - ) - typeset -AH hdd_usage_backcolors - hdd_usage_backcolors=( - 'normal' $DEFAULT_COLOR - 'warning' 'yellow' - 'critical' 'red' - ) - - local disk_usage="${$(\df -P . | sed -n '2p' | awk '{ print $5 }')%%\%}" - - if [ "$disk_usage" -ge "$POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL" ]; then - current_state='warning' - if [ "$disk_usage" -ge "$POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL" ]; then - current_state='critical' - fi - else - if [[ "$POWERLEVEL9K_DISK_USAGE_ONLY_WARNING" == true ]]; then - current_state='' - return - fi - current_state='normal' - fi - - local message="${disk_usage}%%" - - # Draw the prompt_segment - if [[ -n $disk_usage ]]; then - "$1_prompt_segment" "${0}_${current_state}" "$2" "${hdd_usage_backcolors[$current_state]}" "${hdd_usage_forecolors[$current_state]}" "$message" 'DISK_ICON' - fi -} - -################################################################ -# Segment that displays the battery status in levels and colors -prompt_battery() { - # The battery can have four different states - default to 'unknown'. - local current_state='unknown' - typeset -AH battery_states - battery_states=( - 'low' 'red' - 'charging' 'yellow' - 'charged' 'green' - 'disconnected' "$DEFAULT_COLOR_INVERTED" - ) - # Set default values if the user did not configure them - set_default POWERLEVEL9K_BATTERY_LOW_THRESHOLD 10 - - if [[ $OS =~ OSX && -f /usr/bin/pmset && -x /usr/bin/pmset ]]; then - # obtain battery information from system - local raw_data="$(pmset -g batt | awk 'FNR==2{print}')" - # return if there is no battery on system - [[ -z $(echo $raw_data | grep "InternalBattery") ]] && return - - # Time remaining on battery operation (charging/discharging) - local tstring=$(echo $raw_data | awk -F ';' '{print $3}' | awk '{print $1}') - # If time has not been calculated by system yet - [[ $tstring =~ '(\(no|not)' ]] && tstring="..." - - # percent of battery charged - typeset -i 10 bat_percent - bat_percent=$(echo $raw_data | grep -o '[0-9]*%' | sed 's/%//') - - local remain="" - # Logic for string output - case $(echo $raw_data | awk -F ';' '{print $2}' | awk '{$1=$1};1') in - # for a short time after attaching power, status will be 'AC attached;' - 'charging'|'finishing charge'|'AC attached') - current_state="charging" - remain=" ($tstring)" - ;; - 'discharging') - [[ $bat_percent -lt $POWERLEVEL9K_BATTERY_LOW_THRESHOLD ]] && current_state="low" || current_state="disconnected" - remain=" ($tstring)" - ;; - *) - current_state="charged" - ;; - esac - fi - - if [[ "$OS" == 'Linux' ]] || [[ "$OS" == 'Android' ]]; then - local sysp="/sys/class/power_supply" - - # Reported BAT0 or BAT1 depending on kernel version - [[ -a $sysp/BAT0 ]] && local bat=$sysp/BAT0 - [[ -a $sysp/BAT1 ]] && local bat=$sysp/BAT1 - - # Android-related - # Tested on: Moto G falcon (CM 13.0) - [[ -a $sysp/battery ]] && local bat=$sysp/battery - - # Return if no battery found - [[ -z $bat ]] && return - local capacity=$(cat $bat/capacity) - local battery_status=$(cat $bat/status) - [[ $capacity -gt 100 ]] && local bat_percent=100 || local bat_percent=$capacity - [[ $battery_status =~ Charging || $battery_status =~ Full ]] && local connected=true - if [[ -z $connected ]]; then - [[ $bat_percent -lt $POWERLEVEL9K_BATTERY_LOW_THRESHOLD ]] && current_state="low" || current_state="disconnected" - else - [[ $bat_percent =~ 100 ]] && current_state="charged" - [[ $bat_percent -lt 100 ]] && current_state="charging" - fi - if [[ -f /usr/bin/acpi ]]; then - local time_remaining=$(acpi | awk '{ print $5 }') - if [[ $time_remaining =~ rate ]]; then - local tstring="..." - elif [[ $time_remaining =~ "[[:digit:]]+" ]]; then - local tstring=${(f)$(date -u -d "$(echo $time_remaining)" +%k:%M 2> /dev/null)} - fi - fi - [[ -n $tstring ]] && local remain=" ($tstring)" - fi - - local message - # Default behavior: Be verbose! - set_default POWERLEVEL9K_BATTERY_VERBOSE true - if [[ "$POWERLEVEL9K_BATTERY_VERBOSE" == true ]]; then - message="$bat_percent%%$remain" - else - message="$bat_percent%%" - fi - - # override default icon if we are using battery stages - if [[ -n "$POWERLEVEL9K_BATTERY_STAGES" ]]; then - local segment=$(( 100.0 / (${#POWERLEVEL9K_BATTERY_STAGES} - 1 ) )) - if [[ $segment > 1 ]]; then - local offset=$(( ($bat_percent / $segment) + 1 )) - # check if the stages are in an array or a string - [[ "${(t)POWERLEVEL9K_BATTERY_STAGES}" =~ "array" ]] && POWERLEVEL9K_BATTERY_ICON="$POWERLEVEL9K_BATTERY_STAGES[$offset]" || POWERLEVEL9K_BATTERY_ICON=${POWERLEVEL9K_BATTERY_STAGES:$offset:1} - fi - fi - # return if POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD is set and the battery percentage is greater or equal - if [[ -v "POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD" && "${bat_percent}" -ge $POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]]; then - return - fi - - # override the default color if we are using a color level array - if [[ -n "$POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND" ]] && [[ "${(t)POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND}" =~ "array" ]]; then - local segment=$(( 100.0 / (${#POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND} - 1 ) )) - local offset=$(( ($bat_percent / $segment) + 1 )) - "$1_prompt_segment" "$0_${current_state}" "$2" "${POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND[$offset]}" "${battery_states[$current_state]}" "${message}" "BATTERY_ICON" - else - # Draw the prompt_segment - "$1_prompt_segment" "$0_${current_state}" "$2" "${DEFAULT_COLOR}" "${battery_states[$current_state]}" "${message}" "BATTERY_ICON" - fi -} - -################################################################ -# Public IP segment -# Parameters: -# * $1 Alignment: string - left|right -# * $2 Index: integer -# * $3 Joined: bool - If the segment should be joined -prompt_public_ip() { - # set default values for segment - set_default POWERLEVEL9K_PUBLIC_IP_TIMEOUT "300" - set_default POWERLEVEL9K_PUBLIC_IP_NONE "" - set_default POWERLEVEL9K_PUBLIC_IP_FILE "/tmp/p9k_public_ip" - set_default POWERLEVEL9K_PUBLIC_IP_HOST "http://ident.me" - defined POWERLEVEL9K_PUBLIC_IP_METHODS || POWERLEVEL9K_PUBLIC_IP_METHODS=(dig curl wget) - - # Do we need a fresh IP? - local refresh_ip=false - if [[ -f $POWERLEVEL9K_PUBLIC_IP_FILE ]]; then - typeset -i timediff - # if saved IP is more than - if [[ "$OS" == "OSX" ]]; then - timediff=$(($(date +%s) - $(stat -f "%m" $POWERLEVEL9K_PUBLIC_IP_FILE))) - else - timediff=$(($(date +%s) - $(date -r $POWERLEVEL9K_PUBLIC_IP_FILE +%s))) - fi - [[ $timediff -gt $POWERLEVEL9K_PUBLIC_IP_TIMEOUT ]] && refresh_ip=true - # If tmp file is empty get a fresh IP - [[ -z $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) ]] && refresh_ip=true - [[ -n $POWERLEVEL9K_PUBLIC_IP_NONE ]] && [[ $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) =~ "$POWERLEVEL9K_PUBLIC_IP_NONE" ]] && refresh_ip=true - else - touch $POWERLEVEL9K_PUBLIC_IP_FILE && refresh_ip=true - fi - - # grab a fresh IP if needed - local fresh_ip - if [[ $refresh_ip =~ true && -w $POWERLEVEL9K_PUBLIC_IP_FILE ]]; then - for method in "${POWERLEVEL9K_PUBLIC_IP_METHODS[@]}"; do - case $method in - 'dig') - fresh_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com 2> /dev/null)" - [[ "$fresh_ip" =~ ^\; ]] && unset fresh_ip - ;; - 'curl') - fresh_ip="$(curl --max-time 10 -w '\n' "$POWERLEVEL9K_PUBLIC_IP_HOST" 2> /dev/null)" - ;; - 'wget') - fresh_ip="$(wget -T 10 -qO- "$POWERLEVEL9K_PUBLIC_IP_HOST" 2> /dev/null)" - ;; - esac - # If we found a fresh IP, break loop. - if [[ -n "${fresh_ip}" ]]; then - break; - fi - done - - # write IP to tmp file or clear tmp file if an IP was not retrieved - # Redirection with `>!`. From the manpage: Same as >, except that the file - # is truncated to zero length if it exists, even if CLOBBER is unset. - # If the file already exists, and a simple `>` redirection and CLOBBER - # unset, ZSH will produce an error. - [[ -n "${fresh_ip}" ]] && echo $fresh_ip >! $POWERLEVEL9K_PUBLIC_IP_FILE || echo $POWERLEVEL9K_PUBLIC_IP_NONE >! $POWERLEVEL9K_PUBLIC_IP_FILE - fi - - # read public IP saved to tmp file - local public_ip="$(cat $POWERLEVEL9K_PUBLIC_IP_FILE)" - - # Draw the prompt segment - if [[ -n $public_ip ]]; then - icon='PUBLIC_IP_ICON' - # Check VPN is on if VPN interface is set - if [[ -n $POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE ]]; then - for vpn_iface in $(/sbin/ifconfig | grep -e ^"$POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE" | cut -d":" -f1) - do - icon='VPN_ICON' - break - done - fi - $1_prompt_segment "$0" "$2" "$DEFAULT_COLOR" "$DEFAULT_COLOR_INVERTED" "${public_ip}" "$icon" - fi -} - -################################################################ -# Context: user@hostname (who am I and where am I) -# Note that if $DEFAULT_USER is not set, this prompt segment will always print -set_default POWERLEVEL9K_ALWAYS_SHOW_CONTEXT false -set_default POWERLEVEL9K_ALWAYS_SHOW_USER false -set_default POWERLEVEL9K_CONTEXT_TEMPLATE "%n@%m" -prompt_context() { - local current_state="DEFAULT" - typeset -AH context_states - context_states=( - "ROOT" "yellow" - "SUDO" "yellow" - "DEFAULT" "yellow" - "REMOTE" "yellow" - "REMOTE_SUDO" "yellow" - ) - - local content="" - - if [[ "$POWERLEVEL9K_ALWAYS_SHOW_CONTEXT" == true ]] || [[ "$(whoami)" != "$DEFAULT_USER" ]] || [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then - content="${POWERLEVEL9K_CONTEXT_TEMPLATE}" - elif [[ "$POWERLEVEL9K_ALWAYS_SHOW_USER" == true ]]; then - content="$(whoami)" - else - return - fi - - if [[ $(print -P "%#") == '#' ]]; then - current_state="ROOT" - elif [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then - if sudo -n true 2>/dev/null; then - current_state="REMOTE_SUDO" - else - current_state="REMOTE" - fi - elif sudo -n true 2>/dev/null; then - current_state="SUDO" - fi - - "$1_prompt_segment" "${0}_${current_state}" "$2" "$DEFAULT_COLOR" "${context_states[$current_state]}" "${content}" -} - -################################################################ -# User: user (who am I) -# Note that if $DEFAULT_USER is not set, this prompt segment will always print -set_default POWERLEVEL9K_USER_TEMPLATE "%n" -prompt_user() { - local current_state="DEFAULT" - typeset -AH user_state - if [[ "$POWERLEVEL9K_ALWAYS_SHOW_USER" == true ]] || [[ "$(whoami)" != "$DEFAULT_USER" ]]; then - if [[ $(print -P "%#") == '#' ]]; then - user_state=( - "STATE" "ROOT" - "CONTENT" "${POWERLEVEL9K_USER_TEMPLATE}" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "ROOT_ICON" - ) - elif sudo -n true 2>/dev/null; then - user_state=( - "STATE" "SUDO" - "CONTENT" "${POWERLEVEL9K_USER_TEMPLATE}" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "SUDO_ICON" - ) - else - user_state=( - "STATE" "DEFAULT" - "CONTENT" "$(whoami)" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "USER_ICON" - ) - fi - "$1_prompt_segment" "${0}_${user_state[STATE]}" "$2" "${user_state[BACKGROUND_COLOR]}" "${user_state[FOREGROUND_COLOR]}" "${user_state[CONTENT]}" "${user_state[VISUAL_IDENTIFIER]}" - fi -} - -################################################################ -# Host: machine (where am I) -set_default POWERLEVEL9K_HOST_TEMPLATE "%m" -prompt_host() { - local current_state="LOCAL" - typeset -AH host_state - if [[ -n "$SSH_CLIENT" ]] || [[ -n "$SSH_TTY" ]]; then - host_state=( - "STATE" "REMOTE" - "CONTENT" "${POWERLEVEL9K_HOST_TEMPLATE}" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "SSH_ICON" - ) - else - host_state=( - "STATE" "LOCAL" - "CONTENT" "${POWERLEVEL9K_HOST_TEMPLATE}" - "BACKGROUND_COLOR" "${DEFAULT_COLOR}" - "FOREGROUND_COLOR" "yellow" - "VISUAL_IDENTIFIER" "HOST_ICON" - ) - fi - "$1_prompt_segment" "$0_${host_state[STATE]}" "$2" "${host_state[BACKGROUND_COLOR]}" "${host_state[FOREGROUND_COLOR]}" "${host_state[CONTENT]}" "${host_state[VISUAL_IDENTIFIER]}" -} - -################################################################ -# The 'custom` prompt provides a way for users to invoke commands and display -# the output in a segment. -prompt_custom() { - local command=POWERLEVEL9K_CUSTOM_$3:u - local segment_content="$(eval ${(P)command})" - - if [[ -n $segment_content ]]; then - "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$segment_content" - fi -} - -################################################################ -# Display the duration the command needed to run. -prompt_command_execution_time() { - set_default POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD 3 - set_default POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION 2 - - # Print time in human readable format - # For that use `strftime` and convert - # the duration (float) to an seconds - # (integer). - # See http://unix.stackexchange.com/a/89748 - local humanReadableDuration - if (( _P9K_COMMAND_DURATION > 3600 )); then - humanReadableDuration=$(TZ=GMT; strftime '%H:%M:%S' $(( int(rint(_P9K_COMMAND_DURATION)) ))) - elif (( _P9K_COMMAND_DURATION > 60 )); then - humanReadableDuration=$(TZ=GMT; strftime '%M:%S' $(( int(rint(_P9K_COMMAND_DURATION)) ))) - else - # If the command executed in seconds, print as float. - # Convert to float - if [[ "${POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION}" == "0" ]]; then - # If user does not want microseconds, then we need to convert - # the duration to an integer. - typeset -i humanReadableDuration - else - typeset -F ${POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION} humanReadableDuration - fi - humanReadableDuration=$_P9K_COMMAND_DURATION - fi - - if (( _P9K_COMMAND_DURATION >= POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD )); then - "$1_prompt_segment" "$0" "$2" "red" "yellow1" "${humanReadableDuration}" 'EXECUTION_TIME_ICON' - fi -} - -################################################################ -# Dir: current working directory -# Parameters: -# * $1 Alignment: string - left|right -# * $2 Index: integer -set_default POWERLEVEL9K_DIR_PATH_SEPARATOR "/" -set_default POWERLEVEL9K_HOME_FOLDER_ABBREVIATION "~" -set_default POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD false -prompt_dir() { - # using $PWD instead of "$(print -P '%~')" to allow use of POWERLEVEL9K_DIR_PATH_ABSOLUTE - local current_path=$PWD # WAS: local current_path="$(print -P '%~')" - # check if the user wants to use absolute paths or "~" paths - [[ ${(L)POWERLEVEL9K_DIR_PATH_ABSOLUTE} != "true" ]] && current_path=${current_path//$HOME/"~"} - # declare all local variables - local paths directory test_dir test_dir_length trunc_path threshhold - # if we are not in "~" or "/", split the paths into an array and exclude "~" - (( ${#current_path} > 1 )) && paths=(${(s:/:)${current_path//"~\/"/}}) || paths=() - # only run the code if SHORTEN_DIR_LENGTH is set, or we are using the two strategies that don't rely on it. - if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_with_folder_marker" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_to_last" ]]; then - set_default POWERLEVEL9K_SHORTEN_DELIMITER "\u2026" - # convert delimiter from unicode to literal character, so that we can get the correct length later - local delim=$(echo -n $POWERLEVEL9K_SHORTEN_DELIMITER) - - case "$POWERLEVEL9K_SHORTEN_STRATEGY" in - truncate_absolute_chars) - if [ ${#current_path} -gt $(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#POWERLEVEL9K_SHORTEN_DELIMITER} )) ]; then - current_path=$POWERLEVEL9K_SHORTEN_DELIMITER${current_path:(-POWERLEVEL9K_SHORTEN_DIR_LENGTH)} - fi - ;; - truncate_middle) - # truncate characters from the middle of the path - current_path=$(truncatePath $current_path $POWERLEVEL9K_SHORTEN_DIR_LENGTH $POWERLEVEL9K_SHORTEN_DELIMITER "middle") - ;; - truncate_from_right) - # truncate characters from the right of the path - current_path=$(truncatePath "$current_path" $POWERLEVEL9K_SHORTEN_DIR_LENGTH $POWERLEVEL9K_SHORTEN_DELIMITER) - ;; - truncate_absolute) - # truncate all characters except the last POWERLEVEL9K_SHORTEN_DIR_LENGTH characters - if [ ${#current_path} -gt $(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#POWERLEVEL9K_SHORTEN_DELIMITER} )) ]; then - current_path=$POWERLEVEL9K_SHORTEN_DELIMITER${current_path:(-POWERLEVEL9K_SHORTEN_DIR_LENGTH)} - fi - ;; - truncate_to_last) - # truncate all characters before the current directory - current_path=${current_path##*/} - ;; - truncate_to_first_and_last) - if (( ${#current_path} > 1 )) && (( ${POWERLEVEL9K_SHORTEN_DIR_LENGTH} > 0 )); then - threshhold=$(( ${POWERLEVEL9K_SHORTEN_DIR_LENGTH} * 2)) - # if we are in "~", add it back into the paths array - [[ $current_path == '~'* ]] && paths=("~" "${paths[@]}") - if (( ${#paths} > $threshhold )); then - local num=$(( ${#paths} - ${POWERLEVEL9K_SHORTEN_DIR_LENGTH} )) - # repace the middle elements - for (( i=$POWERLEVEL9K_SHORTEN_DIR_LENGTH; i<$num; i++ )); do - paths[$i+1]=$POWERLEVEL9K_SHORTEN_DELIMITER - done - [[ $current_path != '~'* ]] && current_path="/" || current_path="" - current_path+="${(j:/:)paths}" - fi - fi - ;; - truncate_to_unique) - # for each parent path component find the shortest unique beginning - # characters sequence. Source: https://stackoverflow.com/a/45336078 - if (( ${#current_path} > 1 )); then # root and home are exceptions and won't have paths - local matching - local cur_path='/' - [[ $current_path != "~"* ]] && trunc_path='/' || trunc_path='' - for directory in ${paths[@]}; do - test_dir='' - for (( i=0; i<${#directory}; i++ )); do - test_dir+="${directory:$i:1}" - matching=("$cur_path"/"$test_dir"*/) - if [[ ${#matching[@]} -eq 1 ]]; then - break - fi - done - trunc_path+="$test_dir/" - cur_path+="$directory/" - done - [[ $current_path == "~"* ]] && trunc_path="~/$trunc_path" - current_path="${trunc_path: : -1}" - fi - ;; - truncate_with_folder_marker) - if (( ${#paths} > 0 )); then # root and home are exceptions and won't have paths, so skip this - local last_marked_folder marked_folder - set_default POWERLEVEL9K_SHORTEN_FOLDER_MARKER ".shorten_folder_marker" - - # Search for the folder marker in the parent directories and - # buildup a pattern that is removed from the current path - # later on. - for marked_folder in $(upsearch $POWERLEVEL9K_SHORTEN_FOLDER_MARKER); do - if [[ "$marked_folder" == "/" ]]; then - # If we reached root folder, stop upsearch. - trunc_path="/" - elif [[ "$marked_folder" == "$HOME" ]]; then - # If we reached home folder, stop upsearch. - trunc_path="~" - elif [[ "${marked_folder%/*}" == $last_marked_folder ]]; then - trunc_path="${trunc_path%/}/${marked_folder##*/}" - else - trunc_path="${trunc_path%/}/$POWERLEVEL9K_SHORTEN_DELIMITER/${marked_folder##*/}" - fi - last_marked_folder=$marked_folder - done - - # Replace the shortest possible match of the marked folder from - # the current path. - current_path=$trunc_path${current_path#${last_marked_folder}*} - fi - ;; - truncate_with_package_name) - local name repo_path package_path current_dir zero - - # Get the path of the Git repo, which should have the package.json file - if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == "true" ]]; then - # Get path from the root of the git repository to the current dir - local gitPath=$(git rev-parse --show-prefix) - # Remove trailing slash from git path, so that we can - # remove that git path from the pwd. - gitPath=${gitPath%/} - package_path=${$(pwd)%%$gitPath} - # Remove trailing slash - package_path=${package_path%/} - elif [[ $(git rev-parse --is-inside-git-dir 2> /dev/null) == "true" ]]; then - package_path=${$(pwd)%%/.git*} - fi - - # Replace the shortest possible match of the marked folder from - # the current path. Remove the amount of characters up to the - # folder marker from the left. Count only the visible characters - # in the path (this is done by the "zero" pattern; see - # http://stackoverflow.com/a/40855342/5586433). - local zero='%([BSUbfksu]|([FB]|){*})' - trunc_path=$(pwd) - # Then, find the length of the package_path string, and save the - # subdirectory path as a substring of the current directory's path from 0 - # to the length of the package path's string - subdirectory_path=$(truncatePath "${trunc_path:${#${(S%%)package_path//$~zero/}}}" $POWERLEVEL9K_SHORTEN_DIR_LENGTH $POWERLEVEL9K_SHORTEN_DELIMITER) - # Parse the 'name' from the package.json; if there are any problems, just - # print the file path - defined POWERLEVEL9K_DIR_PACKAGE_FILES || POWERLEVEL9K_DIR_PACKAGE_FILES=(package.json composer.json) - - local pkgFile="unknown" - for file in "${POWERLEVEL9K_DIR_PACKAGE_FILES[@]}"; do - if [[ -f "${package_path}/${file}" ]]; then - pkgFile="${package_path}/${file}" - break; - fi - done - - local packageName=$(jq '.name' ${pkgFile} 2> /dev/null \ - || node -e 'console.log(require(process.argv[1]).name);' ${pkgFile} 2>/dev/null \ - || cat "${pkgFile}" 2> /dev/null | grep -m 1 "\"name\"" | awk -F ':' '{print $2}' | awk -F '"' '{print $2}' 2>/dev/null \ - ) - if [[ -n "${packageName}" ]]; then - # Instead of printing out the full path, print out the name of the package - # from the package.json and append the current subdirectory - current_path="`echo $packageName | tr -d '"'`$subdirectory_path" - fi - ;; - *) - if [[ $current_path != "~" ]]; then - current_path="$(print -P "%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c")" - fi - ;; - esac - fi - - # save state of path for highlighting and bold options - local path_opt=$current_path - - typeset -AH dir_states - dir_states=( - "DEFAULT" "FOLDER_ICON" - "HOME" "HOME_ICON" - "HOME_SUBFOLDER" "HOME_SUB_ICON" - "NOT_WRITABLE" "LOCK_ICON" - "ETC" "ETC_ICON" - ) - local state_path="$(print -P '%~')" - local current_state="DEFAULT" - if [[ $state_path == '/etc'* ]]; then - current_state='ETC' - elif [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == true && ! -w "$PWD" ]]; then - current_state="NOT_WRITABLE" - elif [[ $state_path == '~' ]]; then - current_state="HOME" - elif [[ $state_path == '~'* ]]; then - current_state="HOME_SUBFOLDER" - fi - - # declare variables used for bold and state colors - local bld_on bld_off dir_state_foreground dir_state_user_foreground - # test if user wants the last directory printed in bold - if [[ "${(L)POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD}" == "true" ]]; then - bld_on="%B" - bld_off="%b" - else - bld_on="" - bld_off="" - fi - # determine is the user has set a last directory color - local dir_state_user_foreground=POWERLEVEL9K_DIR_${current_state}_FOREGROUND - local dir_state_foreground=${(P)dir_state_user_foreground} - [[ -z ${dir_state_foreground} ]] && dir_state_foreground="${DEFAULT_COLOR}" - - local dir_name base_name - # use ZSH substitution to get the dirname and basename instead of calling external functions - dir_name=${path_opt%/*} - base_name=${path_opt##*/} - - # if the user wants the last directory colored... - if [[ -n ${POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND} ]]; then - # it the path is "/" or "~" - if [[ $path_opt == "/" || $path_opt == "~" ]]; then - current_path="${bld_on}%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${current_path}${bld_off}" - else # has a subfolder - # test if dirname != basename - they are equal if we use truncate_to_last or truncate_absolute - if [[ $dir_name != $base_name ]]; then - current_path="${dir_name}/${bld_on}%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${base_name}${bld_off}" - else - current_path="${bld_on}%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${base_name}${bld_off}" - fi - fi - else # no coloring - # it the path is "/" or "~" - if [[ $path_opt == "/" || $path_opt == "~" ]]; then - current_path="${bld_on}${current_path}${bld_off}" - else # has a subfolder - # test if dirname != basename - they are equal if we use truncate_to_last or truncate_absolute - if [[ $dir_name != $base_name ]]; then - current_path="${dir_name}/${bld_on}${base_name}${bld_off}" - else - current_path="${bld_on}${base_name}${bld_off}" - fi - fi - fi - - # check if we need to omit the first character and only do it if we are not in "~" or "/" - if [[ "${POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER}" == "true" && $path_opt != "/" && $path_opt != "~" ]]; then - current_path="${current_path[2,-1]}" - fi - - # check if the user wants the separator colored. - if [[ -n ${POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND} && $path_opt != "/" ]]; then - # because this contains color changing codes, it is easier to set a variable for what should be replaced - local repl="%F{$POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND}/%F{$dir_state_foreground}" - # escape the / with a \ - current_path=${current_path//\//$repl} - fi - - if [[ "${POWERLEVEL9K_DIR_PATH_SEPARATOR}" != "/" && $path_opt != "/" ]]; then - current_path=${current_path//\//$POWERLEVEL9K_DIR_PATH_SEPARATOR} - fi - - if [[ "${POWERLEVEL9K_HOME_FOLDER_ABBREVIATION}" != "~" && ! "${(L)POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER}" == "true" ]]; then - # use :s to only replace the first occurance - current_path=${current_path:s/~/$POWERLEVEL9K_HOME_FOLDER_ABBREVIATION} - fi - - "$1_prompt_segment" "$0_${current_state}" "$2" "blue" "$DEFAULT_COLOR" "${current_path}" "${dir_states[$current_state]}" -} - -################################################################ -# Docker machine -prompt_docker_machine() { - local docker_machine="$DOCKER_MACHINE_NAME" - - if [[ -n "$docker_machine" ]]; then - "$1_prompt_segment" "$0" "$2" "magenta" "$DEFAULT_COLOR" "$docker_machine" 'SERVER_ICON' - fi -} - -################################################################ -# GO prompt -prompt_go_version() { - local go_version - local go_path - go_version=$(go version 2>/dev/null | sed -E "s/.*(go[0-9.]*).*/\1/") - go_path=$(go env GOPATH 2>/dev/null) - - if [[ -n "$go_version" && "${PWD##$go_path}" != "$PWD" ]]; then - "$1_prompt_segment" "$0" "$2" "green" "grey93" "$go_version" "GO_ICON" - fi -} - -################################################################ -# Command number (in local history) -prompt_history() { - "$1_prompt_segment" "$0" "$2" "grey50" "$DEFAULT_COLOR" '%h' -} - -################################################################ -# Detection for virtualization (systemd based systems only) -prompt_detect_virt() { - if ! command -v systemd-detect-virt > /dev/null; then - return - fi - local virt=$(systemd-detect-virt) - if [[ "$virt" == "none" ]]; then - if [[ "$(ls -di / | grep -o 2)" != "2" ]]; then - virt="chroot" - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" - else - ; - fi - else - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" - fi -} - -################################################################ -# Test icons -prompt_icons_test() { - for key in ${(@k)icons}; do - # The lower color spectrum in ZSH makes big steps. Choosing - # the next color has enough contrast to read. - local random_color=$((RANDOM % 8)) - local next_color=$((random_color+1)) - "$1_prompt_segment" "$0" "$2" "$random_color" "$next_color" "$key" "$key" - done -} - -################################################################ -# Segment to display the current IP address -prompt_ip() { - if [[ "$OS" == "OSX" ]]; then - if defined POWERLEVEL9K_IP_INTERFACE; then - # Get the IP address of the specified interface. - ip=$(ipconfig getifaddr "$POWERLEVEL9K_IP_INTERFACE") - else - local interfaces callback - # Get network interface names ordered by service precedence. - interfaces=$(networksetup -listnetworkserviceorder | grep -o "Device:\s*[a-z0-9]*" | grep -o -E '[a-z0-9]*$') - callback='ipconfig getifaddr $item' - - ip=$(getRelevantItem "$interfaces" "$callback") - fi - else - if defined POWERLEVEL9K_IP_INTERFACE; then - # Get the IP address of the specified interface. - ip=$(ip -4 a show "$POWERLEVEL9K_IP_INTERFACE" | grep -o "inet\s*[0-9.]*" | grep -o "[0-9.]*") - else - local interfaces callback - # Get all network interface names that are up - interfaces=$(ip link ls up | grep -o -E ":\s+[a-z0-9]+:" | grep -v "lo" | grep -o "[a-z0-9]*") - callback='ip -4 a show $item | grep -o "inet\s*[0-9.]*" | grep -o "[0-9.]*"' - - ip=$(getRelevantItem "$interfaces" "$callback") - fi - fi - - "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'NETWORK_ICON' -} - -################################################################ -# Segment to display if VPN is active -set_default POWERLEVEL9K_VPN_IP_INTERFACE "tun" -# prompt if vpn active -prompt_vpn_ip() { - for vpn_iface in $(/sbin/ifconfig | grep -e ^"$POWERLEVEL9K_VPN_IP_INTERFACE" | cut -d":" -f1) - do - ip=$(/sbin/ifconfig "$vpn_iface" | grep -o "inet\s.*" | cut -d' ' -f2) - "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'VPN_ICON' - done -} - -################################################################ -# Segment to display laravel version -prompt_laravel_version() { - local laravel_version="$(php artisan --version 2>/dev/null)" - if [[ -n "${laravel_version}" ]]; then - # Remove unrelevant infos - laravel_version="${laravel_version//Laravel Framework version /}" - - "$1_prompt_segment" "$0" "$2" "maroon" "white" "${laravel_version}" 'LARAVEL_ICON' - fi -} - -################################################################ -# Segment to display load -set_default POWERLEVEL9K_LOAD_WHICH 5 -prompt_load() { - # The load segment can have three different states - local current_state="unknown" - local load_select=2 - local load_avg - local cores - - typeset -AH load_states - load_states=( - 'critical' 'red' - 'warning' 'yellow' - 'normal' 'green' - ) - - case "$POWERLEVEL9K_LOAD_WHICH" in - 1) - load_select=1 - ;; - 5) - load_select=2 - ;; - 15) - load_select=3 - ;; - esac - - case "$OS" in - OSX|BSD) - load_avg=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | sed -n ${load_select}p) - if [[ "$OS" == "OSX" ]]; then - cores=$(sysctl -n hw.logicalcpu) - else - cores=$(sysctl -n hw.ncpu) - fi - ;; - *) - load_avg=$(cut -d" " -f${load_select} /proc/loadavg) - cores=$(nproc) - esac - - # Replace comma - load_avg=${load_avg//,/.} - - if [[ "$load_avg" -gt $((${cores} * 0.7)) ]]; then - current_state="critical" - elif [[ "$load_avg" -gt $((${cores} * 0.5)) ]]; then - current_state="warning" - else - current_state="normal" - fi - - "$1_prompt_segment" "${0}_${current_state}" "$2" "${load_states[$current_state]}" "$DEFAULT_COLOR" "$load_avg" 'LOAD_ICON' -} - -################################################################ -# Segment to diplay Node version -prompt_node_version() { - local node_version=$(node -v 2>/dev/null) - [[ -z "${node_version}" ]] && return - - "$1_prompt_segment" "$0" "$2" "green" "white" "${node_version:1}" 'NODE_ICON' -} - -################################################################ -# Segment to display Node version from NVM -# Only prints the segment if different than the default value -prompt_nvm() { - local node_version nvm_default - (( $+functions[nvm_version] )) || return - - node_version=$(nvm_version current) - [[ -z "${node_version}" || ${node_version} == "none" ]] && return - - nvm_default=$(nvm_version default) - [[ "$node_version" =~ "$nvm_default" ]] && return - - $1_prompt_segment "$0" "$2" "magenta" "black" "${node_version:1}" 'NODE_ICON' -} - -################################################################ -# Segment to display NodeEnv -prompt_nodeenv() { - local nodeenv_path="$NODE_VIRTUAL_ENV" - if [[ -n "$nodeenv_path" && "$NODE_VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then - local info="$(node -v)[$(basename "$nodeenv_path")]" - "$1_prompt_segment" "$0" "$2" "black" "green" "$info" 'NODE_ICON' - fi -} - -################################################################ -# Segment to print a little OS icon -prompt_os_icon() { - "$1_prompt_segment" "$0" "$2" "black" "white" "$OS_ICON" -} - -################################################################ -# Segment to display PHP version number -prompt_php_version() { - local php_version - php_version=$(php -v 2>&1 | grep -oe "^PHP\s*[0-9.]*") - - if [[ -n "$php_version" ]]; then - "$1_prompt_segment" "$0" "$2" "fuchsia" "grey93" "$php_version" - fi -} - -################################################################ -# Segment to display free RAM and used Swap -prompt_ram() { - local base='' - local ramfree=0 - if [[ "$OS" == "OSX" ]]; then - # Available = Free + Inactive - # See https://support.apple.com/en-us/HT201538 - ramfree=$(vm_stat | grep "Pages free" | grep -o -E '[0-9]+') - ramfree=$((ramfree + $(vm_stat | grep "Pages inactive" | grep -o -E '[0-9]+'))) - # Convert pages into Bytes - ramfree=$(( ramfree * 4096 )) - else - if [[ "$OS" == "BSD" ]]; then - ramfree=$(grep 'avail memory' /var/run/dmesg.boot | awk '{print $4}') - else - ramfree=$(grep -o -E "MemAvailable:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - base='K' - fi - fi - - "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$ramfree" $base)" 'RAM_ICON' -} - - -set_default POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW false -# rbenv information -prompt_rbenv() { - if command which rbenv 2>/dev/null >&2; then - local rbenv_version_name="$(rbenv version-name)" - local rbenv_global="$(rbenv global)" - - # Don't show anything if the current Ruby is the same as the global Ruby - # unless `POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW` is set. - if [[ $rbenv_version_name == $rbenv_global && "$POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW" = false ]]; then - return - fi - - "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON' - fi -} - -################################################################ -# Segment to display chruby information -# see https://github.com/postmodern/chruby/issues/245 for chruby_auto issue with ZSH -prompt_chruby() { - # Uses $RUBY_VERSION and $RUBY_ENGINE set by chruby - set_default POWERLEVEL9K_CHRUBY_SHOW_VERSION true - set_default POWERLEVEL9K_CHRUBY_SHOW_ENGINE true - local chruby_label="" - - if [[ "$POWERLEVEL9K_CHRUBY_SHOW_ENGINE" == true ]]; then - chruby_label+="$RUBY_ENGINE " - fi - if [[ "$POWERLEVEL9K_CHRUBY_SHOW_VERSION" == true ]]; then - chruby_label+="$RUBY_VERSION" - fi - - # Truncate trailing spaces - chruby_label="${chruby_label%"${chruby_label##*[![:space:]]}"}" - - # Don't show anything if the chruby did not change the default ruby - if [[ "$RUBY_ENGINE" != "" ]]; then - "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "${chruby_label}" 'RUBY_ICON' - fi -} - -################################################################ -# Segment to print an icon if user is root. -prompt_root_indicator() { - if [[ "$UID" -eq 0 ]]; then - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "" 'ROOT_ICON' - fi -} - -################################################################ -# Segment to display Rust version number -prompt_rust_version() { - local rust_version - rust_version=$(command rustc --version 2>/dev/null) - # Remove "rustc " (including the whitespace) from the beginning - # of the version string and remove everything after the next - # whitespace. This way we'll end up with only the version. - rust_version=${${rust_version/rustc /}%% *} - - if [[ -n "$rust_version" ]]; then - "$1_prompt_segment" "$0" "$2" "darkorange" "$DEFAULT_COLOR" "$rust_version" 'RUST_ICON' - fi -} - -# RSpec test ratio -prompt_rspec_stats() { - if [[ (-d app && -d spec) ]]; then - local code_amount tests_amount - code_amount=$(ls -1 app/**/*.rb | wc -l) - tests_amount=$(ls -1 spec/**/*.rb | wc -l) - - build_test_stats "$1" "$0" "$2" "$code_amount" "$tests_amount" "RSpec" 'TEST_ICON' - fi -} - -################################################################ -# Segment to display Ruby Version Manager information -prompt_rvm() { - local version_and_gemset=${rvm_env_string/ruby-} - - if [[ -n "$version_and_gemset" ]]; then - "$1_prompt_segment" "$0" "$2" "grey35" "$DEFAULT_COLOR" "$version_and_gemset" 'RUBY_ICON' - fi -} - -################################################################ -# Segment to display SSH icon when connected -prompt_ssh() { - if [[ -n "$SSH_CLIENT" ]] || [[ -n "$SSH_TTY" ]]; then - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "" 'SSH_ICON' - fi -} - -################################################################ -# Status: When an error occur, return the error code, or a cross icon if option is set -# Display an ok icon when no error occur, or hide the segment if option is set to false -# -set_default POWERLEVEL9K_STATUS_CROSS false -set_default POWERLEVEL9K_STATUS_OK true -set_default POWERLEVEL9K_STATUS_SHOW_PIPESTATUS true -set_default POWERLEVEL9K_STATUS_HIDE_SIGNAME false -# old options, retro compatibility -set_default POWERLEVEL9K_STATUS_VERBOSE true -set_default POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE false - -exit_code_or_status() { - local ec=$1 - if [[ "$POWERLEVEL9K_STATUS_HIDE_SIGNAME" = true ]]; then - echo "$ec" - elif (( ec <= 128 )); then - echo "$ec" - else - local sig=$(( ec - 128 )) - local idx=$(( sig + 1 )) - echo "SIG${signals[$idx]}(${sig})" - fi -} - -prompt_status() { - local ec_text - local ec_sum - local ec - - if [[ $POWERLEVEL9K_STATUS_SHOW_PIPESTATUS == true ]]; then - if (( $#RETVALS > 1 )); then - ec_text=$(exit_code_or_status "${RETVALS[1]}") - ec_sum=${RETVALS[1]} - else - ec_text=$(exit_code_or_status "${RETVAL}") - ec_sum=${RETVAL} - fi - - for ec in "${(@)RETVALS[2,-1]}"; do - ec_text="${ec_text}|$(exit_code_or_status "$ec")" - ec_sum=$(( $ec_sum + $ec )) - done - else - # We use RETVAL instead of the right-most RETVALS item because - # PIPE_FAIL may be set. - ec_text=$(exit_code_or_status "${RETVAL}") - ec_sum=${RETVAL} - fi - - if (( ec_sum > 0 )); then - if [[ "$POWERLEVEL9K_STATUS_CROSS" == false && "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then - "$1_prompt_segment" "$0_ERROR" "$2" "red" "yellow1" "$ec_text" 'CARRIAGE_RETURN_ICON' - else - "$1_prompt_segment" "$0_ERROR" "$2" "$DEFAULT_COLOR" "red" "" 'FAIL_ICON' - fi - elif [[ "$POWERLEVEL9K_STATUS_OK" == true ]] && [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true || "$POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE" == true ]]; then - "$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "green" "" 'OK_ICON' - fi -} - -################################################################ -# Segment to display Swap information -prompt_swap() { - local swap_used=0 - local base='' - - if [[ "$OS" == "OSX" ]]; then - local raw_swap_used - raw_swap_used=$(sysctl vm.swapusage | grep -o "used\s*=\s*[0-9,.A-Z]*" | grep -o "[0-9,.A-Z]*$") - - typeset -F 2 swap_used - swap_used=${$(echo $raw_swap_used | grep -o "[0-9,.]*")//,/.} - # Replace comma - swap_used=${swap_used//,/.} - - base=$(echo "$raw_swap_used" | grep -o "[A-Z]*$") - else - swap_total=$(grep -o -E "SwapTotal:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - swap_free=$(grep -o -E "SwapFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - swap_used=$(( swap_total - swap_free )) - base='K' - fi - - "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$swap_used" $base)" 'SWAP_ICON' -} - -################################################################ -# Symfony2-PHPUnit test ratio -prompt_symfony2_tests() { - if [[ (-d src && -d app && -f app/AppKernel.php) ]]; then - local code_amount tests_amount - code_amount=$(ls -1 src/**/*.php | grep -vc Tests) - tests_amount=$(ls -1 src/**/*.php | grep -c Tests) - - build_test_stats "$1" "$0" "$2" "$code_amount" "$tests_amount" "SF2" 'TEST_ICON' - fi -} - -################################################################ -# Segment to display Symfony2-Version -prompt_symfony2_version() { - if [[ -f app/bootstrap.php.cache ]]; then - local symfony2_version - symfony2_version=$(grep " VERSION " app/bootstrap.php.cache | sed -e 's/[^.0-9]*//g') - "$1_prompt_segment" "$0" "$2" "grey35" "$DEFAULT_COLOR" "$symfony2_version" 'SYMFONY_ICON' - fi -} - -################################################################ -# Show a ratio of tests vs code -build_test_stats() { - local code_amount="$4" - local tests_amount="$5"+0.00001 - local headline="$6" - - # Set float precision to 2 digits: - typeset -F 2 ratio - local ratio=$(( (tests_amount/code_amount) * 100 )) - - (( ratio >= 75 )) && "$1_prompt_segment" "${2}_GOOD" "$3" "cyan" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6" - (( ratio >= 50 && ratio < 75 )) && "$1_prompt_segment" "$2_AVG" "$3" "yellow" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6" - (( ratio < 50 )) && "$1_prompt_segment" "$2_BAD" "$3" "red" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6" -} - -################################################################ -# System time -prompt_time() { - set_default POWERLEVEL9K_TIME_FORMAT "%D{%H:%M:%S}" - - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$POWERLEVEL9K_TIME_FORMAT" "TIME_ICON" -} - -################################################################ -# System date -prompt_date() { - set_default POWERLEVEL9K_DATE_FORMAT "%D{%d.%m.%y}" - - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$POWERLEVEL9K_DATE_FORMAT" "DATE_ICON" -} - -################################################################ -# todo.sh: shows the number of tasks in your todo.sh file -prompt_todo() { - if $(hash todo.sh 2>&-); then - count=$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }') - if [[ "$count" = <-> ]]; then - "$1_prompt_segment" "$0" "$2" "grey50" "$DEFAULT_COLOR" "$count" 'TODO_ICON' - fi - fi -} - -################################################################ -# VCS segment: shows the state of your repository, if you are in a folder under -# version control -set_default POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND "red" -# Default: Just display the first 8 characters of our changeset-ID. -set_default POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH "8" -powerlevel9k_vcs_init() { - if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then - POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH" - fi - - # Load VCS_INFO - autoload -Uz vcs_info - - VCS_WORKDIR_DIRTY=false - VCS_WORKDIR_HALF_DIRTY=false - - # The vcs segment can have three different states - defaults to 'clean'. - typeset -gAH vcs_states - vcs_states=( - 'clean' 'green' - 'modified' 'yellow' - 'untracked' 'green' - ) - - VCS_CHANGESET_PREFIX='' - if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then - VCS_CHANGESET_PREFIX="$(print_icon 'VCS_COMMIT_ICON')%0.$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH""i " - fi - - zstyle ':vcs_info:*' enable git hg svn - zstyle ':vcs_info:*' check-for-changes true - - VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%b%c%u%m" - zstyle ':vcs_info:*' formats "$VCS_DEFAULT_FORMAT" - - zstyle ':vcs_info:*' actionformats "%b %F{${POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND}}| %a%f" - - zstyle ':vcs_info:*' stagedstr " $(print_icon 'VCS_STAGED_ICON')" - zstyle ':vcs_info:*' unstagedstr " $(print_icon 'VCS_UNSTAGED_ICON')" - - defined POWERLEVEL9K_VCS_GIT_HOOKS || POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname) - zstyle ':vcs_info:git*+set-message:*' hooks $POWERLEVEL9K_VCS_GIT_HOOKS - defined POWERLEVEL9K_VCS_HG_HOOKS || POWERLEVEL9K_VCS_HG_HOOKS=(vcs-detect-changes) - zstyle ':vcs_info:hg*+set-message:*' hooks $POWERLEVEL9K_VCS_HG_HOOKS - defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(vcs-detect-changes svn-detect-changes) - zstyle ':vcs_info:svn*+set-message:*' hooks $POWERLEVEL9K_VCS_SVN_HOOKS - - # For Hg, only show the branch name - zstyle ':vcs_info:hg*:*' branchformat "$(print_icon 'VCS_BRANCH_ICON')%b" - # The `get-revision` function must be turned on for dirty-check to work for Hg - zstyle ':vcs_info:hg*:*' get-revision true - zstyle ':vcs_info:hg*:*' get-bookmarks true - zstyle ':vcs_info:hg*+gen-hg-bookmark-string:*' hooks hg-bookmarks - - # For svn, only - # TODO fix the %b (branch) format for svn. Using %b breaks - # color-encoding of the foreground for the rest of the powerline. - zstyle ':vcs_info:svn*:*' formats "$VCS_CHANGESET_PREFIX%c%u" - zstyle ':vcs_info:svn*:*' actionformats "$VCS_CHANGESET_PREFIX%c%u %F{${POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND}}| %a%f" - - if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then - zstyle ':vcs_info:*' get-revision true - fi -} - -################################################################ -# Segment to show VCS information -prompt_vcs() { - VCS_WORKDIR_DIRTY=false - VCS_WORKDIR_HALF_DIRTY=false - local current_state="" - - # Actually invoke vcs_info manually to gather all information. - vcs_info - local vcs_prompt="${vcs_info_msg_0_}" - - if [[ -n "$vcs_prompt" ]]; then - if [[ "$VCS_WORKDIR_DIRTY" == true ]]; then - # $vcs_visual_identifier gets set in +vi-vcs-detect-changes in functions/vcs.zsh, - # as we have there access to vcs_info internal hooks. - current_state='modified' - else - if [[ "$VCS_WORKDIR_HALF_DIRTY" == true ]]; then - current_state='untracked' - else - current_state='clean' - fi - fi - "$1_prompt_segment" "${0}_${(U)current_state}" "$2" "${vcs_states[$current_state]}" "$DEFAULT_COLOR" "$vcs_prompt" "$vcs_visual_identifier" - fi -} - -################################################################ -# Vi Mode: show editing mode (NORMAL|INSERT) -set_default POWERLEVEL9K_VI_INSERT_MODE_STRING "INSERT" -set_default POWERLEVEL9K_VI_COMMAND_MODE_STRING "NORMAL" -prompt_vi_mode() { - case ${KEYMAP} in - vicmd) - "$1_prompt_segment" "$0_NORMAL" "$2" "$DEFAULT_COLOR" "default" "$POWERLEVEL9K_VI_COMMAND_MODE_STRING" - ;; - main|viins|*) - if [[ -z $POWERLEVEL9K_VI_INSERT_MODE_STRING ]]; then return; fi - "$1_prompt_segment" "$0_INSERT" "$2" "$DEFAULT_COLOR" "blue" "$POWERLEVEL9K_VI_INSERT_MODE_STRING" - ;; - esac -} - -################################################################ -# Virtualenv: current working virtualenv -# More information on virtualenv (Python): -# https://virtualenv.pypa.io/en/latest/ -prompt_virtualenv() { - local virtualenv_path="$VIRTUAL_ENV" - if [[ -n "$virtualenv_path" && "$VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then - "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$(basename "$virtualenv_path")" 'PYTHON_ICON' - fi -} - -################################################################ -# pyenv: current active python version (with restrictions) -# https://github.com/pyenv/pyenv#choosing-the-python-version -prompt_pyenv() { - if [[ -n "$PYENV_VERSION" ]]; then - "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$PYENV_VERSION" 'PYTHON_ICON' - fi -} - -################################################################ -# Display openfoam information -prompt_openfoam() { - local wm_project_version="$WM_PROJECT_VERSION" - local wm_fork="$WM_FORK" - if [[ -n "$wm_project_version" ]] && [[ -z "$wm_fork" ]] ; then - "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "OF: $(basename "$wm_project_version")" - elif [[ -n "$wm_project_version" ]] && [[ -n "$wm_fork" ]] ; then - "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "F-X: $(basename "$wm_project_version")" - fi -} - -################################################################ -# Segment to display Swift version -prompt_swift_version() { - # Get the first number as this is probably the "main" version number.. - local swift_version=$(swift --version 2>/dev/null | grep -o -E "[0-9.]+" | head -n 1) - [[ -z "${swift_version}" ]] && return - - "$1_prompt_segment" "$0" "$2" "magenta" "white" "${swift_version}" 'SWIFT_ICON' -} - -################################################################ -# dir_writable: Display information about the user's permission to write in the current directory -prompt_dir_writable() { - if [[ ! -w "$PWD" ]]; then - "$1_prompt_segment" "$0_FORBIDDEN" "$2" "red" "yellow1" "" 'LOCK_ICON' - fi -} - -################################################################ -# Kubernetes Current Context/Namespace -prompt_kubecontext() { - local kubectl_version="$(kubectl version --client 2>/dev/null)" - - if [[ -n "$kubectl_version" ]]; then - # Get the current Kuberenetes context - local cur_ctx=$(kubectl config view -o=jsonpath='{.current-context}') - cur_namespace="$(kubectl config view -o=jsonpath="{.contexts[?(@.name==\"${cur_ctx}\")].context.namespace}")" - # If the namespace comes back empty set it default. - if [[ -z "${cur_namespace}" ]]; then - cur_namespace="default" - fi - - local k8s_final_text="" - - if [[ "$cur_ctx" == "$cur_namespace" ]]; then - # No reason to print out the same identificator twice - k8s_final_text="$cur_ctx" - else - k8s_final_text="$cur_ctx/$cur_namespace" - fi - - "$1_prompt_segment" "$0" "$2" "magenta" "white" "$k8s_final_text" "KUBERNETES_ICON" - fi -} - -################################################################ -# Dropbox status -prompt_dropbox() { - # The first column is just the directory, so cut it - local dropbox_status="$(dropbox-cli filestatus . | cut -d\ -f2-)" - - # Only show if the folder is tracked and dropbox is running - if [[ "$dropbox_status" != 'unwatched' && "$dropbox_status" != "isn't running!" ]]; then - # If "up to date", only show the icon - if [[ "$dropbox_status" =~ 'up to date' ]]; then - dropbox_status="" - fi - - "$1_prompt_segment" "$0" "$2" "white" "blue" "$dropbox_status" "DROPBOX_ICON" - fi -} - -# print Java version number -prompt_java_version() { - local java_version - # Stupid: Java prints its version on STDERR. - # The first version ouput will print nothing, we just - # use it to transport whether the command was successful. - # If yes, we parse the version string (and need to - # redirect the stderr to stdout to make the pipe work). - java_version=$(java -version 2>/dev/null && java -fullversion 2>&1 | cut -d '"' -f 2) - - if [[ -n "$java_version" ]]; then - "$1_prompt_segment" "$0" "$2" "red" "white" "$java_version" "JAVA_ICON" - fi -} - -################################################################ -# Prompt processing and drawing -################################################################ -# Main prompt -build_left_prompt() { - local index=1 - local element - for element in "${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[@]}"; do - # Remove joined information in direct calls - element=${element%_joined} - - # Check if it is a custom command, otherwise interpet it as - # a prompt. - if [[ $element[0,7] =~ "custom_" ]]; then - "prompt_custom" "left" "$index" $element[8,-1] - else - "prompt_$element" "left" "$index" - fi - - index=$((index + 1)) - done - - left_prompt_end -} - -# Right prompt -build_right_prompt() { - local index=1 - local element - for element in "${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[@]}"; do - # Remove joined information in direct calls - element=${element%_joined} - - # Check if it is a custom command, otherwise interpet it as - # a prompt. - if [[ $element[0,7] =~ "custom_" ]]; then - "prompt_custom" "right" "$index" $element[8,-1] - else - "prompt_$element" "right" "$index" - fi - - index=$((index + 1)) - done - - # Clear to the end of the line - echo -n "%E" -} - -powerlevel9k_preexec() { - _P9K_TIMER_START=$EPOCHREALTIME -} - -set_default POWERLEVEL9K_PROMPT_ADD_NEWLINE false -powerlevel9k_prepare_prompts() { - local RETVAL RPROMPT_PREFIX RPROMPT_SUFFIX - RETVAL=$? - RETVALS=( "$pipestatus[@]" ) - - _P9K_COMMAND_DURATION=$((EPOCHREALTIME - _P9K_TIMER_START)) - - # Reset start time - _P9K_TIMER_START=0x7FFFFFFF - - if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then - PROMPT='$(print_icon 'MULTILINE_FIRST_PROMPT_PREFIX')%f%b%k$(build_left_prompt) -$(print_icon 'MULTILINE_LAST_PROMPT_PREFIX')' - if [[ "$POWERLEVEL9K_RPROMPT_ON_NEWLINE" != true ]]; then - # The right prompt should be on the same line as the first line of the left - # prompt. To do so, there is just a quite ugly workaround: Before zsh draws - # the RPROMPT, we advise it, to go one line up. At the end of RPROMPT, we - # advise it to go one line down. See: - # http://superuser.com/questions/357107/zsh-right-justify-in-ps1 - local LC_ALL="" LC_CTYPE="en_US.UTF-8" # Set the right locale to protect special characters - RPROMPT_PREFIX='%{'$'\e[1A''%}' # one line up - RPROMPT_SUFFIX='%{'$'\e[1B''%}' # one line down - else - RPROMPT_PREFIX='' - RPROMPT_SUFFIX='' - fi - else - PROMPT='%f%b%k$(build_left_prompt)' - RPROMPT_PREFIX='' - RPROMPT_SUFFIX='' - fi - - if [[ "$POWERLEVEL9K_DISABLE_RPROMPT" != true ]]; then - RPROMPT="${RPROMPT_PREFIX}"'%f%b%k$(build_right_prompt)%{$reset_color%}'"${RPROMPT_SUFFIX}" - fi - -local NEWLINE=' -' - - if [[ $POWERLEVEL9K_PROMPT_ADD_NEWLINE == true ]]; then - NEWLINES="" - repeat ${POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT:-1} { NEWLINES+=$NEWLINE } - PROMPT="$NEWLINES$PROMPT" - fi - - # Allow iTerm integration to work - [[ $ITERM_SHELL_INTEGRATION_INSTALLED == "Yes" ]] && PROMPT="%{$(iterm2_prompt_mark)%}$PROMPT" -} - -zle-keymap-select () { - zle reset-prompt - zle -R -} - -set_default POWERLEVEL9K_IGNORE_TERM_COLORS false -set_default POWERLEVEL9K_IGNORE_TERM_LANG false - -prompt_powerlevel9k_setup() { - # The value below was set to better support 32-bit CPUs. - # It's the maximum _signed_ integer value on 32-bit CPUs. - # Please don't change it until 19 January of 2038. ;) - - # Disable false display of command execution time - _P9K_TIMER_START=0x7FFFFFFF - - # The prompt function will set these prompt_* options after the setup function - # returns. We need prompt_subst so we can safely run commands in the prompt - # without them being double expanded and we need prompt_percent to expand the - # common percent escape sequences. - prompt_opts=(cr percent sp subst) - - # Borrowed from promptinit, sets the prompt options in case the theme was - # not initialized via promptinit. - setopt noprompt{bang,cr,percent,sp,subst} "prompt${^prompt_opts[@]}" - - # Display a warning if the terminal does not support 256 colors - termColors - - # If the terminal `LANG` is set to `C`, this theme will not work at all. - if [[ $POWERLEVEL9K_IGNORE_TERM_LANG == false ]]; then - local term_lang - term_lang=$(echo $LANG) - if [[ $term_lang == 'C' ]]; then - print -P "\t%F{red}WARNING!%f Your terminal's 'LANG' is set to 'C', which breaks this theme!" - print -P "\t%F{red}WARNING!%f Please set your 'LANG' to a UTF-8 language, like 'en_US.UTF-8'" - print -P "\t%F{red}WARNING!%f _before_ loading this theme in your \~\.zshrc. Putting" - print -P "\t%F{red}WARNING!%f %F{blue}export LANG=\"en_US.UTF-8\"%f at the top of your \~\/.zshrc is sufficient." - fi - fi - - defined POWERLEVEL9K_LEFT_PROMPT_ELEMENTS || POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs) - defined POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS || POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time) - - # Display a warning if deprecated segments are in use. - typeset -AH deprecated_segments - # old => new - deprecated_segments=( - 'longstatus' 'status' - ) - print_deprecation_warning deprecated_segments - - # initialize colors - autoload -U colors && colors - - if segment_in_use "vcs"; then - powerlevel9k_vcs_init - fi - - # initialize timing functions - zmodload zsh/datetime - - # Initialize math functions - zmodload zsh/mathfunc - - # initialize hooks - autoload -Uz add-zsh-hook - - # prepare prompts - add-zsh-hook precmd powerlevel9k_prepare_prompts - add-zsh-hook preexec powerlevel9k_preexec - - zle -N zle-keymap-select -} - -prompt_powerlevel9k_teardown() { - add-zsh-hook -D precmd powerlevel9k_\* - add-zsh-hook -D preexec powerlevel9k_\* - PROMPT='%m%# ' - RPROMPT= -} - -prompt_powerlevel9k_setup "$@" diff --git a/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup b/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup new file mode 120000 index 0000000..f692e0a --- /dev/null +++ b/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup @@ -0,0 +1 @@ +../external/powerlevel9k/powerlevel9k.zsh-theme \ No newline at end of file diff --git a/.zprezto/modules/prompt/functions/prompt_powerline_setup b/.zprezto/modules/prompt/functions/prompt_powerline_setup deleted file mode 100644 index a27b67b..0000000 --- a/.zprezto/modules/prompt/functions/prompt_powerline_setup +++ /dev/null @@ -1,185 +0,0 @@ -# -# A ZSH theme based on a combination of the skwp prezto theme and the robl ohmyzsh theme. -# * RVM info shown on the right -# * Git branch info on the left -# * Single line prompt -# * Time since last commit on the left -# * Time in place of user@hostname -# -# Authors: -# David Rice - -ZSH_THEME_REP_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" -ZSH_THEME_REP_TIME_SINCE_COMMIT_MEDIUM="%{$fg[yellow]%}" -ZSH_THEME_REP_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" -ZSH_THEME_REP_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" - -# returns the time since last git commit -git_time_details()() { - # only proceed if there is actually a git repository - if $(git rev-parse --git-dir > /dev/null 2>&1); then - # only proceed if there is actually a commit - if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then - # get the last commit hash - # lc_hash=$(git log --pretty=format:'%h' -1 2> /dev/null) - # get the last commit time - lc_time=$(git log --pretty=format:'%at' -1 2> /dev/null) - - now=$(date +%s) - seconds_since_last_commit=$((now-lc_time)) - lc_time_since=$(time_since_commit $seconds_since_last_commit) - - echo "$lc_time_since" - else - echo "" - fi - else - echo "" - fi -} - -# returns the time by given seconds -time_since_commit()() { - seconds_since_last_commit=$(($1 + 0)) - - # totals - MINUTES=$((seconds_since_last_commit / 60)) - HOURS=$((seconds_since_last_commit/3600)) - - # sub-hours and sub-minutes - DAYS=$((seconds_since_last_commit / 86400)) - SUB_HOURS=$((HOURS % 24)) - SUB_MINUTES=$((MINUTES % 60)) - - if [ "$HOURS" -gt 24 ]; then - echo "${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m" - elif [ "$MINUTES" -gt 60 ]; then - echo "${HOURS}h${SUB_MINUTES}m" - else - echo "${MINUTES}m" - fi -} - -rvm_info_for_prompt() { - if [[ -d ~/.rvm/ ]]; then - local ruby_version=$(~/.rvm/bin/rvm-prompt) - if [ -n "$ruby_version" ]; then - echo "$ruby_version" - fi - else - echo "" - fi -} - -prompt_powerline_precmd() { - # Check for untracked files or updated submodules since vcs_info doesn't. - if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then - fmt_branch="%b%u%c${__PROMPT_SKWP_COLORS[4]}●%f" - else - fmt_branch="%b%u%c" - fi - zstyle ':vcs_info:*:prompt:*' formats "${fmt_branch}" - - vcs_info 'prompt' - RVM_PRECMD_INFO=$(rvm_info_for_prompt) - - # zstyle ':prezto:module:ruby' rvm '%r' -} - -prompt_powerline_setup() { - setopt LOCAL_OPTIONS - unsetopt XTRACE KSH_ARRAYS - prompt_opts=(cr percent subst) - - autoload -Uz add-zsh-hook - autoload -Uz vcs_info - - add-zsh-hook precmd prompt_powerline_precmd - - # Use extended color pallete if available. - if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then - __PROMPT_SKWP_COLORS=( - "%F{81}" # turquoise - "%F{166}" # orange - "%F{135}" # purple - "%F{161}" # hotpink - "%F{118}" # limegreen - ) - else - __PROMPT_SKWP_COLORS=( - "%F{cyan}" - "%F{yellow}" - "%F{magenta}" - "%F{red}" - "%F{green}" - ) - fi - - # Enable VCS systems you use. - zstyle ':vcs_info:*' enable bzr git hg svn - - # check-for-changes can be really slow. - # You should disable it if you work with large repositories. - zstyle ':vcs_info:*:prompt:*' check-for-changes true - - # Formats: - # %b - branchname - # %u - unstagedstr (see below) - # %c - stagedstr (see below) - # %a - action (e.g. rebase-i) - # %R - repository path - # %S - path in the repository - # %n - user - # %m - machine hostname - - # local fmt_branch="(${__PROMPT_SKWP_COLORS[1]}%b%f%u%c)" - local fmt_branch="${__PROMPT_SKWP_COLORS[2]}%b%f%u%c" - local fmt_action="${__PROMPT_SKWP_COLORS[5]}%a%f" - local fmt_unstaged="${__PROMPT_SKWP_COLORS[2]}●%f" - local fmt_staged="${__PROMPT_SKWP_COLORS[5]}●%f" - - zstyle ':vcs_info:*:prompt:*' unstagedstr "${fmt_unstaged}" - zstyle ':vcs_info:*:prompt:*' stagedstr "${fmt_staged}" - zstyle ':vcs_info:*:prompt:*' actionformats "${fmt_branch}${fmt_action}" - zstyle ':vcs_info:*:prompt:*' formats "${fmt_branch}" - zstyle ':vcs_info:*:prompt:*' nvcsformats "" - - # SPLIT RVM PROMPT INFO - # TODO: should assign this to local variable? somehow doesn't work correctly. - rvm_split=("${(s/@/)$(rvm_info_for_prompt)}") - - # if [ "$POWERLINE_RIGHT_B" = "" ]; then - # POWERLINE_RIGHT_B=%D{%H:%M:%S} - local powerline_right_b=$rvm_split[1] - # fi - - # if [ "$POWERLINE_RIGHT_A" = "" ]; then - local powerline_right_a=$rvm_split[2] - # fi - - # Setup powerline style colouring - POWERLINE_COLOR_BG_GRAY=%K{240} - POWERLINE_COLOR_BG_LIGHT_GRAY=%K{240} - POWERLINE_COLOR_BG_WHITE=%K{255} - - POWERLINE_COLOR_FG_GRAY=%F{240} - POWERLINE_COLOR_FG_LIGHT_GRAY=%F{240} - POWERLINE_COLOR_FG_WHITE=%F{255} - - POWERLINE_SEPARATOR=$'\uE0B0' - POWERLINE_R_SEPARATOR=$'\uE0B2' - - POWERLINE_LEFT_A="%K{green}%F{white} %~ %k%f%F{green}%K{blue}"$POWERLINE_SEPARATOR - POWERLINE_LEFT_B="%k%f%F{white}%K{blue} "'${vcs_info_msg_0_}'" %k%f%F{blue}%K{black}"$POWERLINE_SEPARATOR - POWERLINE_LEFT_C=" %k%f%F{white}%K{black}"'$(git_time_details)'" %k%f%F{black}"$POWERLINE_SEPARATOR"%f " - - PROMPT=$POWERLINE_LEFT_A$POWERLINE_LEFT_B$POWERLINE_LEFT_C - # RPROMPT=$POWERLINE_COLOR_FG_WHITE$POWERLINE_R_SEPARATOR"%f$POWERLINE_COLOR_BG_WHITE $POWERLINE_COLOR_FG_GRAY$powerline_right_b "$POWERLINE_R_SEPARATOR"%f%k$POWERLINE_COLOR_BG_GRAY$POWERLINE_COLOR_FG_WHITE $powerline_right_a %f%k" - # RPROMPT=$POWERLINE_COLOR_FG_WHITE$POWERLINE_R_SEPARATOR"%f$POWERLINE_COLOR_BG_WHITE $POWERLINE_COLOR_FG_GRAY"'$powerline_right_b'" "$POWERLINE_R_SEPARATOR"%f%k$POWERLINE_COLOR_BG_GRAY$POWERLINE_COLOR_FG_WHITE "'$powerline_right_a'" %f%k" - RPROMPT=$POWERLINE_COLOR_FG_WHITE$POWERLINE_R_SEPARATOR"%f$POWERLINE_COLOR_BG_WHITE $POWERLINE_COLOR_FG_GRAY"'$(rvm_info_for_prompt)'" " -} - -prompt_powerline_setup "$@" - - - diff --git a/.zprezto/modules/prompt/functions/prompt_powerline_setup b/.zprezto/modules/prompt/functions/prompt_powerline_setup new file mode 120000 index 0000000..3715d75 --- /dev/null +++ b/.zprezto/modules/prompt/functions/prompt_powerline_setup @@ -0,0 +1 @@ +../external/powerline/prompt_powerline_setup \ No newline at end of file diff --git a/.zprezto/modules/prompt/functions/prompt_pure_setup b/.zprezto/modules/prompt/functions/prompt_pure_setup deleted file mode 100644 index 2fd19e8..0000000 --- a/.zprezto/modules/prompt/functions/prompt_pure_setup +++ /dev/null @@ -1,486 +0,0 @@ -# Pure -# by Sindre Sorhus -# https://github.com/sindresorhus/pure -# MIT License - -# For my own and others sanity -# git: -# %b => current branch -# %a => current action (rebase/merge) -# prompt: -# %F => color dict -# %f => reset color -# %~ => current path -# %* => time -# %n => username -# %m => shortname host -# %(?..) => prompt conditional - %(condition.true.false) -# terminal codes: -# \e7 => save cursor position -# \e[2A => move cursor 2 lines up -# \e[1G => go to position 1 in terminal -# \e8 => restore cursor position -# \e[K => clears everything after the cursor on the current line -# \e[2K => clear everything on the current line - - -# turns seconds into human readable time -# 165392 => 1d 21h 56m 32s -# https://github.com/sindresorhus/pretty-time-zsh -prompt_pure_human_time_to_var() { - local human total_seconds=$1 var=$2 - local days=$(( total_seconds / 60 / 60 / 24 )) - local hours=$(( total_seconds / 60 / 60 % 24 )) - local minutes=$(( total_seconds / 60 % 60 )) - local seconds=$(( total_seconds % 60 )) - (( days > 0 )) && human+="${days}d " - (( hours > 0 )) && human+="${hours}h " - (( minutes > 0 )) && human+="${minutes}m " - human+="${seconds}s" - - # store human readable time in variable as specified by caller - typeset -g "${var}"="${human}" -} - -# stores (into prompt_pure_cmd_exec_time) the exec time of the last command if set threshold was exceeded -prompt_pure_check_cmd_exec_time() { - integer elapsed - (( elapsed = EPOCHSECONDS - ${prompt_pure_cmd_timestamp:-$EPOCHSECONDS} )) - typeset -g prompt_pure_cmd_exec_time= - (( elapsed > ${PURE_CMD_MAX_EXEC_TIME:-5} )) && { - prompt_pure_human_time_to_var $elapsed "prompt_pure_cmd_exec_time" - } -} - -prompt_pure_set_title() { - setopt localoptions noshwordsplit - - # emacs terminal does not support settings the title - (( ${+EMACS} )) && return - - case $TTY in - # Don't set title over serial console. - /dev/ttyS[0-9]*) return;; - esac - - # tell the terminal we are setting the title - print -n '\e]0;' - # show hostname if connected through ssh - [[ -n $SSH_CONNECTION ]] && print -Pn '(%m) ' - case $1 in - expand-prompt) - print -Pn $2;; - ignore-escape) - print -rn $2;; - esac - # end set title - print -n '\a' -} - -prompt_pure_preexec() { - if [[ -n $prompt_pure_git_fetch_pattern ]]; then - # detect when git is performing pull/fetch (including git aliases). - local -H MATCH MBEGIN MEND match mbegin mend - if [[ $2 =~ (git|hub)\ (.*\ )?($prompt_pure_git_fetch_pattern)(\ .*)?$ ]]; then - # we must flush the async jobs to cancel our git fetch in order - # to avoid conflicts with the user issued pull / fetch. - async_flush_jobs 'prompt_pure' - fi - fi - - typeset -g prompt_pure_cmd_timestamp=$EPOCHSECONDS - - # shows the current dir and executed command in the title while a process is active - prompt_pure_set_title 'ignore-escape' "$PWD:t: $2" - - # Disallow python virtualenv from updating the prompt, set it to 12 if - # untouched by the user to indicate that Pure modified it. Here we use - # magic number 12, same as in psvar. - export VIRTUAL_ENV_DISABLE_PROMPT=${VIRTUAL_ENV_DISABLE_PROMPT:-12} -} - -# string length ignoring ansi escapes -prompt_pure_string_length_to_var() { - local str=$1 var=$2 length - # perform expansion on str and check length - length=$(( ${#${(S%%)str//(\%([KF1]|)\{*\}|\%[Bbkf])}} )) - - # store string length in variable as specified by caller - typeset -g "${var}"="${length}" -} - -prompt_pure_preprompt_render() { - setopt localoptions noshwordsplit - - # Set color for git branch/dirty status, change color if dirty checking has - # been delayed. - local git_color=242 - [[ -n ${prompt_pure_git_last_dirty_check_timestamp+x} ]] && git_color=red - - # Initialize the preprompt array. - local -a preprompt_parts - - # Set the path. - preprompt_parts+=('%F{blue}%~%f') - - # Add git branch and dirty status info. - typeset -gA prompt_pure_vcs_info - if [[ -n $prompt_pure_vcs_info[branch] ]]; then - preprompt_parts+=("%F{$git_color}"'${prompt_pure_vcs_info[branch]}${prompt_pure_git_dirty}%f') - fi - # Git pull/push arrows. - if [[ -n $prompt_pure_git_arrows ]]; then - preprompt_parts+=('%F{cyan}${prompt_pure_git_arrows}%f') - fi - - # Username and machine, if applicable. - [[ -n $prompt_pure_username ]] && preprompt_parts+=('$prompt_pure_username') - # Execution time. - [[ -n $prompt_pure_cmd_exec_time ]] && preprompt_parts+=('%F{yellow}${prompt_pure_cmd_exec_time}%f') - - local cleaned_ps1=$PROMPT - local -H MATCH MBEGIN MEND - if [[ $PROMPT = *$prompt_newline* ]]; then - # When the prompt contains newlines, we keep everything before the first - # and after the last newline, leaving us with everything except the - # preprompt. This is needed because some software prefixes the prompt - # (e.g. virtualenv). - cleaned_ps1=${PROMPT%%${prompt_newline}*}${PROMPT##*${prompt_newline}} - fi - unset MATCH MBEGIN MEND - - # Construct the new prompt with a clean preprompt. - local -ah ps1 - ps1=( - $prompt_newline # Initial newline, for spaciousness. - ${(j. .)preprompt_parts} # Join parts, space separated. - $prompt_newline # Separate preprompt and prompt. - $cleaned_ps1 - ) - - PROMPT="${(j..)ps1}" - - # Expand the prompt for future comparision. - local expanded_prompt - expanded_prompt="${(S%%)PROMPT}" - - if [[ $1 != precmd ]] && [[ $prompt_pure_last_prompt != $expanded_prompt ]]; then - # Redraw the prompt. - zle && zle .reset-prompt - fi - - typeset -g prompt_pure_last_prompt=$expanded_prompt -} - -prompt_pure_precmd() { - # check exec time and store it in a variable - prompt_pure_check_cmd_exec_time - unset prompt_pure_cmd_timestamp - - # shows the full path in the title - prompt_pure_set_title 'expand-prompt' '%~' - - # preform async git dirty check and fetch - prompt_pure_async_tasks - - # Check if we should display the virtual env, we use a sufficiently high - # index of psvar (12) here to avoid collisions with user defined entries. - psvar[12]= - # When VIRTUAL_ENV_DISABLE_PROMPT is empty, it was unset by the user and - # Pure should take back control. - if [[ -n $VIRTUAL_ENV ]] && [[ -z $VIRTUAL_ENV_DISABLE_PROMPT || $VIRTUAL_ENV_DISABLE_PROMPT = 12 ]]; then - psvar[12]="${VIRTUAL_ENV:t}" - export VIRTUAL_ENV_DISABLE_PROMPT=12 - fi - - # print the preprompt - prompt_pure_preprompt_render "precmd" -} - -prompt_pure_async_git_aliases() { - setopt localoptions noshwordsplit - local dir=$1 - local -a gitalias pullalias - - # we enter repo to get local aliases as well. - builtin cd -q $dir - - # list all aliases and split on newline. - gitalias=(${(@f)"$(command git config --get-regexp "^alias\.")"}) - for line in $gitalias; do - parts=(${(@)=line}) # split line on spaces - aliasname=${parts[1]#alias.} # grab the name (alias.[name]) - shift parts # remove aliasname - - # check alias for pull or fetch (must be exact match). - if [[ $parts =~ ^(.*\ )?(pull|fetch)(\ .*)?$ ]]; then - pullalias+=($aliasname) - fi - done - - print -- ${(j:|:)pullalias} # join on pipe (for use in regex). -} - -prompt_pure_async_vcs_info() { - setopt localoptions noshwordsplit - builtin cd -q $1 2>/dev/null - - # configure vcs_info inside async task, this frees up vcs_info - # to be used or configured as the user pleases. - zstyle ':vcs_info:*' enable git - zstyle ':vcs_info:*' use-simple true - # only export two msg variables from vcs_info - zstyle ':vcs_info:*' max-exports 2 - # export branch (%b) and git toplevel (%R) - zstyle ':vcs_info:git*' formats '%b' '%R' - zstyle ':vcs_info:git*' actionformats '%b|%a' '%R' - - vcs_info - - local -A info - info[top]=$vcs_info_msg_1_ - info[branch]=$vcs_info_msg_0_ - - print -r - ${(@kvq)info} -} - -# fastest possible way to check if repo is dirty -prompt_pure_async_git_dirty() { - setopt localoptions noshwordsplit - local untracked_dirty=$1 dir=$2 - - # use cd -q to avoid side effects of changing directory, e.g. chpwd hooks - builtin cd -q $dir - - if [[ $untracked_dirty = 0 ]]; then - command git diff --no-ext-diff --quiet --exit-code - else - test -z "$(command git status --porcelain --ignore-submodules -unormal)" - fi - - return $? -} - -prompt_pure_async_git_fetch() { - setopt localoptions noshwordsplit - # use cd -q to avoid side effects of changing directory, e.g. chpwd hooks - builtin cd -q $1 - - # set GIT_TERMINAL_PROMPT=0 to disable auth prompting for git fetch (git 2.3+) - export GIT_TERMINAL_PROMPT=0 - # set ssh BachMode to disable all interactive ssh password prompting - export GIT_SSH_COMMAND=${GIT_SSH_COMMAND:-"ssh -o BatchMode=yes"} - - command git -c gc.auto=0 fetch &>/dev/null || return 99 - - # check arrow status after a successful git fetch - prompt_pure_async_git_arrows $1 -} - -prompt_pure_async_git_arrows() { - setopt localoptions noshwordsplit - builtin cd -q $1 - command git rev-list --left-right --count HEAD...@'{u}' -} - -prompt_pure_async_tasks() { - setopt localoptions noshwordsplit - - # initialize async worker - ((!${prompt_pure_async_init:-0})) && { - async_start_worker "prompt_pure" -u -n - async_register_callback "prompt_pure" prompt_pure_async_callback - typeset -g prompt_pure_async_init=1 - } - - typeset -gA prompt_pure_vcs_info - - local -H MATCH MBEGIN MEND - if ! [[ $PWD = ${prompt_pure_vcs_info[pwd]}* ]]; then - # stop any running async jobs - async_flush_jobs "prompt_pure" - - # reset git preprompt variables, switching working tree - unset prompt_pure_git_dirty - unset prompt_pure_git_last_dirty_check_timestamp - unset prompt_pure_git_arrows - unset prompt_pure_git_fetch_pattern - prompt_pure_vcs_info[branch]= - prompt_pure_vcs_info[top]= - fi - unset MATCH MBEGIN MEND - - async_job "prompt_pure" prompt_pure_async_vcs_info $PWD - - # # only perform tasks inside git working tree - [[ -n $prompt_pure_vcs_info[top] ]] || return - - prompt_pure_async_refresh -} - -prompt_pure_async_refresh() { - setopt localoptions noshwordsplit - - if [[ -z $prompt_pure_git_fetch_pattern ]]; then - # we set the pattern here to avoid redoing the pattern check until the - # working three has changed. pull and fetch are always valid patterns. - typeset -g prompt_pure_git_fetch_pattern="pull|fetch" - async_job "prompt_pure" prompt_pure_async_git_aliases $working_tree - fi - - async_job "prompt_pure" prompt_pure_async_git_arrows $PWD - - # do not preform git fetch if it is disabled or working_tree == HOME - if (( ${PURE_GIT_PULL:-1} )) && [[ $working_tree != $HOME ]]; then - # tell worker to do a git fetch - async_job "prompt_pure" prompt_pure_async_git_fetch $PWD - fi - - # if dirty checking is sufficiently fast, tell worker to check it again, or wait for timeout - integer time_since_last_dirty_check=$(( EPOCHSECONDS - ${prompt_pure_git_last_dirty_check_timestamp:-0} )) - if (( time_since_last_dirty_check > ${PURE_GIT_DELAY_DIRTY_CHECK:-1800} )); then - unset prompt_pure_git_last_dirty_check_timestamp - # check check if there is anything to pull - async_job "prompt_pure" prompt_pure_async_git_dirty ${PURE_GIT_UNTRACKED_DIRTY:-1} $PWD - fi -} - -prompt_pure_check_git_arrows() { - setopt localoptions noshwordsplit - local arrows left=${1:-0} right=${2:-0} - - (( right > 0 )) && arrows+=${PURE_GIT_DOWN_ARROW:-⇣} - (( left > 0 )) && arrows+=${PURE_GIT_UP_ARROW:-⇡} - - [[ -n $arrows ]] || return - typeset -g REPLY=$arrows -} - -prompt_pure_async_callback() { - setopt localoptions noshwordsplit - local job=$1 code=$2 output=$3 exec_time=$4 next_pending=$6 - local do_render=0 - - case $job in - prompt_pure_async_vcs_info) - local -A info - typeset -gA prompt_pure_vcs_info - - # parse output (z) and unquote as array (Q@) - info=("${(Q@)${(z)output}}") - local -H MATCH MBEGIN MEND - # check if git toplevel has changed - if [[ $info[top] = $prompt_pure_vcs_info[top] ]]; then - # if stored pwd is part of $PWD, $PWD is shorter and likelier - # to be toplevel, so we update pwd - if [[ $prompt_pure_vcs_info[pwd] = ${PWD}* ]]; then - prompt_pure_vcs_info[pwd]=$PWD - fi - else - # store $PWD to detect if we (maybe) left the git path - prompt_pure_vcs_info[pwd]=$PWD - fi - unset MATCH MBEGIN MEND - - # update has a git toplevel set which means we just entered a new - # git directory, run the async refresh tasks - [[ -n $info[top] ]] && [[ -z $prompt_pure_vcs_info[top] ]] && prompt_pure_async_refresh - - # always update branch and toplevel - prompt_pure_vcs_info[branch]=$info[branch] - prompt_pure_vcs_info[top]=$info[top] - - do_render=1 - ;; - prompt_pure_async_git_aliases) - if [[ -n $output ]]; then - # append custom git aliases to the predefined ones. - prompt_pure_git_fetch_pattern+="|$output" - fi - ;; - prompt_pure_async_git_dirty) - local prev_dirty=$prompt_pure_git_dirty - if (( code == 0 )); then - unset prompt_pure_git_dirty - else - typeset -g prompt_pure_git_dirty="*" - fi - - [[ $prev_dirty != $prompt_pure_git_dirty ]] && do_render=1 - - # When prompt_pure_git_last_dirty_check_timestamp is set, the git info is displayed in a different color. - # To distinguish between a "fresh" and a "cached" result, the preprompt is rendered before setting this - # variable. Thus, only upon next rendering of the preprompt will the result appear in a different color. - (( $exec_time > 5 )) && prompt_pure_git_last_dirty_check_timestamp=$EPOCHSECONDS - ;; - prompt_pure_async_git_fetch|prompt_pure_async_git_arrows) - # prompt_pure_async_git_fetch executes prompt_pure_async_git_arrows - # after a successful fetch. - if (( code == 0 )); then - local REPLY - prompt_pure_check_git_arrows ${(ps:\t:)output} - if [[ $prompt_pure_git_arrows != $REPLY ]]; then - typeset -g prompt_pure_git_arrows=$REPLY - do_render=1 - fi - elif (( code != 99 )); then - # Unless the exit code is 99, prompt_pure_async_git_arrows - # failed with a non-zero exit status, meaning there is no - # upstream configured. - if [[ -n $prompt_pure_git_arrows ]]; then - unset prompt_pure_git_arrows - do_render=1 - fi - fi - ;; - esac - - if (( next_pending )); then - (( do_render )) && typeset -g prompt_pure_async_render_requested=1 - return - fi - - [[ ${prompt_pure_async_render_requested:-$do_render} = 1 ]] && prompt_pure_preprompt_render - unset prompt_pure_async_render_requested -} - -prompt_pure_setup() { - # Prevent percentage showing up if output doesn't end with a newline. - export PROMPT_EOL_MARK='' - - prompt_opts=(subst percent) - - # borrowed from promptinit, sets the prompt options in case pure was not - # initialized via promptinit. - setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}" - - if [[ -z $prompt_newline ]]; then - # This variable needs to be set, usually set by promptinit. - typeset -g prompt_newline=$'\n%{\r%}' - fi - - zmodload zsh/datetime - zmodload zsh/zle - zmodload zsh/parameter - - autoload -Uz add-zsh-hook - autoload -Uz vcs_info - autoload -Uz async && async - - add-zsh-hook precmd prompt_pure_precmd - add-zsh-hook preexec prompt_pure_preexec - - # show username@host if logged in through SSH - [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%F{242}%n@%m%f' - - # show username@host if root, with username in white - [[ $UID -eq 0 ]] && prompt_pure_username='%F{white}%n%f%F{242}@%m%f' - - # if a virtualenv is activated, display it in grey - PROMPT='%(12V.%F{242}%12v%f .)' - - # prompt turns red if the previous command didn't exit with 0 - PROMPT+='%(?.%F{magenta}.%F{red})${PURE_PROMPT_SYMBOL:-❯}%f ' -} - -prompt_pure_setup "$@" diff --git a/.zprezto/modules/prompt/functions/prompt_pure_setup b/.zprezto/modules/prompt/functions/prompt_pure_setup new file mode 120000 index 0000000..1480fcf --- /dev/null +++ b/.zprezto/modules/prompt/functions/prompt_pure_setup @@ -0,0 +1 @@ +../external/pure/pure.zsh \ No newline at end of file diff --git a/.zprezto/modules/prompt/functions/prompt_sorin_setup b/.zprezto/modules/prompt/functions/prompt_sorin_setup index 30e71a9..14f8858 100644 --- a/.zprezto/modules/prompt/functions/prompt_sorin_setup +++ b/.zprezto/modules/prompt/functions/prompt_sorin_setup @@ -144,16 +144,17 @@ function prompt_sorin_setup { zstyle ':prezto:module:git:info:keys' format \ 'status' '%b %p %c:%s%A%B%S%a%d%m%r%U%u' + # Set python-info parameters. + zstyle ':prezto:module:python:info:virtualenv' format '%f%F{3}(%v)%F{7} ' + # Set up non-zero return value display local show_return="✘ " # Default is to show the return value if zstyle -T ':prezto:module:prompt' show-return-val; then show_return+='%? ' fi - # Set python-info format - zstyle ':prezto:module:python:info:virtualenv' format '%f%F{3}(%v)%F{7} ' - # Get the async worker set up + # Get the async worker set up. _sorin_cur_git_root='' _prompt_sorin_git='' diff --git a/.zprezto/modules/prompt/functions/prompt_steeef_setup b/.zprezto/modules/prompt/functions/prompt_steeef_setup index b241f9a..ca39f93 100644 --- a/.zprezto/modules/prompt/functions/prompt_steeef_setup +++ b/.zprezto/modules/prompt/functions/prompt_steeef_setup @@ -72,6 +72,9 @@ function prompt_steeef_setup { local unstaged_format="${_prompt_steeef_colors[2]}●%f" local staged_format="${_prompt_steeef_colors[5]}●%f" + # Set editor-info parameters. + zstyle ':prezto:module:editor:info:keymap:primary' format '$' + # Set vcs_info parameters. zstyle ':vcs_info:*' enable bzr git hg svn zstyle ':vcs_info:*:prompt:*' check-for-changes true @@ -87,8 +90,17 @@ function prompt_steeef_setup { # Define prompts. PROMPT=" ${_prompt_steeef_colors[3]}%n%f at ${_prompt_steeef_colors[2]}%m%f in ${_prompt_steeef_colors[5]}%~%f "'${vcs_info_msg_0_}'" -"'$python_info[virtualenv]'"$ " +"'$python_info[virtualenv]${editor_info[keymap]} ' RPROMPT='' } +function prompt_steeef_preview { + local +h PROMPT='' + local +h RPROMPT='' + local +h SPROMPT='' + + editor-info 2> /dev/null + prompt_preview_theme 'steeef' +} + prompt_steeef_setup "$@" diff --git a/.zprezto/modules/python/README.md b/.zprezto/modules/python/README.md index e7b72c4..121ea37 100644 --- a/.zprezto/modules/python/README.md +++ b/.zprezto/modules/python/README.md @@ -6,7 +6,9 @@ Enables local Python and local Python package installation. Settings -------- -This module supports virtual environments from conda and virtualenvwrapper. By default, only virtualenvwrapper is enabled. To disable virtualenvwrapper, add the following to *zpreztorc*. +This module supports virtual environments from conda and virtualenvwrapper. By +default, only virtualenvwrapper is enabled. To disable virtualenvwrapper, add +the following to *zpreztorc*. ```sh zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on' @@ -52,8 +54,8 @@ virtualenvwrapper [`virtualenvwrapper`][2] is a frontend to the popular [`virtualenv`][3] utility. -`virtualenv` creates isolated Python environments and `virtualenvwrapper` provides -convenient shell functions to create, switch, and manage them. +`virtualenv` creates isolated Python environments and `virtualenvwrapper` +provides convenient shell functions to create, switch, and manage them. ### Usage diff --git a/.zprezto/modules/python/init.zsh b/.zprezto/modules/python/init.zsh index 28f671e..9796294 100644 --- a/.zprezto/modules/python/init.zsh +++ b/.zprezto/modules/python/init.zsh @@ -7,15 +7,18 @@ # Patrick Bos # -# Load manually installed pyenv into the shell session. -if [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then +# Load manually installed pyenv into the path +if [[ -n "$PYENV_ROOT" && -s "$PYENV_ROOT/bin/pyenv" ]]; then + path=("$PYENV_ROOT/bin" $path) +elif [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then path=("$HOME/.pyenv/bin" $path) - export PYENV_ROOT=$(pyenv root) - eval "$(pyenv init - --no-rehash zsh)" +fi -# Load package manager installed pyenv into the shell session. -elif (( $+commands[pyenv] )); then - export PYENV_ROOT=$(pyenv root) +# Load pyenv into the current python session +if (( $+commands[pyenv] )); then + if [[ -z "$PYENV_ROOT" ]]; then + export PYENV_ROOT=$(pyenv root) + fi eval "$(pyenv init - --no-rehash zsh)" # Prepend PEP 370 per user site packages directory, which defaults to @@ -57,7 +60,7 @@ function _python-workon-cwd { local ENV_NAME="" if [[ -f "$PROJECT_ROOT/.venv" ]]; then ENV_NAME="$(cat "$PROJECT_ROOT/.venv")" - elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then + elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]]; then ENV_NAME="$PROJECT_ROOT/.venv" elif [[ "$PROJECT_ROOT" != "." ]]; then ENV_NAME="${PROJECT_ROOT:t}" @@ -93,8 +96,11 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \ # Set the directory where virtual environments are stored. export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}" - # Disable the virtualenv prompt. - export VIRTUAL_ENV_DISABLE_PROMPT=1 + # Disable the virtualenv prompt. Note that we use the magic value used by the + # pure prompt because there's some additional logic in that prompt which tries + # to figure out if a user set this variable and disable the python portion of + # that prompt based on it which is the exact opposite of what we want to do. + export VIRTUAL_ENV_DISABLE_PROMPT=12 # Create a sorted array of available virtualenv related 'pyenv' commands to # look for plugins of interest. Scanning shell '$path' isn't enough as they diff --git a/.zprezto/modules/rsync/init.zsh b/.zprezto/modules/rsync/init.zsh index a802222..3618812 100644 --- a/.zprezto/modules/rsync/init.zsh +++ b/.zprezto/modules/rsync/init.zsh @@ -14,7 +14,8 @@ fi # Aliases # -_rsync_cmd='rsync --verbose --progress --human-readable --compress --archive --hard-links --one-file-system' +_rsync_cmd='rsync --verbose --progress --human-readable --compress --archive \ + --hard-links --one-file-system' if grep -q 'xattrs' <(rsync --help 2>&1); then _rsync_cmd="${_rsync_cmd} --acls --xattrs" diff --git a/.zprezto/modules/syntax-highlighting/external/INSTALL.md b/.zprezto/modules/syntax-highlighting/external/INSTALL.md index 1f0d923..468e9bd 100644 --- a/.zprezto/modules/syntax-highlighting/external/INSTALL.md +++ b/.zprezto/modules/syntax-highlighting/external/INSTALL.md @@ -33,17 +33,17 @@ See also [repology's cross-distro index](https://repology.org/metapackage/zsh-sy Simply clone this repository and source the script: - git clone https://github.com/zsh-users/zsh-syntax-highlighting.git - echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc + git clone https://github.com/zsh-users/zsh-syntax-highlighting.git + echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc Then, enable syntax highlighting in the current interactive shell: - source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh If `git` is not installed, download and extract a snapshot of the latest development tree from: - https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz + https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz Note the `source` command must be **at the end** of `~/.zshrc`. @@ -69,15 +69,15 @@ your `.zshrc`. 1. Clone this repository in oh-my-zsh's plugins directory: - git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting + git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting 2. Activate the plugin in `~/.zshrc`: - plugins=( [plugins...] zsh-syntax-highlighting) + plugins=( [plugins...] zsh-syntax-highlighting) 3. Source `~/.zshrc` to take changes into account: - source ~/.zshrc + source ~/.zshrc #### [Prezto](https://github.com/sorin-ionescu/prezto) diff --git a/.zprezto/modules/syntax-highlighting/external/docs/highlighters/main.md b/.zprezto/modules/syntax-highlighting/external/docs/highlighters/main.md index c14b32f..005fc4d 100644 --- a/.zprezto/modules/syntax-highlighting/external/docs/highlighters/main.md +++ b/.zprezto/modules/syntax-highlighting/external/docs/highlighters/main.md @@ -32,10 +32,19 @@ This highlighter defines the following styles: * `path_prefix_pathseparator` - path separators in prefixes of existing filenames (`/`); if unset, `path_prefix` is used (default) * `globbing` - globbing expressions (`*.txt`) * `history-expansion` - history expansion expressions (`!foo` and `^foo^bar`) +* `command-substitution` - command substitutions (`$(echo foo)`) +* `command-substitution-unquoted` - an unquoted command substitution (`$(echo foo)`) +* `command-substitution-quoted` - a quoted command substitution (`"$(echo foo)"`) +* `command-substitution-delimiter` - command substitution delimiters (`$(` and `)`) +* `command-substitution-delimiter-unquoted` - an unquoted command substitution delimiters (`$(` and `)`) +* `command-substitution-delimiter-quoted` - a quoted command substitution delimiters (`"$(` and `)"`) +* `process-substitution` - process substitutions (`<(echo foo)`) +* `process-substitution-delimiter` - process substitution delimiters (`<(` and `)`) * `single-hyphen-option` - single-hyphen options (`-o`) * `double-hyphen-option` - double-hyphen options (`--option`) * `back-quoted-argument` - backtick command substitution (`` `foo` ``) * `back-quoted-argument-unclosed` - unclosed backtick command substitution (`` `foo ``) +* `back-quoted-argument-delimiter` - backtick command substitution delimiters (`` ` ``) * `single-quoted-argument` - single-quoted arguments (`` 'foo' ``) * `single-quoted-argument-unclosed` - unclosed single-quoted arguments (`` 'foo ``) * `double-quoted-argument` - double-quoted arguments (`` "foo" ``) @@ -49,6 +58,7 @@ This highlighter defines the following styles: * `assign` - parameter assignments (`x=foo` and `x=( )`) * `redirection` - redirection operators (`<`, `>`, etc) * `comment` - comments, when `setopt INTERACTIVE_COMMENTS` is in effect (`echo # foo`) +* `named-fd` - named file descriptor (`echo foo {fd}>&2`) * `arg0` - a command word other than one of those enumerated above (other than a command, precommand, alias, function, or shell builtin command). * `default` - everything else diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/brackets/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/brackets/README.md deleted file mode 100644 index 9001074..0000000 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/brackets/README.md +++ /dev/null @@ -1,29 +0,0 @@ -zsh-syntax-highlighting / highlighters / brackets -------------------------------------------------- - -This is the `brackets` highlighter, that highlights brackets and parentheses, and -matches them. - - -### How to tweak it - -This highlighter defines the following styles: - -* `bracket-error` - unmatched brackets -* `bracket-level-N` - brackets with nest level N -* `cursor-matchingbracket` - the matching bracket, if cursor is on a bracket - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, -for example in `~/.zshrc`: - - # To define styles for nested brackets up to level 4 - ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold' - ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold' - ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold' - ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold' - -The syntax for values is the same as the syntax of "types of highlighting" of -the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` -manual page][zshzle-Character-Highlighting]. - -[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/brackets/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/brackets/README.md new file mode 120000 index 0000000..6997bd6 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/brackets/README.md @@ -0,0 +1 @@ +../../docs/highlighters/brackets.md \ No newline at end of file diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/cursor/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/cursor/README.md deleted file mode 100644 index 7295fd1..0000000 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/cursor/README.md +++ /dev/null @@ -1,22 +0,0 @@ -zsh-syntax-highlighting / highlighters / cursor ------------------------------------------------ - -This is the `cursor` highlighter, that highlights the cursor. - - -### How to tweak it - -This highlighter defines the following styles: - -* `cursor` - the style for the current cursor position - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, -for example in `~/.zshrc`: - - ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue' - -The syntax for values is the same as the syntax of "types of highlighting" of -the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` -manual page][zshzle-Character-Highlighting]. - -[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/cursor/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/cursor/README.md new file mode 120000 index 0000000..70e0c8c --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/cursor/README.md @@ -0,0 +1 @@ +../../docs/highlighters/cursor.md \ No newline at end of file diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/line/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/line/README.md deleted file mode 100644 index 4ba14e9..0000000 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/line/README.md +++ /dev/null @@ -1,22 +0,0 @@ -zsh-syntax-highlighting / highlighters / line ---------------------------------------------- - -This is the `line` highlighter, that highlights the whole line. - - -### How to tweak it - -This highlighter defines the following styles: - -* `line` - the style for the whole line - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, -for example in `~/.zshrc`: - - ZSH_HIGHLIGHT_STYLES[line]='bold' - -The syntax for values is the same as the syntax of "types of highlighting" of -the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` -manual page][zshzle-Character-Highlighting]. - -[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/line/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/line/README.md new file mode 120000 index 0000000..052fe20 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/line/README.md @@ -0,0 +1 @@ +../../docs/highlighters/line.md \ No newline at end of file diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/main/README.md deleted file mode 100644 index c14b32f..0000000 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/README.md +++ /dev/null @@ -1,103 +0,0 @@ -zsh-syntax-highlighting / highlighters / main ---------------------------------------------- - -This is the `main` highlighter, that highlights: - -* Commands -* Options -* Arguments -* Paths -* Strings - -This highlighter is active by default. - - -### How to tweak it - -This highlighter defines the following styles: - -* `unknown-token` - unknown tokens / errors -* `reserved-word` - shell reserved words (`if`, `for`) -* `alias` - aliases -* `suffix-alias` - suffix aliases (requires zsh 5.1.1 or newer) -* `builtin` - shell builtin commands (`shift`, `pwd`, `zstyle`) -* `function` - function names -* `command` - command names -* `precommand` - precommand modifiers (e.g., `noglob`, `builtin`) -* `commandseparator` - command separation tokens (`;`, `&&`) -* `hashed-command` - hashed commands -* `path` - existing filenames -* `path_pathseparator` - path separators in filenames (`/`); if unset, `path` is used (default) -* `path_prefix` - prefixes of existing filenames -* `path_prefix_pathseparator` - path separators in prefixes of existing filenames (`/`); if unset, `path_prefix` is used (default) -* `globbing` - globbing expressions (`*.txt`) -* `history-expansion` - history expansion expressions (`!foo` and `^foo^bar`) -* `single-hyphen-option` - single-hyphen options (`-o`) -* `double-hyphen-option` - double-hyphen options (`--option`) -* `back-quoted-argument` - backtick command substitution (`` `foo` ``) -* `back-quoted-argument-unclosed` - unclosed backtick command substitution (`` `foo ``) -* `single-quoted-argument` - single-quoted arguments (`` 'foo' ``) -* `single-quoted-argument-unclosed` - unclosed single-quoted arguments (`` 'foo ``) -* `double-quoted-argument` - double-quoted arguments (`` "foo" ``) -* `double-quoted-argument-unclosed` - unclosed double-quoted arguments (`` "foo ``) -* `dollar-quoted-argument` - dollar-quoted arguments (`` $'foo' ``) -* `dollar-quoted-argument-unclosed` - unclosed dollar-quoted arguments (`` $'foo ``) -* `rc-quote` - two single quotes inside single quotes when the `RC_QUOTES` option is set (`` 'foo''bar' ``) -* `dollar-double-quoted-argument` - parameter expansion inside double quotes (`$foo` inside `""`) -* `back-double-quoted-argument` - backslash escape sequences inside double-quoted arguments (`\"` in `"foo\"bar"`) -* `back-dollar-quoted-argument` - backslash escape sequences inside dollar-quoted arguments (`\x` in `$'\x48'`) -* `assign` - parameter assignments (`x=foo` and `x=( )`) -* `redirection` - redirection operators (`<`, `>`, etc) -* `comment` - comments, when `setopt INTERACTIVE_COMMENTS` is in effect (`echo # foo`) -* `arg0` - a command word other than one of those enumerated above (other than a command, precommand, alias, function, or shell builtin command). -* `default` - everything else - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, -for example in `~/.zshrc`: - - # Declare the variable - typeset -A ZSH_HIGHLIGHT_STYLES - - # To differentiate aliases from other command types - ZSH_HIGHLIGHT_STYLES[alias]='fg=magenta,bold' - - # To have paths colored instead of underlined - ZSH_HIGHLIGHT_STYLES[path]='fg=cyan' - - # To disable highlighting of globbing expressions - ZSH_HIGHLIGHT_STYLES[globbing]='none' - -The syntax for values is the same as the syntax of "types of highlighting" of -the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` -manual page][zshzle-Character-Highlighting]. - -#### Parameters - -To avoid partial path lookups on a path, add the path to the `X_ZSH_HIGHLIGHT_DIRS_BLACKLIST` array. -This interface is still experimental. - - X_ZSH_HIGHLIGHT_DIRS_BLACKLIST+=(/mnt/slow_share) - -### Useless trivia - -#### Forward compatibility. - -zsh-syntax-highlighting attempts to be forward-compatible with zsh. -Specifically, we attempt to facilitate highlighting _command word_ types that -had not yet been invented when this version of zsh-syntax-highlighting was -released. - -A _command word_ is something like a function name, external command name, et -cetera. (See -[Simple Commands & Pipelines in `zshmisc(1)`][zshmisc-Simple-Commands-And-Pipelines] -for a formal definition.) - -If a new _kind_ of command word is ever added to zsh — something conceptually -different than "function" and "alias" and "external command" — then command words -of that (new) kind will be highlighted by the style `arg0_$kind`, -where `$kind` is the output of `type -w` on the new kind of command word. If that -style is not defined, then the style `arg0` will be used instead. - -[zshmisc-Simple-Commands-And-Pipelines]: http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Simple-Commands-_0026-Pipelines - -[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/main/README.md new file mode 120000 index 0000000..0354731 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/README.md @@ -0,0 +1 @@ +../../docs/highlighters/main.md \ No newline at end of file diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/main-highlighter.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/main-highlighter.zsh index 8b373ab..06839ce 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/main-highlighter.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/main-highlighter.zsh @@ -1,5 +1,5 @@ # ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2017 zsh-syntax-highlighting contributors +# Copyright (c) 2010-2018 zsh-syntax-highlighting contributors # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted @@ -40,9 +40,14 @@ : ${ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]:=} : ${ZSH_HIGHLIGHT_STYLES[globbing]:=fg=blue} : ${ZSH_HIGHLIGHT_STYLES[history-expansion]:=fg=blue} +: ${ZSH_HIGHLIGHT_STYLES[command-substitution]:=none} +: ${ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]:=fg=magenta} +: ${ZSH_HIGHLIGHT_STYLES[process-substitution]:=none} +: ${ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]:=fg=magenta} : ${ZSH_HIGHLIGHT_STYLES[single-hyphen-option]:=none} : ${ZSH_HIGHLIGHT_STYLES[double-hyphen-option]:=none} : ${ZSH_HIGHLIGHT_STYLES[back-quoted-argument]:=none} +: ${ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]:=fg=magenta} : ${ZSH_HIGHLIGHT_STYLES[single-quoted-argument]:=fg=yellow} : ${ZSH_HIGHLIGHT_STYLES[double-quoted-argument]:=fg=yellow} : ${ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]:=fg=yellow} @@ -53,6 +58,7 @@ : ${ZSH_HIGHLIGHT_STYLES[assign]:=none} : ${ZSH_HIGHLIGHT_STYLES[redirection]:=none} : ${ZSH_HIGHLIGHT_STYLES[comment]:=fg=black,bold} +: ${ZSH_HIGHLIGHT_STYLES[named-fd]:=none} : ${ZSH_HIGHLIGHT_STYLES[arg0]:=fg=green} # Whether the highlighter should be called or not. @@ -67,47 +73,14 @@ _zsh_highlight_main_add_region_highlight() { integer start=$1 end=$2 shift 2 - if (( $+argv[2] )); then - # Caller specified inheritance explicitly. - else - # Automate inheritance. - typeset -A fallback_of; fallback_of=( - alias arg0 - suffix-alias arg0 - builtin arg0 - function arg0 - command arg0 - precommand arg0 - hashed-command arg0 + (( highlighted_alias )) && return + (( in_alias )) && highlighted_alias=1 - path_prefix path - # The path separator fallback won't ever be used, due to the optimisation - # in _zsh_highlight_main_highlighter_highlight_path_separators(). - path_pathseparator path - path_prefix_pathseparator path_prefix + # The calculation was relative to $buf but region_highlight is relative to $BUFFER. + (( start += buf_offset )) + (( end += buf_offset )) - single-quoted-argument{-unclosed,} - double-quoted-argument{-unclosed,} - dollar-quoted-argument{-unclosed,} - back-quoted-argument{-unclosed,} - ) - local needle=$1 value - while [[ -n ${value::=$fallback_of[$needle]} ]]; do - unset "fallback_of[$needle]" # paranoia against infinite loops - argv+=($value) - needle=$value - done - fi - - # The calculation was relative to $PREBUFFER$BUFFER, but region_highlight is - # relative to $BUFFER. - (( start -= $#PREBUFFER )) - (( end -= $#PREBUFFER )) - - (( start >= end )) && { print -r -- >&2 "zsh-syntax-highlighting: BUG: _zsh_highlight_main_add_region_highlight: start($start) >= end($end)"; return } - (( end <= 0 )) && return - (( start < 0 )) && start=0 # having start<0 is normal with e.g. multiline strings - _zsh_highlight_add_highlight $start $end "$@" + list_highlights+=($start $end $1) } _zsh_highlight_main_add_many_region_highlights() { @@ -116,29 +89,81 @@ _zsh_highlight_main_add_many_region_highlights() { done } +_zsh_highlight_main_calculate_fallback() { + local -A fallback_of; fallback_of=( + alias arg0 + suffix-alias arg0 + builtin arg0 + function arg0 + command arg0 + precommand arg0 + hashed-command arg0 + arg0_\* arg0 + + path_prefix path + # The path separator fallback won't ever be used, due to the optimisation + # in _zsh_highlight_main_highlighter_highlight_path_separators(). + path_pathseparator path + path_prefix_pathseparator path_prefix + + single-quoted-argument{-unclosed,} + double-quoted-argument{-unclosed,} + dollar-quoted-argument{-unclosed,} + back-quoted-argument{-unclosed,} + + command-substitution{-quoted,,-unquoted,} + command-substitution-delimiter{-quoted,,-unquoted,} + + command-substitution{-delimiter,} + process-substitution{-delimiter,} + back-quoted-argument{-delimiter,} + ) + local needle=$1 value + reply=($1) + while [[ -n ${value::=$fallback_of[(k)$needle]} ]]; do + unset "fallback_of[$needle]" # paranoia against infinite loops + reply+=($value) + needle=$value + done +} + # Get the type of a command. # # Uses the zsh/parameter module if available to avoid forks, and a # wrapper around 'type -w' as fallback. # -# Takes a single argument. +# If $2 is 0, do not consider aliases. # # The result will be stored in REPLY. _zsh_highlight_main__type() { + integer -r aliases_allowed=${2-1} + # We won't cache replies of anything that exists as an alias at all, to + # ensure the cached value is correct regardless of $aliases_allowed. + # + # ### We probably _should_ cache them in a cache that's keyed on the value of + # ### $aliases_allowed, on the assumption that aliases are the common case. + integer may_cache=1 + + # Cache lookup if (( $+_zsh_highlight_main__command_type_cache )); then REPLY=$_zsh_highlight_main__command_type_cache[(e)$1] if [[ -n "$REPLY" ]]; then return fi fi + + # Main logic if (( $#options_to_set )); then setopt localoptions $options_to_set; fi unset REPLY if zmodload -e zsh/parameter; then if (( $+aliases[(e)$1] )); then + may_cache=0 + fi + if (( $+aliases[(e)$1] )) && (( aliases_allowed )); then REPLY=alias - elif (( $+saliases[(e)${1##*.}] )); then + elif [[ $1 == *.* && -n ${1%.*} ]] && (( $+saliases[(e)${1##*.}] )); then REPLY='suffix alias' elif (( $reswords[(Ie)$1] )); then REPLY=reserved @@ -161,11 +186,36 @@ _zsh_highlight_main__type() { fi if ! (( $+REPLY )); then # Note that 'type -w' will run 'rehash' implicitly. - REPLY="${$(LC_ALL=C builtin type -w -- $1 2>/dev/null)##*: }" + # + # We 'unalias' in a subshell, so the parent shell is not affected. + # + # The colon command is there just to avoid a command substitution that + # starts with an arithmetic expression [«((…))» as the first thing inside + # «$(…)»], which is area that has had some parsing bugs before 5.6 + # (approximately). + REPLY="${$(:; (( aliases_allowed )) || unalias -- $1 2>/dev/null; LC_ALL=C builtin type -w -- $1 2>/dev/null)##*: }" + if [[ $REPLY == 'alias' ]]; then + may_cache=0 + fi fi - if (( $+_zsh_highlight_main__command_type_cache )); then + + # Cache population + if (( may_cache )) && (( $+_zsh_highlight_main__command_type_cache )); then _zsh_highlight_main__command_type_cache[(e)$1]=$REPLY fi + [[ -n $REPLY ]] + return $? +} + +# Checks whether $1 is something that can be run. +# +# Return 0 if runnable, 1 if not runnable, 2 if trouble. +_zsh_highlight_main__is_runnable() { + if _zsh_highlight_main__type "$1"; then + [[ $REPLY != none ]] + else + return 2 + fi } # Check whether the first argument is a redirection operator token. @@ -196,13 +246,18 @@ _zsh_highlight_main__resolve_alias() { # the style according to $2; otherwise, set style=unknown-token. # # $1: character expected to be at the top of $braces_stack -# $2: assignment to execute it if matches +# $2: optional assignment to style it if matches +# return value is 0 if there is a match else 1 _zsh_highlight_main__stack_pop() { if [[ $braces_stack[1] == $1 ]]; then braces_stack=${braces_stack:1} - eval "$2" + if (( $+2 )); then + style=$2 + fi + return 0 else style=unknown-token + return 1 fi } @@ -220,24 +275,37 @@ _zsh_highlight_highlighter_main_paint() return fi - ## Variable declarations and initializations - local start_pos=0 end_pos highlight_glob=true arg style - local in_array_assignment=false # true between 'a=(' and the matching ')' typeset -a ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR - typeset -a ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS typeset -a ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW - local -a options_to_set # used in callees - local buf="$PREBUFFER$BUFFER" - integer len="${#buf}" + local -a options_to_set reply # used in callees + local REPLY - # "R" for round - # "Q" for square - # "Y" for curly - # "D" for do/done - # "$" for 'end' (matches 'foreach' always; also used with cshjunkiequotes in repeat/while) - # "?" for 'if'/'fi'; also checked by 'elif'/'else' - # ":" for 'then' - local braces_stack + # $flags_with_argument is a set of letters, corresponding to the option letters + # that would be followed by a colon in a getopts specification. + local flags_with_argument + # $flags_sans_argument is a set of letters, corresponding to the option letters + # that wouldn't be followed by a colon in a getopts specification. + local flags_sans_argument + # $precommand_options maps precommand name to values of $flags_with_argument and + # $flags_sans_argument for that precommand, joined by a colon. + # + # Currently, setting $flags_sans_argument is only important for commands that + # have a non-empty $flags_with_argument; see test-data/precommand4.zsh. + local -A precommand_options + precommand_options=( + # Precommand modifiers as of zsh 5.6.2 cf. zshmisc(1). + '-' '' + 'builtin' '' + 'command' :pvV + 'exec' a:cl + 'nocorrect' '' + 'noglob' '' + + 'doas' aCu:Lns # as of OpenBSD's doas(1) dated September 4, 2016 + 'nice' n: # as of current POSIX spec + 'pkexec' '' # doesn't take short options; immune to #121 because it's usually not passed --option flags + 'sudo' Cgprtu:AEHKPSVbhiklnsv # as of sudo 1.8.21p2 + ) if [[ $zsyh_user_options[ignorebraces] == on || ${zsyh_user_options[ignoreclosebraces]:-off} == on ]]; then local right_brace_is_recognised_everywhere=false @@ -256,10 +324,6 @@ _zsh_highlight_highlighter_main_paint() # ### 'case' syntax, but followed by a pattern, not by a command # ';;' ';&' ';|' ) - ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS=( - 'builtin' 'command' 'exec' 'nocorrect' 'noglob' - 'pkexec' # immune to #121 because it's usually not passed --option flags - ) # Tokens that, at (naively-determined) "command position", are followed by # a de jure command position. All of these are reserved words. @@ -279,14 +343,66 @@ _zsh_highlight_highlighter_main_paint() '!' # reserved word; unrelated to $histchars[1] ) - local -a match mbegin mend + _zsh_highlight_main_highlighter_highlight_list -$#PREBUFFER '' 1 "$PREBUFFER$BUFFER" + + # end is a reserved word + local start end_ style + for start end_ style in $reply; do + (( start >= end_ )) && { print -r -- >&2 "zsh-syntax-highlighting: BUG: _zsh_highlight_highlighter_main_paint: start($start) >= end($end_)"; return } + (( end_ <= 0 )) && continue + (( start < 0 )) && start=0 # having start<0 is normal with e.g. multiline strings + _zsh_highlight_main_calculate_fallback $style + _zsh_highlight_add_highlight $start $end_ $reply + done +} + +# $1 is the offset of $4 from the parent buffer. Added to the returned highlights. +# $2 is the initial braces_stack (for a closing paren). +# $3 is 1 if $4 contains the end of $BUFFER, else 0. +# $4 is the buffer to highlight. +# Returns: +# $REPLY: $buf[REPLY] is the last character parsed. +# $reply is an array of region_highlight additions. +# exit code is 0 if the braces_stack is empty, 1 otherwise. +_zsh_highlight_main_highlighter_highlight_list() +{ + integer start_pos end_pos=0 buf_offset=$1 has_end=$3 + # last_alias is the last alias arg (lhs) expanded (if in an alias). + # This allows for expanding alias ls='ls -l' while avoiding loops. + local arg buf=$4 highlight_glob=true last_alias style + local in_array_assignment=false # true between 'a=(' and the matching ')' + # highlighted_alias is 1 when the alias arg has been highlighted with a non-alias style. + # E.g. alias x=ls; x has been highlighted as alias AND command. + # in_alias is equal to the number of shifts needed until arg=args[1] pops an + # arg from BUFFER and not added by an alias. + integer highlighted_alias=0 in_alias=0 len=$#buf + local -a match mbegin mend list_highlights + # seen_alias is a map of aliases already seen to avoid loops like alias a=b b=a + local -A seen_alias + # Pattern for parameter names + readonly parameter_name_pattern='([A-Za-z_][A-Za-z0-9_]*|[0-9]+)' + list_highlights=() + + # "R" for round + # "Q" for square + # "Y" for curly + # "T" for [[ ]] + # "S" for $( ) + # "D" for do/done + # "$" for 'end' (matches 'foreach' always; also used with cshjunkiequotes in repeat/while) + # "?" for 'if'/'fi'; also checked by 'elif'/'else' + # ":" for 'then' + local braces_stack=$2 # State machine # # The states are: # - :start: Command word - # - :sudo_opt: A leading-dash option to sudo (such as "-u" or "-i") - # - :sudo_arg: The argument to a sudo leading-dash option that takes one, + # - :start_of_pipeline: Start of a 'pipeline' as defined in zshmisc(1). + # Only valid when :start: is present + # - :sudo_opt: A leading-dash option to a precommand, whether it takes an + # argument or not. (Example: sudo's "-u" or "-i".) + # - :sudo_arg: The argument to a precommand's leading-dash option, # when given as a separate word; i.e., "foo" in "-u foo" (two # words) but not in "-ufoo" (one word). # - :regular: "Not a command word", and command delimiters are permitted. @@ -317,7 +433,7 @@ _zsh_highlight_highlighter_main_paint() # $in_redirection. The value of $next_word from the iteration that processed # the operator is discarded. # - local this_word=':start:' next_word + local this_word next_word=':start::start_of_pipeline:' integer in_redirection # Processing buffer local proc_buf="$buf" @@ -327,30 +443,29 @@ _zsh_highlight_highlighter_main_paint() else args=(${(z)buf}) fi - for arg in $args; do - # Initialize $next_word. - if (( in_redirection )); then - (( --in_redirection )) + while (( $#args )); do + arg=$args[1] + shift args + if (( in_alias )); then + (( in_alias-- )) + (( in_alias == 0 )) && highlighted_alias=0 last_alias= seen_alias=() fi + + # Initialize this_word and next_word. if (( in_redirection == 0 )); then - # Initialize $next_word to its default value. + this_word=$next_word next_word=':regular:' else # Stall $next_word. + (( --in_redirection )) fi # Initialize per-"simple command" [zshmisc(1)] variables: # - # $already_added (see next paragraph) # $style how to highlight $arg # $in_array_assignment boolean flag for "between '(' and ')' of array assignment" # $highlight_glob boolean flag for "'noglob' is in effect" # - # $already_added is set to 1 to disable adding an entry to region_highlight - # for this iteration. Currently, that is done for "" and $'' strings, - # which add the entry early so escape sequences within the string override - # the string's color. - integer already_added=0 style=unknown-token if [[ $this_word == *':start:'* ]]; then in_array_assignment=false @@ -359,59 +474,33 @@ _zsh_highlight_highlighter_main_paint() fi fi - # Compute the new $start_pos and $end_pos, skipping over whitespace in $buf. - if [[ $arg == ';' ]] ; then - # We're looking for either a semicolon or a newline, whichever comes - # first. Both of these are rendered as a ";" (SEPER) by the ${(z)..} - # flag. - # - # We can't use the (Z+n+) flag because that elides the end-of-command - # token altogether, so 'echo foo\necho bar' (two commands) becomes - # indistinguishable from 'echo foo echo bar' (one command with three - # words for arguments). - local needle=$'[;\n]' - integer offset=$(( ${proc_buf[(i)$needle]} - 1 )) - (( start_pos += offset )) + if (( in_alias == 0 )); then + # Compute the new $start_pos and $end_pos, skipping over whitespace in $buf. + [[ "$proc_buf" = (#b)(#s)(([ $'\t']|\\$'\n')#)* ]] + # The first, outer parenthesis + integer offset="${#match[1]}" + (( start_pos = end_pos + offset )) (( end_pos = start_pos + $#arg )) - else - # The line was: - # - # integer offset=$(((len-start_pos)-${#${proc_buf##([[:space:]]|\\[[:space:]])#}})) - # - # - len-start_pos is length of current proc_buf; basically: initial length minus where - # we are, and proc_buf is chopped to the "where we are" (compare the "previous value - # of start_pos" below, and the len-(start_pos-offset) = len-start_pos+offset) - # - what's after main minus sign is: length of proc_buf without spaces at the beginning - # - so what the line actually did, was computing length of the spaces! - # - this can be done via (#b) flag, like below - if [[ "$proc_buf" = (#b)(#s)(([[:space:]]|\\[[:space:]])##)* ]]; then - # The first, outer parenthesis - integer offset="${#match[1]}" - else - integer offset=0 - fi - ((start_pos+=offset)) - ((end_pos=$start_pos+${#arg})) - fi - # Compute the new $proc_buf. We advance it - # (chop off characters from the beginning) - # beyond what end_pos points to, by skipping - # as many characters as end_pos was advanced. - # - # end_pos was advanced by $offset (via start_pos) - # and by $#arg. Note the `start_pos=$end_pos` - # below. - # - # As for the [,len]. We could use [,len-start_pos+offset] - # here, but to make it easier on eyes, we use len and - # rely on the fact that Zsh simply handles that. The - # length of proc_buf is len-start_pos+offset because - # we're chopping it to match current start_pos, so its - # length matches the previous value of start_pos. - # - # Why [,-1] is slower than [,length] isn't clear. - proc_buf="${proc_buf[offset + $#arg + 1,len]}" + # Compute the new $proc_buf. We advance it + # (chop off characters from the beginning) + # beyond what end_pos points to, by skipping + # as many characters as end_pos was advanced. + # + # end_pos was advanced by $offset (via start_pos) + # and by $#arg. Note the `start_pos=$end_pos` + # below. + # + # As for the [,len]. We could use [,len-start_pos+offset] + # here, but to make it easier on eyes, we use len and + # rely on the fact that Zsh simply handles that. The + # length of proc_buf is len-start_pos+offset because + # we're chopping it to match current start_pos, so its + # length matches the previous value of start_pos. + # + # Why [,-1] is slower than [,length] isn't clear. + proc_buf="${proc_buf[offset + $#arg + 1,len]}" + fi # Handle the INTERACTIVE_COMMENTS option. # @@ -423,41 +512,139 @@ _zsh_highlight_highlighter_main_paint() style=unknown-token # prematurely terminated fi _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style - already_added=1 - start_pos=$end_pos + # Stall this arg + in_redirection=1 continue fi + if [[ $this_word == *:start:* ]] && ! (( in_redirection )); then + # Expand aliases. + _zsh_highlight_main__type "$arg" + local res="$REPLY" + if [[ $res == "alias" ]] && [[ $last_alias != $arg ]]; then + # Avoid looping forever on alias a=b b=c c=b, but allow alias foo='foo bar' + # Also mark insane aliases as unknown-token (cf. #263). + if (( $+seen_alias[$arg] )) || [[ $arg == ?*=* ]]; then + _zsh_highlight_main_add_region_highlight $start_pos $end_pos unknown-token + continue + fi + seen_alias[$arg]=1 + last_alias=$arg + _zsh_highlight_main__resolve_alias $arg + local -a alias_args + # Elision is desired in case alias x='' + alias_args=( ${interactive_comments-${(z)REPLY}} + ${interactive_comments+${(zZ+c+)REPLY}} ) + args=( $alias_args $args ) + if (( in_alias == 0 )); then + _zsh_highlight_main_add_region_highlight $start_pos $end_pos alias + # Add one because we will in_alias-- on the next loop iteration so + # this iteration should be considered in in_alias as well + (( in_alias += $#alias_args + 1 )) + else + # This arg is already included in the count, so no need to + 1. + (( in_alias += $#alias_args )) + fi + (( in_redirection++ )) # Stall this arg + continue + else + _zsh_highlight_main_highlighter_expand_path $arg + arg=$REPLY + _zsh_highlight_main__type "$arg" 0 + res="$REPLY" + fi + fi + # Analyse the current word. if _zsh_highlight_main__is_redirection $arg ; then - if (( in_redirection )); then + if (( in_redirection == 1 )); then + # The condition excludes the case that BUFFER='{foo}>&2' and we're on the '>&'. _zsh_highlight_main_add_region_highlight $start_pos $end_pos unknown-token - already_added=1 else in_redirection=2 + _zsh_highlight_main_add_region_highlight $start_pos $end_pos redirection fi + continue + elif [[ $arg == '{'${~parameter_name_pattern}'}' ]] && _zsh_highlight_main__is_redirection $args[1]; then + # named file descriptor: {foo}>&2 + in_redirection=3 + _zsh_highlight_main_add_region_highlight $start_pos $end_pos named-fd + continue fi - # Special-case the first word after 'sudo'. - if (( ! in_redirection )); then - if [[ $this_word == *':sudo_opt:'* ]] && [[ $arg != -* ]]; then - this_word=${this_word//:sudo_opt:/} + # Expand parameters. + # + # ### For now, expand just '$foo' or '${foo}', possibly with braces, but with + # ### no other features of the parameter expansion syntax. (No ${(x)foo}, + # ### no ${foo[x]}, no ${foo:-x}.) + () { + # That's not entirely correct --- if the parameter's value happens to be a reserved + # word, the parameter expansion will be highlighted as a reserved word --- but that + # incorrectness is outweighed by the usability improvement of permitting the use of + # parameters that refer to commands, functions, and builtins. + local -a match mbegin mend + local MATCH; integer MBEGIN MEND + local parameter_name + if [[ $arg[1] == '$' ]] && [[ ${arg[2]} == '{' ]] && [[ ${arg[-1]} == '}' ]]; then + parameter_name=${${arg:2}%?} + elif [[ $arg[1] == '$' ]]; then + parameter_name=${arg:1} fi - fi + if [[ $res == none ]] && zmodload -e zsh/parameter && + [[ ${parameter_name} =~ ^${~parameter_name_pattern}$ ]] && + (( ${+parameters[(e)${MATCH}]} )) && [[ ${parameters[(e)$MATCH]} != *special* ]] + then + # Set $arg. + case ${(tP)MATCH} in + (*array*|*assoc*) + local -a words; words=( ${(P)MATCH} ) + arg=${words[1]} + ;; + (*) + # scalar, presumably + arg=${(P)MATCH} + ;; + esac + _zsh_highlight_main__type "$arg" 0 + res=$REPLY + fi + } # Parse the sudo command line if (( ! in_redirection )); then if [[ $this_word == *':sudo_opt:'* ]]; then - case "$arg" in + if [[ -n $flags_with_argument ]] && + { [[ -n $flags_sans_argument ]] && [[ $arg == '-'[$flags_sans_argument]#[$flags_with_argument] ]] || + [[ $arg == '-'[$flags_with_argument] ]] }; then # Flag that requires an argument - '-'[Cgprtu]) this_word=${this_word//:start:/}; - next_word=':sudo_arg:';; - # This prevents misbehavior with sudo -u -otherargument - '-'*) this_word=${this_word//:start:/}; - next_word+=':start:'; - next_word+=':sudo_opt:';; - *) ;; - esac + this_word=${this_word//:start:/} + next_word=':sudo_arg:' + elif [[ -n $flags_with_argument ]] && + { [[ -n $flags_sans_argument ]] && [[ $arg == '-'[$flags_sans_argument]#[$flags_with_argument]* ]] || + [[ $arg == '-'[$flags_with_argument]* ]] }; then + # Argument attached in the same word + this_word=${this_word//:start:/} + next_word+=':start:' + next_word+=':sudo_opt:' + elif [[ -n $flags_sans_argument ]] && + [[ $arg == '-'[$flags_sans_argument]# ]]; then + # Flag that requires no argument + this_word=:sudo_opt: + next_word+=':start:' + next_word+=':sudo_opt:' + elif [[ $arg == '-'* ]]; then + # Unknown flag + this_word=:sudo_opt: + next_word+=':start:' + next_word+=':sudo_opt:' + _zsh_highlight_main_add_region_highlight $start_pos $end_pos unknown-token + continue + else + # Not an option flag; nothing to do. (If the command line is + # syntactically valid, ${this_word//:sudo_opt:/} should be + # non-empty now.) + this_word=${this_word//:sudo_opt:/} + fi elif [[ $this_word == *':sudo_arg:'* ]]; then next_word+=':sudo_opt:' next_word+=':start:' @@ -465,67 +652,69 @@ _zsh_highlight_highlighter_main_paint() fi # The Great Fork: is this a command word? Is this a non-command word? - if [[ $this_word == *':always:'* && $arg == 'always' ]]; then + if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then + if _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q; then + # Missing closing square bracket(s) + style=unknown-token + elif [[ $this_word == *':regular:'* ]]; then + # This highlights empty commands (semicolon follows nothing) as an error. + # Zsh accepts them, though. + style=commandseparator + else + style=unknown-token + fi + if [[ $arg == ';' ]] && $in_array_assignment; then + # literal newline inside an array assignment + next_word=':regular:' + else + next_word=':start:' + highlight_glob=true + if [[ $arg != '|' && $arg != '|&' ]]; then + next_word+=':start_of_pipeline:' + fi + fi + elif ! (( in_redirection)) && [[ $this_word == *':always:'* && $arg == 'always' ]]; then # try-always construct style=reserved-word # de facto a reserved word, although not de jure - next_word=':start:' - elif [[ $this_word == *':start:'* ]] && (( in_redirection == 0 )); then # $arg is the command word - if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]]; then - style=precommand - elif [[ "$arg" = "sudo" ]] && { _zsh_highlight_main__type sudo; [[ -n $REPLY && $REPLY != "none" ]] }; then + next_word=':start:' # only left brace is allowed, apparently + elif ! (( in_redirection)) && [[ $this_word == *':start:'* ]]; then # $arg is the command word + if (( ${+precommand_options[$arg]} )) && _zsh_highlight_main__is_runnable $arg; then style=precommand + flags_with_argument=${precommand_options[$arg]%:*} + flags_sans_argument=${precommand_options[$arg]#*:} next_word=${next_word//:regular:/} next_word+=':sudo_opt:' next_word+=':start:' else - _zsh_highlight_main_highlighter_expand_path $arg - local expanded_arg="$REPLY" - _zsh_highlight_main__type ${expanded_arg} - local res="$REPLY" - () { - # Special-case: command word is '$foo', like that, without braces or anything. - # - # That's not entirely correct --- if the parameter's value happens to be a reserved - # word, the parameter expansion will be highlighted as a reserved word --- but that - # incorrectness is outweighed by the usability improvement of permitting the use of - # parameters that refer to commands, functions, and builtins. - local -a match mbegin mend - local MATCH; integer MBEGIN MEND - if [[ $res == none ]] && (( ${+parameters} )) && - [[ ${arg[1]} == \$ ]] && [[ ${arg:1} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]] && - (( ${+parameters[(e)${MATCH}]} )) && [[ ${parameters[(e)$MATCH]} != *special* ]] - then - _zsh_highlight_main__type ${(P)MATCH} - res=$REPLY - fi - } case $res in reserved) # reserved word style=reserved-word - # - # Match braces. + # Match braces and handle special cases. case $arg in ($'\x7b') braces_stack='Y'"$braces_stack" ;; ($'\x7d') # We're at command word, so no need to check $right_brace_is_recognised_everywhere - _zsh_highlight_main__stack_pop 'Y' style=reserved-word + _zsh_highlight_main__stack_pop 'Y' reserved-word if [[ $style == reserved-word ]]; then next_word+=':always:' fi ;; + ($'\x5b\x5b') + braces_stack='T'"$braces_stack" + ;; ('do') braces_stack='D'"$braces_stack" ;; ('done') - _zsh_highlight_main__stack_pop 'D' style=reserved-word + _zsh_highlight_main__stack_pop 'D' reserved-word ;; ('if') braces_stack=':?'"$braces_stack" ;; ('then') - _zsh_highlight_main__stack_pop ':' style=reserved-word + _zsh_highlight_main__stack_pop ':' reserved-word ;; ('elif') if [[ ${braces_stack[1]} == '?' ]]; then @@ -542,69 +731,68 @@ _zsh_highlight_highlighter_main_paint() fi ;; ('fi') - _zsh_highlight_main__stack_pop '?' "" + _zsh_highlight_main__stack_pop '?' ;; ('foreach') braces_stack='$'"$braces_stack" ;; ('end') - _zsh_highlight_main__stack_pop '$' style=reserved-word + _zsh_highlight_main__stack_pop '$' reserved-word + ;; + ('repeat') + # skip the repeat-count word + in_redirection=2 + # The redirection mechanism assumes $this_word describes the word + # following the redirection. Make it so. + # + # That word can be a command word with shortloops (`repeat 2 ls`) + # or a command separator (`repeat 2; ls` or `repeat 2; do ls; done`). + # + # The repeat-count word will be handled like a redirection target. + this_word=':start::regular:' + ;; + ('!') + if [[ $this_word != *':start_of_pipeline:'* ]]; then + style=unknown-token + else + # '!' reserved word at start of pipeline; style already set above + fi ;; esac ;; 'suffix alias') style=suffix-alias;; - alias) () { - integer insane_alias - case $arg in - # Issue #263: aliases with '=' on their LHS. - # - # There are three cases: - # - # - Unsupported, breaks 'alias -L' output, but invokable: - ('='*) :;; - # - Unsupported, not invokable: - (*'='*) insane_alias=1;; - # - The common case: - (*) :;; - esac - if (( insane_alias )); then - style=unknown-token - else - # The common case. - style=alias - _zsh_highlight_main__resolve_alias $arg - local alias_target="$REPLY" - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$alias_target"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS+=($arg) - fi - } + alias) :;; + builtin) style=builtin + [[ $arg == $'\x5b' ]] && braces_stack='Q'"$braces_stack" ;; - builtin) style=builtin;; function) style=function;; command) style=command;; hashed) style=hashed-command;; none) if _zsh_highlight_main_highlighter_check_assign; then - style=assign - if [[ $arg[-1] == '(' ]]; then + _zsh_highlight_main_add_region_highlight $start_pos $end_pos assign + local i=$(( arg[(i)=] + 1 )) + if [[ $arg[i] == '(' ]]; then in_array_assignment=true else # assignment to a scalar parameter. # (For array assignments, the command doesn't start until the ")" token.) + # + # Discard :start_of_pipeline:, if present, as '!' is not valid + # after assignments. next_word+=':start:' + if (( start_pos + i <= end_pos )); then + () { + local highlight_glob=false + [[ $zsyh_user_options[globassign] == on ]] && highlight_glob=true + _zsh_highlight_main_highlighter_highlight_argument $i + } + fi fi + continue elif [[ $arg[0,1] = $histchars[0,1] ]] && (( $#arg[0,2] == 2 )); then style=history-expansion elif [[ $arg[0,1] == $histchars[2,2] ]]; then style=history-expansion - elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then - if [[ $this_word == *':regular:'* ]]; then - # This highlights empty commands (semicolon follows nothing) as an error. - # Zsh accepts them, though. - style=commandseparator - else - style=unknown-token - fi - elif (( in_redirection == 2 )); then - style=redirection elif [[ $arg[1,2] == '((' ]]; then # Arithmetic evaluation. # @@ -615,13 +803,11 @@ _zsh_highlight_highlighter_main_paint() # # We highlight just the opening parentheses, as a reserved word; this # is how [[ ... ]] is highlighted, too. - style=reserved-word - _zsh_highlight_main_add_region_highlight $start_pos $((start_pos + 2)) $style - already_added=1 + _zsh_highlight_main_add_region_highlight $start_pos $((start_pos + 2)) reserved-word if [[ $arg[-2,-1] == '))' ]]; then - _zsh_highlight_main_add_region_highlight $((end_pos - 2)) $end_pos $style - already_added=1 + _zsh_highlight_main_add_region_highlight $((end_pos - 2)) $end_pos reserved-word fi + continue elif [[ $arg == '()' ]]; then # anonymous function style=reserved-word @@ -630,103 +816,90 @@ _zsh_highlight_highlighter_main_paint() style=reserved-word braces_stack='R'"$braces_stack" elif [[ $arg == $'\x29' ]]; then - # end of subshell - _zsh_highlight_main__stack_pop 'R' style=reserved-word + # end of subshell or command substitution + if _zsh_highlight_main__stack_pop 'S'; then + REPLY=$start_pos + reply=($list_highlights) + return 0 + fi + _zsh_highlight_main__stack_pop 'R' reserved-word else - if _zsh_highlight_main_highlighter_check_path; then + if _zsh_highlight_main_highlighter_check_path $arg; then style=$REPLY else style=unknown-token fi fi ;; - *) _zsh_highlight_main_add_region_highlight $start_pos $end_pos arg0_$res arg0 - already_added=1 + *) _zsh_highlight_main_add_region_highlight $start_pos $end_pos arg0_$res + continue ;; esac fi - fi - if (( ! already_added )) && [[ $style == unknown-token ]] && # not handled by the 'command word' codepath - { (( in_redirection )) || [[ $this_word == *':regular:'* ]] || [[ $this_word == *':sudo_opt:'* ]] || [[ $this_word == *':sudo_arg:'* ]] } - then # $arg is a non-command word + if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW:#"$arg"} ]]; then + next_word=':start::start_of_pipeline:' + fi + else # $arg is a non-command word case $arg in $'\x29') # subshell or end of array assignment if $in_array_assignment; then style=assign in_array_assignment=false next_word+=':start:' + elif (( in_redirection )); then + style=unknown-token else - _zsh_highlight_main__stack_pop 'R' style=reserved-word + if _zsh_highlight_main__stack_pop 'S'; then + REPLY=$start_pos + reply=($list_highlights) + return 0 + fi + _zsh_highlight_main__stack_pop 'R' reserved-word fi;; $'\x28\x29') # possibly a function definition - if [[ $zsyh_user_options[multifuncdef] == on ]] || false # TODO: or if the previous word was a command word - then - next_word+=':start:' + if (( in_redirection )) || $in_array_assignment; then + style=unknown-token + else + if [[ $zsyh_user_options[multifuncdef] == on ]] || false # TODO: or if the previous word was a command word + then + next_word+=':start::start_of_pipeline:' + fi + style=reserved-word fi - style=reserved-word ;; *) if false; then elif [[ $arg = $'\x7d' ]] && $right_brace_is_recognised_everywhere; then - # Parsing rule: } + # Parsing rule: { # # Additionally, `tt(})' is recognized in any position if neither the # tt(IGNORE_BRACES) option nor the tt(IGNORE_CLOSE_BRACES) option is set. - _zsh_highlight_main__stack_pop 'Y' style=reserved-word - if [[ $style == reserved-word ]]; then - next_word+=':always:' + if (( in_redirection )) || $in_array_assignment; then + style=unknown-token + else + _zsh_highlight_main__stack_pop 'Y' reserved-word + if [[ $style == reserved-word ]]; then + next_word+=':always:' + fi fi elif [[ $arg[0,1] = $histchars[0,1] ]] && (( $#arg[0,2] == 2 )); then style=history-expansion - elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then - if [[ $this_word == *':regular:'* ]]; then - style=commandseparator - else - style=unknown-token - fi - elif (( in_redirection == 2 )); then - style=redirection + elif [[ $arg == $'\x5d\x5d' ]] && _zsh_highlight_main__stack_pop 'T' reserved-word; then + : + elif [[ $arg == $'\x5d' ]] && _zsh_highlight_main__stack_pop 'Q' builtin; then + : else - _zsh_highlight_main_highlighter_highlight_argument - already_added=1 + _zsh_highlight_main_highlighter_highlight_argument 1 $(( 1 != in_redirection )) + continue fi ;; esac fi - if ! (( already_added )); then - _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style - fi - if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then - if [[ $arg == ';' ]] && $in_array_assignment; then - # literal newline inside an array assignment - next_word=':regular:' - else - next_word=':start:' - highlight_glob=true - fi - elif - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW:#"$arg"} && $this_word == *':start:'* ]] || - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} && $this_word == *':start:'* ]]; then - next_word=':start:' - elif [[ $arg == "repeat" && $this_word == *':start:'* ]]; then - # skip the repeat-count word - in_redirection=2 - # The redirection mechanism assumes $this_word describes the word - # following the redirection. Make it so. - # - # That word can be a command word with shortloops (`repeat 2 ls`) - # or a command separator (`repeat 2; ls` or `repeat 2; do ls; done`). - # - # The repeat-count word will be handled like a redirection target. - this_word=':start::regular:' - fi - start_pos=$end_pos - if (( in_redirection == 0 )); then - # This is the default/common codepath. - this_word=$next_word - else - # Stall $this_word. - fi + _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style done + [[ "$proc_buf" = (#b)(#s)(([[:space:]]|\\$'\n')#) ]] + REPLY=$(( end_pos + ${#match[1]} - 1 )) + reply=($list_highlights) + return $(( $#braces_stack > 0 )) } # Check if $arg is variable assignment @@ -750,19 +923,17 @@ _zsh_highlight_main_highlighter_highlight_path_separators() done } -# Check if $arg is a path. +# Check if $1 is a path. # If yes, return 0 and in $REPLY the style to use. # Else, return non-zero (and the contents of $REPLY is undefined). _zsh_highlight_main_highlighter_check_path() { - _zsh_highlight_main_highlighter_expand_path $arg; + _zsh_highlight_main_highlighter_expand_path "$1" local expanded_path="$REPLY" tmp_path REPLY=path [[ -z $expanded_path ]] && return 1 - [[ -L $expanded_path ]] && return 0 - [[ -e $expanded_path ]] && return 0 # Check if this is a blacklisted path if [[ $expanded_path[1] == / ]]; then @@ -773,21 +944,24 @@ _zsh_highlight_main_highlighter_check_path() tmp_path=$tmp_path:a while [[ $tmp_path != / ]]; do - [[ -n "${(M)X_ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path}" ]] && return 1 + [[ -n ${(M)X_ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path} ]] && return 1 tmp_path=$tmp_path:h done + [[ -L $expanded_path ]] && return 0 + [[ -e $expanded_path ]] && return 0 + # Search the path in CDPATH local cdpath_dir for cdpath_dir in $cdpath ; do [[ -e "$cdpath_dir/$expanded_path" ]] && return 0 done - # If dirname($arg) doesn't exist, neither does $arg. + # If dirname($1) doesn't exist, neither does $1. [[ ! -d ${expanded_path:h} ]] && return 1 # If this word ends the buffer, check if it's the prefix of a valid path. - if [[ ${BUFFER[1]} != "-" && $len == $end_pos ]] && + if (( has_end && (len == end_pos) )) && [[ $WIDGET != zle-line-finish ]]; then local -a tmp tmp=( ${expanded_path}*(N) ) @@ -798,26 +972,46 @@ _zsh_highlight_main_highlighter_check_path() return 1 } -# Highlight an argument and possibly special chars in quotes -# This command will at least highlight start_pos to end_pos with the default style +# Highlight an argument and possibly special chars in quotes starting at $1 in $arg +# This command will at least highlight $1 to end_pos with the default style +# If $2 is set to 0, the argument cannot be highlighted as an option. _zsh_highlight_main_highlighter_highlight_argument() { - local base_style=default i path_eligible=1 style - local -a highlights reply + local base_style=default i=$1 option_eligible=${2:-1} path_eligible=1 ret start style + local -a highlights local -a match mbegin mend local MATCH; integer MBEGIN MEND - if [[ $arg[1] == - ]]; then - if [[ $arg[2] == - ]]; then - base_style=double-hyphen-option - else - base_style=single-hyphen-option - fi - path_eligible=0 - fi + case "$arg[i]" in + '-') + if (( option_eligible )); then + if [[ $arg[i+1] == - ]]; then + base_style=double-hyphen-option + else + base_style=single-hyphen-option + fi + path_eligible=0 + fi + ;; + '=') + if [[ $arg[i+1] == $'\x28' ]]; then + (( i += 2 )) + _zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,end_pos] + ret=$? + (( i += REPLY )) + highlights+=( + $(( start_pos + $1 - 1 )) $(( start_pos + i )) process-substitution + $(( start_pos + $1 - 1 )) $(( start_pos + $1 + 1 )) process-substitution-delimiter + $reply + ) + if (( ret == 0 )); then + highlights+=($(( start_pos + i - 1 )) $(( start_pos + i )) process-substitution-delimiter) + fi + fi + esac - for (( i = 1 ; i <= end_pos - start_pos ; i += 1 )); do + for (( ; i <= end_pos - start_pos ; i += 1 )); do case "$arg[$i]" in "\\") (( i += 1 )); continue;; "'") @@ -843,6 +1037,21 @@ _zsh_highlight_main_highlighter_highlight_argument() (( i = REPLY )) highlights+=($reply) continue + elif [[ $arg[i+1] == $'\x28' ]]; then + start=$i + (( i += 2 )) + _zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,end_pos] + ret=$? + (( i += REPLY )) + highlights+=( + $(( start_pos + start - 1)) $(( start_pos + i )) command-substitution-unquoted + $(( start_pos + start - 1)) $(( start_pos + start + 1)) command-substitution-delimiter-unquoted + $reply + ) + if (( ret == 0 )); then + highlights+=($(( start_pos + i - 1)) $(( start_pos + i )) command-substitution-delimiter-unquoted) + fi + continue fi while [[ $arg[i+1] == [\^=~#+] ]]; do (( i += 1 )) @@ -850,6 +1059,24 @@ _zsh_highlight_main_highlighter_highlight_argument() if [[ $arg[i+1] == [*@#?$!-] ]]; then (( i += 1 )) fi;; + [\<\>]) + if [[ $arg[i+1] == $'\x28' ]]; then # \x28 = open paren + start=$i + (( i += 2 )) + _zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,end_pos] + ret=$? + (( i += REPLY )) + highlights+=( + $(( start_pos + start - 1)) $(( start_pos + i )) process-substitution + $(( start_pos + start - 1)) $(( start_pos + start + 1 )) process-substitution-delimiter + $reply + ) + if (( ret == 0 )); then + highlights+=($(( start_pos + i - 1)) $(( start_pos + i )) process-substitution-delimiter) + fi + continue + fi + ;| *) if $highlight_glob && [[ ${arg[$i]} =~ ^[*?] || ${arg:$i-1} =~ ^\<[0-9]*-[0-9]*\> ]]; then highlights+=($(( start_pos + i - 1 )) $(( start_pos + i + $#MATCH - 1)) globbing) @@ -862,13 +1089,13 @@ _zsh_highlight_main_highlighter_highlight_argument() esac done - if (( path_eligible )) && _zsh_highlight_main_highlighter_check_path; then + if (( path_eligible )) && _zsh_highlight_main_highlighter_check_path $arg[$1,end_pos]; then base_style=$REPLY _zsh_highlight_main_highlighter_highlight_path_separators $base_style highlights+=($reply) fi - highlights=($start_pos $end_pos $base_style $highlights) + highlights=($(( start_pos + $1 - 1 )) $end_pos $base_style $highlights) _zsh_highlight_main_add_many_region_highlights $highlights } @@ -909,9 +1136,9 @@ _zsh_highlight_main_highlighter_highlight_single_quote() # Highlight special chars inside double-quoted strings _zsh_highlight_main_highlighter_highlight_double_quote() { - local -a match mbegin mend saved_reply - local MATCH; integer MBEGIN MEND - local i j k style + local -a breaks match mbegin mend saved_reply + local MATCH; integer last_break=$(( start_pos + $1 - 1 )) MBEGIN MEND + local i j k ret style reply=() for (( i = $1 + 1 ; i <= end_pos - start_pos ; i += 1 )) ; do @@ -942,7 +1169,23 @@ _zsh_highlight_main_highlighter_highlight_double_quote() (( k += 1 )) # highlight both dollar signs (( i += 1 )) # don't consider the second one as introducing another parameter expansion elif [[ $arg[i+1] == $'\x28' ]]; then - # Highlight just the '$'. + breaks+=( $last_break $(( start_pos + i - 1 )) ) + (( i += 2 )) + saved_reply=($reply) + _zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,end_pos] + ret=$? + (( i += REPLY )) + last_break=$(( start_pos + i )) + reply=( + $saved_reply + $j $(( start_pos + i )) command-substitution-quoted + $j $(( j + 2 )) command-substitution-delimiter-quoted + $reply + ) + if (( ret == 0 )); then + reply+=($(( start_pos + i - 1 )) $(( start_pos + i )) command-substitution-delimiter-quoted) + fi + continue else continue fi @@ -975,7 +1218,13 @@ _zsh_highlight_main_highlighter_highlight_double_quote() (( i-- )) style=double-quoted-argument-unclosed fi - reply=($(( start_pos + $1 - 1)) $(( start_pos + i )) $style $reply) + (( last_break != start_pos + i )) && breaks+=( $last_break $(( start_pos + i )) ) + saved_reply=($reply) + reply=() + for 1 2 in $breaks; do + reply+=($1 $2 $style) + done + reply+=($saved_reply) REPLY=$i } @@ -1033,21 +1282,73 @@ _zsh_highlight_main_highlighter_highlight_dollar_quote() REPLY=$i } -# Highlight backtick subshells +# Highlight backtick substitutions _zsh_highlight_main_highlighter_highlight_backtick() { - local arg1=$1 i=$1 q=\` style + # buf is the contents of the backticks with a layer of backslashes removed. + # last is the index of arg for the start of the string to be copied into buf. + # It is either one past the beginning backtick or one past the last backslash. + # offset is a count of consumed \ (the delta between buf and arg). + # offsets is an array indexed by buf offset of when the delta between buf and arg changes. + # It is sparse, so search backwards to the last value + local buf highlight style=back-quoted-argument-unclosed style_end + local -i arg1=$1 end_ i=$1 last offset=0 start subshell_has_end=0 + local -a highlight_zone highlights offsets reply=() - while i=$arg[(ib:i+1:)$q]; [[ $arg[i-1] == '\' && $i -lt $(( end_pos - start_pos )) ]]; do done - if [[ $arg[i] == '`' ]]; then - style=back-quoted-argument - else - # If unclosed, i points past the end - (( i-- )) - style=back-quoted-argument-unclosed + last=$(( arg1 + 1 )) + # Remove one layer of backslashes and find the end + while i=$arg[(ib:i+1:)[\\\\\`]]; do # find the next \ or ` + if (( i > end_pos - start_pos )); then + buf=$buf$arg[last,i] + offsets[i-arg1-offset]='' # So we never index past the end + (( i-- )) + subshell_has_end=$(( has_end && (start_pos + i == len) )) + break + fi + + if [[ $arg[i] == '\' ]]; then + (( i++ )) + # POSIX XCU 2.6.3 + if [[ $arg[i] == ('$'|'`'|'\') ]]; then + buf=$buf$arg[last,i-2] + (( offset++ )) + # offsets is relative to buf, so adjust by -arg1 + offsets[i-arg1-offset]=$offset + else + buf=$buf$arg[last,i-1] + fi + else # it's an unquoted ` and this is the end + style=back-quoted-argument + style_end=back-quoted-argument-delimiter + buf=$buf$arg[last,i-1] + offsets[i-arg1-offset]='' # So we never index past the end + break + fi + last=$i + done + + _zsh_highlight_main_highlighter_highlight_list 0 '' $subshell_has_end $buf + + # Munge the reply to account for removed backslashes + for start end_ highlight in $reply; do + start=$(( start_pos + arg1 + start + offsets[(Rb:start:)?*] )) + end_=$(( start_pos + arg1 + end_ + offsets[(Rb:end_:)?*] )) + highlights+=($start $end_ $highlight) + if [[ $highlight == back-quoted-argument-unclosed && $style == back-quoted-argument ]]; then + # An inner backtick command substitution is unclosed, but this level is closed + style_end=unknown-token + fi + done + + reply=( + $(( start_pos + arg1 - 1 )) $(( start_pos + i )) $style + $(( start_pos + arg1 - 1 )) $(( start_pos + arg1 )) back-quoted-argument-delimiter + $highlights + ) + if (( $#style_end )); then + reply+=($(( start_pos + i - 1)) $(( start_pos + i )) $style_end) fi - reply=($(( start_pos + arg1 - 1 )) $(( start_pos + i )) $style) REPLY=$i } diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-comment1.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-comment1.zsh new file mode 100644 index 0000000..0c449e1 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-comment1.zsh @@ -0,0 +1,38 @@ +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2016 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +# see alias-comment2.zsh +setopt interactivecomments +alias x=$'# foo\npwd' +BUFFER='x' + +expected_region_highlight=( + '1 1 alias' # x + '1 1 comment' # x (#) +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-comment2.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-comment2.zsh new file mode 100644 index 0000000..8bdc5a8 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-comment2.zsh @@ -0,0 +1,38 @@ +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2016 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +# see alias-comment1.zsh +setopt NO_interactivecomments +alias x=$'# foo\npwd' +BUFFER='x' + +expected_region_highlight=( + '1 1 alias' # x + '1 1 unknown-token' # x (#) +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-complex.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-complex.zsh new file mode 100644 index 0000000..7a9626e --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-complex.zsh @@ -0,0 +1,39 @@ +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias x='echo && ls; >' + +BUFFER='x file echo' + +expected_region_highlight=( + '1 1 alias' # x + '1 1 builtin' # x (echo) + '3 6 default' # file + '8 11 builtin' # echo +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-empty.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-empty.zsh new file mode 100644 index 0000000..535fccc --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-empty.zsh @@ -0,0 +1,38 @@ +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias x='' + +BUFFER='x echo foo' + +expected_region_highlight=( + '1 1 alias' # x + '3 6 builtin' # echo + '8 10 default' # foo +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-loop.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-loop.zsh new file mode 100644 index 0000000..b36d1c9 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-loop.zsh @@ -0,0 +1,41 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias a=b b=c c=b + +BUFFER='a foo; :' + +expected_region_highlight=( + '1 1 alias' # a + '1 1 unknown-token' # a (invalid alias loop) + '3 5 default' # foo + '6 6 commandseparator' # ; + '8 8 builtin' # : +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-nested-precommand.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-nested-precommand.zsh new file mode 100644 index 0000000..7c2eeeb --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-nested-precommand.zsh @@ -0,0 +1,44 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias a=b b=sudo +sudo(){} + +BUFFER='a -u phy1729 echo; :' + +expected_region_highlight=( + '1 1 alias' # a + '1 1 precommand' # a (sudo) + '3 4 single-hyphen-option' # -u + '6 12 default' # phy1729 + '14 17 builtin' # echo + '18 18 commandseparator' # ; + '20 20 builtin' # : +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-nested.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-nested.zsh new file mode 100644 index 0000000..44ab22b --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-nested.zsh @@ -0,0 +1,41 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias a=b b=: + +BUFFER='a foo; :' + +expected_region_highlight=( + '1 1 alias' # a + '1 1 builtin' # a (:) + '3 5 default' # foo + '6 6 commandseparator' # ; + '8 8 builtin' # : +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-precommand-option-argument1.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-precommand-option-argument1.zsh new file mode 100644 index 0000000..ad16962 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-precommand-option-argument1.zsh @@ -0,0 +1,42 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias sdu='sudo -u' +sudo(){} + +BUFFER='sdu phy1729 echo foo' + +expected_region_highlight=( + '1 3 alias' # sdu + '1 3 precommand' # sdu (sudo) + '5 11 default' # phy1729 + '13 16 commmand "issue #540"' # echo (not builtin) + '18 20 default' # foo +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-precommand-option-argument2.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-precommand-option-argument2.zsh new file mode 100644 index 0000000..2fceff8 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-precommand-option-argument2.zsh @@ -0,0 +1,43 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias sde='sudo -e' +alias seu='sde -u' +sudo(){} + +BUFFER='seu phy1729 echo foo' + +expected_region_highlight=( + '1 3 alias' # seu + '1 3 precommand' # seu (sudo) + '5 11 default' # phy1729 + '13 16 commmand "issue #540"' # echo (not builtin) + '18 20 default' # foo +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-quoted.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-quoted.zsh new file mode 100644 index 0000000..e42e2f0 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-quoted.zsh @@ -0,0 +1,39 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) YYYY zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias a=: ls='ls -l' +BUFFER='"a" foo; \ls' + +expected_region_highlight=( + '1 3 unknown-token' # "a" + '5 7 default' # foo + '8 8 commandseparator' # ; + '10 12 command' # \ls +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-redirect.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-redirect.zsh new file mode 100644 index 0000000..a6a0aab --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-redirect.zsh @@ -0,0 +1,39 @@ +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2016 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias x=\> +BUFFER='x foo echo bar' + +expected_region_highlight=( + '1 1 alias' # x + '1 1 redirection' # x (>) + '3 5 default' # foo + '7 10 builtin' # echo + '12 14 default' # bar +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-self.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-self.zsh new file mode 100644 index 0000000..88ed3c8 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-self.zsh @@ -0,0 +1,39 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias echo='echo foo' + +BUFFER='echo bar' + +expected_region_highlight=( + '1 4 alias' # echo + '1 4 builtin' # echo + '6 8 default' # bar +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-to-dir.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-to-dir.zsh new file mode 100644 index 0000000..93aaa62 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias-to-dir.zsh @@ -0,0 +1,37 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +alias x=/ +BUFFER=$'x' + +expected_region_highlight=( + '1 1 alias' # x + '1 1 unknown-token "issue #202"' # x (/) +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias.zsh index fd867bf..03ca0be 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/alias.zsh @@ -27,14 +27,11 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- -alias alias1="unused expansion" +alias alias1="ls" alias -s alias2="echo" -if set -o | grep -q aliasfuncdef; then - setopt alias_func_def # 5.4+ -fi -alias1() {} # to check that it's highlighted as an alias, not as a function +function alias1() {} # to check that it's highlighted as an alias, not as a function -BUFFER='x.alias2; alias1' +BUFFER='x.alias2; alias1; alias2' # Set expected_region_highlight as a function of zsh version. # @@ -51,4 +48,7 @@ fi expected_region_highlight+=( "9 9 commandseparator" # ; "11 16 alias" # alias1 + "11 16 command" # alias1 (ls) + "17 17 commandseparator" # ; + "19 24 unknown-token" # alias2 ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-argv.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-argv.zsh index fdf30aa..ec5acc2 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-argv.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-argv.zsh @@ -27,9 +27,12 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- +touch foo BUFFER='42=foo 43+=bar' expected_region_highlight=( "1 6 assign" # 42=foo + "4 6 path" # foo "8 14 assign" # 43+=bar + "12 14 default" # bar ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-array3.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-array3.zsh index 4e20cfc..986d71f 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-array3.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-array3.zsh @@ -35,4 +35,5 @@ expected_region_highlight=( "10 14 default" # world "15 15 assign" # ) "17 20 assign" # b=42 + "19 20 default" # 42 ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-not-array.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-not-array.zsh new file mode 100644 index 0000000..651ab80 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-not-array.zsh @@ -0,0 +1,36 @@ +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER='a=foo( bar ) :' + +expected_region_highlight=( + '1 12 assign' # a=foo( bar ) + '3 12 default' # foo( bar ) + '14 14 builtin' # : +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-not-array2.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-not-array2.zsh new file mode 100644 index 0000000..dfda106 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-not-array2.zsh @@ -0,0 +1,36 @@ +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER='a=foo\( :' + +expected_region_highlight=( + '1 7 assign' # a=foo\( + '3 7 default' # foo\( + '9 9 builtin' # : +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-semicolon.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-semicolon.zsh index fe55b6a..f748c94 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-semicolon.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-semicolon.zsh @@ -31,6 +31,7 @@ BUFFER='A=1; echo hello world' expected_region_highlight=( "1 3 assign" # A=1 + "3 3 default" # 1 "4 4 commandseparator" # ; "6 9 builtin" # echo "11 15 default" # hello diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-subshell.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-subshell.zsh index fc04f6b..2022889 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-subshell.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign-subshell.zsh @@ -32,5 +32,6 @@ BUFFER='(A=1)' expected_region_highlight=( "1 1 reserved-word" # ( "2 4 assign" # A=1 + "4 4 default" # 1 "5 5 reserved-word" # ) ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign.zsh index 36fa5d1..6e797ac 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/assign.zsh @@ -31,6 +31,7 @@ BUFFER='A=1 b=("foo" bar)' expected_region_highlight=( "1 3 assign" # A=1 + "3 3 default" # 1 "5 7 assign" # b=( "8 12 default" # "foo" "8 12 double-quoted-argument" # "foo" diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/back-quoted-argument.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/back-quoted-argument.zsh index 346d9fa..d504a2c 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/back-quoted-argument.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/back-quoted-argument.zsh @@ -27,16 +27,32 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- -# 42 is in the command position in a nested subshell. BUFFER='echo `echo \`42\`` "is `echo equal` to" `echo 6 times 9' expected_region_highlight=( "1 4 builtin" # echo "6 18 default" # `echo \`42\`` "6 18 back-quoted-argument" # `echo \`42\`` + "6 6 back-quoted-argument-delimiter" # ` + "7 10 builtin" # echo + "12 17 default" # \`42\` + "12 17 back-quoted-argument" # \`42\` + "12 13 back-quoted-argument-delimiter" # \` + "14 15 unknown-token" # 42 + "16 17 back-quoted-argument-delimiter" # \` + "18 18 back-quoted-argument-delimiter" # ` "20 39 default" # "is `echo equal` to" "20 39 double-quoted-argument" # "is `echo equal` to" "24 35 back-quoted-argument" # `echo equal` + "24 24 back-quoted-argument-delimiter" # ` + "25 28 builtin" # echo + "30 34 default" # equal + "35 35 back-quoted-argument-delimiter" # ` "41 55 default" # `echo 6 times 9 "41 55 back-quoted-argument-unclosed" # `echo 6 times 9 + "41 41 back-quoted-argument-delimiter" # ` + "42 45 builtin" # echo + "47 47 default" # 6 + "49 53 default" # times + "55 55 default" # 9 ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/back-quoted-open.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/back-quoted-open.zsh new file mode 100644 index 0000000..f188d81 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/back-quoted-open.zsh @@ -0,0 +1,41 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +touch foo +BUFFER=$': `ls fo' + +expected_region_highlight=( + '1 1 builtin' # : + '3 8 default' # `ls fo + '3 8 back-quoted-argument-unclosed' # `ls fo + '3 3 back-quoted-argument-delimiter' # ` + '4 5 command' # ls + '7 8 path_prefix' # fo +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/backslash-space.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/backslash-space.zsh new file mode 100644 index 0000000..0d8a63c --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/backslash-space.zsh @@ -0,0 +1,39 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER=$'echo \\ \'foo\' ; ls' + +expected_region_highlight=( + '1 4 builtin' # echo + '6 12 default' # \ \'foo\' + '8 12 single-quoted-argument' # 'foo' + '14 14 commandseparator' # ; + '16 17 command' # ls +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/bang-assign-array.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/bang-assign-array.zsh new file mode 100644 index 0000000..77b57e6 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/bang-assign-array.zsh @@ -0,0 +1,40 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER=$'foo=(bar abaz) \! ls' + +expected_region_highlight=( + '1 5 assign' # foo=( + '6 8 default' # bar + '10 13 default' # abaz + '14 14 assign' # ) + '16 16 unknown-token' # \! + '18 19 command' # ls +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/bang-assign-scalar.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/bang-assign-scalar.zsh new file mode 100644 index 0000000..e919050 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/bang-assign-scalar.zsh @@ -0,0 +1,38 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER=$'foo=bar \! ls' + +expected_region_highlight=( + '1 7 assign' # foo=bar + '5 7 default' # bar + '9 9 unknown-token' # \! + '11 12 command' # ls +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/bang-pipeline.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/bang-pipeline.zsh new file mode 100644 index 0000000..fef25f1 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/bang-pipeline.zsh @@ -0,0 +1,39 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER=$'\! ls | \! ls' + +expected_region_highlight=( + '1 1 reserved-word' # \! + '3 4 command' # ls + '6 6 commandseparator' # | + '8 8 unknown-token' # \! + '10 11 command' # ls +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/brackets-matching1.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/brackets-matching1.zsh new file mode 100644 index 0000000..7cc6de5 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/brackets-matching1.zsh @@ -0,0 +1,38 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER='[[ -n foo ]]' + +expected_region_highlight=( + '1 2 reserved-word' # [[ + '4 5 single-hyphen-option' # -n + '7 9 default' # foo + '11 12 reserved-word' # ]] +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/brackets-matching2.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/brackets-matching2.zsh new file mode 100644 index 0000000..19c7f0d --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/brackets-matching2.zsh @@ -0,0 +1,38 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER='[ -n foo ]' + +expected_region_highlight=( + '1 1 builtin' # [ + '3 4 single-hyphen-option' # -n + '6 8 default' # foo + '10 10 builtin' # ] +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/brackets-premature-termination.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/brackets-premature-termination.zsh new file mode 100644 index 0000000..fa813da --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/brackets-premature-termination.zsh @@ -0,0 +1,40 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER='[[ -n foo; echo ]]' + +expected_region_highlight=( + '1 2 reserved-word' # [[ + '4 5 single-hyphen-option' # -n + '7 9 default' # foo + '10 10 unknown-token' # ; + '12 15 builtin' # echo + '17 18 default' # ]] +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/command-substitution-in-assignment.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/command-substitution-in-assignment.zsh new file mode 100644 index 0000000..fafda49 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/command-substitution-in-assignment.zsh @@ -0,0 +1,42 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER=$'foo=$(echo bar) :' + +expected_region_highlight=( + '1 15 assign' # foo=$(echo bar) + '5 15 default' # $(echo bar) + '5 15 command-substitution-unquoted' # $(echo bar) + '5 6 command-substitution-delimiter-unquoted' # $( + '7 10 builtin' # echo + '12 14 default' # bar + '15 15 command-substitution-delimiter-unquoted' # ) + '17 17 builtin' # : +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/command-substitution-unclosed.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/command-substitution-unclosed.zsh new file mode 100644 index 0000000..3229dfc --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/command-substitution-unclosed.zsh @@ -0,0 +1,45 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER=$': foo$(echo bar' + +expected_region_highlight=( + '1 1 builtin' # : + '3 15 default' # foo$(echo bar + '6 15 command-substitution-unquoted' # $(echo bar + '6 7 command-substitution-delimiter-unquoted' # $( + '8 11 builtin' # echo + '13 15 default' # bar +) + +if [[ ${(z):-'$('} == '$( ' ]]; then # ignore zsh 5.0.8 bug + expected_region_highlight[2]='3 16 default' # foo$(echo bar + expected_region_highlight[3]='6 16 command-substitution-unquoted' # $(echo bar +fi diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/commmand-parameter.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/commmand-parameter.zsh index 07dfc4c..48d20ba 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/commmand-parameter.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/commmand-parameter.zsh @@ -28,10 +28,18 @@ # ------------------------------------------------------------------------------------------------- local x=/usr/bin/env -BUFFER='$x "argument"' +local y=sudo +local -a z; z=(zsh -f) +sudo(){} + +BUFFER='$x "argument"; $y; $z' expected_region_highlight=( "1 2 command" # $x "4 13 default" # "argument" "4 13 double-quoted-argument" # "argument" + "14 14 commandseparator" # ; + "16 17 precommand" # $y (sudo) + "18 18 unknown-token" # ; + "20 21 command" # $z - 'zsh' being the command ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/cthulhu.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/cthulhu.zsh new file mode 100644 index 0000000..c8119a8 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/cthulhu.zsh @@ -0,0 +1,70 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +# 0000000 0 01111111111222222 222233333 3 333344 4 4 444444555555555 5 6 6666 6 6 6667777777777888 8 8 88888999 9 9999 9 9 00 00 0000001111 +# 1234567 8 90123456789012345 678901234 5 678901 2 3 456789012345678 9 0 1234 5 6 7890123456789012 3 4 56789012 3 4567 8 9 01 23 4567890123 +BUFFER=$'echo Ph\\\'ng`echo lui "mg"\\`echo lw\\\'nafh \\\\\\`echo Cthu"lhu\\\\\\` R\\\\\'ly$(echo eh wag\\\\\\`echo h\\\'nag\\\\\\`\'l\' fht)agn`' + +expected_region_highlight=( + '1 4 builtin' # echo + '6 113 default' # Ph\'ng`echo lui "mg"\`echo lw\'nafh \\\`echo Cthu"lhu\\\` R\\'ly$(echo eh wag\\\`echo h\'nag\\\`'l' fht)agn` + '12 113 back-quoted-argument' # `echo lui "mg"\`echo lw\'nafh \\\`echo Cthu"lhu\\\` R\\'ly$(echo eh wag\\\`echo h\'nag\\\`'l' fht)agn` + '12 12 back-quoted-argument-delimiter' # ` + '13 16 builtin' # echo + '18 20 default' # lui + '22 112 default' # "mg"\`echo lw\'nafh \\\`echo Cthu"lhu\\\` R\\'ly$(echo eh wag\\\`echo h\'nag\\\`'l' fht)agn + '22 25 double-quoted-argument' # "mg" + '26 112 back-quoted-argument-unclosed' # \`echo lw\'nafh \\\`echo Cthu"lhu\\\` R\\'ly$(echo eh wag\\\`echo h\'nag\\\`'l' fht)agn + '26 27 back-quoted-argument-delimiter' # \` + '28 31 builtin' # echo + '33 40 default' # lw\'nafh + '42 62 default' # \\\`echo Cthu"lhu\\\` + '42 62 back-quoted-argument' # \\\`echo Cthu"lhu\\\` + '42 45 back-quoted-argument-delimiter' # \\\` + '46 49 builtin' # echo + '51 58 default' # Cthu"lhu + '55 58 double-quoted-argument-unclosed' # "lhu + '59 62 back-quoted-argument-delimiter' # \\\` + '64 112 default' # R\\'ly$(echo eh wag\\\`echo h\'nag\\\`'l' fht)agn + '70 109 command-substitution-unquoted' # $(echo eh wag\\\`echo h\'nag\\\`'l' fht) + '70 71 command-substitution-delimiter-unquoted' # $( + '72 75 builtin' # echo + '77 78 default' # eh + '80 104 default' # wag\\\`echo h\'nag\\\`'l' + '83 101 back-quoted-argument' # \\\`echo h\'nag\\\` + '83 86 back-quoted-argument-delimiter' # \\\` + '87 90 builtin' # echo + '92 97 default' # h\'nag + '98 101 back-quoted-argument-delimiter' # \\\` + '102 104 single-quoted-argument' # 'l' + '106 108 default' # fht + '109 109 command-substitution-delimiter-unquoted' # ) + '113 113 unknown-token' # ` +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/dirs_blacklist.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/dirs_blacklist.zsh index 0d4d666..8cf04be 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/dirs_blacklist.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/dirs_blacklist.zsh @@ -30,11 +30,11 @@ mkdir foo touch foo/bar BUFFER=": foo/bar $PWD/foo foo/b" -X_ZSH_HIGHLIGHT_DIRS_BLACKLIST=($PWD/foo) +X_ZSH_HIGHLIGHT_DIRS_BLACKLIST=($PWD/foo $PWD/bar) expected_region_highlight=( '1 1 builtin' # : - '3 9 path' # foo/bar - "11 $(( 14 + $#PWD )) path" # $PWD/foo + '3 9 default' # foo/bar + "11 $(( 14 + $#PWD )) default" # $PWD/foo "$(( 16 + $#PWD )) $(( 20 + $#PWD )) default" # foo/b ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/dollar-paren.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/dollar-paren.zsh index 2a1aecd..2bbcef1 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/dollar-paren.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/dollar-paren.zsh @@ -28,11 +28,22 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- -BUFFER=': "$(:)"' +BUFFER=': "$(:)" "foo$(:)bar' expected_region_highlight=( '1 1 builtin' # : '3 8 default' # "$(:)" - '3 8 double-quoted-argument' # "$(:)" - '4 4 dollar-double-quoted-argument' # $ + '3 3 double-quoted-argument' # "$(:)" + '8 8 double-quoted-argument' # "$(:)" + '4 7 command-substitution-quoted' # $(:) + '4 5 command-substitution-delimiter-quoted' # $( + '6 6 builtin' # : + '7 7 command-substitution-delimiter-quoted' # ) + '10 20 default' # "foo$(:)bar + '10 13 double-quoted-argument-unclosed' # "foo + '18 20 double-quoted-argument-unclosed' # bar + '14 17 command-substitution-quoted' # $(:) + '14 15 command-substitution-delimiter-quoted' # $( + '16 16 builtin' # : + '17 17 command-substitution-delimiter-quoted' # ) ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/empty-line.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/empty-line.zsh new file mode 100644 index 0000000..a4d6685 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/empty-line.zsh @@ -0,0 +1,36 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER=$'\\\n; ls' + +expected_region_highlight=( + '3 3 unknown-token' # ; + '5 6 command' # ls +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/exec-redirection1.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/exec-redirection1.zsh index caec2f1..78a0c62 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/exec-redirection1.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/exec-redirection1.zsh @@ -31,8 +31,8 @@ BUFFER='exec {foo}>&/tmp ls' expected_region_highlight=( "1 4 precommand" # exec - "6 10 redirection 'issue #238'" # {foo} + "6 10 named-fd" # {foo} "11 12 redirection" # >& "13 16 path" # /tmp - "18 19 command 'issue #238'" # ls + "18 19 command" # ls ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/function-altsyntax.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/function-altsyntax.zsh new file mode 100644 index 0000000..0f9a833 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/function-altsyntax.zsh @@ -0,0 +1,45 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +# Define named and anonymous function using the alternative syntax +BUFFER=$'function f { pwd }; function { pwd }' + +expected_region_highlight=( + '1 8 reserved-word' # function + '10 10 default' # f + '12 12 reserved-word "issue #237"' # { + '14 16 command "issue #237"' # pwd + '18 18 reserved-word "issue #237"' # } + '19 19 commandseparator' # ; + '21 28 reserved-word' # function + '30 30 reserved-word "issue #237"' # { + '32 34 command "issue #237"' # pwd + '36 36 reserved-word "issue #237"' # } +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob-alias.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob-alias.zsh index 2f96445..5676b5a 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob-alias.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob-alias.zsh @@ -32,5 +32,6 @@ BUFFER='x ls' expected_region_highlight=( "1 1 alias" # x + "1 1 precommand" # x (command) "3 4 command" # ls ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob-always.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob-always.zsh new file mode 100644 index 0000000..481722f --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob-always.zsh @@ -0,0 +1,44 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER=$'{ noglob echo * } always { echo * }' + +expected_region_highlight=( + '1 1 reserved-word' # { + '3 8 precommand' # noglob + '10 13 builtin' # echo + '15 15 default' # * + '17 17 reserved-word' # } + '19 24 reserved-word' # always + '26 26 reserved-word' # { + '28 31 builtin' # echo + '33 33 globbing "issue #577"' # * + '35 35 reserved-word' # } +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob4.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob4.zsh new file mode 100644 index 0000000..cc7065f --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/noglob4.zsh @@ -0,0 +1,45 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER=$'noglob cat <(print -r -- *)' + +expected_region_highlight=( + '1 6 precommand' # noglob + '8 10 command' # cat + '12 27 default' # <(print -r -- *) + '12 27 process-substitution' # <(print -r -- *) + '12 13 process-substitution-delimiter' # <( + '14 18 builtin' # print + '20 21 single-hyphen-option' # -r + '23 24 double-hyphen-option' # -- + '26 26 default' # * + '26 26 globbing' # * + '27 27 process-substitution-delimiter' # ) +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/off-by-one.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/off-by-one.zsh index 550c09f..7d6961a 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/off-by-one.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/off-by-one.zsh @@ -27,14 +27,15 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- -alias a=A +alias a=: f() {} BUFFER='a;f;' expected_region_highlight=( - "1 1 alias" # f + "1 1 alias" # a + "1 1 builtin" # a (:) "2 2 commandseparator" # ; - "3 3 function" # g + "3 3 function" # f "4 4 commandseparator" # ; ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/path-dollared-word3.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/path-dollared-word3.zsh index a9a5fa3..6921cba 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/path-dollared-word3.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/path-dollared-word3.zsh @@ -29,10 +29,12 @@ # «/usr» at this point would be highlighted as path_prefix; so should # a parameter that expands to an equivalent string be highlighted. +# +# More complicated parameter substitutions aren't eval'd; issue #328. BUFFER='$PWD; ${PWD}' expected_region_highlight=( - "1 4 unknown-token" # $PWD - not eval'd; issue #328 + "1 4 path" # $PWD "5 5 commandseparator" # ; - "7 12 unknown-token" # ${PWD} + "7 12 path" # ${PWD} ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand-unknown-option.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand-unknown-option.zsh new file mode 100644 index 0000000..1fba1b9 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand-unknown-option.zsh @@ -0,0 +1,43 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +sudo(){} + +BUFFER='sudo -ux ls; sudo -x ls' + +expected_region_highlight=( + '1 4 precommand' # sudo + '6 8 single-hyphen-option' # -ux + '10 11 command' # ls + '12 12 commandseparator' # ; + '14 17 precommand' # sudo + '19 20 unknown-token' # -x + '22 23 command' # ls +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand2.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand2.zsh index 3d8f332..75dceab 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand2.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand2.zsh @@ -31,6 +31,6 @@ BUFFER='command -v ls' expected_region_highlight=( "1 7 precommand" # command - "9 10 single-hyphen-option 'issue #343'" # -v - "12 13 command 'issue #343'" # ls + "9 10 single-hyphen-option" # -v + "12 13 command" # ls ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand3.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand3.zsh new file mode 100644 index 0000000..f8b0c78 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand3.zsh @@ -0,0 +1,41 @@ +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2016 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +BUFFER='nice -n10 ls; nice -n 10 ls' + +expected_region_highlight=( + "1 4 precommand" # nice + "6 9 single-hyphen-option" # -n10 + "11 12 command" # ls + "13 13 commandseparator" # ; + "15 18 precommand" # nice + "20 21 single-hyphen-option" # -n + "23 24 default" # 10 + "26 27 command" # ls +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand4.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand4.zsh new file mode 100644 index 0000000..b9e6119 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/precommand4.zsh @@ -0,0 +1,39 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------------------------- +# Copyright (c) 2018 zsh-syntax-highlighting contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are permitted +# provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of conditions +# and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the following disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors +# may be used to endorse or promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------------- +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------------------------- + +doas(){} +BUFFER=$'doas -nu phy1729 ls' + +expected_region_highlight=( + '1 4 precommand' # doas + '6 8 single-hyphen-option' # -nu + '10 16 default' # phy1729 + '18 19 command' # ls +) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/process-substitution-redirection-isnt-globbing.zsh b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/process-substitution-redirection-isnt-globbing.zsh index 05c11b8..f8dbd6b 100644 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/process-substitution-redirection-isnt-globbing.zsh +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/main/test-data/process-substitution-redirection-isnt-globbing.zsh @@ -33,4 +33,9 @@ BUFFER=$': =((wc) + "4 8 default" # >(wc) + "4 8 process-substitution" # >(wc) + "4 5 process-substitution-delimiter" # >( + "6 7 command" # wc + "8 8 process-substitution-delimiter" # ) "10 10 commandseparator" # | "12 13 command" # nl ) diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/pattern/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/pattern/README.md deleted file mode 100644 index 3ad5f24..0000000 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/pattern/README.md +++ /dev/null @@ -1,19 +0,0 @@ -zsh-syntax-highlighting / highlighters / pattern ------------------------------------------------- - -This is the `pattern` highlighter, that highlights user-defined patterns. - - -### How to tweak it - -To use this highlighter, associate patterns with styles in the -`ZSH_HIGHLIGHT_PATTERNS` associative array, for example in `~/.zshrc`: - - # To have commands starting with `rm -rf` in red: - ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red') - -The syntax for values is the same as the syntax of "types of highlighting" of -the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` -manual page][zshzle-Character-Highlighting]. - -[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/pattern/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/pattern/README.md new file mode 120000 index 0000000..5ff00e6 --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/pattern/README.md @@ -0,0 +1 @@ +../../docs/highlighters/pattern.md \ No newline at end of file diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/regexp/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/regexp/README.md deleted file mode 100644 index 25f1b6c..0000000 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/regexp/README.md +++ /dev/null @@ -1,27 +0,0 @@ -zsh-syntax-highlighting / highlighters / regexp ------------------------------------------------- - -This is the `regexp` highlighter, that highlights user-defined regular -expressions. It's similar to the `pattern` highlighter, but allows more complex -patterns. - -### How to tweak it - -To use this highlighter, associate regular expressions with styles in the -`ZSH_HIGHLIGHT_REGEXP` associative array, for example in `~/.zshrc`: - - ZSH_HIGHLIGHT_REGEXP+=('\bsudo\b' fg=123,bold) - -This will highlight "sudo" only as a complete word, i.e., "sudo cmd", but not -"sudoedit" - -The syntax for values is the same as the syntax of "types of highlighting" of -the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` -manual page][zshzle-Character-Highlighting]. - -See also: [regular expressions tutorial][perlretut], zsh regexp operator `=~` -in [the `zshmisc(1)` manual page][zshmisc-Conditional-Expressions] - -[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting -[perlretut]: http://perldoc.perl.org/perlretut.html -[zshmisc-Conditional-Expressions]: http://zsh.sourceforge.net/Doc/Release/Conditional-Expressions.html#Conditional-Expressions diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/regexp/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/regexp/README.md new file mode 120000 index 0000000..9f2522d --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/regexp/README.md @@ -0,0 +1 @@ +../../docs/highlighters/regexp.md \ No newline at end of file diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/root/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/root/README.md deleted file mode 100644 index 0b0d41f..0000000 --- a/.zprezto/modules/syntax-highlighting/external/highlighters/root/README.md +++ /dev/null @@ -1,23 +0,0 @@ -zsh-syntax-highlighting / highlighters / root ---------------------------------------------- - -This is the `root` highlighter, that highlights the whole line if the current -user is root. - - -### How to tweak it - -This highlighter defines the following styles: - -* `root` - the style for the whole line if the current user is root. - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, -for example in `~/.zshrc`: - - ZSH_HIGHLIGHT_STYLES[root]='bg=red' - -The syntax for values is the same as the syntax of "types of highlighting" of -the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` -manual page][zshzle-Character-Highlighting]. - -[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting diff --git a/.zprezto/modules/syntax-highlighting/external/highlighters/root/README.md b/.zprezto/modules/syntax-highlighting/external/highlighters/root/README.md new file mode 120000 index 0000000..ca6799d --- /dev/null +++ b/.zprezto/modules/syntax-highlighting/external/highlighters/root/README.md @@ -0,0 +1 @@ +../../docs/highlighters/root.md \ No newline at end of file diff --git a/.zprezto/modules/syntax-highlighting/external/zsh-syntax-highlighting.zsh b/.zprezto/modules/syntax-highlighting/external/zsh-syntax-highlighting.zsh index 6838e1d..4caf3a8 100644 --- a/.zprezto/modules/syntax-highlighting/external/zsh-syntax-highlighting.zsh +++ b/.zprezto/modules/syntax-highlighting/external/zsh-syntax-highlighting.zsh @@ -305,7 +305,7 @@ _zsh_highlight_bind_widgets() # Override ZLE widgets to make them invoke _zsh_highlight. local -U widgets_to_bind - widgets_to_bind=(${${(k)widgets}:#(.*|run-help|which-command|beep|set-local-history|yank)}) + widgets_to_bind=(${${(k)widgets}:#(.*|run-help|which-command|beep|set-local-history|yank|yank-pop)}) # Always wrap special zle-line-finish widget. This is needed to decide if the # current line ends and special highlighting logic needs to be applied. @@ -363,7 +363,7 @@ _zsh_highlight_bind_widgets() # 1) Path to the highlighters directory. _zsh_highlight_load_highlighters() { - setopt localoptions noksharrays + setopt localoptions noksharrays bareglobqual # Check the directory exists. [[ -d "$1" ]] || { diff --git a/.zprezto/modules/utility/README.md b/.zprezto/modules/utility/README.md index 84e81f5..3b25b3a 100644 --- a/.zprezto/modules/utility/README.md +++ b/.zprezto/modules/utility/README.md @@ -8,8 +8,8 @@ Settings ### Highlighting -If you have enabled color globally in *zpreztorc*, you may disable it for certain -commands. +If you have enabled color globally in *zpreztorc*, you may disable it for +certain commands. To disable `ls` color, add the following line to *zpreztorc*; when coloring is disabled, type indicators (\*, /, =>, @, =, |, %) will be appended to entries. @@ -18,6 +18,12 @@ disabled, type indicators (\*, /, =>, @, =, |, %) will be appended to entries. zstyle ':prezto:module:utility:ls' color 'no' ``` +To disable GNU coreutils `ls` to list directories grouped first, add the following line to *zpreztorc*: + +```sh +zstyle ':prezto:module:utility:ls' dirs-first 'no' +``` + To disable `diff` highlighting, add the following line to *zpreztorc*: ```sh @@ -109,7 +115,8 @@ Aliases ### Resource Usage - - `df` displays free disk space using human readable units (aliases to `pydf`, if installed). + - `df` displays free disk space using human readable units (aliases to `pydf`, + if installed). - `du` displays disk usage using human readable units. - `top` displays information about processes. - `topc` displays information about processes sorted by CPU usage. diff --git a/.zprezto/modules/utility/init.zsh b/.zprezto/modules/utility/init.zsh index 942090d..6b07bf0 100644 --- a/.zprezto/modules/utility/init.zsh +++ b/.zprezto/modules/utility/init.zsh @@ -73,7 +73,10 @@ fi # ls if is-callable 'dircolors'; then # GNU Core Utilities - alias ls='ls --group-directories-first' + + if zstyle -T ':prezto:module:utility:ls' dirs-first; then + alias ls="${aliases[ls]:-ls} --group-directories-first" + fi if zstyle -t ':prezto:module:utility:ls' color; then # Call dircolors to define colors if they're missing diff --git a/.zprezto/runcoms/README.md b/.zprezto/runcoms/README.md index 9df890e..29d9f8a 100644 --- a/.zprezto/runcoms/README.md +++ b/.zprezto/runcoms/README.md @@ -10,7 +10,7 @@ in */etc* by default. User-local configuration files have the same name as their global counterparts but are prefixed with a dot (hidden). Zsh looks for these files in the path -stored in the `$ZDOTDIR` environmental variable. However, if said variable is +stored in the `$ZDOTDIR` environment variable. However, if said variable is not defined, Zsh will use the user's home directory. File Descriptions diff --git a/.zprezto/runcoms/zshenv b/.zprezto/runcoms/zshenv index faa2411..2dbf12a 100644 --- a/.zprezto/runcoms/zshenv +++ b/.zprezto/runcoms/zshenv @@ -9,5 +9,3 @@ if [[ ( "$SHLVL" -eq 1 && ! -o LOGIN ) && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then source "${ZDOTDIR:-$HOME}/.zprofile" fi - -unset LC_CTYPE