[
  {
    "path": ".github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\nThanks for opening an issue! For a project that deals with as many different things as P9k, debugging problems can be difficult. Please follow the guide, below, to create a bug report that will help us help you!\n\n### Before Opening a Bug\nP9k is lovingly maintained by volunteers, and we are happy to help you! You can help us by first making sure your issue hasn't already been solved before opening a new one. Please check the [Troubleshooting Guide](https://github.com/bhilburn/powerlevel9k/wiki/Troubleshooting) first. Many issues are actually local configuration problems, which may have previously been solved by another user - be sure to also [search the existing issues](https://github.com/bhilburn/powerlevel9k/issues?utf8=%E2%9C%93&q=is%3Aissue) before opening a new one.\n\nOnce you've done these things, you can delete this section and proceed `=)`\n\n-----\n\n#### Describe Your Issue\nWhat is happening?\n\nMost issues are best explained with a screenshot. Please share one if you can!\n\n#### Have you tried to debug or fix it?\n\nHave you tinkered with your settings, and what happened when you did? Did you find a bit of code that you think might be the culprit? Let us know what you've done so far!\n\n#### Environment Information\n\nThis information will help us understand your configuration.\n\n  - What version of ZSH are you using? You can use `zsh --version` to see this.\n  - Do you use a ZSH framework (e.g., Oh-My-ZSH, Antigen)?\n  - How did you install P9k (cloning the repo, by tarball, a package from your OS, etc.,)?\n  - What version of P9k are you using?\n  - Which terminal emulator do you use?\n\n#### Issues with Fonts & Icons\nYou may delete this section if your issue is not font / icon related.\n\n  - Which font do you use?\n  - Which [font configuration mode](https://github.com/bhilburn/powerlevel9k/wiki/About-Fonts) are you using? You can check this with (`echo $POWERLEVEL9K_MODE`).\n  - Please share the contents of `$P9k/debug/font-issues.zsh`.\n  - If this is an icon problem, does the output of `$ get_icon_names` look correct?\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/PERFORMANCE_ISSUE_TEMPLATE.md",
    "content": "---\nname: Performance Issue\nabout: For performance Issues\ntitle: \"[Performance]\"\nlabels: performance\nassignees: ''\n\n---\n\nSorry to hear that the performance of P9K is not adequate. To fix this, please provide us with some hints.\n\n### Your Hardware\n\nDisk I/O is critical for P9K, so do you use a spinning disk, or a SSD?\n\n### Virtualization\n\nDo you use P9K in some sort of virtualization? This is also the case, if you use WSL on Windows..\n\n### How Fast is Fast\n\nCould you quantify how fast the specific segment is, that you think is slow?\nFor example, if you think the `vcs` segment is slow, could you execute this command in the directory, where the segment is slow:\n\n```zsh\ntime (repeat 10; do; prompt_vcs left 1 false >/dev/null; done;)\n```\n\nAlso, please provide us with some context around the segment. In the `vcs` example:\n\n- How big is the repo?\n- Does it contain a lot of untracked files?\n- Does it contain a lot of git submodules?\n- Does it contain a lot of files in general?\n\nAdditionally, you could install [zsh-prompt-benchmark](https://github.com/romkatv/zsh-prompt-benchmark), to benchmark the general performance of ZSH and P9K.\n\nIf you don't know which segment is slow, could you remove one by one, and spot the one that made the greatest impact?"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "Thank you so much for opening a PR for P9k! Many of our best features and segments have come from the community, and we are excited to see your contribution.\n\nTo help you make the best PR, here are some guidelines:\n\n  - The `master` branch is our *stable* branch, and the `next` branch is our development branch. If you are submitting a bug fix, please file your PR against `master`. If it is a new feature, enhancement, segment, or something similar, please submit it against `next`. For more information, please see our [Developer's Guide](https://github.com/bhilburn/powerlevel9k/wiki/Developer's-Guide).\n  - We maintain unit tests for segments and features in the `test` directory. Please add unit tests for anything new you have developed! If you aren't sure how to do this, go ahead and file your PR and ask for help!\n  - For running manual tests in different environments, we have Vagrant and Docker configurations. Please see the [Test README](https://github.com/bhilburn/powerlevel9k/blob/next/TESTS.md) and make sure your new feature is working as expected!\n  - If your PR requires user configuration, please make sure that it includes an update to the README describing this.\n  - P9k maintains a lot of useful information in our [Wiki](https://github.com/bhilburn/powerlevel9k/wiki). Depending on the content of your PR, we might ask you to update the Wiki (or provide text for us to use) to document your work. Most PRs don't require this.\n  - Please make your commit messages useful! Here is a [great short guide on useful commit messages](https://code.likeagirl.io/useful-tips-for-writing-better-git-commit-messages-808770609503).\n\nOnce you have submitted your PR, P9k core contributors will review the code and work with you to get it merged. During this process, we might request changes to your code and discuss different ways of doing things. This is all part of the open source process, and our goal is to help you create the best contribution possible for P9k `=)`.\n\nPlease follow this template for creating your PR:\n\n#### Title\n\nPlease make the title of your PR descriptive! If appropriate, please prefix the title with one of these tags:\n\n- [Bugfix]\n- [New Segment]\n- [Docs]\n- [Enhancement]\n\n#### Description\n\nPlease describe the contribution your PR makes! Screenshots are especially helpful, here, if it's a new segment.\n\nIf your PR is addressing an issue, please reference the Issue number here.\n\n#### Questions\n\nIs there something in your PR you're not sure about or need help with? Is there a particular piece of code you would like feedback on? Let us know here!\n"
  },
  {
    "path": ".gitignore",
    "content": "test-vm/.vagrant\n*.swp\n.idea"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"shunit2\"]\n\tpath = shunit2\n\turl = https://github.com/kward/shunit2.git\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: sh\n\nos:\n  - linux\n  - osx\n\nosx_image: xcode9.4\n\naddons:\n  apt:\n    packages:\n      - build-essential\n      - git\n      - mercurial\n      - subversion\n      - jq\n      - node\n      - golang\n      - ruby\n      - python\n      - python-virtualenv\n\nbefore_install:\n  - if [[ \"$TRAVIS_OS_NAME\" == \"osx\" ]]; then brew update            ; fi\n\nenv:\n  global:\n    - ZSH_DIST=$HOME/.zshdist\n  matrix:\n    # Use _ZSH_VERSION since if ZSH_VERSION is present, travis cacher thinks it\n    # is running in zsh and tries to use zsh specific functions.\n    - _ZSH_VERSION=5.5.1\n    - _ZSH_VERSION=5.5\n    - _ZSH_VERSION=5.4.2\n    - _ZSH_VERSION=5.4.1\n    - _ZSH_VERSION=5.3.1\n    - _ZSH_VERSION=5.3\n    - _ZSH_VERSION=5.2\n    - _ZSH_VERSION=5.1.1\n\ncache:\n  directories:\n    - $ZSH_DIST\n\nbefore_script:\n  - >\n    setup_zsh() {\n      dest=\"$ZSH_DIST/$1\"\n      if [[ ! -d $dest/bin ]]; then\n        coreutils_mktemp=\"mktemp\"\n        if [[ \"$TRAVIS_OS_NAME\" == \"osx\" ]]; then\n          coreutils_mktemp=\"gmktemp\"\n        fi\n        tmp=\"$(${coreutils_mktemp} --directory --tmpdir=\"${TMPDIR:/tmp}\" zshbuild.XXXXXX)\"\n        (\n          cd \"$tmp\" &&\n          curl -L http://downloads.sourceforge.net/zsh/zsh-${1}.tar.gz | tar zx &&\n          cd zsh-$1 &&\n          ./configure --prefix=\"$dest\" &&\n          make &&\n          mkdir -p \"$dest\" &&\n          make install ||\n          echo \"Failed to build zsh-${1}!\"\n        )\n      fi\n      export PATH=\"$dest/bin:$PATH\"\n    }\n  - setup_zsh $_ZSH_VERSION\n  # Show the git version being used to test.\n  - \"git --version\"\n  # Show the mercurial version being used to test.\n  - \"hg --version\"\n  # Show the zsh version being used to test.\n  - \"zsh --version\"\n\nscript:\n  - test/suite.spec\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "## v0.6.7\n\n- PR #1175 - Fix home dir shortening when using package_name truncation strategy\n- PR #1158 - [Bugfix] dir: Fix package name path truncation inside home dir\n- PR #1157 - Hide stderr from git ls-files\n- PR #1154 - Fix issues with debug/fonts script in Konsole\n- PR #1151 - [Bugfix] Only abbreviate $HOME at the beginning of cwd\n- PR #1148 - Remove checking for NODEENV_DISABLE_PROMPT\n- PR #1147 - Fix newlines in ZSH 5.7\n- PR #1149 - Fix RVM\n- PR #1128 - [Bugfix] virtualenv prompt displaying\n- PR #981 - [Bugfix] Fix for #974\n- PR #1126 - Use ip command for VPN segment\n- PR #1079 - [Bugfix] Update VIRTUAL_ENV_DISABLE_PROMPT value\n- PR #1080 - [Bugfix] Port #1071 to `master` (Fix fatal errors emitted by untracked file check in vcs.zsh)\n- PR #1074 - Add vcs vulnerability tests master\n- PR #1070 - [Docs] Uniformly apply inline code formatting in README\n- PR #1065 - Protect locale\n- PR #1048 - Speedup Improvements in `vcs` segment\n- PR #1037 - Fix vpn_ip segment\n- PR #1036 - Make truncate with package name work without setting shorten length\n- PR #1020 - Fix context spec\n- PR #990 - [Docs] Add forgotten backtick\n- PR #981 - Avoid error if `/etc/os-release` does not exist\n- PR #966 - [Bugfix] Fix icons cut off in RPROMPT segments\n\n## v0.6.6\n\n- The `rbenv` segment is no longer a default segment in the LPROMPT.\n- PR #959 - Fixing issue in v0.6.5 where we changed some color codes.\n- PR #934 - Add Tests\n- PR #884 - test-in-docker: fix with newer ZSH versions\n- PR #928 - [Docs] Add etc state description in dir docs\n- PR #937 - Use SUDO_COMMAND to check for sudo\n- PR #925 - [Bugfix] Resolve #918 Transparent background\n- PR #923 - Fix font issue debugging script\n- PR #921 - Add missing colors to fix color comparison\n- PR #951 - Add fallback icon for missing linux distro icons\n- PR #956 - Fix broken link in readme\n- Fixed #936 - fallback icons for Linux distros\n- Fixed #926 - `etc` state for `dir` segment in docs\n- Fixed #852 - `sudo` detection got crazy, there. sorry, everyone.\n- Fixed #927 - more default color issues.\n\n## v0.6.5\n\n- Multiple PRs: General fixes to README, improved documentation.\n- Multiple PRs: Improvements to icons / glyphs.\n- PR #777: now possible to always show the Ruby env segment.\n- PR #773: Fixed issue with home abbreviation in directory segment.\n- PR #789: Now properly working around some odd ZSH status return codes.\n- PR #716: Now possible to configure the colors of the VCS segment in rebase mode.\n- PR #722: Removed dependency on `bc` for `load` segment.\n- PR #686: Fixed issue where whitespaces in path occasionally broke `dir` segment.\n- PR #685: No longer accidentally invoking user `grep` aliases.\n- PR #680: Using env variable for `PYENV` properly, now.\n- PR #676, #611: Fixes for Kubernetes segment.\n- PR #667: Supporting multiple AWS profiles.\n- PR #660: Fixing directory parsing issue with PYTHONPATH.\n- PR #663: Fixed silly issues causing ZSH warnings.\n- PR #647: Fixing `public_ip` segment for macOS.\n- PR #643: Fixing `vpn_ip` segment naming.\n- PR #636: `context` segment now grabs user with command rather than env.\n- PR #618: Fix issue where `su -` didn't change context segment.\n- PR #608: Load average selection in `load` segment.\n\n### New Segment: `laravel_version`\n\nDisplays the current laravel version.\n\n## v0.6.4\n\n- `load` segment now has configurable averages.\n- Update to `dir` segment to add `dir_writable` feature.\n- `status` segment can now display POSIX signal name of exit code.\n- Added `teardown` command to turn off P9k prompt.\n- Fixes for P9k in Cygwin and 32-bit systems.\n- Better colors in virtualization segments.\n- Added 'Gopher' icon to the `go_version` segment.\n- Improved detection in `nvm`\n- Added option to support command status reading from piped command sequences.\n- Fixed issue with visual artifacts with quick consecutive commands.\n- Updated 'ananconda' segment for more uniform styling.\n- `rvm` segment can now support usernames with dashes.\n- Fixed Python icon reference in some font configurations.\n- Vi mode indicator fixed.\n- Fixes for Docker segment.\n- Added new Docker-based testing system.\n- Significant enhancements to the `battery` segment. Check out the README to\n  read more!\n- New truncation strategy that truncates until the path becomes unique.\n\n### New Segments: `host` and `user`\n\nProvides two separate segments for `host` and `user` in case you don't wont both\nin one (per the `context` segment).\n\n### New Segment: `newline`\n\nAllows you to split segments across multiple lines.\n\n### New Segment: `kubecontext`\n\nShows the current context of your `kubectl` configuration.\n\n### New Segment: `vpn`\n\nShows current `vpn` interface.\n\n## v0.6.3\n\n- Fixed susceptibility to [pw3nage exploit](https://github.com/njhartwell/pw3nage).\n- Added support for Android\n- The abbreviation for $HOME is now configurable (doesn't have to be `~`).\n- Fixed colorization of VCS segment in Subversion repos.\n- Improved handling of symlinks in installation paths.\n\n## v0.6.2\n\n- Fixed some issues with the new `nerdfont-fontconfig` option.\n- Fixed typo in README.\n- The `get_icon_names` function can now print sorted output, and show which\n  icons users have overridden.\n- Added a FreeBSD VM for testing.\n\n### Add debug script for iTerm2 issues\n\nA new script `debug/iterm.zsh` was added for easier spotting problems with your iTerm2 configuration.\n\n### Add debug script for font issues\n\nA new script `debug/font-issues.zsh` was added, so that problems with your font could be spotted easier.\n\n### `ram` changes\n\nThe `ram` segment now shows the available ram instead of free.\n\n### Add new segments `host` and `user`\n\nThe user and host segments allow you to have different icons and colors for both the user and host segments\ndepending on their state.\n\n## v0.6.0\n\n- Fixed a bug where the tag display was broken on detached HEADs.\n- Fixed a bug where SVN detection sometimes failed.\n- Fixed the `load` and `ram` segments for BSD.\n- Fixed code-points that changed in Awesome fonts.\n- Fixed display of \"OK_ICON\" in `status` segment in non-verbose mode.\n- Fixed an issue where dir name truncation that was very short sometimes failed.\n- Speed & accuracy improvements to the battery segment.\n- Added Github syntax highlighting to README.\n- Various documentation cleanup.\n\n### New Font Option: nerd-fonts\n\nThere is now an option to use [nerd-fonts](https://github.com/ryanoasis/nerd-fonts) with P9k. Simply configure the `nerdfont-fontconfig`, and you'll be set!\n\n### `vcs` changes\n\nThe VCS segment can now display icons for remote repo hosting services, including Github, Gitlab, and 'other'.\n\n### `dir` changes\n\nAdded an option to configure the path separator. If you want something\nelse than an ordinary slash, you could set\n`POWERLEVEL9K_DIR_PATH_SEPARATOR` to whatever you want.\n\n#### `truncate_with_package_name` now searches for `composer.json` as well\n\nNow `composer.json` files are searched as well. By default `package.json` still takes\nprecedence. If you want to change that, set `POWERLEVEL9K_DIR_PACKAGE_FILES=(composer.json package.json)`.\n\n### New segment `command_execution_time` added\n\nShows the duration a command needed to run. By default only durations over 3 seconds\nare shown (can be adjusted by setting POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD).\n\n### New segment `dir_writable` added\n\nThis segment displays a lock icon if your user has no write permissions in the current folder.\n\n### New segment `disk_usage` added\n\nThis segment will show the usage level of your current partition.\n\n### New segment `public_ip` added\n\nFetches your Public IP (using ident.me) and displays it in your prompt.\n\n### New segment `swift_version` added\n\nThis segment displays the version of Swift that is installed / in your path.\n\n### New segment `detect_virt` added\n\nDetects and reports if you are in a virtualized session using `systemd`.\n\n## v0.5.0\n\n### `load` and `ram` changes\n\nThese two segments now support BSD.\n\n### `vcs` changes\n\n- We implemented a huge speed improvement for this segment.\n- Now this segment supports Subversion repositories.\n- Add ability to hide tags by setting `POWERLEVEL9K_VCS_HIDE_TAGS` to true.\n\n## `anaconda` changes\n\nSpeed improvements for `anaconda` segment.\n\n## v0.4.0\n\n### Development changes\n\nFrom now on, development makes use of a CI system \"travis\".\n\n### `vcs` changes\n\nThe default state was renamed to `clean`. If you overrode foreground\nor background color in the past, you need to rename your variables to:\n\n```zsh\nPOWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'\nPOWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'\n```\n\nAdditionaly the vcs segment now has an `untracked` state which\nindicates that you have untracked files in your repository.\n\nThe foreground color of actionformat is now configurable via:\n```zsh\nPOWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND='green'\n```\n\nAlso, the vcs segment uses the foreground color it was configured to.\nThat said, the variables `POWERLEVEL9K_VCS_FOREGROUND` and\n`POWERLEVEL9K_VCS_DARK_FOREGROUND` are no longer used. Instead use\nthe proper variable `POWERLEVEL9K_VCS_<STATE>_FOREGROUND` to change\nforeground color.\n\n### `dir` Shortening Strategies\n\nThere is now a path shortening strategy that will use the `package.json` file to\nshorten your directory path. See the documentation for the `dir` segment for more\ndetails.\n\nAlso, the shorten delimiter was changed to an unicode ellipsis. It is configurable\nvia `POWERLEVEL9K_SHORTEN_DELIMITER`.\n\n### `rbenv` changes\n\nThe `rbenv` segment now makes use of the full rbenv command, so the correct\nruby version is now shown if it differs from the globally one.\n\n### `node`, `nvm` Segments\n\nImprovements to speed / reliability.\n\n### `ram` changes\n\nThe `ram` segment was split up into `ram` and `swap`. The\n`POWERLEVEL9K_RAM_ELEMENTS` variable is obsolete.\n\n### New segment `swap` added\n\nDue to the split up of the ram segment, this one was created. It\nshows the currently used swap size.\n\n### New segment `nodeenv` added\n\nAdded new `nodeenv` segment that shows the currently used node environment.\n\n### New segment `aws_eb_env` added\n\nThis segment displays the current Elastic Beanstalk environment.\n\n### New segment `chruby` added\n\nAdded new `chruby` segment to support this version manager.\n\n### New segment `docker_machine` added\n\nAdded new `docker_machine` segment that will show your Docker machine.\n\n### New segment `anaconda` added\n\nA new segment `anaconda` was added that shows the current used\nanaconda environment.\n\n## New segment `pyenv` added\n\nThis segment shows your active python version as reported by `pyenv`.\n\n\n## v0.3.2\n\n### `vcs` changes\n\nA new state `UNTRACKED` was added to the `vcs` segment. So we now\nhave 3 states for repositories: `UNTRACKED`, `MODIFIED`, and the\ndefault state. The `UNTRACKED` state is active when there are files\nin the repository directory which have not been added to the repo\n(the same as when the `+` icon appears). The default color for the\n`UNTRACKED` state is now yellow, and the default color for the\n`MODIFIED` state is now read, but those colors can be changed by\nsetting these variables, for example:\n\n```zsh\nPOWERLEVEL9K_VCS_MODIFIED_FOREGROUND='black'\nPOWERLEVEL9K_VCS_MODIFIED_BACKGROUND='white'\nPOWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='green'\nPOWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='blue'\n```\n\n## v0.3.1\n\n### `dir` changes\n\nA new state `HOME_SUBFOLDER` was added. So if you want to overwrite\ncolors for this segment, also set this variables:\n```zsh\nPOWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND='black'\nPOWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND='white'\n```\n\n### `background_jobs` changes\nNow displays the number of background jobs if there's more than 1.\nYou can disable it by setting :\n```zsh\nPOWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false\n```\n\n## v0.3.0\n\n### Introduced \"visual identifiers\" to the segments\n\nNow almost every segment can have a visual identifier, which is an\nicon whose color could be adjusted by users.\n\n### Added ability for \"joined\" segments\n\nYou can now merge segments together by suffixing the segment name with \"_joined\".\nFor Developers: Be aware that the order of parameters in left/right_prompt_segment\nhas changed. Now a boolean parameter must be set as second parameter (true if joined).\n\n### `dir` changes\n\nThis segment now has \"state\", which means you now can change the colors seperatly\ndepending if you are in your homefolder or not.\nYour variables for that should now look like:\n```zsh\nPOWERLEVEL9K_DIR_HOME_BACKGROUND='green'\nPOWERLEVEL9K_DIR_HOME_FOREGROUND='cyan'\nPOWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red'\nPOWERLEVEL9K_DIR_DEFAULT_FOREGROUND='yellow'\n```\n\n### `status` changes\n\nThe `status` segment was split up into three segments. `background_jobs` prints\nan icon if there are background jobs. `root_indicator` prints an icon if the user\nis root. The `status` segment focuses now on the status only.\nThe `status` segment also now has \"state\". If you want to overwrite the colors,\nyou have to add the state to your variables:\n```zsh\nPOWERLEVEL9K_STATUS_ERROR_BACKGROUND='green'\nPOWERLEVEL9K_STATUS_ERROR_FOREGROUND='cyan'\nPOWERLEVEL9K_STATUS_OK_BACKGROUND='red'\nPOWERLEVEL9K_STATUS_OK_FOREGROUND='yellow'\n```\n\n### New segment `custom_command` added\n\nA new segment that allows users to define a custom command was added.\n\n### `virtualenv` changes\n\nThis segment now respects `VIRTUAL_ENV_DISABLE_PROMPT`. If this variable is set\nto `true`, the segments does not get rendered.\n\n### `load` changes\n\nThe `load` segement was split and a new segment `ram` was extracted. This new\nsegment is able to show the free ram and used swap.\n\n### `vcs` changes\n\nThis prompt uses the `VCS_INFO` subsystem by ZSH. From now on this subsystem\nis only invoked if a `vcs` segment was configured.\n\n### `rvm` changes\n\nThis segment now does not invoke RVM directly anymore. Instead, is relys on the\ncircumstance that RVM was invoked beforehand and just reads the environment\nvariables '$GEM_HOME' and '$MY_RUBY_HOME'. It also now displays the used gemset.\n\n### New segment `battery` added\n\nA new segment that shows the battery status of your laptop was added.\n\n### New segment `go_version` added\n\nThis segment shows the GO version.\n\n### New segment `nvm` added\n\nThis segment shows your NodeJS version by using NVM (and if it is not 'default').\n\n### New segment `todo` added\n\nThis segment shows your ToDos from [todo.sh](http://todotxt.com/).\n\n### New segment `rust_version` added\n\nThis segment shows your local rust version.\n\n## v0.2.0\n\n### `longstatus` is now `status`\n\nThe segments got merged together. To show the segment only if an error occurred,\nset `POWERLEVEL9K_STATUS_VERBOSE=false` (this is the same behavior as the old\n`status` segment.\n\n### Icon overriding mechanism added\n\nAll icons can now be overridden by setting a variable named by the internal icon\nname. You can get a full list of icon name by calling `get_icon_names`.\n\n### Same color segements get visual separator\n\nThis separator can be controlled by setting `POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR`\nor `POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR`. By default this separator is\nprinted in the foreground color.\n\n### `dir` segment has different strategies for truncation\n\nNow you can choose between `truncate_middle` or `truncate_from_right` by setting\n`POWERLEVEL9K_SHORTEN_STRATEGY`. Default behavior is unchanged (truncate whole\ndirectories). `POWERLEVEL9K_SHORTEN_DIR_LENGTH` can be used to influence how\nmuch will be truncated (either direcories or chars).\n\n### New segment `ip` added\n\nThis segment shows your internal IP address. You can define which interfaces IP\nwill be shown by specifying it via `POWERLEVEL9K_IP_INTERFACE`.\n\n### New segment `load` added\n\nThis segment shows your computers 5min load average.\n\n### New segment `os_icon` added\n\nThis segment shows a little indicator which OS you are running.\n\n### New segment `php_version` added\n\nThis segment shows your PHP version.\n\n### New segment `vi_mode` added\n\nThis segment gives you a hint in which VI-mode you currently are. This\nsegment requires a proper configured VI-mode.\n\n### Added the ability to have empty left or right prompts\n\nBy setting the according variable to an empty array, the left or right\nprompt will be empty.\n\n## v0.1.0\n\nThis is the first release\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn 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.\n\n## Our Standards\n\nExamples of behavior that contributes to creating a positive environment include:\n\n* Using welcoming and inclusive language\n* Being respectful of differing viewpoints and experiences\n* Gracefully accepting constructive criticism\n* Focusing on what is best for the community\n* Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery and unwelcome sexual attention or advances\n* Trolling, insulting/derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or electronic address, without explicit permission\n* Other conduct which could reasonably be considered inappropriate in a professional setting\n\n## Our Responsibilities\n\nProject 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.\n\nProject 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.\n\n## Scope\n\nThis 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.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at bhilburn@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.\n\nProject 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.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]\n\n[homepage]: http://contributor-covenant.org\n[version]: http://contributor-covenant.org/version/1/4/\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) 2014-2017 Ben Hilburn <bhilburn@gmail.com>\n\nMIT LICENSE\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "## Powerlevel9k is deprecated and now unmaintained. Please use [Powerlevel10k](https://github.com/romkatv/powerlevel10k)!\n---\n![](https://raw.githubusercontent.com/bhilburn/powerlevel9k-logo/master/logo-banner.png)\n---\n[![Build Status](https://travis-ci.org/bhilburn/powerlevel9k.svg?branch=master)](https://travis-ci.org/bhilburn/powerlevel9k)\n[![Join the chat at https://gitter.im/bhilburn/powerlevel9k](https://badges.gitter.im/bhilburn/powerlevel9k.svg)](https://gitter.im/bhilburn/powerlevel9k?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\nPowerlevel9k is a theme for ZSH which uses [Powerline\nFonts](https://github.com/powerline/fonts). It can be used with vanilla ZSH or\nZSH frameworks such as [Oh-My-Zsh](https://github.com/robbyrussell/oh-my-zsh),\n[Prezto](https://github.com/sorin-ionescu/prezto),\n[Antigen](https://github.com/zsh-users/antigen), and [many\nothers](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions).\n\nGet more out of your terminal. Be a badass. Impress everyone in 'Screenshot Your\nDesktop' threads. Use powerlevel9k.\n\n![](http://bhilburn.org/content/images/2015/01/pl9k-improved.png)\n\nYou can check out some other users' configurations in our wiki: [Show Off Your\nConfig](https://github.com/bhilburn/powerlevel9k/wiki/Show-Off-Your-Config).\n\nThere are a number of Powerline ZSH themes available, now. The developers of\nthis theme focus on four primary goals:\n\n1. Give users a great out-of-the-box configuration with no additional\n   configuration required.\n2. Make customization easy for users who do want to tweak their prompt.\n3. Provide useful segments that you can enable to make your prompt even more\n   effective and helpful. We have prompt segments for everything from unit test\n   coverage to your AWS instance.\n4. Optimize the code for execution speed as much as possible. A snappy terminal\n   is a happy terminal.\n\nPowerlevel9k can be used to create both very useful and beautiful terminal environments:\n\n![](https://camo.githubusercontent.com/b5d7eb49a30bfe6bdb5706fa3c9be95fe8e5956e/687474703a2f2f67696679752e636f6d2f696d616765732f70396b6e65772e676966)\n\n### Table of Contents\n\n1. [Installation](#installation)\n2. [Customization](#prompt-customization)\n    1. [Stylizing Your Prompt](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt)\n    2. [Customizing Prompt Segments](#customizing-prompt-segments)\n    3. [Available Prompt Segments](#available-prompt-segments)\n3. [Troubleshooting](https://github.com/bhilburn/powerlevel9k/wiki/Troubleshooting)\n\nBe sure to also [check out the Wiki](https://github.com/bhilburn/powerlevel9k/wiki)!\n\n### Installation\nThere are two installation steps to go from a vanilla terminal to a PL9k\nterminal. Once you are done, you can optionally customize your prompt.\n\n[Installation Instructions](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions)\n\n1. [Install the Powerlevel9k Theme](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions#step-1-install-powerlevel9k)\n2. [Install Powerline Fonts](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions#step-2-install-a-powerline-font)\n\nNo configuration is necessary post-installation if you like the default\nsettings, but there are plenty of segment customization options available if you\nare interested.\n\n### Prompt Customization\n\nBe sure to check out the wiki page on the additional prompt customization\noptions, including color and icon settings: [Stylizing Your Prompt](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt)\n\n#### Customizing Prompt Segments\nCustomizing your prompt is easy! Select the segments you want to have displayed,\nand then assign them to either the left or right prompt by adding the following\nvariables to your `~/.zshrc`.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_LEFT_PROMPT_ELEMENTS`|`(context dir vcs)`|Segment list for left prompt|\n|`POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS`|`(status root_indicator background_jobs history time)`|Segment list for right prompt|\n\n\nThe table above shows the default values, so if you wanted to set these\nvariables manually, you would put the following in\nyour `~/.zshrc`:\n```zsh\nPOWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs)\nPOWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time)\n```\n#### Available Prompt Segments\nThe segments that are currently available are:\n\n**System Status Segments:**\n* [`background_jobs`](#background_jobs) - Indicator for background jobs.\n* [`battery`](#battery) - Current battery status.\n* [`context`](#context) - Your username and host, conditionalized based on $USER and SSH status.\n* [`date`](#date) - System date.\n* [`dir`](#dir) - Your current working directory.\n* `dir_writable` - Displays a lock icon, if you do not have write permissions on the current folder.\n* [`disk_usage`](#disk_usage) - Disk usage of your current partition.\n* `history` - The command number for the current line.\n* [`host`](#host) - Your current host name\n* [`ip`](#ip) - Shows the current IP address.\n* [`vpn_ip`](#vpn_ip) - Shows the current VPN IP address.\n* [`public_ip`](#public_ip) - Shows your public IP address.\n* [`load`](#load) - Your machine's load averages.\n* `os_icon` - Display a nice little icon, depending on your operating system.\n* `ram` - Show free RAM.\n* `root_indicator` - An indicator if the user has superuser status.\n* [`status`](#status) - The return code of the previous command.\n* `swap` - Prints the current swap size.\n* [`time`](#time) - System time.\n* [`user`](#user) - Your current username\n* [`vi_mode`](#vi_mode)- Your prompt's Vi editing mode (NORMAL|INSERT).\n* `ssh` - Indicates whether or not you are in an SSH session.\n\n**Development Environment Segments:**\n* [`vcs`](#vcs) - Information about this `git` or `hg` repository (if you are in one).\n\n**Language Segments:**\n* **GoLang Segments:**\n    * `go_version` - Show the current GO version.\n* **Javascript / Node.js Segments:**\n    * `node_version` - Show the version number of the installed Node.js.\n    * [`nodeenv`](#nodeenv) - [nodeenv](https://github.com/ekalinin/nodeenv) prompt for displaying node version and environment name.\n    * `nvm` - Show the version of Node that is currently active, if it differs from the version used by NVM\n* **PHP Segments:**\n    * `php_version` - Show the current PHP version.\n    * `laravel_version` - Show the current Laravel version.\n    * [`symfony2_tests`](#symfony2_tests) - Show a ratio of test classes vs code classes for Symfony2.\n    * `symfony2_version` - Show the current Symfony2 version, if you are in a Symfony2-Project dir.\n* **Python Segments:**\n    * [`virtualenv`](#virtualenv) - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/).\n    * [`anaconda`](#anaconda) - Your active [Anaconda](https://www.continuum.io/why-anaconda) environment.\n    * `pyenv` - Your active python version as reported by the first word of [`pyenv version`](https://github.com/yyuu/pyenv). Note that the segment is not displayed if that word is _system_ i.e. the segment is inactive if you are using system python.\n* **Ruby Segments:**\n    * [`chruby`](#chruby) - Ruby environment information using `chruby` (if one is active).\n    * [`rbenv`](#rbenv) - Ruby environment information using `rbenv` (if one is active).\n    * [`rspec_stats`](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec.\n    * `rvm` - Ruby environment information using `$GEM_HOME` and `$MY_RUBY_HOME` (if one is active).\n* **Rust Segments:**\n    * `rust_version` - Display the current rust version and [logo](https://www.rust-lang.org/logos/rust-logo-blk.svg).\n* **Swift Segments:**\n    * `swift_version` - Show the version number of the installed Swift.\n* **Java Segments:**\n    * `java_version` - Show the current Java version.\n\n**Cloud Segments:**\n* **AWS Segments:**\n    * [`aws`](#aws) - The current AWS profile, if active.\n    * `aws_eb_env` - The current Elastic Beanstalk Environment.\n* `docker_machine` - The current Docker Machine.\n* `kubecontext` - The current context of your `kubectl` configuration.\n* `dropbox` - Indicates Dropbox directory and syncing status using `dropbox-cli`\n\n**Other:**\n* [`custom_command`](#custom_command) - Create a custom segment to display the\n  output of an arbitrary command.\n* [`command_execution_time`](#command_execution_time) - Display the time the current command took to execute.\n* [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file.\n* `detect_virt` - Virtualization detection with systemd\n* `newline` - Continues the prompt on a new line.\n* `openfoam` - Shows the currently sourced [OpenFOAM](https://openfoam.org/) environment.\n\n---------------------------------------------------------------------------------\n\n\n##### anaconda\n\nThis segment shows your active anaconda environment. It relies on either the\n`CONDA_ENV_PATH` or the `CONDA_PREFIX` (depending on the `conda` version)\nenvironment variable to be set which happens when you properly `source\nactivate` an environment.\n\nSpecial configuration variables:\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_ANACONDA_LEFT_DELIMITER`|\"(\"|The left delimiter just before the environment name.|\n|`POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER`|\")\"|The right delimiter just after the environment name.|\n\nAdditionally the following segment specific parameters can be used to customize\nit: `POWERLEVEL9K_PYTHON_ICON`, `POWERLEVEL9K_ANACONDA_BACKGROUND`, and\n`POWERLEVEL9K_ANACONDA_FOREGROUND`.\n\n##### aws\n\nIf you would like to display the [current AWS\nprofile](http://docs.aws.amazon.com/cli/latest/userguide/installing.html), add\nthe `aws` segment to one of the prompts, and define `AWS_DEFAULT_PROFILE` in\nyour `~/.zshrc`:\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`AWS_DEFAULT_PROFILE`|None|Your AWS profile name|\n\n##### background_jobs\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE`|`true`|If there is more than one background job, this segment will show the number of jobs. Set this to `false` to turn this feature off.|\n`POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS`|`false`|Always show the jobs count (even if it's zero).|\n\n##### battery\n\nThe default settings for this segment will display your current battery status (fails gracefully on\nsystems without a battery). It is supported on both OSX and Linux (note that it requires `acpi` on Linux).\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_BATTERY_CHARGING`|`\"yellow\"`|Color to indicate a charging battery.|\n|`POWERLEVEL9K_BATTERY_CHARGED`|`\"green\"`|Color to indicate a charged battery.|\n|`POWERLEVEL9K_BATTERY_DISCONNECTED`|`$DEFAULT_COLOR`|Color to indicate absence of battery.|\n|`POWERLEVEL9K_BATTERY_LOW_THRESHOLD`|`10`|Threshold to consider battery level critical.|\n|`POWERLEVEL9K_BATTERY_LOW_COLOR`|`\"red\"`|Color to indicate critically low charge level.|\n|`POWERLEVEL9K_BATTERY_VERBOSE`|`true`|Display time remaining next to battery level.|\n|`POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD`|`unset`|Threshold from which the battery segment should not be displayed.|\n\nNote that you can [modify the `_FOREGROUND`\ncolor](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#segment-color-customization)\nwithout affecting the icon color.\n\nYou can also change the battery icon automatically depending on the battery\nlevel. This will override the default battery icon. In order to do this, you\nneed to define the `POWERLEVEL9k_BATTERY_STAGES` variable.\n\n\n| Variable                      | Default Value | Description                                                   |\n|-------------------------------|---------------|---------------------------------------------------------------|\n| `POWERLEVEL9K_BATTERY_STAGES` | Unset         | A string or array, which each index indicates a charge level. |\n\nPowerlevel9k will use each index of the string or array as a stage to indicate battery\ncharge level, progressing from left to right. You can provide any number of\nstages. The setting below, for example, provides 8 stages for Powerlevel9k to use.\n```zsh\nPOWERLEVEL9K_BATTERY_STAGES=\"▁▂▃▄▅▆▇█\"\n```\n\nIf you require extra spacing after the icon, you will have to set it as an array,\nsince spaces in the string will be used as one of the stages and you will get a\nmissing icon. To do this, declare the variable as follows:\n```zsh\nPOWERLEVEL9K_BATTERY_STAGES=($'\\u2581 ' $'\\u2582 ' $'\\u2583 ' $'\\u2584 ' $'\\u2585 ' $'\\u2586 ' $'\\u2587 ' $'\\u2588 ')\n```\n\nUsing the array syntax, you can create stages comprised of multiple characters.\nThe below setting provides 40 battery stages.\n```zsh\nPOWERLEVEL9K_BATTERY_STAGES=(\n   $'▏    ▏' $'▎    ▏' $'▍    ▏' $'▌    ▏' $'▋    ▏' $'▊    ▏' $'▉    ▏' $'█    ▏'\n   $'█▏   ▏' $'█▎   ▏' $'█▍   ▏' $'█▌   ▏' $'█▋   ▏' $'█▊   ▏' $'█▉   ▏' $'██   ▏'\n   $'██   ▏' $'██▎  ▏' $'██▍  ▏' $'██▌  ▏' $'██▋  ▏' $'██▊  ▏' $'██▉  ▏' $'███  ▏'\n   $'███  ▏' $'███▎ ▏' $'███▍ ▏' $'███▌ ▏' $'███▋ ▏' $'███▊ ▏' $'███▉ ▏' $'████ ▏'\n   $'████ ▏' $'████▎▏' $'████▍▏' $'████▌▏' $'████▋▏' $'████▊▏' $'████▉▏' $'█████▏' )\n```\n\nYou can also change the background of the segment automatically depending on the\nbattery level. This will override the following variables:\n`POWERLEVEL9K_BATTERY_CHARGING`, `POWERLEVEL9K_BATTERY_CHARGED`,\n`POWERLEVEL9K_BATTERY_DISCONNECTED`, and `POWERLEVEL9K_BATTERY_LOW_COLOR`. In\norder to do this, define a color array, from low to high, as shown below:\n```zsh\nPOWERLEVEL9K_BATTERY_LEVEL_BACKGROUND=(red1 orangered1 darkorange orange1 gold1 yellow1 yellow2 greenyellow chartreuse1 chartreuse2 green1)\n```\n\nAs with the battery stages, you can use any number of colors and Powerlevel9k\nwill automatically use all of them appropriately.\n\nSome example settings:\n\n| Brightness     | Possible Array                                                                                                |\n|----------------|---------------------------------------------------------------------------------------------------------------|\n| Bright Colors  | `(red1 orangered1 darkorange orange1 gold1 yellow1 yellow2 greenyellow chartreuse1 chartreuse2 green1)`       |\n| Normal Colors  | `(red3 darkorange3 darkgoldenrod gold3 yellow3 chartreuse2 mediumspringgreen green3 green3 green4 darkgreen)` |\n| Subdued Colors | `(darkred orange4 yellow4 yellow4 chartreuse3 green3 green4 darkgreen)`                                       |\n\n##### chruby\n\nThis segment shows the version of Ruby being used when using `chruby` to change your current Ruby stack.\n\nIt uses `$RUBY_ENGINE` and `$RUBY_VERSION` as set by `chruby`.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_CHRUBY_SHOW_ENGINE`|true|Show the currently selected Ruby engine (e.g. `ruby`, `jruby`, `rbx`, etc)\n|`POWERLEVEL9K_CHRUBY_SHOW_VERSION`|true|Shows the currently selected engine's version (e.g. `2.5.1`)\n\n##### command_execution_time\n\nDisplay the time the previous command took to execute if the time is above\n`POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD`. The time is formatted to be\n\"human readable\", and so scales the units based on the length of execution time.\nIf you want more precision, just set the\n`POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION` field.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD`|3|Threshold above which to print this segment. Can be set to `0` to always print.|\n|`POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION`|2|Number of digits to use in the fractional part of the time value.|\n\n##### custom_command\n\nThe `custom_...` segment allows you to turn the output of a custom command into\na prompt segment. As an example, if you wanted to create a custom segment to\ndisplay your WiFi signal strength, you might define a custom segment called\n`custom_wifi_signal` like this:\n```zsh\nPOWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)\nPOWERLEVEL9K_CUSTOM_WIFI_SIGNAL=\"echo signal: \\$(nmcli device wifi | grep yes | awk '{print \\$8}')\"\nPOWERLEVEL9K_CUSTOM_WIFI_SIGNAL_BACKGROUND=\"blue\"\nPOWERLEVEL9K_CUSTOM_WIFI_SIGNAL_FOREGROUND=\"yellow\"\n```\nIf you prefer, you can also define the function in your `.zshrc` rather than\nputting it in-line with the variable export, as shown above. Just don't forget\nto invoke your function from your segment! Example code that achieves the same\nresult as the above:\n```zsh\nzsh_wifi_signal(){\n    local signal=$(nmcli device wifi | grep yes | awk '{print $8}')\n    local color='%F{yellow}'\n    [[ $signal -gt 75 ]] && color='%F{green}'\n    [[ $signal -lt 50 ]] && color='%F{red}'\n    echo -n \"%{$color%}\\uf230  $signal%{%f%}\" # \\uf230 is \n}\n\nPOWERLEVEL9K_CUSTOM_WIFI_SIGNAL=\"zsh_wifi_signal\"\nPOWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)\n```\nThe command, above, gives you the wireless signal segment shown below:\n\n![signal](http://i.imgur.com/hviMATC.png)\n\nYou can define as many custom segments as you wish. If you think you have\na segment that others would find useful, please consider upstreaming it to the\nmain theme distribution so that everyone can use it!\n\n##### context\n\nThe `context` segment (user@host string) is conditional. By default, it will\nonly print if you are not your 'normal' user (including if you are root), or if\nyou are SSH'd to a remote host. `SUDO` and `REMOTE_SUDO` states are also available to show whether the current user or remote user has superuser privileges.\n\nTo use this feature, make sure the `context` segment is enabled in your prompt\nelements (it is by default), and define a `DEFAULT_USER` in your `~/.zshrc`.\n\nYou can customize the `context` segment. For example, you can make it to print the\nfull hostname by setting\n\n```\nPOWERLEVEL9K_CONTEXT_TEMPLATE=\"%n@`hostname -f`\"\n```\n\nYou can set the `POWERLEVEL9K_CONTEXT_HOST_DEPTH` variable to change how the\nhostname is displayed. See [ZSH Manual](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Login-information)\nfor details. The default is set to %m which will show the hostname up to the first ‘.’\nYou can set it to %{N}m where N is an integer to show that many segments of system\nhostname. Setting N to a negative integer will show that many segments from the\nend of the hostname.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`DEFAULT_USER`|None|Username to consider a \"default context\" (you can also set `$USER`).|\n|`POWERLEVEL9K_ALWAYS_SHOW_CONTEXT`|false|Always show this segment, including $USER and hostname.|\n|`POWERLEVEL9K_ALWAYS_SHOW_USER`|false|Always show the username, but conditionalize the hostname.|\n|`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.|\n\nThis segment can have different states. They might help you to visualize your\ndifferent privileges. Read more about styling with states [here](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#special-segment-colors).\n\n| State         | Meaning                                                  |\n|---------------|----------------------------------------------------------|\n| `DEFAULT`     | You are a normal user                                    |\n| `ROOT`        | You are the root user                                    |\n| `SUDO`        | You are using elevated rights                            |\n| `REMOTE_SUDO` | You are SSH'ed into the machine and have elevated rights |\n| `REMOTE`      | You are SSH'ed into the machine                          |\n\n##### date\n\nThe `date` segment shows the current system date.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`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.|\n\n##### dir\n\nThe `dir` segment shows the current working directory. When using the \"Awesome\nPowerline\" fonts, there are additional glyphs, as well:\n\n| `Compatible` | `Powerline` | `Awesome Powerline` | Situation\n|------------|-----------|-------------------|----------------------------\n| None       | None      | ![](https://cloud.githubusercontent.com/assets/1544760/12183451/40ec4016-b58f-11e5-9b9e-74e2b2f0b8b3.png) | At the root of your home folder |\n| None       | None      | ![](https://cloud.githubusercontent.com/assets/1544760/12369315/8a5d762c-bbf5-11e5-8a20-ca1179f48d6c.png) | Within a subfolder of your home directory |\n| None       | None      | ![](https://cloud.githubusercontent.com/assets/1544760/12183452/40f79286-b58f-11e5-9b8c-ed1343a07b08.png) | Outside of your home folder |\n| None       | None      | ⚙ | Within the `/etc` directory |\n\nTo turn off these icons you could set these variables to an empty string.\n```zsh\nPOWERLEVEL9K_HOME_ICON=''\nPOWERLEVEL9K_HOME_SUB_ICON=''\nPOWERLEVEL9K_FOLDER_ICON=''\nPOWERLEVEL9K_ETC_ICON=''\n```\nYou can limit the output to a certain length by truncating long paths.\nCustomizations available are:\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_DIR_PATH_ABSOLUTE`|None|If set to `true`, will use absolute paths instead of home folder abbreviation `~`|\n|`POWERLEVEL9K_SHORTEN_DIR_LENGTH`|`2`|If your shorten strategy, below, is entire directories, this field determines how many directories to leave at the end. If your shorten strategy is by character count, this field determines how many characters to allow per directory string.|\n|`POWERLEVEL9K_SHORTEN_STRATEGY`|None|How the directory strings should be truncated. See the table below for more informations.|\n|`POWERLEVEL9K_SHORTEN_DELIMITER`|`..`|Delimiter to use in truncated strings. This can be any string you choose, including an empty string if you wish to have no delimiter.|\n\n| Strategy Name | Description |\n|---------------|-------------|\n|Default|Truncate whole directories from left. How many is defined by `POWERLEVEL9K_SHORTEN_DIR_LENGTH`|\n|`truncate_absolute_chars`|Truncates an absolute number of characters from the left such that the number of characters that your path displays (with or without `POWERLEVEL9K_SHORTEN_DELIMITER`) is no more than `POWERLEVEL9K_SHORTEN_DIR_LENGTH` + the length of `POWERLEVEL9K_SHORTEN_DELIMITER` |\n|`truncate_middle`|Truncates the middle part of a folder. E.g. you are in a folder named `~/MySuperProjects/AwesomeFiles/BoringOffice`, then it will truncated to `~/MyS..cts/Awe..les/BoringOffice`, if `POWERLEVEL9K_SHORTEN_DIR_LENGTH=3` is also set (controls the amount of characters to be left).|\n|`truncate_from_right`|Just leaves the beginning of a folder name untouched. E.g. your folders will be truncated like so: `/ro../Pr../office`. How many characters will be untouched is controlled by `POWERLEVEL9K_SHORTEN_DIR_LENGTH`.|\n|`truncate_absolute`|Truncates everything exept the last few characters in the path. E.g. if you are in a folder named `~/Projects/powerlevel9k` and you have set `POWERLEVEL9K_SHORTEN_DIR_LENGTH=3`, you will get `..l9k`.|\n|`truncate_to_last`|Truncates everything before the last folder in the path.|\n|`truncate_to_first_and_last`|Truncate middle directories from the path. How many directories will be untouched is controlled by `POWERLEVEL9K_SHORTEN_DIR_LENGTH`. E.g. if you are in a folder named `~/Projects/powerlevel9k` and you have set `POWERLEVEL9K_SHORTEN_DIR_LENGTH=1`, you will get `~/../powerlevel9k`.||\n|`truncate_to_unique`|Parse all parent path components and truncate them to the shortest unique length. If you copy & paste the result to a shell, after hitting `TAB` it should expand to the original path unambiguously.|\n|`truncate_with_package_name`|Search for a `package.json` or `composer.json` and prints the `name` field to abbreviate the directory path. The precedence and/or files could be set by `POWERLEVEL9K_DIR_PACKAGE_FILES=(package.json composer.json)`. If you have [jq](https://stedolan.github.io/jq/) installed, it will dramatically improve the speed of this strategy.|\n|`truncate_with_folder_marker`|Search for a file that is specified by `POWERLEVEL9K_SHORTEN_FOLDER_MARKER` and truncate everything before that (if found, otherwise stop on $HOME and ROOT).|\n\nFor example, if you wanted the truncation behavior of the `fish` shell, which\ntruncates `/usr/share/plasma` to `/u/s/plasma`, you would use the following:\n```zsh\nPOWERLEVEL9K_SHORTEN_DIR_LENGTH=1\nPOWERLEVEL9K_SHORTEN_DELIMITER=\"\"\nPOWERLEVEL9K_SHORTEN_STRATEGY=\"truncate_from_right\"\n```\nIn each case you have to specify the length you want to shorten the directory\nto. So in some cases `POWERLEVEL9K_SHORTEN_DIR_LENGTH` means characters, in\nothers whole directories.\n\nThe `truncate_with_package_name` strategy gives your directory path relative to the root of your project.  For example, if you have a project inside `$HOME/projects/my-project` with a `package.json` that looks like:\n\n```json\n{\n  \"name\": \"my-cool-project\"\n}\n```\n\nThe path shown would be `my-cool-project`.  If you navigate to `$HOME/projects/my-project/src`, then the path shown would be `my-cool-project/src`.  Please note that this currently looks for `.git` directory to determine the root of the project.\n\nIf you want to customize the directory separator, you could set:\n```zsh\n# Double quotes are important here!\nPOWERLEVEL9K_DIR_PATH_SEPARATOR=\"%F{red} $(print_icon 'LEFT_SUBSEGMENT_SEPARATOR') %F{black}\"\n```\nTo omit the first character (usually a slash that gets replaced if you set `POWERLEVEL9K_DIR_PATH_SEPARATOR`),\nyou could set `POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true`.\n\nYou can also customize the leading tilde character when you are in `$HOME` using:\n```zsh\n# Double quotes are important here!\nPOWERLEVEL9K_HOME_FOLDER_ABBREVIATION=\"%F{red} $(print_icon 'HOME_ICON') %F{black}\"\n```\nYou can also configure the `dir` segment to show when you are in a directory without write permissions, using the variable below.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_DIR_SHOW_WRITABLE`|`false`|If set to `true` and you are in a directory that you do not have write permissions for, this segment will display a lock icon and enter the `NOT_WRITABLE` state (which can be customized per [our usual process](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#segment-color-customization)). Note that this functionality is also available in a separate segment, `dir_writable`.|\n\nIf you want to customize the last directory of the path, you can now set `POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND` to a custom color and/or `POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true` to display that part in bold.\n\nYou can also color the separator separately by setting the color using `POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND`.\n\n##### disk_usage\n\nThe `disk_usage` segment will show the usage level of the partition that your current working directory resides in. It can be configured with the following variables.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_DISK_USAGE_ONLY_WARNING`|false|Hide the segment except when usage levels have hit warning or critical levels.|\n|`POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL`|90|The usage level that triggers a warning state.|\n|`POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL`|95|The usage level that triggers a critical state.|\n\n##### host\n\nThe `host` segment will print the hostname.\n\nYou can set the `POWERLEVEL9K_HOST_TEMPLATE` variable to change how the hostname\nis displayed. See (ZSH Manual)[http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Login-information]\nfor details. The default is set to `%m` which will show the hostname up to the\nfirst `.`. You can set it to `%{N}m` where N is an integer to show that many\nsegments of system hostname. Setting `N` to a negative integer will show that many\nsegments from the end of the hostname.\n\n```\nPOWERLEVEL9K_HOST_TEMPLATE=\"%2m\"\n```\n\nBy default, LOCAL hosts will show the host icon and remote hosts will show the SSH icon. You can override them by setting\n```\nPOWERLEVEL9K_HOST_ICON=\"\\uF109 \"\nPOWERLEVEL9K_SSH_ICON=\"\\uF489 \"\n```\n\n\n##### ip\n\nThis segment tries to examine all currently used network interfaces and prints\nthe first address it finds.  In the case that this is not the right NIC, you can\nspecify the correct network interface by setting:\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_IP_INTERFACE`|None|The NIC for which you wish to display the IP address. Example: `eth0`.|\n\n##### vpn_ip\n\nThis segment tries to extract the VPN related IP addresses from nmcli, based on the NIC type:\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_VPN_IP_INTERFACE`|`tun`|The VPN interface.|\n\n##### public_ip\n\nThis segment will display your public IP address. There are several methods of obtaining this\ninformation and by default it will try all of them starting with the most efficient. You can\nalso specify which method you would like it to use. The methods available are dig using opendns,\ncurl, or wget. The host used for wget and curl is http://ident.me by default but can be set to\nanother host if you prefer.\n\nIf you activate a VPN, the icon for this segment will change to the defined VPN icon.\n\nThe public_ip segment will attempt to update your public IP address every 5 minutes by default(also\nconfigurable by the user). If you lose connection your cached IP address will be displayed until\nyour timeout expires at which point every time your prompt is generated a new attempt will be made.\nUntil an IP is successfully pulled the value of $POWERLEVEL9K_PUBLIC_IP_NONE will be displayed for\nthis segment. If this value is empty(the default)and $POWERLEVEL9K_PUBLIC_IP_FILE is empty the\nsegment will not be displayed.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_PUBLIC_IP_FILE`|'/tmp/p9k_public_ip'|This is the file your public IP is cached in.|\n|`POWERLEVEL9K_PUBLIC_IP_HOST`|'http://ident.me'|This is the default host to get your public IP.|\n|`POWERLEVEL9K_PUBLIC_IP_TIMEOUT`|300|The amount of time in seconds between refreshing your cached IP.|\n|`POWERLEVEL9K_PUBLIC_IP_METHODS`|(dig curl wget)| These methods in that order are used to refresh your IP.|\n|`POWERLEVEL9K_PUBLIC_IP_NONE`|None|The string displayed when an IP was not obtained|\n\n##### load\n\nDisplays one of your load averages with appropriate state coloring. The thresholds are:\n- `0.7 * NUM_CORES <`: critical\n- `0.5 * NUM_CORES <`: warning\n- `less`: normal\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_LOAD_WHICH`|5|Which average to show. Possible values: 1, 5 or 15|\n\n##### newline\n\nPuts a newline in your prompt so you can continue using segments on the next\nline. This allows you to use segments on both lines, unlike\n`POWERLEVEL9K_PROMPT_ON_NEWLINE`, which simply separates segments from the\nprompt itself.\n\nThis only works on the left side.  On the right side it does nothing.\n\n##### nodeenv\n\nShows the currently used [nodeenv](https://github.com/ekalinin/nodeenv). To avoid\nNodeenvs activate command from interfering with Powerlevel9k, you should set\n`NODE_VIRTUAL_ENV_DISABLE_PROMPT=1` in your `~/.zshrc`.\n\n##### rbenv\n\nThis segment shows the version of Ruby being used when using `rbenv` to change your current Ruby stack.\n\nIt figures out the version being used by taking the output of the `rbenv version-name` command.\n\n* If `rbenv` is not in $PATH, nothing will be shown.\n* By default, if the current local Ruby version is the same as the global Ruby version, nothing will be shown. See the configuration variable, below, to modify this behavior.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`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|\n\n##### pyenv\n\nThis segment shows the version of Python being used when using `pyenv` to change your current Python stack.\n\nThe `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.\n\n* If `pyenv` is not in $PATH, nothing will be shown.\n* If the current Python version is the same as the global Python version, nothing will be shown.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`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|\n\n##### rspec_stats\n\nSee [Unit Test Ratios](#unit-test-ratios), below.\n\n##### status\n\nThis segment shows the return code of the last command.\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_STATUS_CROSS`|`false`|Set to true if you wish not to show the error code when the last command returned an error and optionally hide this segment when the last command completed successfully by setting `POWERLEVEL9K_STATUS_OK` to false.|\n|`POWERLEVEL9K_STATUS_OK`|`true`|Set to true if you wish to show this segment when the last command completed successfully, false to hide it.|\n|`POWERLEVEL9K_STATUS_SHOW_PIPESTATUS`|`true`|Set to true if you wish to show the exit status for all piped commands.|\n|`POWERLEVEL9K_STATUS_HIDE_SIGNAME`|`false`|Set to true return the raw exit code (`1-255`).  When set to false, values over 128 are shown as `SIGNAME(-n)` (e.g. `KILL(-9)`)|\n\n##### ram\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_RAM_ELEMENTS`|Both|Specify `ram_free` or `swap_used` to only show one or the other rather than both.|\n\n##### symfony2_tests\n\nSee [Unit Test Ratios](#unit-test-ratios), below.\n\n##### time\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_TIME_FORMAT`|`'H:M:S'`|ZSH time format to use in this segment.|\n\nAs an example, if you wanted a reversed time format, you would use this:\n```zsh\n# Reversed time format\nPOWERLEVEL9K_TIME_FORMAT='%D{%S:%M:%H}'\n```\nIf you are using an \"Awesome Powerline Font\", you can add a time symbol to this\nsegment, as well:\n```zsh\n# Output time, date, and a symbol from the \"Awesome Powerline Font\" set\nPOWERLEVEL9K_TIME_FORMAT=\"%D{%H:%M:%S \\uE868  %d.%m.%y}\"\n```\n##### user\n\nThe `user` segment will print the username.\n\nYou can also override the icons by setting:\n\n```\nPOWERLEVEL9K_USER_ICON=\"\\uF415\" # \nPOWERLEVEL9K_ROOT_ICON=\"#\"\nPOWERLEVEL9K_SUDO_ICON=$'\\uF09C' # \n```\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`DEFAULT_USER`|None|Username to consider a \"default context\".|\n|`POWERLEVEL9K_ALWAYS_SHOW_USER`|`false`|Always print this segment.|\n|`POWERLEVEL9K_USER_TEMPLATE`|`%n`|Default username prompt. Refer to the [ZSH Documentation](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html) for all possible expansions|\n\n##### vcs\n\nBy default, the `vcs` segment will provide quite a bit of information. Further\ncustomization is provided via:\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_HIDE_BRANCH_ICON`|`false`|Set to `true` to hide the branch icon from the segment.|\n|`POWERLEVEL9K_SHOW_CHANGESET`|`false`|Set to `true` to display the hash / changeset in the segment.|\n|`POWERLEVEL9K_CHANGESET_HASH_LENGTH`|`12`|How many characters of the hash / changeset to display in the segment.|\n|`POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY`|`true`|Set to `false` to not reflect submodule status in the top-level repository prompt.|\n|`POWERLEVEL9K_VCS_HIDE_TAGS`|`false`|Set to `true` to stop tags being displayed in the segment.|\n|`POWERLEVEL9K_VCS_GIT_HOOKS`|`(vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname)`|Layout of the segment for git repositories.|\n|`POWERLEVEL9K_VCS_HG_HOOKS`|`(vcs-detect-changes)`|Layout of the segment for Mercurial repositories.|\n|`POWERLEVEL9K_VCS_SVN_HOOKS`|`(vcs-detect-changes svn-detect-changes)`|Layout of the segment for SVN repositories.|\n|`POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND`|`red`|The color of the foreground font during actions (e.g., `REBASE`).|\n\n\n##### vcs symbols\n\nThe `vcs` segment uses various symbols to tell you the state of your repository.\nThese symbols depend on your installed font and selected `POWERLEVEL9K_MODE`\nfrom the [Installation](#Installation) section above.\n\n| `Compatible` | `Powerline` | `Awesome Powerline` | Explanation\n|--------------|---------------------|-------------------|--------------------------\n| `↑4`         | `↑4`                | ![icon_outgoing](https://cloud.githubusercontent.com/assets/1544760/7976089/b5904d6e-0a76-11e5-8147-5e873ac52d79.gif)4  | Number of commits your repository is ahead of your remote branch\n| `↓5`         | `↓5`                | ![icon_incoming](https://cloud.githubusercontent.com/assets/1544760/7976091/b5909c9c-0a76-11e5-9cad-9bf0a28a897c.gif)5  | Number of commits your repository is behind of your remote branch\n| `⍟3`         | `⍟3`                | ![icon_stash](https://cloud.githubusercontent.com/assets/1544760/7976094/b5ae9346-0a76-11e5-8cc7-e98b81824118.gif)3 | Number of stashes, here 3.\n| `●`          | `●`                 | ![icon_unstaged](https://cloud.githubusercontent.com/assets/1544760/7976096/b5aefa98-0a76-11e5-9408-985440471215.gif) | There are unstaged changes in your working copy\n| `✚`          | `✚`                 | ![icon_staged](https://cloud.githubusercontent.com/assets/1544760/7976095/b5aecc8a-0a76-11e5-8988-221afc6e8982.gif) | There are staged changes in your working copy\n| `?`          | `?`                 | ![icon_untracked](https://cloud.githubusercontent.com/assets/1544760/7976098/b5c7a2e6-0a76-11e5-8c5b-315b595b2bc4.gif)  | There are files in your working copy, that are unknown to your repository\n| `→`          | `→`                 | ![icon_remote_tracking_branch](https://cloud.githubusercontent.com/assets/1544760/7976093/b5ad2c0e-0a76-11e5-9cd3-62a077b1b0c7.gif) | The name of your branch differs from its tracking branch.\n| `☿`          | `☿`                 | ![icon_bookmark](https://cloud.githubusercontent.com/assets/1544760/7976197/546cfac6-0a78-11e5-88a6-ce3a1e0a174e.gif) | A mercurial bookmark is active.\n| `@`         | ![icon_branch_powerline](https://cloud.githubusercontent.com/assets/1544760/8000852/e7e8d8a0-0b5f-11e5-9834-de9b25c92284.gif) | ![](https://cloud.githubusercontent.com/assets/1544760/7976087/b58bbe3e-0a76-11e5-8d0d-7a5c1bc7f730.gif) | Branch Icon\n| None         |  None               | ![icon_commit](https://cloud.githubusercontent.com/assets/1544760/7976088/b58f4e50-0a76-11e5-9e70-86450d937030.gif)2c3705 | The current commit hash. Here \"2c3705\"\n| None         |  None               | ![icon_git](https://cloud.githubusercontent.com/assets/1544760/7976092/b5909f80-0a76-11e5-9950-1438b9d72465.gif) | Repository is a git repository\n| None         |  None               | ![icon_mercurial](https://cloud.githubusercontent.com/assets/1544760/7976090/b5908da6-0a76-11e5-8c91-452b6e73f631.gif) | Repository is a Mercurial repository\n\n##### vcs truncation\n\nYou can limit the branch name to a certain length by truncating long names.\nCustomizations available are:\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_VCS_SHORTEN_LENGTH`|None|This field determines how many characters to show.|\n|`POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH`|None|This field determines minimum branch length. Branch name will be truncated if its length greater than this field.|\n|`POWERLEVEL9K_VCS_SHORTEN_STRATEGY`|None|This field determines how branch name should be truncated. See the table below for more information.|\n|`POWERLEVEL9K_SHORTEN_DELIMITER`|`...`|Delimiter to use in truncated strings. This can be any string you choose, including an empty string if you wish to have no delimiter.|\n\n| Strategy Name | Description |\n|---------------|-------------|\n|`truncate_middle`|Truncates the middle part of a branch. E.g. branch name is `1234-super_super_long_branch_name`, then it will truncated to `1234-..._name`, if `POWERLEVEL9K_VCS_SHORTEN_LENGTH=5` is also set (controls the amount of characters to be left).|\n|`truncate_from_right`|Just leaves the beginning of a branch name untouched. E.g. branch name will be truncated like so: `1234-...`. How many characters will be untouched is controlled by `POWERLEVEL9K_VCS_SHORTEN_LENGTH`.|\n\nFor example, if you want to truncate `1234-super_super_long_branch_name` to `1234-..` and don't do it with `development`:\n```zsh\nPOWERLEVEL9K_VCS_SHORTEN_LENGTH=4\nPOWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=11\nPOWERLEVEL9K_VCS_SHORTEN_STRATEGY=\"truncate_from_right\"\nPOWERLEVEL9K_VCS_SHORTEN_DELIMITER=\"..\"\n```\n\n##### vi_mode\n\nThis segment shows ZSH's current input mode. Note that this is only useful if\nyou are using the [ZSH Line Editor](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html)\n(VI mode).  You can enable this either by `.zshrc` configuration or using a plugin, like\n[Oh-My-Zsh's vi-mode plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/vi-mode/vi-mode.plugin.zsh).\n\n| Variable | Default Value | Description |\n|----------|---------------|-------------|\n|`POWERLEVEL9K_VI_INSERT_MODE_STRING`|`\"INSERT\"`|String to display while in 'Insert' mode.|\n|`POWERLEVEL9K_VI_COMMAND_MODE_STRING`|`\"NORMAL\"`|String to display while in 'Command' mode.|\n\nTo hide the segment entirely when in `INSERT` mode, set `POWERLEVEL9K_VI_INSERT_MODE_STRING=''`\n\n##### virtualenv\n\nThis segment shows your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/). To avoid\nVirtualEnvs activate command from interfering with Powerlevel9k, you should set\n`VIRTUAL_ENV_DISABLE_PROMPT=1` in your `~/.zshrc`.\n\n#### Unit Test Ratios\n\nThe `symfony2_tests` and `rspec_stats` segments both show a ratio of \"real\"\nclasses vs test classes in your source code. This is just a very simple ratio,\nand does not show your code coverage or any sophisticated stats. All this does\nis count your source files and test files, and calculate the ratio between them.\nJust enough to give you a quick overview about the test situation of the project\nyou are dealing with.\n\n### Disabling / Enabling Powerlevel9k\n\nYou can disable P9k and return to a very basic prompt at any time simply by\ncalling:\n\n```zsh\n$ prompt_powerlevel9k_teardown\n```\n\nYou can then re-enable it by calling:\n\n```zsh\n$ prompt_powerlevel9k_setup\n```\n\n### tl; dr\n\nWant to just get a quick start? Check out the [Show Off Your\nConfig](https://github.com/bhilburn/powerlevel9k/wiki/Show-Off-Your-Config)\nportion of the wiki to get going.\n\n[The Wiki also has a ton of other useful\ninformation!](https://github.com/bhilburn/powerlevel9k/wiki)\n\n### License\n\nProject: MIT\n\nLogo: CC-BY-SA. Source repository: https://github.com/bhilburn/powerlevel9k-logo\n"
  },
  {
    "path": "TESTS.md",
    "content": "# Tests\n\n## Automated Tests\n\nThe Unit-Tests do not follow exactly the file structure of Powerlevel9k itself,\nbut we try to reflect the structure as much as possible. All tests are located\nunder `test/`. Segment specific tests under `test/segments/` (one file per\nsegment).\n\n### Installation\n\nIn order to execute the tests you need to install `shunit2`, which is a\nsubmodule. To install the submodule, you can execute \n`git submodule init && git submodule update`.\n\n### Executing tests\n\nThe tests are shell scripts on their own. So you can execute them right away.\nTo execute all tests you could just execute `./test/suite.spec`.\n\n### General Test Structure\n\nThe tests usually have a `setUp()` function which is executed before every\ntest function. Speaking of, test functions must be prefixed with `test`. In\nthe tests, you can do [different Assertions](https://github.com/kward/shunit2#-asserts).\nIt is always a good idea to mock the program you want to test (just have a\nlook at other tests), so that the testrunner does not have to have all\nprograms installed.\n\n### Travis\n\nWe use [Travis](https://travis-ci.org/) for Continuous Integration. This\nservice executes our tests after every push. For now, we need to tell travis\nwhere to find the tests, which is what happens in the `.travis.yml` file.\n\n## Manual Testing\n\nIf unit tests are not sufficient (e.g. you have an issue with your prompt that\noccurs only in a specific ZSH framework) then you can use either Docker or\nor our Vagrant.\n\n### Docker\n\nThis is the easiest to use _if_ you have Docker already installed and running.\n\nThe command `./test-in-docker` should make it fairly easy to get into a running\ncontainer with the framework of your choice.\n\nExamples:\n\n``` zsh\n# Test Antigen with the oldest version of ZSH\n$ ./test-in-docker antigen\n```\n\n``` zsh\n# Test Prezto with ZSH version 5.2\n$ ./test-in-docker --zsh 5.2 prezto\n```\n\nYou can get Docker at <https://www.docker.com/community-edition>.\n\n**Note:** Not all frameworks work with all versions of ZSH (or the underlying OS).\n\n### Vagrant\n\nCurrently there are two test VMs. `test-vm` is an Ubuntu machine with several\npre-installed ZSH frameworks. And there is `test-bsd-vm` which is a FreeBSD!\nFor how to run the machines see [here](test-vm/README.md).\n"
  },
  {
    "path": "debug/font-issues.zsh",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\nsource functions/colors.zsh\nsource functions/icons.zsh\nsource functions/utilities.zsh\n# Map our $OS to neofetch $os\nos=\"$OS\"\n\n\ntrim() {\n    set -f\n    # shellcheck disable=2048,2086\n    set -- $*\n    printf '%s\\n' \"${*//[[:space:]]/}\"\n    set +f\n}\n\ntrim_quotes() {\n    trim_output=\"${1//\\'}\"\n    trim_output=\"${trim_output//\\\"}\"\n    printf \"%s\" \"$trim_output\"\n}\n\nget_ppid() {\n    # Get parent process ID of PID.\n    case \"$os\" in\n        \"Windows\")\n            ppid=\"$(ps -p \"${1:-$PPID}\" | awk '{printf $2}')\"\n            ppid=\"${ppid/PPID}\"\n        ;;\n\n        \"Linux\")\n            ppid=\"$(grep -i -F \"PPid:\" \"/proc/${1:-$PPID}/status\")\"\n            ppid=\"$(trim \"${ppid/PPid:}\")\"\n        ;;\n\n        *)\n            ppid=\"$(ps -p \"${1:-$PPID}\" -o ppid=)\"\n        ;;\n    esac\n\n    printf \"%s\" \"$ppid\"\n}\n\nget_process_name() {\n    # Get PID name.\n    case \"$os\" in\n        \"Windows\")\n            name=\"$(ps -p \"${1:-$PPID}\" | awk '{printf $8}')\"\n            name=\"${name/COMMAND}\"\n            name=\"${name/*\\/}\"\n        ;;\n\n        \"Linux\")\n            name=\"$(< \"/proc/${1:-$PPID}/comm\")\"\n        ;;\n\n        *)\n            name=\"$(ps -p \"${1:-$PPID}\" -o comm=)\"\n        ;;\n    esac\n\n    printf \"%s\" \"$name\"\n}\n\n# Taken from NeoFetch (slightly modified)\nget_term() {\n    local term\n\n    # If function was run, stop here.\n    # ((term_run == 1)) && return\n\n    # Workaround for macOS systems that\n    # don't support the block below.\n    case \"$TERM_PROGRAM\" in\n        \"iTerm.app\")    term=\"iTerm2\" ;;\n        \"Terminal.app\") term=\"Apple Terminal\" ;;\n        \"Hyper\")        term=\"HyperTerm\" ;;\n        *)              term=\"${TERM_PROGRAM/\\.app}\" ;;\n    esac\n\n    # Most likely TosWin2 on FreeMiNT - quick check\n    [[ \"$TERM\" == \"tw52\" || \"$TERM\" == \"tw100\" ]] && \\\n        term=\"TosWin2\"\n\n    [[ \"$SSH_CONNECTION\" ]] && \\\n        term=\"$SSH_TTY\"\n\n    # Check $PPID for terminal emulator.\n    while [[ -z \"$term\" ]]; do\n        parent=\"$(get_ppid \"$parent\")\"\n        [[ -z \"$parent\" ]] && break\n        name=\"$(get_process_name \"$parent\")\"\n\n        case \"${name// }\" in\n            \"${SHELL/*\\/}\"|*\"sh\"|\"screen\"|\"su\"*) ;;\n\n            \"login\"*|*\"Login\"*|\"init\"|\"(init)\")\n                term=\"$(tty)\"\n            ;;\n\n            \"ruby\"|\"1\"|\"tmux\"*|\"systemd\"|\"sshd\"*|\"python\"*|\"USER\"*\"PID\"*|\"kdeinit\"*|\"launchd\"*)\n                break\n            ;;\n\n            \"gnome-terminal-\") term=\"gnome-terminal\" ;;\n            \"urxvtd\")          term=\"urxvt\" ;;\n            *\"nvim\")           term=\"Neovim Terminal\" ;;\n            *\"NeoVimServer\"*)  term=\"VimR Terminal\" ;;\n            *)                 term=\"${name##*/}\" ;;\n        esac\n    done\n\n    # Log that the function was run.\n    # term_run=1\n\n    echo \"${term}\"\n}\n\nget_term_font() {\n    local confs term_font mateterm_config role profile xrdb child profile_filename\n    local term=\"${1}\"\n    # ((term_run != 1)) && get_term\n\n    case \"$term\" in\n        \"alacritty\"*)\n            setopt nullglob\n            confs=({$XDG_CONFIG_HOME,$HOME}/{alacritty,}/{.,}alacritty.ym?)\n            unsetopt nullglob\n\n            [[ -f \"${confs[1]}\" ]] || return\n\n            term_font=\"$(awk -F ':|#' '/normal:/ {getline; print}' \"${confs[1]}\")\"\n            term_font=\"${term_font/*family:}\"\n            term_font=\"${term_font/$'\\n'*}\"\n            term_font=\"${term_font/\\#*}\"\n        ;;\n\n        \"Apple_Terminal\")\n            term_font=\"$(osascript <<END\n                         tell application \"Terminal\" to font name of window frontmost\nEND\n)\"\n        ;;\n\n        \"iTerm2\")\n            # Unfortunately the profile name is not unique, but it seems to be the only thing\n            # that identifies an active profile. There is the \"id of current session of current win-\n            # dow\" though, but that does not match to a guid in the plist.\n            # So, be warned, collisions may occur!\n            # See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg\n            local current_profile_name profiles_count profile_name diff_font\n\n            current_profile_name=\"$(osascript <<END\n                                    tell application \"iTerm2\" to profile name \\\n                                    of current session of current window\nEND\n)\"\n\n            # Warning: Dynamic profiles are not taken into account here!\n            # https://www.iterm2.com/documentation-dynamic-profiles.html\n            font_file=\"${HOME}/Library/Preferences/com.googlecode.iterm2.plist\"\n\n            # Count Guids in \"New Bookmarks\"; they should be unique\n            profiles_count=\"$(/usr/libexec/PlistBuddy -c \"Print ':New Bookmarks:'\" \"$font_file\" 2>/dev/null | \\\n                              grep -w -c \"Guid\")\"\n\n            for ((i=0; i<profiles_count; i++)); do\n                profile_name=\"$(/usr/libexec/PlistBuddy -c \"Print ':New Bookmarks:${i}:Name:'\" \"$font_file\" 2>/dev/null)\"\n\n                if [[ \"$profile_name\" == \"$current_profile_name\" ]]; then\n                    # \"Normal Font\"\n                    term_font=\"$(/usr/libexec/PlistBuddy -c \"Print ':New Bookmarks:${i}:Normal Font:'\" \\\n                                 \"$font_file\" 2>/dev/null)\"\n\n                    # Font for non-ascii characters\n                    # Only check for a different non-ascii font, if the user checked\n                    # the \"use a different font for non-ascii text\" switch.\n                    diff_font=\"$(/usr/libexec/PlistBuddy -c \"Print ':New Bookmarks:${i}:Use Non-ASCII Font:'\" \\\n                                 \"$font_file\" 2>/dev/null)\"\n\n                    if [[ \"$diff_font\" == \"true\" ]]; then\n                        non_ascii=\"$(/usr/libexec/PlistBuddy -c \"Print ':New Bookmarks:${i}:Non Ascii Font:'\" \\\n                                     \"$font_file\" 2>/dev/null)\"\n\n                        [[ \"$term_font\" != \"$non_ascii\" ]] && \\\n                            term_font=\"$term_font (normal) / $non_ascii (non-ascii)\"\n                    fi\n                fi\n            done\n        ;;\n\n        \"deepin-terminal\"*)\n            term_font=\"$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END {print a,b}' \\\n                         \"${XDG_CONFIG_HOME}/deepin/deepin-terminal/config.conf\")\"\n        ;;\n\n        \"GNUstep_Terminal\")\n             term_font=\"$(awk -F '>|<' '/>TerminalFont</ {getline; f=$3}\n                          />TerminalFontSize</ {getline; s=$3} END {print f,s}' \\\n                          \"${HOME}/GNUstep/Defaults/Terminal.plist\")\"\n        ;;\n\n        \"Hyper\"*)\n            term_font=\"$(awk -F':|,' '/fontFamily/ {print $2; exit}' \"${HOME}/.hyper.js\")\"\n            term_font=\"$(trim_quotes \"$term_font\")\"\n        ;;\n\n        \"kitty\"*)\n            kitty_config=\"$(kitty --debug-config)\"\n            [[ \"$kitty_config\" != *font_family* ]] && return\n\n            term_font_size=\"${kitty_config/*font_size}\"\n            term_font_size=\"${term_font_size/$'\\n'*}\"\n            term_font=\"${kitty_config/*font_family}\"\n            term_font=\"${term_font/$'\\n'*} $term_font_size\"\n        ;;\n\n        \"konsole\" | \"yakuake\")\n            # Get Process ID of current konsole window / tab\n            child=\"$(get_ppid \"$$\")\"\n\n            declare -a konsole_instances; konsole_instances=( \"${(@f)\"$(qdbus | grep -F 'org.kde.konsole')\"/ /}\" )\n\n            for i in \"${konsole_instances[@]}\"; do\n                declare -a konsole_sessions; konsole_sessions=( \"${(@f)\"$(qdbus \"$i\" | grep -F '/Sessions/')\"}\" )\n\n                for session in \"${konsole_sessions[@]}\"; do\n                    if ((child == $(qdbus \"$i\" \"$session\" processId))); then\n                        profile=\"$(qdbus \"$i\" \"$session\" environment |\\\n                                   awk -F '=' '/KONSOLE_PROFILE_NAME/ {print $2}')\"\n                        break\n                    fi\n                done\n                [[ \"$profile\" ]] && break\n            done\n\n            # We could have two profile files for the same profile name, take first match\n            profile_filename=\"$(grep -l \"Name=${profile}\" \"$HOME\"/.local/share/konsole/*.profile)\"\n            profile_filename=\"${profile_filename/$'\\n'*}\"\n\n            [[ \"$profile_filename\" ]] && \\\n                term_font=\"$(awk -F '=|,' '/Font=/ {print $2,$3}' \"$profile_filename\")\"\n        ;;\n\n        \"lxterminal\"*)\n            term_font=\"$(awk -F '=' '/fontname=/ {print $2; exit}' \\\n                         \"${XDG_CONFIG_HOME}/lxterminal/lxterminal.conf\")\"\n        ;;\n\n        \"mate-terminal\")\n            # To get the actual config we have to create a temporarily file with the\n            # --save-config option.\n            mateterm_config=\"/tmp/mateterm.cfg\"\n\n            # Ensure /tmp exists and we do not overwrite anything.\n            if [[ -d \"/tmp\" && ! -f \"$mateterm_config\" ]]; then\n                mate-terminal --save-config=\"$mateterm_config\"\n\n                role=\"$(xprop -id \"${WINDOWID}\" WM_WINDOW_ROLE)\"\n                role=\"${role##* }\"\n                role=\"${role//\\\"}\"\n\n                profile=\"$(awk -F '=' -v r=\"$role\" \\\n                                  '$0~r {\n                                            getline;\n                                            if(/Maximized/) getline;\n                                            if(/Fullscreen/) getline;\n                                            id=$2\"]\"\n                                         } $0~id {if(id) {getline; print $2; exit}}' \\\n                           \"$mateterm_config\")\"\n\n                rm -f \"$mateterm_config\"\n\n                mate_get() {\n                   gsettings get org.mate.terminal.profile:/org/mate/terminal/profiles/\"$1\"/ \"$2\"\n                }\n\n                if [[ \"$(mate_get \"$profile\" \"use-system-font\")\" == \"true\" ]]; then\n                    term_font=\"$(gsettings get org.mate.interface monospace-font-name)\"\n                else\n                    term_font=\"$(mate_get \"$profile\" \"font\")\"\n                fi\n                term_font=\"$(trim_quotes \"$term_font\")\"\n            fi\n        ;;\n\n        \"mintty\")\n            term_font=\"$(awk -F '=' '!/^($|#)/ && /Font/ {printf $2; exit}' \"${HOME}/.minttyrc\")\"\n        ;;\n\n        \"pantheon\"*)\n            term_font=\"$(gsettings get org.pantheon.terminal.settings font)\"\n\n            [[ -z \"${term_font//\\'}\" ]] && \\\n                term_font=\"$(gsettings get org.gnome.desktop.interface monospace-font-name)\"\n\n            term_font=\"$(trim_quotes \"$term_font\")\"\n        ;;\n\n        \"qterminal\")\n            term_font=\"$(awk -F '=' '/fontFamily=/ {a=$2} /fontSize=/ {b=$2} END {print a,b}' \\\n                         \"${XDG_CONFIG_HOME}/qterminal.org/qterminal.ini\")\"\n        ;;\n\n        \"sakura\"*)\n            term_font=\"$(awk -F '=' '/^font=/ {print $2; exit}' \\\n                         \"${XDG_CONFIG_HOME}/sakura/sakura.conf\")\"\n        ;;\n\n        \"st\")\n            term_font=\"$(ps -o command= -p \"$parent\" | grep -F -- \"-f\")\"\n\n            if [[ \"$term_font\" ]]; then\n                term_font=\"${term_font/*-f/}\"\n                term_font=\"${term_font/ -*/}\"\n\n            else\n                # On Linux we can get the exact path to the running binary through the procfs\n                # (in case `st` is launched from outside of $PATH) on other systems we just\n                # have to guess and assume `st` is invoked from somewhere in the users $PATH\n                [[ -L \"/proc/$parent/exe\" ]] && binary=\"/proc/$parent/exe\" || binary=\"$(type -p st)\"\n\n                # Grep the output of strings on the `st` binary for anything that looks vaguely\n                # like a font definition. NOTE: There is a slight limitation in this approach.\n                # Technically \"Font Name\" is a valid font. As it doesn't specify any font options\n                # though it is hard to match it correctly amongst the rest of the noise.\n                [[ -n \"$binary\" ]] && \\\n                    term_font=\"$(strings \"$binary\" | grep -F -m 1 \\\n                                                          -e \"pixelsize=\" \\\n                                                          -e \"size=\" \\\n                                                          -e \"antialias=\" \\\n                                                          -e \"autohint=\")\"\n            fi\n\n            term_font=\"${term_font/xft:}\"\n            term_font=\"${term_font/:*}\"\n        ;;\n\n        \"terminology\")\n            term_font=\"$(strings \"${XDG_CONFIG_HOME}/terminology/config/standard/base.cfg\" |\\\n                         awk '/^font\\.name$/{print a}{a=$0}')\"\n            term_font=\"${term_font/.pcf}\"\n            term_font=\"${term_font/:*}\"\n        ;;\n\n        \"termite\")\n            [[ -f \"${XDG_CONFIG_HOME}/termite/config\" ]] && \\\n                termite_config=\"${XDG_CONFIG_HOME}/termite/config\"\n\n            term_font=\"$(awk -F '= ' '/\\[options\\]/ {\n                                          opt=1\n                                      }\n                                      /^\\s*font/ {\n                                          if(opt==1) a=$2;\n                                          opt=0\n                                      } END {print a}' \"/etc/xdg/termite/config\" \\\n                         \"$termite_config\")\"\n        ;;\n\n        \"urxvt\" | \"urxvtd\" | \"rxvt-unicode\" | \"xterm\")\n            xrdb=\"$(xrdb -query)\"\n            term_font=\"$(grep -im 1 -e \"^${term/d}\"'\\**\\.*font' -e '^\\*font' <<< \"$xrdb\")\"\n            term_font=\"${term_font/*\"*font:\"}\"\n            term_font=\"${term_font/*\".font:\"}\"\n            term_font=\"${term_font/*\"*.font:\"}\"\n            term_font=\"$(trim \"$term_font\")\"\n\n            [[ -z \"$term_font\" && \"$term\" == \"xterm\" ]] && \\\n                term_font=\"$(grep '^XTerm.vt100.faceName' <<< \"$xrdb\")\"\n\n            term_font=\"$(trim \"${term_font/*\"faceName:\"}\")\"\n\n            # xft: isn't required at the beginning so we prepend it if it's missing\n            [[ \"${term_font:0:1}\" != \"-\" && \"${term_font:0:4}\" != \"xft:\" ]] && \\\n                term_font=\"xft:$term_font\"\n\n            # Xresources has two different font formats, this checks which\n            # one is in use and formats it accordingly.\n            case \"$term_font\" in\n                *\"xft:\"*)\n                    term_font=\"${term_font/xft:}\"\n                    term_font=\"${term_font/:*}\"\n                ;;\n\n                \"-\"*)\n                    IFS=- read -r _ _ term_font _ <<< \"$term_font\"\n                ;;\n            esac\n        ;;\n\n        \"xfce4-terminal\")\n            term_font=\"$(awk -F '=' '/^FontName/{a=$2}/^FontUseSystem=TRUE/{a=$0} END {print a}' \\\n                         \"${XDG_CONFIG_HOME}/xfce4/terminal/terminalrc\")\"\n\n            [[ \"$term_font\" == \"FontUseSystem=TRUE\" ]] && \\\n                term_font=\"$(gsettings get org.gnome.desktop.interface monospace-font-name)\"\n\n            term_font=\"$(trim_quotes \"$term_font\")\"\n\n            # Default fallback font hardcoded in terminal-preferences.c\n            [[ -z \"$term_font\" ]] && term_font=\"Monospace 12\"\n        ;;\n    esac\n\n    echo \"${term_font}\"\n}\n\nlocal currentTerminal=$(get_term)\nlocal currentFont=$(get_term_font \"${currentTerminal}\")\nprint -P \"===== Font debugging =====\"\nprint -P \"You are using %F{blue}${currentTerminal}%f with Font %F{blue}${currentFont}%f\\n\"\n\nif [[ $(echo \"${currentFont}\" | grep -c -E \"Powerline|Awesome|Nerd\") -eq 0 ]]; then\n    print -P \"%F{yellow}WARNING%f It does not seem like you use an Powerline-enabled or Awesome Terminal Font!\"\n    print -P \"Please make sure that your font settings are correct!\"\nelse\n    print -P \"Your font settings seem to be all right. If you still have issues,\"\n    print -P \"it is more likely to be a font issue than a Powerlevel9k related one.\"\nfi\n"
  },
  {
    "path": "debug/iterm.zsh",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\nif [[ \"$TERM_PROGRAM\" != \"iTerm.app\" ]]; then\n    print \"Your Terminal Emulator does not appear to be iTerm2!\"\n    print \"This debug script is intended only for iTerm2 terminals.\"\n    exit 1\nfi\n\nif [[ ! -x \"/usr/libexec/PlistBuddy\" ]]; then\n    print \"To use this debug script, you need to install XCode!\"\n    exit 2\nfi\n\nlocal normalFont\nlocal type\nlocal command\nlocal ambiguousDoubleWidth\nlocal minimumContrast\nlocal useDifferentFont\n\n# Unfortunately the profile name is not unique, but it seems to be the only\n# thing that identifies an active profile. There is the \"ID of current session\n# of current window\" though, but that does not match to a `guid` in the plist.\n# So, be warned - collisions may occur!\n# See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg\nlocal currentProfileName=$(osascript -e 'tell application \"iTerm2\" to profile name of current session of current window')\n\n# Warning: Dynamic profiles are not taken into account here!\n# https://www.iterm2.com/documentation-dynamic-profiles.html\n\n# Count `guids` in \"New Bookmarks\"; they should be unique\nlocal profilesCount=$(/usr/libexec/PlistBuddy -c \"Print :New\\ Bookmarks:\" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep -c \"Guid\")\nfor idx in $(seq 0 \"${profilesCount}\"); do\n    local profileName=$(/usr/libexec/PlistBuddy -c \"Print :New\\ Bookmarks:${idx}:Name:\" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null)\n    if [[ \"${profileName}\" == \"${currentProfileName}\" ]]; then\n        # \"Normal Font\"\n        normalFont=$(/usr/libexec/PlistBuddy -c \"Print :New\\ Bookmarks:${idx}:Normal\\ Font:\" ~/Library/Preferences/com.googlecode.iterm2.plist)\n        type=$(/usr/libexec/PlistBuddy -c \"Print :New\\ Bookmarks:${idx}:Terminal\\ Type:\" ~/Library/Preferences/com.googlecode.iterm2.plist)\n        command=$(/usr/libexec/PlistBuddy -c \"Print :New\\ Bookmarks:${idx}:Command:\" ~/Library/Preferences/com.googlecode.iterm2.plist)\n        ambiguousDoubleWidth=$(/usr/libexec/PlistBuddy -c \"Print :New\\ Bookmarks:${idx}:Ambiguous\\ Double\\ Width:\" ~/Library/Preferences/com.googlecode.iterm2.plist)\n        minimumContrast=$(/usr/libexec/PlistBuddy -c \"Print :New\\ Bookmarks:${idx}:Minimum\\ Contrast:\" ~/Library/Preferences/com.googlecode.iterm2.plist)\n\n        # Font for non-ascii characters\n        # Only check for a different non-ASCII font, if the user checked\n        # the \"use a different font for non-ascii text\" switch.\n        useDifferentFont=$(/usr/libexec/PlistBuddy -c \"Print :New\\ Bookmarks:${idx}:Use\\ Non-ASCII\\ Font:\" ~/Library/Preferences/com.googlecode.iterm2.plist)\n        if [[ \"$useDifferentFont\" == \"true\" ]]; then\n            nonAsciiFont=$(/usr/libexec/PlistBuddy -c \"Print :New\\ Bookmarks:${idx}:Non\\ Ascii\\ Font:\" ~/Library/Preferences/com.googlecode.iterm2.plist)\n            if [[ \"$normalFont\" != \"$nonAsciiFont\" ]]; then\n                normalFont=\"$normalFont (normal) / $nonAsciiFont (non-ascii)\"\n            fi\n        fi\n        break\n    fi\ndone\n\nprint -P \"You use %F{blue}iTerm2%f with the following settings:\"\nprint -P \"  Font: ${normalFont}\"\nprint -P \"  Terminal-Type: ${type}\"\nprint -P \"  Command: ${command}\"\n\n#############################\n# Analyse possible problems #\n#############################\nlocal problemsFound\nif [[ \"${ambiguousDoubleWidth}\" == \"true\" ]]; then\n    problemsFound=\"${problemsFound}\\n  * Please uncheck 'Treat ambiguous characters as double-width'.\"\nfi\nif (( minimumContrast > 0 )); then\n    problemsFound=\"${problemsFound}\\n  * Please set minimum contrast to zero.\"\nfi\nif [[ $(echo \"${normalFont}\" | grep -c -E \"Powerline|Awesome|Nerd|Source Code Pro\") -eq 0 ]]; then\n    problemsFound=\"${problemsFound}\\n  * It does not seem like you use an Powerline-enabled or Awesome Terminal Font!\"\nfi\n\n#############################\n# Output problems           #\n#############################\nif [[ -n \"${problemsFound}\" ]]; then\n    print -P \"\\n\"\n    print -P \"%F{yellow}Possible Problems found:%f\"\n    print -P \"${problemsFound}\"\nelse\n    print -P \"%F{green}No Problems found%f. Yay!\"\nfi\n"
  },
  {
    "path": "docker/antibody/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/antibody/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\nCOPY docker/antibody/zshrc .zshrc\n"
  },
  {
    "path": "docker/antibody/install.zsh",
    "content": "curl -sL https://git.io/antibody | bash -s\n"
  },
  {
    "path": "docker/antibody/zshrc",
    "content": "source <(antibody init)\nantibody bundle ~/p9k/\n"
  },
  {
    "path": "docker/antigen/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/antigen/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\nCOPY docker/antigen/zshrc .zshrc\n"
  },
  {
    "path": "docker/antigen/install.zsh",
    "content": "#!/bin/zsh\n\nmkdir ~/antigen\n\ncurl \\\n  -qLsSf \\\n  -o ~/antigen/antigen.zsh \\\n  https://git.io/antigen\n\nsource ~/antigen/antigen.zsh\n\n# EOF\n"
  },
  {
    "path": "docker/antigen/zshrc",
    "content": "source ~/antigen/antigen.zsh\n\nantigen theme \"${HOME}/p9k\" powerlevel9k --no-local-clone\nantigen apply\n"
  },
  {
    "path": "docker/base-4.3.11/Dockerfile",
    "content": "FROM centos:6\n\nRUN \\\n  yum install -y \\\n  curl \\\n  git \\\n  zsh \\\n  mercurial \\\n  subversion \\\n  golang \\\n  jq \\\n  node \\\n  ruby \\\n  python \\\n  python-virtualenv \\\n  sudo\n\nRUN adduser --shell /bin/zsh --comment 'fred' --user-group fred\n\nCOPY docker/fred-sudoers /etc/sudoers.d/fred\n\nUSER fred\nWORKDIR /home/fred\nENV LANG=en_US.UTF-8\nENV TERM=xterm-256color\nENV DEFAULT_USER=fred\nENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true\n\nRUN touch .zshrc\n\nCMD [\"/bin/zsh\", \"-l\"]\n"
  },
  {
    "path": "docker/base-5.0.3/Dockerfile",
    "content": "FROM ubuntu:14.04\n\nRUN \\\n  apt-get update && \\\n  echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \\\n  DEBIAN_FRONTEND=noninteractive apt-get install -y \\\n  curl \\\n  git \\\n  zsh=5.0.2-3ubuntu6.2 \\\n  mercurial \\\n  subversion \\\n  golang \\\n  jq \\\n  node \\\n  ruby \\\n  python \\\n  python-virtualenv\n\nRUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred\nRUN locale-gen \"en_US.UTF-8\"\n\nCOPY docker/fred-sudoers /etc/sudoers.d/fred\n\nUSER fred\nWORKDIR /home/fred\nENV LANG=en_US.UTF-8\nENV TERM=xterm-256color\nENV DEFAULT_USER=fred\nENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true\n\nRUN touch .zshrc\n\nCMD [\"/bin/zsh\", \"-l\"]\n"
  },
  {
    "path": "docker/base-5.1.1/Dockerfile",
    "content": "FROM ubuntu:16.04\n\nRUN \\\n  apt-get update && \\\n  echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \\\n  DEBIAN_FRONTEND=noninteractive apt-get install -y \\\n  curl \\\n  git \\\n  zsh=5.1.1-1ubuntu2.2 \\\n  mercurial \\\n  subversion \\\n  golang \\\n  jq \\\n  nodejs \\\n  ruby \\\n  python \\\n  python-virtualenv \\\n  sudo \\\n  locales\n\nRUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred\nRUN locale-gen \"en_US.UTF-8\"\n\nCOPY docker/fred-sudoers /etc/sudoers.d/fred\n\nUSER fred\nWORKDIR /home/fred\nENV LANG=en_US.UTF-8\nENV TERM=xterm-256color\nENV DEFAULT_USER=fred\nENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true\n\nRUN touch .zshrc\n\nCMD [\"/bin/zsh\", \"-l\"]\n"
  },
  {
    "path": "docker/base-5.2/Dockerfile",
    "content": "FROM ubuntu:17.10\n\nRUN \\\n  apt-get update && \\\n  echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \\\n  DEBIAN_FRONTEND=noninteractive apt-get install -y \\\n  curl \\\n  git \\\n  zsh=5.2-5ubuntu1.2 \\\n  mercurial \\\n  subversion \\\n  golang \\\n  jq \\\n  nodejs \\\n  ruby \\\n  python \\\n  python-virtualenv \\\n  sudo \\\n  locales\n\nRUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred\nRUN locale-gen \"en_US.UTF-8\"\n\nCOPY docker/fred-sudoers /etc/sudoers.d/fred\n\nUSER fred\nWORKDIR /home/fred\nENV LANG=en_US.UTF-8\nENV TERM=xterm-256color\nENV DEFAULT_USER=fred\nENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true\n\nRUN touch .zshrc\n\nCMD [\"/bin/zsh\", \"-l\"]\n"
  },
  {
    "path": "docker/base-5.3.1/Dockerfile",
    "content": "FROM debian:stretch\n\n# We switched here to debian, as there seems no ZSH 5.3 in ubuntu.\n\nRUN \\\n  apt-get update && \\\n  echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \\\n  DEBIAN_FRONTEND=noninteractive apt-get install -y \\\n  curl \\\n  git \\\n  zsh=5.3.1-4+b2 \\\n  mercurial \\\n  subversion \\\n  golang \\\n  jq \\\n  nodejs \\\n  ruby \\\n  python \\\n  python-virtualenv \\\n  sudo \\\n  locales\n\nRUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred\n# Locale generation is different in debian. We need to enable en_US\n# locale and then regenerate locales.\nRUN echo \"en_US.UTF-8 UTF-8\" > /etc/locale.gen\nRUN locale-gen \"en_US.UTF-8\"\n\nCOPY docker/fred-sudoers /etc/sudoers.d/fred\n\nUSER fred\nWORKDIR /home/fred\nENV LANG=en_US.UTF-8\nENV TERM=xterm-256color\nENV DEFAULT_USER=fred\nENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true\n\nRUN touch .zshrc\n\nCMD [\"/bin/zsh\", \"-l\"]\n"
  },
  {
    "path": "docker/base-5.4.2/Dockerfile",
    "content": "FROM ubuntu:18.04\n\nRUN \\\n  apt-get update && \\\n  echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \\\n  DEBIAN_FRONTEND=noninteractive apt-get install -y \\\n  curl \\\n  git \\\n  zsh=5.4.2-3ubuntu3 \\\n  mercurial \\\n  subversion \\\n  golang \\\n  jq \\\n  nodejs \\\n  ruby \\\n  python \\\n  python-virtualenv \\\n  sudo \\\n  locales\n\nRUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred\nRUN locale-gen \"en_US.UTF-8\"\n\nCOPY docker/fred-sudoers /etc/sudoers.d/fred\n\nUSER fred\nWORKDIR /home/fred\nENV LANG=en_US.UTF-8\nENV TERM=xterm-256color\nENV DEFAULT_USER=fred\nENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true\n\nRUN touch .zshrc\n\nCMD [\"/bin/zsh\", \"-l\"]\n"
  },
  {
    "path": "docker/base-5.5.1/Dockerfile",
    "content": "FROM ubuntu:18.10\n\nRUN \\\n  apt-get update && \\\n  echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \\\n  DEBIAN_FRONTEND=noninteractive apt-get install -y \\\n  curl \\\n  git \\\n  zsh=5.5.1-1ubuntu1 \\\n  mercurial \\\n  subversion \\\n  golang \\\n  jq \\\n  nodejs \\\n  ruby \\\n  python \\\n  python-virtualenv \\\n  sudo \\\n  locales\n\nRUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred\nRUN locale-gen \"en_US.UTF-8\"\n\nCOPY docker/fred-sudoers /etc/sudoers.d/fred\n\nUSER fred\nWORKDIR /home/fred\nENV LANG=en_US.UTF-8\nENV TERM=xterm-256color\nENV DEFAULT_USER=fred\nENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true\n\nRUN touch .zshrc\n\nCMD [\"/bin/zsh\", \"-l\"]\n"
  },
  {
    "path": "docker/dotfile/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY ./ p9k/\nCOPY docker/dotfile/zshrc .zshrc\n"
  },
  {
    "path": "docker/dotfile/zshrc",
    "content": "source \"${HOME}/p9k/prompt_powerlevel9k_setup\"\n"
  },
  {
    "path": "docker/fred-sudoers",
    "content": "Defaults:fred !requiretty\nfred ALL=(ALL) NOPASSWD: ALL\n"
  },
  {
    "path": "docker/omz/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/omz/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY docker/omz/zshrc .zshrc\nCOPY ./ p9k/\n"
  },
  {
    "path": "docker/omz/install.zsh",
    "content": "sh -c \"$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)\"\n\nmkdir -p ~/.oh-my-zsh/custom/themes\nln -nsf ~/p9k/ ~/.oh-my-zsh/custom/themes/powerlevel9k\n"
  },
  {
    "path": "docker/omz/zshrc",
    "content": "export ZSH=$HOME/.oh-my-zsh\nZSH_THEME=\"powerlevel9k/powerlevel9k\"\nplugins=(git rake ruby)\n\nsource $ZSH/oh-my-zsh.sh\n"
  },
  {
    "path": "docker/prezto/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/prezto/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\n"
  },
  {
    "path": "docker/prezto/install.zsh",
    "content": "#!/bin/zsh\n\nset -eu\n\ngit clone --recursive https://github.com/sorin-ionescu/prezto.git \"${ZDOTDIR:-$HOME}/.zprezto\"\n\nsetopt EXTENDED_GLOB\nfor rcfile in \"${ZDOTDIR:-$HOME}\"/.zprezto/runcoms/^README.md(.N); do\n  ln -nsf \"$rcfile\" \"${ZDOTDIR:-$HOME}/.${rcfile:t}\"\ndone\n\nln -snf \"${HOME}/p9k/powerlevel9k.zsh-theme\" \\\n  \"${HOME}/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup\"\n\necho \"zstyle ':prezto:module:prompt' theme 'powerlevel9k'\" \\\n  >> \"${HOME}/.zpreztorc\"\n\n# EOF\n"
  },
  {
    "path": "docker/zgen/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/zgen/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\nCOPY docker/zgen/zshrc .zshrc\n"
  },
  {
    "path": "docker/zgen/install.zsh",
    "content": "#!/bin/zsh\n\ngit clone https://github.com/tarjoilija/zgen.git \"${HOME}/.zgen\"\n\n# EOF\n"
  },
  {
    "path": "docker/zgen/zshrc",
    "content": "# load zgen\nsource ~/.zgen/zgen.zsh\n\n# if the init scipt doesn't exist\nif ! zgen saved; then\n  zgen load ~/p9k/powerlevel9k.zsh-theme\n\n  # generate the init script from plugins above\n  zgen save\nfi\n"
  },
  {
    "path": "docker/zim/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/zim/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\n"
  },
  {
    "path": "docker/zim/install.zsh",
    "content": "#!zsh\n\ngit clone --recursive https://github.com/Eriner/zim.git \"${ZDOTDIR:-${HOME}}/.zim\"\n\nsetopt EXTENDED_GLOB\nfor template_file ( ${ZDOTDIR:-${HOME}}/.zim/templates/* ); do\n  user_file=\"${ZDOTDIR:-${HOME}}/.${template_file:t}\"\n  touch ${user_file}\n  ( print -rn \"$(<${template_file})$(<${user_file})\" >! ${user_file} ) 2>/dev/null\ndone\n\nsource \"${ZDOTDIR:-${HOME}}/.zlogin\"\n\nln -nsf \\\n  ~/p9k/ \\\n  ~/.zim/modules/prompt/external-themes/powerlevel9k\nln -nsf \\\n  ~/.zim/modules/prompt/external-themes/powerlevel9k/powerlevel9k.zsh-theme \\\n  ~/.zim/modules/prompt/functions/prompt_powerlevel9k_setup\n\nsed -i \"s/zprompt_theme='steeef'/zprompt_theme='powerlevel9k'/g\" ~/.zimrc\n"
  },
  {
    "path": "docker/zplug/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/zplug/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\nCOPY docker/zplug/zshrc .zshrc\n"
  },
  {
    "path": "docker/zplug/install.zsh",
    "content": "#!zsh\n\ncurl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh| zsh\n\n# git clone https://github.com/zplug/zplug \"${HOME}/.zplug\"\n"
  },
  {
    "path": "docker/zplug/zshrc",
    "content": "#!zsh\n\nsource ~/.zplug/init.zsh\nzplug \"${HOME}/p9k\", use:\"powerlevel9k.zsh-theme\", from:local, as:theme\nzplug load --verbose\n"
  },
  {
    "path": "docker/zplugin/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/zplugin/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\nCOPY docker/zplugin/zshrc.plugins .zshrc.plugins\n"
  },
  {
    "path": "docker/zplugin/install.zsh",
    "content": "sh -c \"$(curl -fsSL https://raw.githubusercontent.com/psprint/zplugin/master/doc/install.sh)\"\n\n# The 'zplugin snippet' only copies the .zsh-theme file, not everything else.\nmkdir -p ~/.zplugin/snippets\nln -nsf \\\n  ~/p9k/ \\\n~/.zplugin/snippets/--SLASH--home--SLASH--fred--SLASH--p9k--SLASH--powerlevel9k--DOT--zsh-theme\n\n{\n  echo\n  echo \"source ~/.zshrc.plugins\"\n} >> ~/.zshrc\n"
  },
  {
    "path": "docker/zplugin/zshrc.plugins",
    "content": "#!zsh\n\nzplugin load psprint zsh-navigation-tools\nzplugin load psprint---zprompts\nzplugin snippet ~/p9k/powerlevel9k.zsh-theme\n"
  },
  {
    "path": "docker/zpm/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/zpm/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\nCOPY docker/zpm/zshrc .zshrc\n"
  },
  {
    "path": "docker/zpm/install.zsh",
    "content": "# install zpm\ngit clone --recursive https://github.com/zpm-zsh/zpm.git ~/.zpm\n\n# Install powerlevel9k\nmkdir ~/.zpm/plugins/powerlevel9k\nln -s ~/p9k/powerlevel9k.zsh-theme ~/.zpm/plugins/powerlevel9k/powerlevel9k.plugin.zsh\n"
  },
  {
    "path": "docker/zpm/zshrc",
    "content": "source ~/.zpm/zpm.zsh\n\nzpm load powerlevel9k\n"
  },
  {
    "path": "docker/zshing/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/zshing/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\n"
  },
  {
    "path": "docker/zshing/install.zsh",
    "content": "#!zsh\n\n# install zshing https://github.com/zakariaGatter/zshing\ngit clone https://github.com/zakariaGatter/zshing.git ~/.zshing/zshing\n\n# Link P9K in zshing directory\nln -nsf ~/p9k ~/.zshing/powerlevel9k\n\n{\n  echo\n  echo 'ZSHING_PLUGINS=(\n     \"bhilburn/powerlevel9k\"\n )'\n  echo\n  echo \"source ~/.zshing/zshing/zshing.zsh\"\n} >> ~/.zshrc\n"
  },
  {
    "path": "docker/zulu/Dockerfile",
    "content": "ARG base\nFROM p9k:${base}\n\nCOPY docker/zulu/install.zsh /tmp/\nRUN zsh /tmp/install.zsh\n\nCOPY ./ p9k/\n"
  },
  {
    "path": "docker/zulu/install.zsh",
    "content": "#!zsh\n\n# install zulu https://github.com/zulu-zsh/zulu\ncurl -L https://git.io/zulu-install | zsh && zsh\n\n{\necho 'zulu fpath add ~/p9k'\necho 'zulu fpath add ~/p9k/functions'\necho 'zulu theme powerlevel9k'\n} >> ~/.zshrc\n"
  },
  {
    "path": "functions/colors.zsh",
    "content": "# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n################################################################\n# Color functions\n# This file holds some color-functions for\n# the powerlevel9k-ZSH-theme\n# https://github.com/bhilburn/powerlevel9k\n################################################################\n\ntypeset -gAh __P9K_COLORS\n# https://jonasjacek.github.io/colors/\n# use color names by default to allow dark/light themes to adjust colors based on names\n__P9K_COLORS=(\n  black 000\n  red 001\n  green 002\n  yellow 003\n  blue 004\n  magenta 005\n  cyan 006\n  white 007\n  grey 008\n  maroon 009\n  lime 010\n  olive 011\n  navy 012\n  fuchsia 013\n  purple 013\n  aqua 014\n  teal 014\n  silver 015\n  grey0 016\n  navyblue 017\n  darkblue 018\n  blue3 019\n  blue3 020\n  blue1 021\n  darkgreen 022\n  deepskyblue4 023\n  deepskyblue4 024\n  deepskyblue4 025\n  dodgerblue3 026\n  dodgerblue2 027\n  green4 028\n  springgreen4 029\n  turquoise4 030\n  deepskyblue3 031\n  deepskyblue3 032\n  dodgerblue1 033\n  green3 034\n  springgreen3 035\n  darkcyan 036\n  lightseagreen 037\n  deepskyblue2 038\n  deepskyblue1 039\n  green3 040\n  springgreen3 041\n  springgreen2 042\n  cyan3 043\n  darkturquoise 044\n  turquoise2 045\n  green1 046\n  springgreen2 047\n  springgreen1 048\n  mediumspringgreen 049\n  cyan2 050\n  cyan1 051\n  darkred 052\n  deeppink4 053\n  purple4 054\n  purple4 055\n  purple3 056\n  blueviolet 057\n  orange4 058\n  grey37 059\n  mediumpurple4 060\n  slateblue3 061\n  slateblue3 062\n  royalblue1 063\n  chartreuse4 064\n  darkseagreen4 065\n  paleturquoise4 066\n  steelblue 067\n  steelblue3 068\n  cornflowerblue 069\n  chartreuse3 070\n  darkseagreen4 071\n  cadetblue 072\n  cadetblue 073\n  skyblue3 074\n  steelblue1 075\n  chartreuse3 076\n  palegreen3 077\n  seagreen3 078\n  aquamarine3 079\n  mediumturquoise 080\n  steelblue1 081\n  chartreuse2 082\n  seagreen2 083\n  seagreen1 084\n  seagreen1 085\n  aquamarine1 086\n  darkslategray2 087\n  darkred 088\n  deeppink4 089\n  darkmagenta 090\n  darkmagenta 091\n  darkviolet 092\n  purple 093\n  orange4 094\n  lightpink4 095\n  plum4 096\n  mediumpurple3 097\n  mediumpurple3 098\n  slateblue1 099\n  yellow4 100\n  wheat4 101\n  grey53 102\n  lightslategrey 103\n  mediumpurple 104\n  lightslateblue 105\n  yellow4 106\n  darkolivegreen3 107\n  darkseagreen 108\n  lightskyblue3 109\n  lightskyblue3 110\n  skyblue2 111\n  chartreuse2 112\n  darkolivegreen3 113\n  palegreen3 114\n  darkseagreen3 115\n  darkslategray3 116\n  skyblue1 117\n  chartreuse1 118\n  lightgreen 119\n  lightgreen 120\n  palegreen1 121\n  aquamarine1 122\n  darkslategray1 123\n  red3 124\n  deeppink4 125\n  mediumvioletred 126\n  magenta3 127\n  darkviolet 128\n  purple 129\n  darkorange3 130\n  indianred 131\n  hotpink3 132\n  mediumorchid3 133\n  mediumorchid 134\n  mediumpurple2 135\n  darkgoldenrod 136\n  lightsalmon3 137\n  rosybrown 138\n  grey63 139\n  mediumpurple2 140\n  mediumpurple1 141\n  gold3 142\n  darkkhaki 143\n  navajowhite3 144\n  grey69 145\n  lightsteelblue3 146\n  lightsteelblue 147\n  yellow3 148\n  darkolivegreen3 149\n  darkseagreen3 150\n  darkseagreen2 151\n  lightcyan3 152\n  lightskyblue1 153\n  greenyellow 154\n  darkolivegreen2 155\n  palegreen1 156\n  darkseagreen2 157\n  darkseagreen1 158\n  paleturquoise1 159\n  red3 160\n  deeppink3 161\n  deeppink3 162\n  magenta3 163\n  magenta3 164\n  magenta2 165\n  darkorange3 166\n  indianred 167\n  hotpink3 168\n  hotpink2 169\n  orchid 170\n  mediumorchid1 171\n  orange3 172\n  lightsalmon3 173\n  lightpink3 174\n  pink3 175\n  plum3 176\n  violet 177\n  gold3 178\n  lightgoldenrod3 179\n  tan 180\n  mistyrose3 181\n  thistle3 182\n  plum2 183\n  yellow3 184\n  khaki3 185\n  lightgoldenrod2 186\n  lightyellow3 187\n  grey84 188\n  lightsteelblue1 189\n  yellow2 190\n  darkolivegreen1 191\n  darkolivegreen1 192\n  darkseagreen1 193\n  honeydew2 194\n  lightcyan1 195\n  red1 196\n  deeppink2 197\n  deeppink1 198\n  deeppink1 199\n  magenta2 200\n  magenta1 201\n  orangered1 202\n  indianred1 203\n  indianred1 204\n  hotpink 205\n  hotpink 206\n  mediumorchid1 207\n  darkorange 208\n  salmon1 209\n  lightcoral 210\n  palevioletred1 211\n  orchid2 212\n  orchid1 213\n  orange1 214\n  sandybrown 215\n  lightsalmon1 216\n  lightpink1 217\n  pink1 218\n  plum1 219\n  gold1 220\n  lightgoldenrod2 221\n  lightgoldenrod2 222\n  navajowhite1 223\n  mistyrose1 224\n  thistle1 225\n  yellow1 226\n  lightgoldenrod1 227\n  khaki1 228\n  wheat1 229\n  cornsilk1 230\n  grey100 231\n  grey3 232\n  grey7 233\n  grey11 234\n  grey15 235\n  grey19 236\n  grey23 237\n  grey27 238\n  grey30 239\n  grey35 240\n  grey39 241\n  grey42 242\n  grey46 243\n  grey50 244\n  grey54 245\n  grey58 246\n  grey62 247\n  grey66 248\n  grey70 249\n  grey74 250\n  grey78 251\n  grey82 252\n  grey85 253\n  grey89 254\n  grey93 255\n)\n\nfunction termColors() {\n  if [[ $POWERLEVEL9K_IGNORE_TERM_COLORS == true ]]; then\n    return\n  fi\n\n  local term_colors\n\n  if which tput &>/dev/null; then\n\tterm_colors=$(tput colors)\n  else\n\tterm_colors=$(echotc Co)\n  fi\n  if (( ! $? && ${term_colors:-0} < 256 )); then\n    print -P \"%F{red}WARNING!%f Your terminal appears to support fewer than 256 colors!\"\n    print -P \"If your terminal supports 256 colors, please export the appropriate environment variable\"\n    print -P \"_before_ loading this theme in your \\~\\/.zshrc. In most terminal emulators, putting\"\n    print -P \"%F{blue}export TERM=\\\"xterm-256color\\\"%f at the top of your \\~\\/.zshrc is sufficient.\"\n  fi\n}\n\n# get the proper color code if it does not exist as a name.\nfunction getColor() {\n  # If Color is not numerical, try to get the color code.\n  if [[ \"$1\" != <-> ]]; then\n    1=$(getColorCode $1)\n  fi\n  echo -n \"$1\"\n}\n\n# empty paramenter resets (stops) background color\nfunction backgroundColor() {\n  echo -n \"%K{$(getColor $1)}\"\n}\n\n# empty paramenter resets (stops) foreground color\nfunction foregroundColor() {\n  echo -n \"%F{$(getColor $1)}\"\n}\n\n# Get numerical color codes. That way we translate ANSI codes\n# into ZSH-Style color codes.\nfunction getColorCode() {\n  # Early exit: Check if given value is already numerical\n  if [[ \"$1\" == <-> ]]; then\n    # Pad color with zeroes\n    echo -n \"${(l:3::0:)1}\"\n    return\n  fi\n\n  local colorName=\"${1}\"\n  # Check if value is none with any case.\n  if [[ \"${(L)colorName}\" == \"none\" ]]; then\n      echo -n 'none'\n  elif [[ \"${colorName}\" == \"foreground\"  ]]; then\n      # for testing purposes in terminal\n      # call via `getColorCode foreground`\n      for i in \"${(k@)__P9K_COLORS}\"; do\n          print -P \"$(foregroundColor $i)$(getColor $i) - $i%f\"\n      done\n  elif [[ \"${colorName}\" == \"background\"  ]]; then\n      # call via `getColorCode background`\n      for i in \"${(k@)__P9K_COLORS}\"; do\n          print -P \"$(backgroundColor $i)$(getColor $i) - $i%k\"\n      done\n  else\n      # Strip eventual \"bg-\" prefixes\n      colorName=${colorName#bg-}\n      # Strip eventual \"fg-\" prefixes\n      colorName=${colorName#fg-}\n      # Strip eventual \"br\" prefixes (\"bright\" colors)\n      colorName=${colorName#br}\n      echo -n $__P9K_COLORS[$colorName]\n  fi\n}\n\n# Check if two colors are equal, even if one is specified as ANSI code.\nfunction isSameColor() {\n  if [[ \"$1\" == \"NONE\" || \"$2\" == \"NONE\" ]]; then\n    return 1\n  fi\n\n  local color1=$(getColorCode \"$1\")\n  local color2=$(getColorCode \"$2\")\n\n  return $(( color1 != color2 ))\n}\n"
  },
  {
    "path": "functions/icons.zsh",
    "content": "# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n################################################################\n# icons\n# This file holds the icon definitions and\n# icon-functions for the powerlevel9k-ZSH-theme\n# https://github.com/bhilburn/powerlevel9k\n################################################################\n\n# These characters require the Powerline fonts to work properly. If you see\n# boxes or bizarre characters below, your fonts are not correctly installed. If\n# you do not want to install a special font, you can set `POWERLEVEL9K_MODE` to\n# `compatible`. This shows all icons in regular symbols.\n\n# Initialize the icon list according to the user's `POWERLEVEL9K_MODE`.\ntypeset -gAH icons\n() { # add scope to protect the users locale and not overwrite LC_CTYPE!\ncase $POWERLEVEL9K_MODE in\n  'flat'|'awesome-patched')\n    # Awesome-Patched Font required! See:\n    # https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched\n    # Set the right locale to protect special characters\n    local LC_ALL=\"\" LC_CTYPE=\"en_US.UTF-8\"\n    icons=(\n      LEFT_SEGMENT_SEPARATOR         $'\\uE0B0'              # \n      RIGHT_SEGMENT_SEPARATOR        $'\\uE0B2'              # \n      LEFT_SEGMENT_END_SEPARATOR     ' '                    # Whitespace\n      LEFT_SUBSEGMENT_SEPARATOR      $'\\uE0B1'              # \n      RIGHT_SUBSEGMENT_SEPARATOR     $'\\uE0B3'              # \n      CARRIAGE_RETURN_ICON           $'\\u21B5'              # ↵\n      ROOT_ICON                      $'\\uE801'              # \n      SUDO_ICON                      $'\\uF09C'              # \n      RUBY_ICON                      $'\\uE847 '             # \n      AWS_ICON                       $'\\uE895'              # \n      AWS_EB_ICON                    $'\\U1F331 '            # 🌱\n      BACKGROUND_JOBS_ICON           $'\\uE82F '             # \n      TEST_ICON                      $'\\uE891'              # \n      TODO_ICON                      $'\\u2611'              # ☑\n      BATTERY_ICON                   $'\\uE894'              # \n      DISK_ICON                      $'\\uE1AE '             # \n      OK_ICON                        $'\\u2714'              # ✔\n      FAIL_ICON                      $'\\u2718'              # ✘\n      SYMFONY_ICON                   'SF'\n      NODE_ICON                      $'\\u2B22'              # ⬢\n      MULTILINE_FIRST_PROMPT_PREFIX  $'\\u256D'$'\\U2500'     # ╭─\n      MULTILINE_NEWLINE_PROMPT_PREFIX  $'\\u251C'$'\\U2500'   # ├─\n      MULTILINE_LAST_PROMPT_PREFIX   $'\\u2570'$'\\U2500 '    # ╰─\n      APPLE_ICON                     $'\\uE26E'              # \n      WINDOWS_ICON                   $'\\uE26F'              # \n      FREEBSD_ICON                   $'\\U1F608 '            # 😈\n      ANDROID_ICON                   $'\\uE270'              # \n      LINUX_ICON                     $'\\uE271'              # \n      LINUX_ARCH_ICON                $'\\uE271'              # \n      LINUX_DEBIAN_ICON              $'\\uE271'              # \n      LINUX_UBUNTU_ICON              $'\\uE271'              # \n      LINUX_CENTOS_ICON              $'\\uE271'              # \n      LINUX_COREOS_ICON              $'\\uE271'              # \n      LINUX_ELEMENTARY_ICON          $'\\uE271'              # \n      LINUX_MINT_ICON                $'\\uE271'              # \n      LINUX_FEDORA_ICON              $'\\uE271'              # \n      LINUX_GENTOO_ICON              $'\\uE271'              # \n      LINUX_MAGEIA_ICON              $'\\uE271'              # \n      LINUX_NIXOS_ICON               $'\\uE271'              # \n      LINUX_MANJARO_ICON             $'\\uE271'              # \n      LINUX_DEVUAN_ICON              $'\\uE271'              # \n      LINUX_ALPINE_ICON              $'\\uE271'              # \n      LINUX_AOSC_ICON                $'\\uE271'              # \n      LINUX_OPENSUSE_ICON            $'\\uE271'              # \n      LINUX_SABAYON_ICON             $'\\uE271'              # \n      LINUX_SLACKWARE_ICON           $'\\uE271'              # \n      SUNOS_ICON                     $'\\U1F31E '            # 🌞\n      HOME_ICON                      $'\\uE12C'              # \n      HOME_SUB_ICON                  $'\\uE18D'              # \n      FOLDER_ICON                    $'\\uE818'              # \n      NETWORK_ICON                   $'\\uE1AD'              # \n      ETC_ICON                       $'\\uE82F'              # \n      LOAD_ICON                      $'\\uE190 '             # \n      SWAP_ICON                      $'\\uE87D'              # \n      RAM_ICON                       $'\\uE1E2 '             # \n      SERVER_ICON                    $'\\uE895'              # \n      VCS_UNTRACKED_ICON             $'\\uE16C'              # \n      VCS_UNSTAGED_ICON              $'\\uE17C'              # \n      VCS_STAGED_ICON                $'\\uE168'              # \n      VCS_STASH_ICON                 $'\\uE133 '             # \n      #VCS_INCOMING_CHANGES_ICON     $'\\uE1EB '             # \n      #VCS_INCOMING_CHANGES_ICON     $'\\uE80D '             # \n      VCS_INCOMING_CHANGES_ICON      $'\\uE131 '             # \n      #VCS_OUTGOING_CHANGES_ICON     $'\\uE1EC '             # \n      #VCS_OUTGOING_CHANGES_ICON     $'\\uE80E '             # \n      VCS_OUTGOING_CHANGES_ICON      $'\\uE132 '             # \n      VCS_TAG_ICON                   $'\\uE817 '             # \n      VCS_BOOKMARK_ICON              $'\\uE87B'              # \n      VCS_COMMIT_ICON                $'\\uE821 '             # \n      VCS_BRANCH_ICON                $'\\uE220 '             # \n      VCS_REMOTE_BRANCH_ICON         $'\\u2192'              # →\n      VCS_GIT_ICON                   $'\\uE20E '             # \n      VCS_GIT_GITHUB_ICON            $'\\uE20E '             #\n      VCS_GIT_BITBUCKET_ICON         $'\\uE20E '             #\n      VCS_GIT_GITLAB_ICON            $'\\uE20E '             #\n      VCS_HG_ICON                    $'\\uE1C3 '             # \n      VCS_SVN_ICON                   '(svn) '\n      RUST_ICON                      '(rust)'\n      PYTHON_ICON                    $'\\ue63c'             # \n      SWIFT_ICON                     ''\n      GO_ICON                        ''\n      PUBLIC_IP_ICON                 ''\n      LOCK_ICON                      $'\\UE138'              # \n      EXECUTION_TIME_ICON            $'\\UE89C'              # \n      SSH_ICON                       '(ssh)'\n      VPN_ICON                       '(vpn)'\n      KUBERNETES_ICON                $'\\U2388'              # ⎈\n      DROPBOX_ICON                   $'\\UF16B'              # \n      DATE_ICON                      $'\\uE184'              # \n      TIME_ICON                      $'\\uE12E'              # \n      JAVA_ICON                      $'\\U2615'              # ☕︎\n      LARAVEL_ICON                   ''\n    )\n  ;;\n  'awesome-fontconfig')\n    # fontconfig with awesome-font required! See\n    # https://github.com/gabrielelana/awesome-terminal-fonts\n    # Set the right locale to protect special characters\n    local LC_ALL=\"\" LC_CTYPE=\"en_US.UTF-8\"\n    icons=(\n      LEFT_SEGMENT_SEPARATOR         $'\\uE0B0'              # \n      RIGHT_SEGMENT_SEPARATOR        $'\\uE0B2'              # \n      LEFT_SEGMENT_END_SEPARATOR     ' '                    # Whitespace\n      LEFT_SUBSEGMENT_SEPARATOR      $'\\uE0B1'              # \n      RIGHT_SUBSEGMENT_SEPARATOR     $'\\uE0B3'              # \n      CARRIAGE_RETURN_ICON           $'\\u21B5'              # ↵\n      ROOT_ICON                      $'\\uF201'              # \n      SUDO_ICON                      $'\\uF09C'              # \n      RUBY_ICON                      $'\\uF219 '             # \n      AWS_ICON                       $'\\uF270'              # \n      AWS_EB_ICON                    $'\\U1F331 '            # 🌱\n      BACKGROUND_JOBS_ICON           $'\\uF013 '             # \n      TEST_ICON                      $'\\uF291'              # \n      TODO_ICON                      $'\\u2611'              # ☑\n      BATTERY_ICON                   $'\\U1F50B'             # 🔋\n      DISK_ICON                      $'\\uF0A0 '             # \n      OK_ICON                        $'\\u2714'              # ✔\n      FAIL_ICON                      $'\\u2718'              # ✘\n      SYMFONY_ICON                   'SF'\n      NODE_ICON                      $'\\u2B22'              # ⬢\n      MULTILINE_FIRST_PROMPT_PREFIX  $'\\u256D'$'\\U2500'     # ╭─\n      MULTILINE_NEWLINE_PROMPT_PREFIX  $'\\u251C'$'\\U2500'   # ├─\n      MULTILINE_LAST_PROMPT_PREFIX   $'\\u2570'$'\\U2500 '    # ╰─\n      APPLE_ICON                     $'\\uF179'              # \n      WINDOWS_ICON                   $'\\uF17A'              # \n      FREEBSD_ICON                   $'\\U1F608 '            # 😈\n      ANDROID_ICON                   $'\\uE17B'              # \n      LINUX_ICON                     $'\\uF17C'              # \n      LINUX_ARCH_ICON                $'\\uF17C'              # \n      LINUX_DEBIAN_ICON              $'\\uF17C'              # \n      LINUX_UBUNTU_ICON              $'\\uF17C'              # \n      LINUX_CENTOS_ICON              $'\\uF17C'              # \n      LINUX_COREOS_ICON              $'\\uF17C'              # \n      LINUX_ELEMENTARY_ICON          $'\\uF17C'              # \n      LINUX_MINT_ICON                $'\\uF17C'              # \n      LINUX_FEDORA_ICON              $'\\uF17C'              # \n      LINUX_GENTOO_ICON              $'\\uF17C'              # \n      LINUX_MAGEIA_ICON              $'\\uF17C'              # \n      LINUX_NIXOS_ICON               $'\\uF17C'              # \n      LINUX_MANJARO_ICON             $'\\uF17C'              # \n      LINUX_DEVUAN_ICON              $'\\uF17C'              # \n      LINUX_ALPINE_ICON              $'\\uF17C'              # \n      LINUX_AOSC_ICON                $'\\uF17C'              # \n      LINUX_OPENSUSE_ICON            $'\\uF17C'              # \n      LINUX_SABAYON_ICON             $'\\uF17C'              # \n      LINUX_SLACKWARE_ICON           $'\\uF17C'              # \n      SUNOS_ICON                     $'\\uF185 '             # \n      HOME_ICON                      $'\\uF015'              # \n      HOME_SUB_ICON                  $'\\uF07C'              # \n      FOLDER_ICON                    $'\\uF115'              # \n      ETC_ICON                       $'\\uF013 '             # \n      NETWORK_ICON                   $'\\uF09E'              # \n      LOAD_ICON                      $'\\uF080 '             # \n      SWAP_ICON                      $'\\uF0E4'              # \n      RAM_ICON                       $'\\uF0E4'              # \n      SERVER_ICON                    $'\\uF233'              # \n      VCS_UNTRACKED_ICON             $'\\uF059'              # \n      VCS_UNSTAGED_ICON              $'\\uF06A'              # \n      VCS_STAGED_ICON                $'\\uF055'              # \n      VCS_STASH_ICON                 $'\\uF01C '             # \n      VCS_INCOMING_CHANGES_ICON      $'\\uF01A '             # \n      VCS_OUTGOING_CHANGES_ICON      $'\\uF01B '             # \n      VCS_TAG_ICON                   $'\\uF217 '             # \n      VCS_BOOKMARK_ICON              $'\\uF27B'              # \n      VCS_COMMIT_ICON                $'\\uF221 '             # \n      VCS_BRANCH_ICON                $'\\uF126 '             # \n      VCS_REMOTE_BRANCH_ICON         $'\\u2192'              # →\n      VCS_GIT_ICON                   $'\\uF1D3 '             # \n      VCS_GIT_GITHUB_ICON            $'\\uF113 '             # \n      VCS_GIT_BITBUCKET_ICON         $'\\uF171 '             # \n      VCS_GIT_GITLAB_ICON            $'\\uF296 '             # \n      VCS_HG_ICON                    $'\\uF0C3 '             # \n      VCS_SVN_ICON                   '(svn) '\n      RUST_ICON                      $'\\uE6A8'              # \n      PYTHON_ICON                    $'\\ue63c'             # \n      SWIFT_ICON                     ''\n      GO_ICON                        ''\n      PUBLIC_IP_ICON                 ''\n      LOCK_ICON                      $'\\UF023'              # \n      EXECUTION_TIME_ICON            $'\\uF253'\n      SSH_ICON                       '(ssh)'\n      VPN_ICON                       $'\\uF023'\n      KUBERNETES_ICON                $'\\U2388'              # ⎈\n      DROPBOX_ICON                   $'\\UF16B'              # \n      DATE_ICON                      $'\\uF073 '             # \n      TIME_ICON                      $'\\uF017 '             # \n      JAVA_ICON                      $'\\U2615'              # ☕︎\n      LARAVEL_ICON                   ''\n    )\n  ;;\n  'awesome-mapped-fontconfig')\n    # mapped fontconfig with awesome-font required! See\n    # https://github.com/gabrielelana/awesome-terminal-fonts\n    # don't forget to source the font maps in your startup script\n    # Set the right locale to protect special characters\n    local LC_ALL=\"\" LC_CTYPE=\"en_US.UTF-8\"\n\n    if [ -z \"$AWESOME_GLYPHS_LOADED\" ]; then\n        echo \"Powerlevel9k warning: Awesome-Font mappings have not been loaded.\n        Source a font mapping in your shell config, per the Awesome-Font docs\n        (https://github.com/gabrielelana/awesome-terminal-fonts),\n        Or use a different Powerlevel9k font configuration.\";\n    fi\n\n    icons=(\n      LEFT_SEGMENT_SEPARATOR         $'\\uE0B0'                                      # \n      RIGHT_SEGMENT_SEPARATOR        $'\\uE0B2'                                      # \n      LEFT_SEGMENT_END_SEPARATOR     ' '                                            # Whitespace\n      LEFT_SUBSEGMENT_SEPARATOR      $'\\uE0B1'                                      # \n      RIGHT_SUBSEGMENT_SEPARATOR     $'\\uE0B3'                                      # \n      CARRIAGE_RETURN_ICON           $'\\u21B5'                                      # ↵\n      ROOT_ICON                      '\\u'$CODEPOINT_OF_OCTICONS_ZAP                 # \n      SUDO_ICON                      '\\u'$CODEPOINT_OF_AWESOME_UNLOCK               # \n      RUBY_ICON                      '\\u'$CODEPOINT_OF_OCTICONS_RUBY' '             # \n      AWS_ICON                       '\\u'$CODEPOINT_OF_AWESOME_SERVER               # \n      AWS_EB_ICON                    $'\\U1F331 '                                    # 🌱\n      BACKGROUND_JOBS_ICON           '\\u'$CODEPOINT_OF_AWESOME_COG' '               # \n      TEST_ICON                      '\\u'$CODEPOINT_OF_AWESOME_BUG                  # \n      TODO_ICON                      '\\u'$CODEPOINT_OF_AWESOME_CHECK_SQUARE_O       # \n      BATTERY_ICON                   '\\U'$CODEPOINT_OF_AWESOME_BATTERY_FULL         # \n      DISK_ICON                      '\\u'$CODEPOINT_OF_AWESOME_HDD_O' '             # \n      OK_ICON                        '\\u'$CODEPOINT_OF_AWESOME_CHECK                # \n      FAIL_ICON                      '\\u'$CODEPOINT_OF_AWESOME_TIMES                # \n      SYMFONY_ICON                   'SF'\n      NODE_ICON                      $'\\u2B22'                                      # ⬢\n      MULTILINE_FIRST_PROMPT_PREFIX  $'\\u256D'$'\\U2500'                             # ╭─\n      MULTILINE_SECOND_PROMPT_PREFIX $'\\u2570'$'\\U2500 '                            # ╰─\n      APPLE_ICON                     '\\u'$CODEPOINT_OF_AWESOME_APPLE                # \n      FREEBSD_ICON                   $'\\U1F608 '                                    # 😈\n      LINUX_ICON                     '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_ARCH_ICON                '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_DEBIAN_ICON              '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_UBUNTU_ICON              '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_CENTOS_ICON              '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_COREOS_ICON              '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_ELEMENTARY_ICON          '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_MINT_ICON                '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_FEDORA_ICON              '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_GENTOO_ICON              '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_MAGEIA_ICON              '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_NIXOS_ICON               '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_MANJARO_ICON             '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_DEVUAN_ICON              '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_ALPINE_ICON              '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_AOSC_ICON                '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_OPENSUSE_ICON            '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_SABAYON_ICON             '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      LINUX_SLACKWARE_ICON           '\\u'$CODEPOINT_OF_AWESOME_LINUX                # \n      SUNOS_ICON                     '\\u'$CODEPOINT_OF_AWESOME_SUN_O' '             # \n      HOME_ICON                      '\\u'$CODEPOINT_OF_AWESOME_HOME                 # \n      HOME_SUB_ICON                  '\\u'$CODEPOINT_OF_AWESOME_FOLDER_OPEN          # \n      FOLDER_ICON                    '\\u'$CODEPOINT_OF_AWESOME_FOLDER_O             # \n      ETC_ICON                       '\\u'$CODEPOINT_OF_AWESOME_COG' '               # \n      NETWORK_ICON                   '\\u'$CODEPOINT_OF_AWESOME_RSS                  # \n      LOAD_ICON                      '\\u'$CODEPOINT_OF_AWESOME_BAR_CHART' '         # \n      SWAP_ICON                      '\\u'$CODEPOINT_OF_AWESOME_DASHBOARD            # \n      RAM_ICON                       '\\u'$CODEPOINT_OF_AWESOME_DASHBOARD            # \n      SERVER_ICON                    '\\u'$CODEPOINT_OF_AWESOME_SERVER               # \n      VCS_UNTRACKED_ICON             '\\u'$CODEPOINT_OF_AWESOME_QUESTION_CIRCLE      # \n      VCS_UNSTAGED_ICON              '\\u'$CODEPOINT_OF_AWESOME_EXCLAMATION_CIRCLE   # \n      VCS_STAGED_ICON                '\\u'$CODEPOINT_OF_AWESOME_PLUS_CIRCLE          # \n      VCS_STASH_ICON                 '\\u'$CODEPOINT_OF_AWESOME_INBOX' '             # \n      VCS_INCOMING_CHANGES_ICON      '\\u'$CODEPOINT_OF_AWESOME_ARROW_CIRCLE_DOWN' ' # \n      VCS_OUTGOING_CHANGES_ICON      '\\u'$CODEPOINT_OF_AWESOME_ARROW_CIRCLE_UP' '   # \n      VCS_TAG_ICON                   '\\u'$CODEPOINT_OF_AWESOME_TAG' '               # \n      VCS_BOOKMARK_ICON              '\\u'$CODEPOINT_OF_OCTICONS_BOOKMARK            # \n      VCS_COMMIT_ICON                '\\u'$CODEPOINT_OF_OCTICONS_GIT_COMMIT' '       # \n      VCS_BRANCH_ICON                '\\u'$CODEPOINT_OF_OCTICONS_GIT_BRANCH' '       # \n      VCS_REMOTE_BRANCH_ICON         '\\u'$CODEPOINT_OF_OCTICONS_REPO_PUSH           # \n      VCS_GIT_ICON                   '\\u'$CODEPOINT_OF_AWESOME_GIT' '               # \n      VCS_GIT_GITHUB_ICON            '\\u'$CODEPOINT_OF_AWESOME_GITHUB_ALT' '        # \n      VCS_GIT_BITBUCKET_ICON         '\\u'$CODEPOINT_OF_AWESOME_BITBUCKET' '         # \n      VCS_GIT_GITLAB_ICON            '\\u'$CODEPOINT_OF_AWESOME_GITLAB' '            # \n      VCS_HG_ICON                    '\\u'$CODEPOINT_OF_AWESOME_FLASK' '             # \n      VCS_SVN_ICON                   '(svn) '\n      RUST_ICON                      $'\\uE6A8'                                      # \n      PYTHON_ICON                    $'\\U1F40D'                                     # 🐍\n      SWIFT_ICON                     $'\\uE655'                                      # \n      PUBLIC_IP_ICON                 '\\u'$CODEPOINT_OF_AWESOME_GLOBE                # \n      LOCK_ICON                      '\\u'$CODEPOINT_OF_AWESOME_LOCK                 # \n      EXECUTION_TIME_ICON            '\\u'$CODEPOINT_OF_AWESOME_HOURGLASS_END        # \n      SSH_ICON                       '(ssh)'\n      VPN_ICON                       '\\u'$CODEPOINT_OF_AWESOME_LOCK\n      KUBERNETES_ICON                $'\\U2388'                                      # ⎈\n      DROPBOX_ICON                   '\\u'$CODEPOINT_OF_AWESOME_DROPBOX              # \n      DATE_ICON                      $'\\uF073 '                                     # \n      TIME_ICON                      $'\\uF017 '                                     # \n      JAVA_ICON                      $'\\U2615'              # ☕︎\n      LARAVEL_ICON                   ''\n    )\n  ;;\n  'nerdfont-complete'|'nerdfont-fontconfig')\n    # nerd-font patched (complete) font required! See\n    # https://github.com/ryanoasis/nerd-fonts\n    # http://nerdfonts.com/#cheat-sheet\n    # Set the right locale to protect special characters\n    local LC_ALL=\"\" LC_CTYPE=\"en_US.UTF-8\"\n    icons=(\n      LEFT_SEGMENT_SEPARATOR         $'\\uE0B0'              # \n      RIGHT_SEGMENT_SEPARATOR        $'\\uE0B2'              # \n      LEFT_SEGMENT_END_SEPARATOR     ' '                    # Whitespace\n      LEFT_SUBSEGMENT_SEPARATOR      $'\\uE0B1'              # \n      RIGHT_SUBSEGMENT_SEPARATOR     $'\\uE0B3'              # \n      CARRIAGE_RETURN_ICON           $'\\u21B5'              # ↵\n      ROOT_ICON                      $'\\uE614 '             # \n      SUDO_ICON                      $'\\uF09C'              # \n      RUBY_ICON                      $'\\uF219 '             # \n      AWS_ICON                       $'\\uF270'              # \n      AWS_EB_ICON                    $'\\UF1BD  '            # \n      BACKGROUND_JOBS_ICON           $'\\uF013 '             # \n      TEST_ICON                      $'\\uF188'              # \n      TODO_ICON                      $'\\uF133'              # \n      BATTERY_ICON                   $'\\UF240 '             # \n      DISK_ICON                      $'\\uF0A0'              # \n      OK_ICON                        $'\\uF00C'              # \n      FAIL_ICON                      $'\\uF00D'              # \n      SYMFONY_ICON                   $'\\uE757'              # \n      NODE_ICON                      $'\\uE617 '             # \n      MULTILINE_FIRST_PROMPT_PREFIX  $'\\u256D'$'\\U2500'     # ╭─\n      MULTILINE_NEWLINE_PROMPT_PREFIX  $'\\u251C'$'\\U2500'   # ├─\n      MULTILINE_LAST_PROMPT_PREFIX   $'\\u2570'$'\\U2500 '    # ╰─\n      APPLE_ICON                     $'\\uF179'              # \n      WINDOWS_ICON                   $'\\uF17A'              # \n      FREEBSD_ICON                   $'\\UF30C '             # \n      ANDROID_ICON                   $'\\uF17B'              # \n      LINUX_ARCH_ICON                $'\\uF303'              # \n      LINUX_CENTOS_ICON              $'\\uF304'              # \n      LINUX_COREOS_ICON              $'\\uF305'              # \n      LINUX_DEBIAN_ICON              $'\\uF306'              # \n      LINUX_ELEMENTARY_ICON          $'\\uF309'              # \n      LINUX_FEDORA_ICON              $'\\uF30a'              # \n      LINUX_GENTOO_ICON              $'\\uF30d'              # \n      LINUX_MAGEIA_ICON              $'\\uF310'              # \n      LINUX_MINT_ICON                $'\\uF30e'              # \n      LINUX_NIXOS_ICON               $'\\uF313'              # \n      LINUX_MANJARO_ICON             $'\\uF312'              # \n      LINUX_DEVUAN_ICON              $'\\uF307'              # \n      LINUX_ALPINE_ICON              $'\\uF300'              # \n      LINUX_AOSC_ICON                $'\\uF301'              # \n      LINUX_OPENSUSE_ICON            $'\\uF314'              # \n      LINUX_SABAYON_ICON             $'\\uF317'              # \n      LINUX_SLACKWARE_ICON           $'\\uF319'              # \n      LINUX_UBUNTU_ICON              $'\\uF31b'              # \n      LINUX_ICON                     $'\\uF17C'              # \n      SUNOS_ICON                     $'\\uF185 '             # \n      HOME_ICON                      $'\\uF015'              # \n      HOME_SUB_ICON                  $'\\uF07C'              # \n      FOLDER_ICON                    $'\\uF115'              # \n      ETC_ICON                       $'\\uF013'              # \n      NETWORK_ICON                   $'\\uF1EB'              # \n      LOAD_ICON                      $'\\uF080 '             # \n      SWAP_ICON                      $'\\uF464'              # \n      RAM_ICON                       $'\\uF0E4'              # \n      SERVER_ICON                    $'\\uF0AE'              # \n      VCS_UNTRACKED_ICON             $'\\uF059'              # \n      VCS_UNSTAGED_ICON              $'\\uF06A'              # \n      VCS_STAGED_ICON                $'\\uF055'              # \n      VCS_STASH_ICON                 $'\\uF01C '             # \n      VCS_INCOMING_CHANGES_ICON      $'\\uF01A '             # \n      VCS_OUTGOING_CHANGES_ICON      $'\\uF01B '             # \n      VCS_TAG_ICON                   $'\\uF02B '             # \n      VCS_BOOKMARK_ICON              $'\\uF461 '             # \n      VCS_COMMIT_ICON                $'\\uE729 '             # \n      VCS_BRANCH_ICON                $'\\uF126 '             # \n      VCS_REMOTE_BRANCH_ICON         $'\\uE728 '             # \n      VCS_GIT_ICON                   $'\\uF1D3 '             # \n      VCS_GIT_GITHUB_ICON            $'\\uF113 '             # \n      VCS_GIT_BITBUCKET_ICON         $'\\uE703 '             # \n      VCS_GIT_GITLAB_ICON            $'\\uF296 '             # \n      VCS_HG_ICON                    $'\\uF0C3 '             # \n      VCS_SVN_ICON                   $'\\uE72D '             # \n      RUST_ICON                      $'\\uE7A8 '             # \n      PYTHON_ICON                    $'\\UE73C '             # \n      SWIFT_ICON                     $'\\uE755'              # \n      GO_ICON                        $'\\uE626'              # \n      PUBLIC_IP_ICON                 $'\\UF0AC'              # \n      LOCK_ICON                      $'\\UF023'              # \n      EXECUTION_TIME_ICON            $'\\uF252'              # \n      SSH_ICON                       $'\\uF489'              # \n      VPN_ICON                       '(vpn)'\n      KUBERNETES_ICON                $'\\U2388'              # ⎈\n      DROPBOX_ICON                   $'\\UF16B'              # \n      DATE_ICON                      $'\\uF073 '             # \n      TIME_ICON                      $'\\uF017 '             # \n      JAVA_ICON                      $'\\U2615'              # ☕︎\n      LARAVEL_ICON                   $'\\ue73f '             # \n    )\n  ;;\n  *)\n    # Powerline-Patched Font required!\n    # See https://github.com/Lokaltog/powerline-fonts\n    # Set the right locale to protect special characters\n    local LC_ALL=\"\" LC_CTYPE=\"en_US.UTF-8\"\n    icons=(\n      LEFT_SEGMENT_SEPARATOR         $'\\uE0B0'              # \n      RIGHT_SEGMENT_SEPARATOR        $'\\uE0B2'              # \n      LEFT_SEGMENT_END_SEPARATOR     ' '                    # Whitespace\n      LEFT_SUBSEGMENT_SEPARATOR      $'\\uE0B1'              # \n      RIGHT_SUBSEGMENT_SEPARATOR     $'\\uE0B3'              # \n      CARRIAGE_RETURN_ICON           $'\\u21B5'              # ↵\n      ROOT_ICON                      $'\\u26A1'              # ⚡\n      SUDO_ICON                      $'\\uE0A2'              # \n      RUBY_ICON                      ''\n      AWS_ICON                       'AWS:'\n      AWS_EB_ICON                    $'\\U1F331 '            # 🌱\n      BACKGROUND_JOBS_ICON           $'\\u2699'              # ⚙\n      TEST_ICON                      ''\n      TODO_ICON                      $'\\u2611'              # ☑\n      BATTERY_ICON                   $'\\U1F50B'             # 🔋\n      DISK_ICON                      $'hdd '\n      OK_ICON                        $'\\u2714'              # ✔\n      FAIL_ICON                      $'\\u2718'              # ✘\n      SYMFONY_ICON                   'SF'\n      NODE_ICON                      $'\\u2B22'              # ⬢\n      MULTILINE_FIRST_PROMPT_PREFIX  $'\\u256D'$'\\U2500'     # ╭─\n      MULTILINE_NEWLINE_PROMPT_PREFIX  $'\\u251C'$'\\U2500'   # ├─\n      MULTILINE_LAST_PROMPT_PREFIX   $'\\u2570'$'\\U2500 '    # ╰─\n      APPLE_ICON                     'OSX'\n      WINDOWS_ICON                   'WIN'\n      FREEBSD_ICON                   'BSD'\n      ANDROID_ICON                   'And'\n      LINUX_ICON                     'Lx'\n      LINUX_ARCH_ICON                'Arc'\n      LINUX_DEBIAN_ICON              'Deb'\n      LINUX_UBUNTU_ICON              'Ubu'\n      LINUX_CENTOS_ICON              'Cen'\n      LINUX_COREOS_ICON              'Cor'\n      LINUX_ELEMENTARY_ICON          'Elm'\n      LINUX_MINT_ICON                'LMi'\n      LINUX_FEDORA_ICON              'Fed'\n      LINUX_GENTOO_ICON              'Gen'\n      LINUX_MAGEIA_ICON              'Mag'\n      LINUX_NIXOS_ICON               'Nix'\n      LINUX_MANJARO_ICON             'Man'\n      LINUX_DEVUAN_ICON              'Dev'\n      LINUX_ALPINE_ICON              'Alp'\n      LINUX_AOSC_ICON                'Aos'\n      LINUX_OPENSUSE_ICON            'OSu'\n      LINUX_SABAYON_ICON             'Sab'\n      LINUX_SLACKWARE_ICON           'Sla'\n      SUNOS_ICON                     'Sun'\n      HOME_ICON                      ''\n      HOME_SUB_ICON                  ''\n      FOLDER_ICON                    ''\n      ETC_ICON                       $'\\u2699'              # ⚙\n      NETWORK_ICON                   'IP'\n      LOAD_ICON                      'L'\n      SWAP_ICON                      'SWP'\n      RAM_ICON                       'RAM'\n      SERVER_ICON                    ''\n      VCS_UNTRACKED_ICON             '?'\n      VCS_UNSTAGED_ICON              $'\\u25CF'              # ●\n      VCS_STAGED_ICON                $'\\u271A'              # ✚\n      VCS_STASH_ICON                 $'\\u235F'              # ⍟\n      VCS_INCOMING_CHANGES_ICON      $'\\u2193'              # ↓\n      VCS_OUTGOING_CHANGES_ICON      $'\\u2191'              # ↑\n      VCS_TAG_ICON                   ''\n      VCS_BOOKMARK_ICON              $'\\u263F'              # ☿\n      VCS_COMMIT_ICON                ''\n      VCS_BRANCH_ICON                $'\\uE0A0 '             # \n      VCS_REMOTE_BRANCH_ICON         $'\\u2192'              # →\n      VCS_GIT_ICON                   ''\n      VCS_GIT_GITHUB_ICON            ''\n      VCS_GIT_BITBUCKET_ICON         ''\n      VCS_GIT_GITLAB_ICON            ''\n      VCS_HG_ICON                    ''\n      VCS_SVN_ICON                   ''\n      RUST_ICON                      'Rust'\n      PYTHON_ICON                    ''\n      SWIFT_ICON                     'Swift'\n      GO_ICON                        'Go'\n      PUBLIC_IP_ICON                 ''\n      LOCK_ICON                      $'\\UE0A2'\n      EXECUTION_TIME_ICON            'Dur'\n      SSH_ICON                       '(ssh)'\n      VPN_ICON                       '(vpn)'\n      KUBERNETES_ICON                $'\\U2388'              # ⎈\n      DROPBOX_ICON                   'Dropbox'\n      DATE_ICON                      ''\n      TIME_ICON                      ''\n      JAVA_ICON                      $'\\U2615'              # ☕︎\n      LARAVEL_ICON                   ''\n    )\n  ;;\nesac\n\n# Override the above icon settings with any user-defined variables.\ncase $POWERLEVEL9K_MODE in\n  'flat')\n    # Set the right locale to protect special characters\n    local LC_ALL=\"\" LC_CTYPE=\"en_US.UTF-8\"\n    icons[LEFT_SEGMENT_SEPARATOR]=''\n    icons[RIGHT_SEGMENT_SEPARATOR]=''\n    icons[LEFT_SUBSEGMENT_SEPARATOR]='|'\n    icons[RIGHT_SUBSEGMENT_SEPARATOR]='|'\n  ;;\n  'compatible')\n    # Set the right locale to protect special characters\n    local LC_ALL=\"\" LC_CTYPE=\"en_US.UTF-8\"\n    icons[LEFT_SEGMENT_SEPARATOR]=$'\\u2B80'                 # ⮀\n    icons[RIGHT_SEGMENT_SEPARATOR]=$'\\u2B82'                # ⮂\n    icons[VCS_BRANCH_ICON]='@'\n  ;;\nesac\n\nif [[ \"$POWERLEVEL9K_HIDE_BRANCH_ICON\" == true ]]; then\n    icons[VCS_BRANCH_ICON]=''\nfi\n}\n\n# Safety function for printing icons\n# Prints the named icon, or if that icon is undefined, the string name.\nfunction print_icon() {\n  local icon_name=$1\n  local ICON_USER_VARIABLE=POWERLEVEL9K_${icon_name}\n  if defined \"$ICON_USER_VARIABLE\"; then\n    echo -n \"${(P)ICON_USER_VARIABLE}\"\n  else\n    echo -n \"${icons[$icon_name]}\"\n  fi\n}\n\n# Get a list of configured icons\n#   * $1 string - If \"original\", then the original icons are printed,\n#                 otherwise \"print_icon\" is used, which takes the users\n#                 overrides into account.\nget_icon_names() {\n  # Iterate over a ordered list of keys of the icons array\n  for key in ${(@kon)icons}; do\n    echo -n \"POWERLEVEL9K_$key: \"\n    if [[ \"${1}\" == \"original\" ]]; then\n      # print the original icons as they are defined in the array above\n      echo \"${icons[$key]}\"\n    else\n      # print the icons as they are configured by the user\n      echo \"$(print_icon \"$key\")\"\n    fi\n  done\n}\n"
  },
  {
    "path": "functions/utilities.zsh",
    "content": "# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n################################################################\n# Utility functions\n# This file holds some utility-functions for\n# the powerlevel9k-ZSH-theme\n# https://github.com/bhilburn/powerlevel9k\n################################################################\n\n# Exits with 0 if a variable has been previously defined (even if empty)\n# Takes the name of a variable that should be checked.\nfunction defined() {\n  [[ ! -z \"${(tP)1}\" ]]\n}\n\n# Given the name of a variable and a default value, sets the variable\n# value to the default only if it has not been defined.\n#\n# Typeset cannot set the value for an array, so this will only work\n# for scalar values.\nfunction set_default() {\n  local varname=\"$1\"\n  local default_value=\"$2\"\n\n  defined \"$varname\" || typeset -g \"$varname\"=\"$default_value\"\n}\n\n# Converts large memory values into a human-readable unit (e.g., bytes --> GB)\n# Takes two arguments:\n#   * $size - The number which should be prettified\n#   * $base - The base of the number (default Bytes)\nprintSizeHumanReadable() {\n  typeset -F 2 size\n  size=\"$1\"+0.00001\n  local extension\n  extension=('B' 'K' 'M' 'G' 'T' 'P' 'E' 'Z' 'Y')\n  local index=1\n\n  # if the base is not Bytes\n  if [[ -n $2 ]]; then\n    local idx\n    for idx in \"${extension[@]}\"; do\n      if [[ \"$2\" == \"$idx\" ]]; then\n        break\n      fi\n      index=$(( index + 1 ))\n    done\n  fi\n\n  while (( (size / 1024) > 0.1 )); do\n    size=$(( size / 1024 ))\n    index=$(( index + 1 ))\n  done\n\n  echo \"$size${extension[$index]}\"\n}\n\n# Gets the first value out of a list of items that is not empty.\n# The items are examined by a callback-function.\n# Takes two arguments:\n#   * $list - A list of items\n#   * $callback - A callback function to examine if the item is\n#                 worthy. The callback function has access to\n#                 the inner variable $item.\nfunction getRelevantItem() {\n  local -a list\n  local callback\n  # Explicitly split the elements by whitespace.\n  list=(${=1})\n  callback=$2\n\n  for item in $list; do\n    # The first non-empty item wins\n    try=$(eval \"$callback\")\n    if [[ -n \"$try\" ]]; then\n      echo \"$try\"\n      break;\n    fi\n  done\n}\n\n# OS detection\ncase $(uname) in\n    Darwin)\n      OS='OSX'\n      OS_ICON=$(print_icon 'APPLE_ICON')\n      ;;\n    CYGWIN_NT-* | MSYS_NT-*)\n      OS='Windows'\n      OS_ICON=$(print_icon 'WINDOWS_ICON')\n      ;;\n    FreeBSD)\n      OS='BSD'\n      OS_ICON=$(print_icon 'FREEBSD_ICON')\n      ;;\n    OpenBSD)\n      OS='BSD'\n      OS_ICON=$(print_icon 'FREEBSD_ICON')\n      ;;\n    DragonFly)\n      OS='BSD'\n      OS_ICON=$(print_icon 'FREEBSD_ICON')\n      ;;\n    Linux)\n      OS='Linux'\n      if [ -f /etc/os-release ]; then\n        [[ ${(f)\"$((</etc/os-release) 2>/dev/null)\"} =~ \"ID=([A-Za-z]+)\" ]] && os_release_id=\"${match[1]}\"\n      fi\n      case \"$os_release_id\" in\n        *arch*)\n        OS_ICON=$(print_icon 'LINUX_ARCH_ICON')\n        ;;\n        *debian*)\n        OS_ICON=$(print_icon 'LINUX_DEBIAN_ICON')\n        ;;\n       *ubuntu*)\n        OS_ICON=$(print_icon 'LINUX_UBUNTU_ICON')\n        ;;\n       *elementary*)\n        OS_ICON=$(print_icon 'LINUX_ELEMENTARY_ICON')\n        ;;\n       *fedora*)\n        OS_ICON=$(print_icon 'LINUX_FEDORA_ICON')\n        ;;\n       *coreos*)\n        OS_ICON=$(print_icon 'LINUX_COREOS_ICON')\n        ;;\n       *gentoo*)\n        OS_ICON=$(print_icon 'LINUX_GENTOO_ICON')\n        ;;\n       *mageia*)\n        OS_ICON=$(print_icon 'LINUX_MAGEIA_ICON')\n        ;;\n       *centos*)\n        OS_ICON=$(print_icon 'LINUX_CENTOS_ICON')\n        ;;\n       *opensuse*|*tumbleweed*)\n        OS_ICON=$(print_icon 'LINUX_OPENSUSE_ICON')\n        ;;\n       *sabayon*)\n        OS_ICON=$(print_icon 'LINUX_SABAYON_ICON')\n        ;;\n       *slackware*)\n        OS_ICON=$(print_icon 'LINUX_SLACKWARE_ICON')\n        ;;\n       *linuxmint*)\n        OS_ICON=$(print_icon 'LINUX_MINT_ICON')\n        ;;\n       *alpine*)\n        OS_ICON=$(print_icon 'LINUX_ALPINE_ICON')\n        ;;\n       *aosc*)\n        OS_ICON=$(print_icon 'LINUX_AOSC_ICON')\n        ;;\n       *nixos*)\n        OS_ICON=$(print_icon 'LINUX_NIXOS_ICON')\n        ;;\n       *devuan*)\n        OS_ICON=$(print_icon 'LINUX_DEVUAN_ICON')\n        ;;\n       *manjaro*)\n        OS_ICON=$(print_icon 'LINUX_MANJARO_ICON')\n        ;;\n        *)\n        OS='Linux'\n        OS_ICON=$(print_icon 'LINUX_ICON')\n        ;;\n      esac\n\n      # Check if we're running on Android\n      case $(uname -o 2>/dev/null) in\n        Android)\n          OS='Android'\n          OS_ICON=$(print_icon 'ANDROID_ICON')\n          ;;\n      esac\n      ;;\n    SunOS)\n      OS='Solaris'\n      OS_ICON=$(print_icon 'SUNOS_ICON')\n      ;;\n    *)\n      OS=''\n      OS_ICON=''\n      ;;\nesac\n\n# Determine the correct sed parameter.\n#\n# `sed` is unfortunately not consistent across OSes when it comes to flags.\nSED_EXTENDED_REGEX_PARAMETER=\"-r\"\nif [[ \"$OS\" == 'OSX' ]]; then\n  local IS_BSD_SED=\"$(sed --version &>> /dev/null || echo \"BSD sed\")\"\n  if [[ -n \"$IS_BSD_SED\" ]]; then\n    SED_EXTENDED_REGEX_PARAMETER=\"-E\"\n  fi\nfi\n\n# Determine if the passed segment is used in the prompt\n#\n# Pass the name of the segment to this function to test for its presence in\n# either the LEFT or RIGHT prompt arrays.\n#    * $1: The segment to be tested.\nsegment_in_use() {\n    local key=$1\n    [[ -n \"${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[(r)${key}]}\" ||\n     -n \"${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[(r)${key}_joined]}\" ||\n     -n \"${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[(r)${key}]}\" ||\n     -n \"${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[(r)${key}_joined]}\" ]]\n}\n\n# Print a deprecation warning if an old segment is in use.\n# Takes the name of an associative array that contains the\n# deprecated segments as keys, the values contain the new\n# segment names.\nprint_deprecation_warning() {\n  typeset -AH raw_deprecated_segments\n  raw_deprecated_segments=(${(kvP@)1})\n\n  for key in ${(@k)raw_deprecated_segments}; do\n    if segment_in_use $key; then\n      # segment is deprecated\n      print -P \"%F{yellow}Warning!%f The '$key' segment is deprecated. Use '%F{blue}${raw_deprecated_segments[$key]}%f' instead. For more informations, have a look at the CHANGELOG.md.\"\n    fi\n  done\n}\n\n# A helper function to determine if a segment should be\n# joined or promoted to a full one.\n# Takes three arguments:\n#   * $1: The array index of the current segment\n#   * $2: The array index of the last printed segment\n#   * $3: The array of segments of the left or right prompt\nfunction segmentShouldBeJoined() {\n  local current_index=$1\n  local last_segment_index=$2\n  # Explicitly split the elements by whitespace.\n  local -a elements\n  elements=(${=3})\n\n  local current_segment=${elements[$current_index]}\n  local joined=false\n  if [[ ${current_segment[-7,-1]} == '_joined' ]]; then\n    joined=true\n    # promote segment to a full one, if the predecessing full segment\n    # was conditional. So this can only be the case for segments that\n    # are not our direct predecessor.\n    if (( $(($current_index - $last_segment_index)) > 1)); then\n      # Now we have to examine every previous segment, until we reach\n      # the last printed one (found by its index). This is relevant if\n      # all previous segments are joined. Then we want to join our\n      # segment as well.\n      local examined_index=$((current_index - 1))\n      while (( $examined_index > $last_segment_index )); do\n        local previous_segment=${elements[$examined_index]}\n        # If one of the examined segments is not joined, then we know\n        # that the current segment should not be joined, as the target\n        # segment is the wrong one.\n        if [[ ${previous_segment[-7,-1]} != '_joined' ]]; then\n          joined=false\n          break\n        fi\n        examined_index=$((examined_index - 1))\n      done\n    fi\n  fi\n\n  # Return 1 means error; return 0 means no error. So we have\n  # to invert $joined\n  if [[ \"$joined\" == \"true\" ]]; then\n    return 0\n  else\n    return 1\n  fi\n}\n\n################################################################\n# Given a directory path, truncate it according to the settings.\n# Parameters:\n#   * $1 Path: string - the directory path to be truncated\n#   * $2 Length: integer - length to truncate to\n#   * $3 Delimiter: string - the delimiter to use\n#   * $4 From: string - \"right\" | \"middle\". If omited, assumes right.\nfunction truncatePath() {\n  # if the current path is not 1 character long (e.g. \"/\" or \"~\")\n  if (( ${#1} > 1 )); then\n    # convert $2 from string to integer\n    2=$(( $2 ))\n    # set $3 to \"\" if not defined\n    [[ -z $3 ]] && 3=\"\" || 3=$(echo -n $3)\n    # set $4 to \"right\" if not defined\n    [[ -z $4 ]] && 4=\"right\"\n    # create a variable for the truncated path.\n    local trunc_path\n    # if the path is in the home folder, add \"~/\" to the start otherwise \"/\"\n    [[ $1 == \"~\"* ]] && trunc_path='~/' || trunc_path='/'\n    # split the path into an array using \"/\" as the delimiter\n    local paths=$1\n    paths=(${(s:/:)${paths//\"~\\/\"/}})\n    # declare locals for the directory being tested and its length\n    local test_dir test_dir_length\n    # do the needed truncation\n    case $4 in\n      right)\n        # include the delimiter length in the threshhold\n        local threshhold=$(( $2 + ${#3} ))\n        # loop through the paths\n        for (( i=1; i<${#paths}; i++ )); do\n          # get the current directory value\n          test_dir=$paths[$i]\n          test_dir_length=${#test_dir}\n          # only truncate if the resulting truncation will be shorter than\n          # the truncation + delimiter length and at least 3 characters\n          if (( $test_dir_length > $threshhold )) && (( $test_dir_length > 3 )); then\n            # use the first $2 characters and the delimiter\n            trunc_path+=\"${test_dir:0:$2}$3/\"\n          else\n            # use the full path\n            trunc_path+=\"${test_dir}/\"\n          fi\n        done\n      ;;\n      middle)\n        # we need double the length for start and end truncation + delimiter length\n        local threshhold=$(( $2 * 2 ))\n        # create a variable for the start of the end truncation\n        local last_pos\n        # loop through the paths\n        for (( i=1; i<${#paths}; i++ )); do\n          # get the current directory value\n          test_dir=$paths[$i]\n          test_dir_length=${#test_dir}\n          # only truncate if the resulting truncation will be shorter than\n          # the truncation + delimiter length\n          if (( $test_dir_length > $threshhold )); then\n            # use the first $2 characters, the delimiter and the last $2 characters\n            last_pos=$(( $test_dir_length - $2 ))\n            trunc_path+=\"${test_dir:0:$2}$3${test_dir:$last_pos:$test_dir_length}/\"\n          else\n            # use the full path\n            trunc_path+=\"${test_dir}/\"\n          fi\n        done\n      ;;\n    esac\n    # return the truncated path + the current directory\n    echo $trunc_path${1:t}\n  else # current path is 1 character long (e.g. \"/\" or \"~\")\n    echo $1\n  fi\n}\n\n# Given a directory path, truncate it according to the settings for\n# `truncate_from_right`\nfunction truncatePathFromRight() {\n  local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER:-1}\n  echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER \\\n \"s@(([^/]{$((POWERLEVEL9K_SHORTEN_DIR_LENGTH))})([^/]{$delim_len}))[^/]+/@\\2$POWERLEVEL9K_SHORTEN_DELIMITER/@g\"\n}\n\n# Search recursively in parent folders for given file.\nfunction upsearch () {\n  if [[ \"$PWD\" == \"$HOME\" || \"$PWD\" == \"/\" ]]; then\n    echo \"$PWD\"\n  elif test -e \"$1\"; then\n    pushd .. > /dev/null\n    upsearch \"$1\"\n    popd > /dev/null\n    echo \"$PWD\"\n  else\n    pushd .. > /dev/null\n    upsearch \"$1\"\n    popd > /dev/null\n  fi\n}\n\n# Parse IP address from ifconfig on OSX and from IP on Linux\n# Parameters:\n#  $1 - string The desired Interface\n#  $2 - string A root prefix for testing purposes\nfunction p9k::parseIp() {\n  local desiredInterface=\"${1}\"\n\n  if [[ -z \"${desiredInterface}\" ]]; then\n    desiredInterface=\"^[^ ]+\"\n  fi\n\n  local ROOT_PREFIX=\"${2}\"\n  if [[ \"$OS\" == \"OSX\" ]]; then\n    # Get a plain list of all interfaces\n    local rawInterfaces=\"$(${ROOT_PREFIX}/sbin/ifconfig -l 2>/dev/null)\"\n    # Parse into array (split by whitespace)\n    local -a interfaces\n    interfaces=(${=rawInterfaces})\n    # Parse only relevant interface names\n    local pattern=\"${desiredInterface}[^ ]?\"\n    local -a relevantInterfaces\n    for rawInterface in $interfaces; do\n      [[ \"$rawInterface\" =~ $pattern ]] && relevantInterfaces+=( $MATCH )\n    done\n    local newline=$'\\n'\n    for interfaceName in $relevantInterfaces; do\n      local interface=\"$(${ROOT_PREFIX}/sbin/ifconfig $interfaceName 2>/dev/null)\"\n      if [[ \"${interface}\" =~ \"lo[0-9]*\" ]]; then\n        continue\n      fi\n      # Check if interface is UP.\n      if [[ \"${interface//${newline}/}\" =~ \"<([^>]*)>(.*)inet[ ]+([^ ]*)\" ]]; then\n        local ipFound=\"${match[3]}\"\n        local -a interfaceStates=(${(s:,:)match[1]})\n        if [[ \"${interfaceStates[(r)UP]}\" == \"UP\" ]]; then\n          echo \"${ipFound}\"\n          return 0\n        fi\n      fi\n    done\n  else\n    local -a interfaces\n    interfaces=( \"${(f)$(${ROOT_PREFIX}/sbin/ip -brief -4 a show 2>/dev/null)}\" )\n    local pattern=\"^${desiredInterface}[ ]+UP[ ]+([^/ ]+)\"\n    for interface in \"${(@)interfaces}\"; do\n      if [[ \"$interface\" =~ $pattern ]]; then\n        echo \"${match[1]}\"\n        return 0\n      fi\n    done\n  fi\n\n  return 1\n}\n"
  },
  {
    "path": "functions/vcs.zsh",
    "content": "# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n################################################################\n# vcs\n# This file holds supplemental VCS functions\n# for the powerlevel9k-ZSH-theme\n# https://github.com/bhilburn/powerlevel9k\n################################################################\n\nset_default POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY false\nfunction +vi-git-untracked() {\n  [[ -z \"${vcs_comm[gitdir]}\" || \"${vcs_comm[gitdir]}\" == \".\" ]] && return\n\n  # get the root for the current repo or submodule\n  local repoTopLevel=\"$(command git rev-parse --show-toplevel 2> /dev/null)\"\n  # dump out if we're outside a git repository (which includes being in the .git folder)\n  [[ $? != 0 || -z $repoTopLevel ]] && return\n\n  local untrackedFiles=$(command git ls-files --others --exclude-standard \"${repoTopLevel}\" 2> /dev/null)\n\n  if [[ -z $untrackedFiles && \"$POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY\" == \"true\" ]]; then\n    untrackedFiles+=$(command git submodule foreach --quiet --recursive 'command git ls-files --others --exclude-standard' 2> /dev/null)\n  fi\n\n  [[ -z $untrackedFiles ]] && return\n\n  hook_com[unstaged]+=\" $(print_icon 'VCS_UNTRACKED_ICON')\"\n  VCS_WORKDIR_HALF_DIRTY=true\n}\n\nfunction +vi-git-aheadbehind() {\n    local ahead behind\n    local -a gitstatus\n\n    # for git prior to 1.7\n    # ahead=$(command git rev-list origin/${hook_com[branch]}..HEAD | wc -l)\n    ahead=$(command git rev-list --count \"${hook_com[branch]}\"@{upstream}..HEAD 2>/dev/null)\n    (( ahead )) && gitstatus+=( \" $(print_icon 'VCS_OUTGOING_CHANGES_ICON')${ahead// /}\" )\n\n    # for git prior to 1.7\n    # behind=$(command git rev-list HEAD..origin/${hook_com[branch]} | wc -l)\n    behind=$(command git rev-list --count HEAD..\"${hook_com[branch]}\"@{upstream} 2>/dev/null)\n    (( behind )) && gitstatus+=( \" $(print_icon 'VCS_INCOMING_CHANGES_ICON')${behind// /}\" )\n\n    hook_com[misc]+=${(j::)gitstatus}\n}\n\nfunction +vi-git-remotebranch() {\n    local remote\n    local branch_name=\"${hook_com[branch]}\"\n\n    # Are we on a remote-tracking branch?\n    remote=${$(command git rev-parse --verify HEAD@{upstream} --symbolic-full-name 2>/dev/null)/refs\\/(remotes|heads)\\/}\n\n    if [[ -n \"$POWERLEVEL9K_VCS_SHORTEN_LENGTH\" ]] && [[ -n \"$POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH\" ]]; then\n     set_default POWERLEVEL9K_VCS_SHORTEN_DELIMITER $'\\U2026'\n\n     if [ ${#hook_com[branch]} -gt ${POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH} ] && [ ${#hook_com[branch]} -gt ${POWERLEVEL9K_VCS_SHORTEN_LENGTH} ]; then\n       case \"$POWERLEVEL9K_VCS_SHORTEN_STRATEGY\" in\n         truncate_middle)\n           hook_com[branch]=\"${branch_name:0:$POWERLEVEL9K_VCS_SHORTEN_LENGTH}${POWERLEVEL9K_VCS_SHORTEN_DELIMITER}${branch_name: -$POWERLEVEL9K_VCS_SHORTEN_LENGTH}\"\n         ;;\n         truncate_from_right)\n           hook_com[branch]=\"${branch_name:0:$POWERLEVEL9K_VCS_SHORTEN_LENGTH}${POWERLEVEL9K_VCS_SHORTEN_DELIMITER}\"\n         ;;\n       esac\n     fi\n    fi\n\n    hook_com[branch]=\"$(print_icon 'VCS_BRANCH_ICON')${hook_com[branch]}\"\n    # Always show the remote\n    #if [[ -n ${remote} ]] ; then\n    # Only show the remote if it differs from the local\n    if [[ -n ${remote} ]] && [[ \"${remote#*/}\" != \"${branch_name}\" ]] ; then\n        hook_com[branch]+=\"$(print_icon 'VCS_REMOTE_BRANCH_ICON')${remote// /}\"\n    fi\n}\n\nset_default POWERLEVEL9K_VCS_HIDE_TAGS false\nfunction +vi-git-tagname() {\n    if [[ \"$POWERLEVEL9K_VCS_HIDE_TAGS\" == \"false\" ]]; then\n        # If we are on a tag, append the tagname to the current branch string.\n        local tag\n        tag=$(command git describe --tags --exact-match HEAD 2>/dev/null)\n\n        if [[ -n \"${tag}\" ]] ; then\n            # There is a tag that points to our current commit. Need to determine if we\n            # are also on a branch, or are in a DETACHED_HEAD state.\n            if [[ -z $(command git symbolic-ref HEAD 2>/dev/null) ]]; then\n                # DETACHED_HEAD state. We want to append the tag name to the commit hash\n                # and print it. Unfortunately, `vcs_info` blows away the hash when a tag\n                # exists, so we have to manually retrieve it and clobber the branch\n                # string.\n                local revision\n                revision=$(command git rev-list -n 1 --abbrev-commit --abbrev=${POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH} HEAD)\n                hook_com[branch]=\"$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}\"\n            else\n                # We are on both a tag and a branch; print both by appending the tag name.\n                hook_com[branch]+=\" $(print_icon 'VCS_TAG_ICON')${tag}\"\n            fi\n        fi\n    fi\n}\n\n# Show count of stashed changes\n# Port from https://github.com/whiteinge/dotfiles/blob/5dfd08d30f7f2749cfc60bc55564c6ea239624d9/.zsh_shouse_prompt#L268\nfunction +vi-git-stash() {\n  if [[ -s \"${vcs_comm[gitdir]}/logs/refs/stash\" ]] ; then\n    local -a stashes=( \"${(@f)\"$(<${vcs_comm[gitdir]}/logs/refs/stash)\"}\" )\n    hook_com[misc]+=\" $(print_icon 'VCS_STASH_ICON')${#stashes}\"\n  fi\n}\n\nfunction +vi-hg-bookmarks() {\n  if [[ -n \"${hgbmarks[@]}\" ]]; then\n    hook_com[hg-bookmark-string]=\" $(print_icon 'VCS_BOOKMARK_ICON')${hgbmarks[@]}\"\n\n    # To signal that we want to use the sting we just generated, set the special\n    # variable `ret' to something other than the default zero:\n    ret=1\n    return 0\n  fi\n}\n\nfunction +vi-vcs-detect-changes() {\n  if [[ \"${hook_com[vcs]}\" == \"git\" ]]; then\n\n    local remote=$(command git ls-remote --get-url 2> /dev/null)\n    if [[ \"$remote\" =~ \"github\" ]] then\n      vcs_visual_identifier='VCS_GIT_GITHUB_ICON'\n    elif [[ \"$remote\" =~ \"bitbucket\" ]] then\n      vcs_visual_identifier='VCS_GIT_BITBUCKET_ICON'\n    elif [[ \"$remote\" =~ \"stash\" ]] then\n      vcs_visual_identifier='VCS_GIT_BITBUCKET_ICON'\n    elif [[ \"$remote\" =~ \"gitlab\" ]] then\n      vcs_visual_identifier='VCS_GIT_GITLAB_ICON'\n    else\n      vcs_visual_identifier='VCS_GIT_ICON'\n    fi\n\n  elif [[ \"${hook_com[vcs]}\" == \"hg\" ]]; then\n    vcs_visual_identifier='VCS_HG_ICON'\n  elif [[ \"${hook_com[vcs]}\" == \"svn\" ]]; then\n    vcs_visual_identifier='VCS_SVN_ICON'\n  fi\n\n  if [[ -n \"${hook_com[staged]}\" ]] || [[ -n \"${hook_com[unstaged]}\" ]]; then\n    VCS_WORKDIR_DIRTY=true\n  else\n    VCS_WORKDIR_DIRTY=false\n  fi\n}\n\nfunction +vi-svn-detect-changes() {\n  local svn_status=\"$(svn status)\"\n  if [[ -n \"$(echo \"$svn_status\" | \\grep \\^\\?)\" ]]; then\n    hook_com[unstaged]+=\" $(print_icon 'VCS_UNTRACKED_ICON')\"\n    VCS_WORKDIR_HALF_DIRTY=true\n  fi\n  if [[ -n \"$(echo \"$svn_status\" | \\grep \\^\\M)\" ]]; then\n    hook_com[unstaged]+=\" $(print_icon 'VCS_UNSTAGED_ICON')\"\n    VCS_WORKDIR_DIRTY=true\n  fi\n  if [[ -n \"$(echo \"$svn_status\" | \\grep \\^\\A)\" ]]; then\n    hook_com[staged]+=\" $(print_icon 'VCS_STAGED_ICON')\"\n    VCS_WORKDIR_DIRTY=true\n  fi\n}\n"
  },
  {
    "path": "powerlevel9k.zsh-theme",
    "content": "# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n################################################################\n# powerlevel9k Theme\n# https://github.com/bhilburn/powerlevel9k\n#\n# This theme was inspired by agnoster's Theme:\n# https://gist.github.com/3712874\n################################################################\n\n################################################################\n# For basic documentation, please refer to the README.md in the top-level\n# directory. For more detailed documentation, refer to the project wiki, hosted\n# on Github: https://github.com/bhilburn/powerlevel9k/wiki\n#\n# There are a lot of easy ways you can customize your prompt segments and\n# theming with simple variables defined in your `~/.zshrc`.\n################################################################\n\n## Turn on for Debugging\n#PS4='%s%f%b%k%F{blue}%{λ%}%L %F{240}%N:%i%(?.. %F{red}%?) %1(_.%F{yellow}%-1_ .)%s%f%b%k '\n#zstyle ':vcs_info:*+*:*' debug true\n#set -o xtrace\n\n# Try to set the installation path\nif [[ -n \"$POWERLEVEL9K_INSTALLATION_DIR\" ]]; then\n  p9k_directory=${POWERLEVEL9K_INSTALLATION_DIR:A}\nelse\n  if [[ \"${(%):-%N}\" == '(eval)' ]]; then\n    if [[ \"$0\" == '-antigen-load' ]] && [[ -r \"${PWD}/powerlevel9k.zsh-theme\" ]]; then\n      # Antigen uses eval to load things so it can change the plugin (!!)\n      # https://github.com/zsh-users/antigen/issues/581\n      p9k_directory=$PWD\n    else\n      print -P \"%F{red}You must set POWERLEVEL9K_INSTALLATION_DIR work from within an (eval).%f\"\n      return 1\n    fi\n  else\n    # Get the path to file this code is executing in; then\n    # get the absolute path and strip the filename.\n    # See https://stackoverflow.com/a/28336473/108857\n    p9k_directory=${${(%):-%x}:A:h}\n  fi\nfi\n\n################################################################\n# Source icon functions\n################################################################\n\nsource \"${p9k_directory}/functions/icons.zsh\"\n\n################################################################\n# Source utility functions\n################################################################\n\nsource \"${p9k_directory}/functions/utilities.zsh\"\n\n################################################################\n# Source color functions\n################################################################\n\nsource \"${p9k_directory}/functions/colors.zsh\"\n\n################################################################\n# Source VCS_INFO hooks / helper functions\n################################################################\n\nsource \"${p9k_directory}/functions/vcs.zsh\"\n\n# cleanup temporary variables.\nunset p9k_directory\n\n################################################################\n# Color Scheme\n################################################################\n\nif [[ \"$POWERLEVEL9K_COLOR_SCHEME\" == \"light\" ]]; then\n  DEFAULT_COLOR=white\n  DEFAULT_COLOR_INVERTED=black\nelse\n  DEFAULT_COLOR=black\n  DEFAULT_COLOR_INVERTED=white\nfi\n\n################################################################\n# Prompt Segment Constructors\n#\n# Methodology behind user-defined variables overwriting colors:\n#     The first parameter to the segment constructors is the calling function's\n#     name. From this function name, we strip the \"prompt_\"-prefix and\n#     uppercase it. This is then prefixed with \"POWERLEVEL9K_\" and suffixed\n#     with either \"_BACKGROUND\" or \"_FOREGROUND\", thus giving us the variable\n#     name. So each new segment is user-overwritten by a variable following\n#     this naming convention.\n################################################################\n\n# The `CURRENT_BG` variable is used to remember what the last BG color used was\n# when building the left-hand prompt. Because the RPROMPT is created from\n# right-left but reads the opposite, this isn't necessary for the other side.\nCURRENT_BG='NONE'\n\n# Begin a left prompt segment\n# Takes four arguments:\n#   * $1: Name of the function that was originally invoked (mandatory).\n#         Necessary, to make the dynamic color-overwrite mechanism work.\n#   * $2: The array index of the current segment\n#   * $3: Background color\n#   * $4: Foreground color\n#   * $5: The segment content\n#   * $6: An identifying icon (must be a key of the icons array)\n# The latter three can be omitted,\nset_default last_left_element_index 1\nset_default POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS \" \"\nleft_prompt_segment() {\n  local segment_name=\"${1}\"\n  local current_index=$2\n  # Check if the segment should be joined with the previous one\n  local joined\n  segmentShouldBeJoined $current_index $last_left_element_index \"$POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\" && joined=true || joined=false\n\n  # Colors\n  local backgroundColor=\"${3}\"\n  local foregroundColor=\"${4}\"\n\n  # Overwrite given background-color by user defined variable for this segment.\n  local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_BACKGROUND\n  local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE}\n  [[ -n $BG_COLOR_MODIFIER ]] && backgroundColor=\"$BG_COLOR_MODIFIER\"\n\n  # Overwrite given foreground-color by user defined variable for this segment.\n  local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_FOREGROUND\n  local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE}\n  [[ -n $FG_COLOR_MODIFIER ]] && foregroundColor=\"$FG_COLOR_MODIFIER\"\n\n  # Get color codes here to save some calls later on\n  backgroundColor=\"$(getColorCode ${backgroundColor})\"\n  foregroundColor=\"$(getColorCode ${foregroundColor})\"\n\n  local background foreground\n  [[ -n \"${backgroundColor}\" ]] && background=\"$(backgroundColor ${backgroundColor})\" || background=\"%k\"\n  [[ -n \"${foregroundColor}\" ]] && foreground=\"$(foregroundColor ${foregroundColor})\" || foreground=\"%f\"\n\n  if [[ $CURRENT_BG != 'NONE' ]] && ! isSameColor \"${backgroundColor}\" \"$CURRENT_BG\"; then\n    echo -n \"${background}%F{$CURRENT_BG}\"\n    if [[ $joined == false ]]; then\n      # Middle segment\n      echo -n \"$(print_icon 'LEFT_SEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS\"\n    fi\n  elif isSameColor \"$CURRENT_BG\" \"${backgroundColor}\"; then\n    # Middle segment with same color as previous segment\n    # We take the current foreground color as color for our\n    # subsegment (or the default color). This should have\n    # enough contrast.\n    local complement\n    [[ -n \"${foregroundColor}\" ]] && complement=\"${foreground}\" || complement=\"$(foregroundColor $DEFAULT_COLOR)\"\n    echo -n \"${background}${complement}\"\n    if [[ $joined == false ]]; then\n      echo -n \"$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS\"\n    fi\n  else\n    # First segment\n    echo -n \"${background}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS\"\n  fi\n\n  local visual_identifier\n  if [[ -n $6 ]]; then\n    visual_identifier=\"$(print_icon $6)\"\n    if [[ -n \"$visual_identifier\" ]]; then\n      # Add an whitespace if we print more than just the visual identifier.\n      # To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st),\n      # we need to color both the visual identifier and the whitespace.\n      [[ -n \"$5\" ]] && visual_identifier=\"$visual_identifier \"\n      # Allow users to overwrite the color for the visual identifier only.\n      local visual_identifier_color_variable=POWERLEVEL9K_${(U)${segment_name}#prompt_}_VISUAL_IDENTIFIER_COLOR\n      set_default $visual_identifier_color_variable \"${foregroundColor}\"\n      visual_identifier=\"$(foregroundColor ${(P)visual_identifier_color_variable})${visual_identifier}\"\n    fi\n  fi\n\n  # Print the visual identifier\n  echo -n \"${visual_identifier}\"\n  # Print the content of the segment, if there is any\n  [[ -n \"$5\" ]] && echo -n \"${foreground}${5}\"\n  echo -n \"${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}\"\n\n  CURRENT_BG=\"${backgroundColor}\"\n  last_left_element_index=$current_index\n}\n\n# End the left prompt, closes the final segment.\nleft_prompt_end() {\n  if [[ -n $CURRENT_BG ]]; then\n    echo -n \"%k$(foregroundColor ${CURRENT_BG})$(print_icon 'LEFT_SEGMENT_SEPARATOR')\"\n  else\n    echo -n \"%k\"\n  fi\n  echo -n \"%f$(print_icon 'LEFT_SEGMENT_END_SEPARATOR')\"\n  CURRENT_BG=''\n}\n\nCURRENT_RIGHT_BG='NONE'\n\n# Begin a right prompt segment\n# Takes four arguments:\n#   * $1: Name of the function that was originally invoked (mandatory).\n#         Necessary, to make the dynamic color-overwrite mechanism work.\n#   * $2: The array index of the current segment\n#   * $3: Background color\n#   * $4: Foreground color\n#   * $5: The segment content\n#   * $6: An identifying icon (must be a key of the icons array)\n# No ending for the right prompt segment is needed (unlike the left prompt, above).\nset_default last_right_element_index 1\nset_default POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS \" \"\nright_prompt_segment() {\n  local segment_name=\"${1}\"\n  local current_index=$2\n\n  # Check if the segment should be joined with the previous one\n  local joined\n  segmentShouldBeJoined $current_index $last_right_element_index \"$POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\" && joined=true || joined=false\n\n  # Colors\n  local backgroundColor=\"${3}\"\n  local foregroundColor=\"${4}\"\n\n  # Overwrite given background-color by user defined variable for this segment.\n  local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_BACKGROUND\n  local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE}\n  [[ -n $BG_COLOR_MODIFIER ]] && backgroundColor=\"$BG_COLOR_MODIFIER\"\n\n  # Overwrite given foreground-color by user defined variable for this segment.\n  local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_FOREGROUND\n  local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE}\n  [[ -n $FG_COLOR_MODIFIER ]] && foregroundColor=\"$FG_COLOR_MODIFIER\"\n\n  # Get color codes here to save some calls later on\n  backgroundColor=\"$(getColorCode ${backgroundColor})\"\n  foregroundColor=\"$(getColorCode ${foregroundColor})\"\n\n  local background foreground\n  [[ -n \"${backgroundColor}\" ]] && background=\"$(backgroundColor ${backgroundColor})\" || background=\"%k\"\n  [[ -n \"${foregroundColor}\" ]] && foreground=\"$(foregroundColor ${foregroundColor})\" || foreground=\"%f\"\n\n  # If CURRENT_RIGHT_BG is \"NONE\", we are the first right segment.\n\n  if [[ \"$CURRENT_RIGHT_BG\" != \"NONE\" ]]; then\n    # This is the closing whitespace for the previous segment\n    echo -n \"${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}%f\"\n  fi\n\n  if [[ $joined == false ]] || [[ \"$CURRENT_RIGHT_BG\" == \"NONE\" ]]; then\n    if isSameColor \"$CURRENT_RIGHT_BG\" \"${backgroundColor}\"; then\n      # Middle segment with same color as previous segment\n      # We take the current foreground color as color for our\n      # subsegment (or the default color). This should have\n      # enough contrast.\n      local complement\n      [[ -n \"${foregroundColor}\" ]] && complement=\"${foreground}\" || complement=\"$(foregroundColor $DEFAULT_COLOR)\"\n      echo -n \"$complement$(print_icon 'RIGHT_SUBSEGMENT_SEPARATOR')%f\"\n    else\n      # Use the new Background Color as the foreground of the segment separator\n      echo -n \"$(foregroundColor ${backgroundColor})$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f\"\n    fi\n  fi\n\n  local visual_identifier\n  if [[ -n \"$6\" ]]; then\n    visual_identifier=\"$(print_icon $6)\"\n    if [[ -n \"$visual_identifier\" ]]; then\n      # Add an whitespace if we print more than just the visual identifier.\n      # To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st),\n      # we need to color both the visual identifier and the whitespace.\n      [[ -n \"$5\" ]] && visual_identifier=\" $visual_identifier\"\n      # Allow users to overwrite the color for the visual identifier only.\n      local visual_identifier_color_variable=POWERLEVEL9K_${(U)${segment_name}#prompt_}_VISUAL_IDENTIFIER_COLOR\n      set_default $visual_identifier_color_variable \"${foregroundColor}\"\n      visual_identifier=\"$(foregroundColor ${(P)visual_identifier_color_variable})${visual_identifier}\"\n    fi\n  fi\n\n  echo -n \"${background}${foreground}\"\n\n  # Print whitespace only if segment is not joined or first right segment\n  [[ $joined == false ]] || [[ \"$CURRENT_RIGHT_BG\" == \"NONE\" ]] && echo -n \"${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}\"\n\n  # Print segment content if there is any\n  [[ -n \"$5\" ]] && echo -n \"${5}\"\n  # Print the visual identifier\n  echo -n \"${visual_identifier}\"\n\n  CURRENT_RIGHT_BG=\"${backgroundColor}\"\n  last_right_element_index=$current_index\n}\n\n################################################################\n# Prompt Segment Definitions\n################################################################\n\n################################################################\n# Anaconda Environment\nprompt_anaconda() {\n  # Depending on the conda version, either might be set. This\n  # variant works even if both are set.\n  local _path=$CONDA_ENV_PATH$CONDA_PREFIX\n  if ! [ -z \"$_path\" ]; then\n    # config - can be overwritten in users' zshrc file.\n    set_default POWERLEVEL9K_ANACONDA_LEFT_DELIMITER \"(\"\n    set_default POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER \")\"\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"blue\" \"$DEFAULT_COLOR\" \"$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER\" 'PYTHON_ICON'\n  fi\n}\n\n################################################################\n# AWS Profile\nprompt_aws() {\n  local aws_profile=\"${AWS_PROFILE:-$AWS_DEFAULT_PROFILE}\"\n\n  if [[ -n \"$aws_profile\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" red white \"$aws_profile\" 'AWS_ICON'\n  fi\n}\n\n################################################################\n# Current Elastic Beanstalk environment\nprompt_aws_eb_env() {\n  local eb_env=$(grep environment .elasticbeanstalk/config.yml 2> /dev/null | awk '{print $2}')\n\n  if [[ -n \"$eb_env\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" black green \"$eb_env\" 'AWS_EB_ICON'\n  fi\n}\n\n################################################################\n# Segment to indicate background jobs with an icon.\nset_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true\nset_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS false\nprompt_background_jobs() {\n  local background_jobs_number=${$(jobs -l | wc -l)// /}\n  local wrong_lines=`jobs -l | awk '/pwd now/{ count++ } END {print count}'`\n  if [[ wrong_lines -gt 0 ]]; then\n     background_jobs_number=$(( $background_jobs_number - $wrong_lines ))\n  fi\n  if [[ background_jobs_number -gt 0 ]]; then\n    local background_jobs_number_print=\"\"\n    if [[ \"$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE\" == \"true\" ]] && ([[ \"$background_jobs_number\" -gt 1 ]] || [[ \"$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS\" == \"true\" ]]); then\n      background_jobs_number_print=\"$background_jobs_number\"\n    fi\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"$DEFAULT_COLOR\" \"cyan\" \"$background_jobs_number_print\" 'BACKGROUND_JOBS_ICON'\n  fi\n}\n\n################################################################\n# A newline in your prompt, so you can segments on multiple lines.\nprompt_newline() {\n  local lws newline\n  [[ \"$1\" == \"right\" ]] && return\n  newline=$'\\n'\n  lws=$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS\n  if [[ \"$POWERLEVEL9K_PROMPT_ON_NEWLINE\" == true ]]; then\n    newline=\"${newline}$(print_icon 'MULTILINE_NEWLINE_PROMPT_PREFIX')\"\n  fi\n  POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=\n  \"$1_prompt_segment\" \\\n    \"$0\" \\\n    \"$2\" \\\n    \"\" \"\" \"${newline}\"\n  CURRENT_BG='NONE'\n  POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=$lws\n}\n\n################################################################\n# Segment that indicates usage level of current partition.\nset_default POWERLEVEL9K_DISK_USAGE_ONLY_WARNING false\nset_default POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL 90\nset_default POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL 95\nprompt_disk_usage() {\n  local current_state=\"unknown\"\n  typeset -AH hdd_usage_forecolors\n  hdd_usage_forecolors=(\n    'normal'        'yellow'\n    'warning'       \"$DEFAULT_COLOR\"\n    'critical'      'white'\n  )\n  typeset -AH hdd_usage_backcolors\n  hdd_usage_backcolors=(\n    'normal'        $DEFAULT_COLOR\n    'warning'       'yellow'\n    'critical'      'red'\n  )\n\n  local disk_usage=\"${$(\\df -P . | sed -n '2p' | awk '{ print $5 }')%%\\%}\"\n\n  if [ \"$disk_usage\" -ge \"$POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL\" ]; then\n    current_state='warning'\n    if [ \"$disk_usage\" -ge \"$POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL\" ]; then\n        current_state='critical'\n    fi\n  else\n    if [[ \"$POWERLEVEL9K_DISK_USAGE_ONLY_WARNING\" == true ]]; then\n        current_state=''\n        return\n    fi\n    current_state='normal'\n  fi\n\n  local message=\"${disk_usage}%%\"\n\n  # Draw the prompt_segment\n  if [[ -n $disk_usage ]]; then\n    \"$1_prompt_segment\" \"${0}_${current_state}\" \"$2\" \"${hdd_usage_backcolors[$current_state]}\" \"${hdd_usage_forecolors[$current_state]}\" \"$message\" 'DISK_ICON'\n  fi\n}\n\n################################################################\n# Segment that displays the battery status in levels and colors\nprompt_battery() {\n  # The battery can have four different states - default to 'unknown'.\n  local current_state='unknown'\n  typeset -AH battery_states\n  battery_states=(\n    'low'           'red'\n    'charging'      'yellow'\n    'charged'       'green'\n    'disconnected'  \"$DEFAULT_COLOR_INVERTED\"\n  )\n  local ROOT_PREFIX=\"${4}\"\n  # Set default values if the user did not configure them\n  set_default POWERLEVEL9K_BATTERY_LOW_THRESHOLD  10\n\n  if [[ $OS =~ OSX && -f \"${ROOT_PREFIX}\"/usr/bin/pmset && -x \"${ROOT_PREFIX}\"/usr/bin/pmset ]]; then\n    # obtain battery information from system\n    local raw_data=\"$(${ROOT_PREFIX}/usr/bin/pmset -g batt | awk 'FNR==2{print}')\"\n    # return if there is no battery on system\n    [[ -z $(echo $raw_data | grep \"InternalBattery\") ]] && return\n\n    # Time remaining on battery operation (charging/discharging)\n    local tstring=$(echo $raw_data | awk -F ';' '{print $3}' | awk '{print $1}')\n    # If time has not been calculated by system yet\n    [[ $tstring =~ '(\\(no|not)' ]] && tstring=\"...\"\n\n    # percent of battery charged\n    typeset -i 10 bat_percent\n    bat_percent=$(echo $raw_data | grep -o '[0-9]*%' | sed 's/%//')\n\n    local remain=\"\"\n    # Logic for string output\n    case $(echo $raw_data | awk -F ';' '{print $2}' | awk '{$1=$1};1') in\n      # for a short time after attaching power, status will be 'AC attached;'\n      'charging'|'finishing charge'|'AC attached')\n        current_state=\"charging\"\n        remain=\" ($tstring)\"\n        ;;\n      'discharging')\n        [[ $bat_percent -lt $POWERLEVEL9K_BATTERY_LOW_THRESHOLD ]] && current_state=\"low\" || current_state=\"disconnected\"\n        remain=\" ($tstring)\"\n        ;;\n      *)\n        current_state=\"charged\"\n        ;;\n    esac\n  fi\n\n  if [[ \"$OS\" == 'Linux' ]] || [[ \"$OS\" == 'Android' ]]; then\n    local sysp=\"${ROOT_PREFIX}/sys/class/power_supply\"\n\n    # Reported BAT0 or BAT1 depending on kernel version\n    [[ -a $sysp/BAT0 ]] && local bat=$sysp/BAT0\n    [[ -a $sysp/BAT1 ]] && local bat=$sysp/BAT1\n\n    # Android-related\n    # Tested on: Moto G falcon (CM 13.0)\n    [[ -a $sysp/battery ]] && local bat=$sysp/battery\n\n    # Return if no battery found\n    [[ -z $bat ]] && return\n    local capacity=$(cat $bat/capacity)\n    local battery_status=$(cat $bat/status)\n    [[ $capacity -gt 100 ]] && local bat_percent=100 || local bat_percent=$capacity\n    [[ $battery_status =~ Charging || $battery_status =~ Full ]] && local connected=true\n    if [[ -z  $connected ]]; then\n      [[ $bat_percent -lt $POWERLEVEL9K_BATTERY_LOW_THRESHOLD ]] && current_state=\"low\" || current_state=\"disconnected\"\n    else\n      [[ $bat_percent =~ 100 ]] && current_state=\"charged\"\n      [[ $bat_percent -lt 100 ]] && current_state=\"charging\"\n    fi\n    if [[ -f ${ROOT_PREFIX}/usr/bin/acpi ]]; then\n      local time_remaining=$(${ROOT_PREFIX}/usr/bin/acpi | awk '{ print $5 }')\n      if [[ $time_remaining =~ rate ]]; then\n        local tstring=\"...\"\n      elif [[ $time_remaining =~ \"[[:digit:]]+\" ]]; then\n        local tstring=${(f)$(date -u -d \"$(echo $time_remaining)\" +%k:%M 2> /dev/null)}\n      fi\n    fi\n    [[ -n $tstring ]] && local remain=\" ($tstring)\"\n  fi\n\n  local message\n  # Default behavior: Be verbose!\n  set_default POWERLEVEL9K_BATTERY_VERBOSE true\n  if [[ \"$POWERLEVEL9K_BATTERY_VERBOSE\" == true ]]; then\n    message=\"$bat_percent%%$remain\"\n  else\n    message=\"$bat_percent%%\"\n  fi\n\n  # override default icon if we are using battery stages\n  if [[ -n \"$POWERLEVEL9K_BATTERY_STAGES\" ]]; then\n    local segment=$(( 100.0 / (${#POWERLEVEL9K_BATTERY_STAGES} - 1 ) ))\n    if [[ $segment > 1 ]]; then\n      local offset=$(( ($bat_percent / $segment) + 1 ))\n      # check if the stages are in an array or a string\n      [[ \"${(t)POWERLEVEL9K_BATTERY_STAGES}\" =~ \"array\" ]] && POWERLEVEL9K_BATTERY_ICON=\"$POWERLEVEL9K_BATTERY_STAGES[$offset]\" || POWERLEVEL9K_BATTERY_ICON=${POWERLEVEL9K_BATTERY_STAGES:$offset:1}\n    fi\n  fi\n  # return if POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD is set and the battery percentage is greater or equal\n  if defined POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD && [[ \"${bat_percent}\" -ge $POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]]; then\n    return\n  fi\n\n    # override the default color if we are using a color level array\n    if [[ -n \"$POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND\" ]] && [[ \"${(t)POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND}\" =~ \"array\" ]]; then\n      local segment=$(( 100.0 / (${#POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND} - 1 ) ))\n      local offset=$(( ($bat_percent / $segment) + 1 ))\n      \"$1_prompt_segment\" \"$0_${current_state}\" \"$2\" \"${POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND[$offset]}\" \"${battery_states[$current_state]}\" \"${message}\" \"BATTERY_ICON\"\n    else\n      # Draw the prompt_segment\n      \"$1_prompt_segment\" \"$0_${current_state}\" \"$2\" \"${DEFAULT_COLOR}\" \"${battery_states[$current_state]}\" \"${message}\" \"BATTERY_ICON\"\n    fi\n}\n\n################################################################\n# Public IP segment\n# Parameters:\n#   * $1 Alignment: string - left|right\n#   * $2 Index: integer\n#   * $3 Joined: bool - If the segment should be joined\n#   * $4 Root Prefix: string - Root prefix for testing purposes\nprompt_public_ip() {\n  local ROOT_PREFIX=\"${4}\"\n  # set default values for segment\n  set_default POWERLEVEL9K_PUBLIC_IP_TIMEOUT \"300\"\n  set_default POWERLEVEL9K_PUBLIC_IP_NONE \"\"\n  set_default POWERLEVEL9K_PUBLIC_IP_FILE \"/tmp/p9k_public_ip\"\n  set_default POWERLEVEL9K_PUBLIC_IP_HOST \"http://ident.me\"\n  defined POWERLEVEL9K_PUBLIC_IP_METHODS || POWERLEVEL9K_PUBLIC_IP_METHODS=(dig curl wget)\n\n  # Do we need a fresh IP?\n  local refresh_ip=false\n  if [[ -f $POWERLEVEL9K_PUBLIC_IP_FILE ]]; then\n    typeset -i timediff\n    # if saved IP is more than\n    if [[ \"$OS\" == \"OSX\" ]]; then\n      timediff=$(($(date +%s) - $(stat -f \"%m\" $POWERLEVEL9K_PUBLIC_IP_FILE)))\n    else\n      timediff=$(($(date +%s) - $(date -r $POWERLEVEL9K_PUBLIC_IP_FILE +%s)))\n    fi\n    [[ $timediff -gt $POWERLEVEL9K_PUBLIC_IP_TIMEOUT ]] && refresh_ip=true\n    # If tmp file is empty get a fresh IP\n    [[ -z $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) ]] && refresh_ip=true\n    [[ -n $POWERLEVEL9K_PUBLIC_IP_NONE ]] && [[ $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) =~ \"$POWERLEVEL9K_PUBLIC_IP_NONE\" ]] && refresh_ip=true\n  else\n    touch $POWERLEVEL9K_PUBLIC_IP_FILE && refresh_ip=true\n  fi\n\n  # grab a fresh IP if needed\n  local fresh_ip\n  if [[ $refresh_ip == true && -w $POWERLEVEL9K_PUBLIC_IP_FILE ]]; then\n    for method in \"${POWERLEVEL9K_PUBLIC_IP_METHODS[@]}\"; do\n      case $method in\n        'dig')\n            fresh_ip=\"$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com 2> /dev/null)\"\n            [[ \"$fresh_ip\" =~ ^\\; ]] && unset fresh_ip\n          ;;\n        'curl')\n            fresh_ip=\"$(curl --max-time 10 -w '\\n' \"$POWERLEVEL9K_PUBLIC_IP_HOST\" 2> /dev/null)\"\n          ;;\n        'wget')\n            fresh_ip=\"$(wget -T 10 -qO- \"$POWERLEVEL9K_PUBLIC_IP_HOST\" 2> /dev/null)\"\n          ;;\n      esac\n      # If we found a fresh IP, break loop.\n      if [[ -n \"${fresh_ip}\" ]]; then\n        break;\n      fi\n    done\n\n    # write IP to tmp file or clear tmp file if an IP was not retrieved\n    # Redirection with `>!`. From the manpage: Same as >, except that the file\n    #   is truncated to zero length if it exists, even if CLOBBER is unset.\n    # If the file already exists, and a simple `>` redirection and CLOBBER\n    # unset, ZSH will produce an error.\n    [[ -n \"${fresh_ip}\" ]] && echo $fresh_ip >! $POWERLEVEL9K_PUBLIC_IP_FILE || echo $POWERLEVEL9K_PUBLIC_IP_NONE >! $POWERLEVEL9K_PUBLIC_IP_FILE\n  fi\n\n  # read public IP saved to tmp file\n  local public_ip=\"$(cat $POWERLEVEL9K_PUBLIC_IP_FILE)\"\n\n  # Draw the prompt segment\n  if [[ -n $public_ip ]]; then\n    icon='PUBLIC_IP_ICON'\n    # Check VPN is on if VPN interface is set\n    if [[ -n $POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE ]]; then\n      local vpnIp=\"$(p9k::parseIp \"${POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE}\" \"${ROOT_PREFIX}\")\"\n      if [[ -n \"$vpnIp\" ]]; then\n        icon='VPN_ICON'\n      fi\n    fi\n    $1_prompt_segment \"$0\" \"$2\" \"$DEFAULT_COLOR\" \"$DEFAULT_COLOR_INVERTED\" \"${public_ip}\" \"$icon\"\n  fi\n}\n\n################################################################\n# Context: user@hostname (who am I and where am I)\n# Note that if $DEFAULT_USER is not set, this prompt segment will always print\nset_default POWERLEVEL9K_ALWAYS_SHOW_CONTEXT false\nset_default POWERLEVEL9K_ALWAYS_SHOW_USER false\nset_default POWERLEVEL9K_CONTEXT_TEMPLATE \"%n@%m\"\nprompt_context() {\n  local current_state=\"DEFAULT\"\n  typeset -AH context_states\n  context_states=(\n    \"ROOT\"        \"yellow\"\n    \"SUDO\"        \"yellow\"\n    \"DEFAULT\"     \"yellow\"\n    \"REMOTE\"      \"yellow\"\n    \"REMOTE_SUDO\" \"yellow\"\n  )\n\n  local content=\"\"\n\n  if [[ \"$POWERLEVEL9K_ALWAYS_SHOW_CONTEXT\" == true ]] || [[ \"$(whoami)\" != \"$DEFAULT_USER\" ]] || [[ -n \"$SSH_CLIENT\" || -n \"$SSH_TTY\" ]]; then\n      content=\"${POWERLEVEL9K_CONTEXT_TEMPLATE}\"\n  elif [[ \"$POWERLEVEL9K_ALWAYS_SHOW_USER\" == true ]]; then\n      content=\"$(whoami)\"\n  else\n      return\n  fi\n\n  if [[ $(print -P \"%#\") == '#' ]]; then\n    current_state=\"ROOT\"\n  elif [[ -n \"$SSH_CLIENT\" || -n \"$SSH_TTY\" ]]; then\n    if [[ -n \"$SUDO_COMMAND\" ]]; then\n      current_state=\"REMOTE_SUDO\"\n    else\n      current_state=\"REMOTE\"\n    fi\n  elif [[ -n \"$SUDO_COMMAND\" ]]; then\n    current_state=\"SUDO\"\n  fi\n\n  \"$1_prompt_segment\" \"${0}_${current_state}\" \"$2\" \"$DEFAULT_COLOR\" \"${context_states[$current_state]}\" \"${content}\"\n}\n\n################################################################\n# User: user (who am I)\n# Note that if $DEFAULT_USER is not set, this prompt segment will always print\nset_default POWERLEVEL9K_USER_TEMPLATE \"%n\"\nprompt_user() {\n  local current_state=\"DEFAULT\"\n  typeset -AH user_state\n  if [[ \"$POWERLEVEL9K_ALWAYS_SHOW_USER\" == true ]] || [[ \"$(whoami)\" != \"$DEFAULT_USER\" ]]; then\n    if [[ $(print -P \"%#\") == '#' ]]; then\n      user_state=(\n        \"STATE\"               \"ROOT\"\n        \"CONTENT\"             \"${POWERLEVEL9K_USER_TEMPLATE}\"\n        \"BACKGROUND_COLOR\"    \"${DEFAULT_COLOR}\"\n        \"FOREGROUND_COLOR\"    \"yellow\"\n        \"VISUAL_IDENTIFIER\"   \"ROOT_ICON\"\n      )\n    elif [[ -n \"$SUDO_COMMAND\" ]]; then\n      user_state=(\n        \"STATE\"               \"SUDO\"\n        \"CONTENT\"             \"${POWERLEVEL9K_USER_TEMPLATE}\"\n        \"BACKGROUND_COLOR\"    \"${DEFAULT_COLOR}\"\n        \"FOREGROUND_COLOR\"    \"yellow\"\n        \"VISUAL_IDENTIFIER\"   \"SUDO_ICON\"\n      )\n    else\n      user_state=(\n        \"STATE\"               \"DEFAULT\"\n        \"CONTENT\"             \"$(whoami)\"\n        \"BACKGROUND_COLOR\"    \"${DEFAULT_COLOR}\"\n        \"FOREGROUND_COLOR\"    \"yellow\"\n        \"VISUAL_IDENTIFIER\"   \"USER_ICON\"\n      )\n    fi\n    \"$1_prompt_segment\" \"${0}_${user_state[STATE]}\" \"$2\" \"${user_state[BACKGROUND_COLOR]}\" \"${user_state[FOREGROUND_COLOR]}\" \"${user_state[CONTENT]}\" \"${user_state[VISUAL_IDENTIFIER]}\"\n  fi\n}\n\n################################################################\n# Host: machine (where am I)\nset_default POWERLEVEL9K_HOST_TEMPLATE \"%m\"\nprompt_host() {\n  local current_state=\"LOCAL\"\n  typeset -AH host_state\n  if [[ -n \"$SSH_CLIENT\" ]] || [[ -n \"$SSH_TTY\" ]]; then\n    host_state=(\n      \"STATE\"               \"REMOTE\"\n      \"CONTENT\"             \"${POWERLEVEL9K_HOST_TEMPLATE}\"\n      \"BACKGROUND_COLOR\"    \"${DEFAULT_COLOR}\"\n      \"FOREGROUND_COLOR\"    \"yellow\"\n      \"VISUAL_IDENTIFIER\"   \"SSH_ICON\"\n    )\n  else\n    host_state=(\n      \"STATE\"               \"LOCAL\"\n      \"CONTENT\"             \"${POWERLEVEL9K_HOST_TEMPLATE}\"\n      \"BACKGROUND_COLOR\"    \"${DEFAULT_COLOR}\"\n      \"FOREGROUND_COLOR\"    \"yellow\"\n      \"VISUAL_IDENTIFIER\"   \"HOST_ICON\"\n    )\n  fi\n  \"$1_prompt_segment\" \"$0_${host_state[STATE]}\" \"$2\" \"${host_state[BACKGROUND_COLOR]}\" \"${host_state[FOREGROUND_COLOR]}\" \"${host_state[CONTENT]}\" \"${host_state[VISUAL_IDENTIFIER]}\"\n}\n\n################################################################\n# The 'custom` prompt provides a way for users to invoke commands and display\n# the output in a segment.\nprompt_custom() {\n  local segment_name=\"${3:u}\"\n  # Get content of custom segment\n  local command=\"POWERLEVEL9K_CUSTOM_${segment_name}\"\n  local segment_content=\"$(eval ${(P)command})\"\n\n  if [[ -n $segment_content ]]; then\n    \"$1_prompt_segment\" \"${0}_${3:u}\" \"$2\" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR \"$segment_content\" \"CUSTOM_${segment_name}_ICON\"\n  fi\n}\n\n################################################################\n# Display the duration the command needed to run.\nprompt_command_execution_time() {\n  set_default POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD 3\n  set_default POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION 2\n\n  # Print time in human readable format\n  # For that use `strftime` and convert\n  # the duration (float) to an seconds\n  # (integer).\n  # See http://unix.stackexchange.com/a/89748\n  local humanReadableDuration\n  if (( _P9K_COMMAND_DURATION > 3600 )); then\n    humanReadableDuration=$(TZ=GMT; strftime '%H:%M:%S' $(( int(rint(_P9K_COMMAND_DURATION)) )))\n  elif (( _P9K_COMMAND_DURATION > 60 )); then\n    humanReadableDuration=$(TZ=GMT; strftime '%M:%S' $(( int(rint(_P9K_COMMAND_DURATION)) )))\n  else\n    # If the command executed in seconds, print as float.\n    # Convert to float\n    if [[ \"${POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION}\" == \"0\" ]]; then\n      # If user does not want microseconds, then we need to convert\n      # the duration to an integer.\n      typeset -i humanReadableDuration\n    else\n      typeset -F ${POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION} humanReadableDuration\n    fi\n    humanReadableDuration=$_P9K_COMMAND_DURATION\n  fi\n\n  if (( _P9K_COMMAND_DURATION >= POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD )); then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"red\" \"yellow1\" \"${humanReadableDuration}\" 'EXECUTION_TIME_ICON'\n  fi\n}\n\n################################################################\n# Determine the unique path - this is needed for the\n# truncate_to_unique strategy.\n#\nfunction getUniqueFolder() {\n  local trunc_path directory test_dir test_dir_length\n  local -a matching\n  local -a paths\n  local cur_path='/'\n  paths=(${(s:/:)1})\n  for directory in ${paths[@]}; do\n    test_dir=''\n    for (( i=0; i < ${#directory}; i++ )); do\n      test_dir+=\"${directory:$i:1}\"\n      matching=(\"$cur_path\"/\"$test_dir\"*/)\n      if [[ ${#matching[@]} -eq 1 ]]; then\n        break\n      fi\n    done\n    trunc_path+=\"$test_dir/\"\n    cur_path+=\"$directory/\"\n  done\n  echo \"${trunc_path: : -1}\"\n}\n\n################################################################\n# Dir: current working directory\n# Parameters:\n#   * $1 Alignment: string - left|right\n#   * $2 Index: integer\nset_default POWERLEVEL9K_DIR_PATH_SEPARATOR \"/\"\nset_default POWERLEVEL9K_HOME_FOLDER_ABBREVIATION \"~\"\nset_default POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD false\nprompt_dir() {\n  # using $PWD instead of \"$(print -P '%~')\" to allow use of POWERLEVEL9K_DIR_PATH_ABSOLUTE\n  local current_path=$PWD # WAS: local current_path=\"$(print -P '%~')\"\n  # check if the user wants to use absolute paths or \"~\" paths\n  [[ ${(L)POWERLEVEL9K_DIR_PATH_ABSOLUTE} != \"true\" ]] && current_path=${current_path/#$HOME/\"~\"}\n  # declare all local variables\n  local paths directory test_dir test_dir_length trunc_path threshhold\n  # if we are not in \"~\" or \"/\", split the paths into an array and exclude \"~\"\n  (( ${#current_path} > 1 )) && paths=(${(s:/:)${current_path//\"~\\/\"/}}) || paths=()\n  # only run the code if SHORTEN_DIR_LENGTH is set, or we are using the two strategies that don't rely on it.\n  if [[ -n \"$POWERLEVEL9K_SHORTEN_DIR_LENGTH\" || \"$POWERLEVEL9K_SHORTEN_STRATEGY\" == \"truncate_with_folder_marker\" || \"$POWERLEVEL9K_SHORTEN_STRATEGY\" == \"truncate_to_last\" || \"$POWERLEVEL9K_SHORTEN_STRATEGY\" == \"truncate_with_package_name\" ]]; then\n    set_default POWERLEVEL9K_SHORTEN_DELIMITER \"\\u2026\"\n    # convert delimiter from unicode to literal character, so that we can get the correct length later\n    local delim=$(echo -n $POWERLEVEL9K_SHORTEN_DELIMITER)\n\n    case \"$POWERLEVEL9K_SHORTEN_STRATEGY\" in\n      truncate_absolute_chars)\n        if [ ${#current_path} -gt $(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#POWERLEVEL9K_SHORTEN_DELIMITER} )) ]; then\n          current_path=$POWERLEVEL9K_SHORTEN_DELIMITER${current_path:(-POWERLEVEL9K_SHORTEN_DIR_LENGTH)}\n        fi\n      ;;\n      truncate_middle)\n        # truncate characters from the middle of the path\n        current_path=$(truncatePath $current_path $POWERLEVEL9K_SHORTEN_DIR_LENGTH $POWERLEVEL9K_SHORTEN_DELIMITER \"middle\")\n      ;;\n      truncate_from_right)\n        # truncate characters from the right of the path\n        current_path=$(truncatePath \"$current_path\" $POWERLEVEL9K_SHORTEN_DIR_LENGTH $POWERLEVEL9K_SHORTEN_DELIMITER)\n      ;;\n      truncate_absolute)\n        # truncate all characters except the last POWERLEVEL9K_SHORTEN_DIR_LENGTH characters\n        if [ ${#current_path} -gt $(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#POWERLEVEL9K_SHORTEN_DELIMITER} )) ]; then\n          current_path=$POWERLEVEL9K_SHORTEN_DELIMITER${current_path:(-POWERLEVEL9K_SHORTEN_DIR_LENGTH)}\n        fi\n      ;;\n      truncate_to_last)\n        # truncate all characters before the current directory\n        current_path=${current_path##*/}\n      ;;\n      truncate_to_first_and_last)\n        if (( ${#current_path} > 1 )) && (( ${POWERLEVEL9K_SHORTEN_DIR_LENGTH} > 0 )); then\n          threshhold=$(( ${POWERLEVEL9K_SHORTEN_DIR_LENGTH} * 2))\n          # if we are in \"~\", add it back into the paths array\n          [[ $current_path == '~'* ]] && paths=(\"~\" \"${paths[@]}\")\n          if (( ${#paths} > $threshhold )); then\n            local num=$(( ${#paths} - ${POWERLEVEL9K_SHORTEN_DIR_LENGTH} ))\n            # repace the middle elements\n            for (( i=$POWERLEVEL9K_SHORTEN_DIR_LENGTH; i<$num; i++ )); do\n              paths[$i+1]=$POWERLEVEL9K_SHORTEN_DELIMITER\n            done\n            [[ $current_path != '~'* ]] && current_path=\"/\" || current_path=\"\"\n            current_path+=\"${(j:/:)paths}\"\n          fi\n        fi\n      ;;\n      truncate_to_unique)\n        # for each parent path component find the shortest unique beginning\n        # characters sequence. Source: https://stackoverflow.com/a/45336078\n        if (( ${#current_path} > 1 )); then # root and home are exceptions and won't have paths\n          # cheating here to retain ~ as home folder\n          local home_path=\"$(getUniqueFolder $HOME)\"\n          trunc_path=\"$(getUniqueFolder $PWD)\"\n          [[ $current_path == \"~\"* ]] && current_path=\"~${trunc_path//${home_path}/}\" || current_path=\"/${trunc_path}\"\n        fi\n      ;;\n      truncate_with_folder_marker)\n        if (( ${#paths} > 0 )); then # root and home are exceptions and won't have paths, so skip this\n          local last_marked_folder marked_folder\n          set_default POWERLEVEL9K_SHORTEN_FOLDER_MARKER \".shorten_folder_marker\"\n\n          # Search for the folder marker in the parent directories and\n          # buildup a pattern that is removed from the current path\n          # later on.\n          for marked_folder in $(upsearch $POWERLEVEL9K_SHORTEN_FOLDER_MARKER); do\n            if [[ \"$marked_folder\" == \"/\" ]]; then\n              # If we reached root folder, stop upsearch.\n              trunc_path=\"/\"\n            elif [[ \"$marked_folder\" == \"$HOME\" ]]; then\n              # If we reached home folder, stop upsearch.\n              trunc_path=\"~\"\n            elif [[ \"${marked_folder%/*}\" == $last_marked_folder ]]; then\n              trunc_path=\"${trunc_path%/}/${marked_folder##*/}\"\n            else\n              trunc_path=\"${trunc_path%/}/$POWERLEVEL9K_SHORTEN_DELIMITER/${marked_folder##*/}\"\n            fi\n            last_marked_folder=$marked_folder\n          done\n\n          # Replace the shortest possible match of the marked folder from\n          # the current path.\n          current_path=$trunc_path${current_path#${last_marked_folder}*}\n        fi\n      ;;\n      truncate_with_package_name)\n        local name repo_path package_path current_dir zero\n\n        # Get the path of the Git repo, which should have the package.json file\n        if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == \"true\" ]]; then\n          # Get path from the root of the git repository to the current dir\n          local gitPath=$(git rev-parse --show-prefix)\n          # Remove trailing slash from git path, so that we can\n          # remove that git path from the pwd.\n          gitPath=${gitPath%/}\n          package_path=${$(pwd)%%$gitPath}\n          # Remove trailing slash\n          package_path=${package_path%/}\n        elif [[ $(git rev-parse --is-inside-git-dir 2> /dev/null) == \"true\" ]]; then\n          package_path=${$(pwd)%%/.git*}\n        fi\n\n        [[ ${(L)POWERLEVEL9K_DIR_PATH_ABSOLUTE} != \"true\" ]] && package_path=${package_path/$HOME/\"~\"}\n\n        # Replace the shortest possible match of the marked folder from\n        # the current path. Remove the amount of characters up to the\n        # folder marker from the left. Count only the visible characters\n        # in the path (this is done by the \"zero\" pattern; see\n        # http://stackoverflow.com/a/40855342/5586433).\n        local zero='%([BSUbfksu]|([FB]|){*})'\n        trunc_path=$(pwd)\n        # Then, find the length of the package_path string, and save the\n        # subdirectory path as a substring of the current directory's path from 0\n        # to the length of the package path's string\n        subdirectory_path=$(truncatePath \"${trunc_path:${#${(S%%)package_path//$~zero/}}}\" $POWERLEVEL9K_SHORTEN_DIR_LENGTH $POWERLEVEL9K_SHORTEN_DELIMITER)\n        # Parse the 'name' from the package.json; if there are any problems, just\n        # print the file path\n        defined POWERLEVEL9K_DIR_PACKAGE_FILES || POWERLEVEL9K_DIR_PACKAGE_FILES=(package.json composer.json)\n\n        local pkgFile=\"unknown\"\n        for file in \"${POWERLEVEL9K_DIR_PACKAGE_FILES[@]}\"; do\n          if [[ -f \"${package_path}/${file}\" ]]; then\n            pkgFile=\"${package_path}/${file}\"\n            break;\n          fi\n        done\n\n        local packageName=$(jq '.name' ${pkgFile} 2> /dev/null \\\n          || node -e 'console.log(require(process.argv[1]).name);' ${pkgFile} 2>/dev/null \\\n          || cat \"${pkgFile}\" 2> /dev/null | grep -m 1 \"\\\"name\\\"\" | awk -F ':' '{print $2}' | awk -F '\"' '{print $2}' 2>/dev/null \\\n          )\n        if [[ -n \"${packageName}\" ]]; then\n          # Instead of printing out the full path, print out the name of the package\n          # from the package.json and append the current subdirectory\n          current_path=\"`echo $packageName | tr -d '\"'`$subdirectory_path\"\n        fi\n      ;;\n      *)\n        if [[ $current_path != \"~\" ]]; then\n          current_path=\"$(print -P \"%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c\")\"\n        fi\n      ;;\n    esac\n  fi\n\n  # save state of path for highlighting and bold options\n  local path_opt=$current_path\n\n  typeset -AH dir_states\n  dir_states=(\n    \"DEFAULT\"         \"FOLDER_ICON\"\n    \"HOME\"            \"HOME_ICON\"\n    \"HOME_SUBFOLDER\"  \"HOME_SUB_ICON\"\n    \"NOT_WRITABLE\"    \"LOCK_ICON\"\n    \"ETC\"             \"ETC_ICON\"\n  )\n  local state_path=\"$(print -P '%~')\"\n  local current_state=\"DEFAULT\"\n  if [[ $state_path == '/etc'* ]]; then\n    current_state='ETC'\n  elif [[ \"${POWERLEVEL9K_DIR_SHOW_WRITABLE}\" == true && ! -w \"$PWD\" ]]; then\n    current_state=\"NOT_WRITABLE\"\n  elif [[ $state_path == '~' ]]; then\n    current_state=\"HOME\"\n  elif [[ $state_path == '~'* ]]; then\n    current_state=\"HOME_SUBFOLDER\"\n  fi\n\n  # declare variables used for bold and state colors\n  local bld_on bld_off dir_state_foreground dir_state_user_foreground\n  # test if user wants the last directory printed in bold\n  if [[ \"${(L)POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD}\" == \"true\" ]]; then\n    bld_on=\"%B\"\n    bld_off=\"%b\"\n  else\n    bld_on=\"\"\n    bld_off=\"\"\n  fi\n  # determine is the user has set a last directory color\n  local dir_state_user_foreground=POWERLEVEL9K_DIR_${current_state}_FOREGROUND\n  local dir_state_foreground=${(P)dir_state_user_foreground}\n  [[ -z ${dir_state_foreground} ]] && dir_state_foreground=\"${DEFAULT_COLOR}\"\n\n  local dir_name base_name\n  # use ZSH substitution to get the dirname and basename instead of calling external functions\n  dir_name=${path_opt%/*}\n  base_name=${path_opt##*/}\n\n  # if the user wants the last directory colored...\n  if [[ -n ${POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND} ]]; then\n    # it the path is \"/\" or \"~\"\n    if [[ $path_opt == \"/\" || $path_opt == \"~\" ]]; then\n      current_path=\"${bld_on}%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${current_path}${bld_off}\"\n    else # has a subfolder\n      # test if dirname != basename - they are equal if we use truncate_to_last or truncate_absolute\n      if [[ $dir_name != $base_name ]]; then\n        current_path=\"${dir_name}/${bld_on}%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${base_name}${bld_off}\"\n      else\n        current_path=\"${bld_on}%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${base_name}${bld_off}\"\n      fi\n    fi\n  else # no coloring\n    # it the path is \"/\" or \"~\"\n    if [[ $path_opt == \"/\" || $path_opt == \"~\" ]]; then\n      current_path=\"${bld_on}${current_path}${bld_off}\"\n    else # has a subfolder\n      # test if dirname != basename - they are equal if we use truncate_to_last or truncate_absolute\n      if [[ $dir_name != $base_name ]]; then\n        current_path=\"${dir_name}/${bld_on}${base_name}${bld_off}\"\n      else\n        current_path=\"${bld_on}${base_name}${bld_off}\"\n      fi\n    fi\n  fi\n\n  # check if we need to omit the first character and only do it if we are not in \"~\" or \"/\"\n  if [[ \"${POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER}\" == \"true\" && $path_opt != \"/\" && $path_opt != \"~\" ]]; then\n    current_path=\"${current_path[2,-1]}\"\n  fi\n\n  # check if the user wants the separator colored.\n  if [[ -n ${POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND} && $path_opt != \"/\" ]]; then\n    # because this contains color changing codes, it is easier to set a variable for what should be replaced\n    local repl=\"%F{$POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND}/%F{$dir_state_foreground}\"\n    # escape the / with a \\\n    current_path=${current_path//\\//$repl}\n  fi\n\n  if [[ \"${POWERLEVEL9K_DIR_PATH_SEPARATOR}\" != \"/\" && $path_opt != \"/\" ]]; then\n    current_path=${current_path//\\//$POWERLEVEL9K_DIR_PATH_SEPARATOR}\n  fi\n\n  if [[ \"${POWERLEVEL9K_HOME_FOLDER_ABBREVIATION}\" != \"~\" && ! \"${(L)POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER}\" == \"true\" ]]; then\n    # use :s to only replace the first occurance\n    current_path=${current_path:s/~/$POWERLEVEL9K_HOME_FOLDER_ABBREVIATION}\n  fi\n\n  \"$1_prompt_segment\" \"$0_${current_state}\" \"$2\" \"blue\" \"$DEFAULT_COLOR\" \"${current_path}\" \"${dir_states[$current_state]}\"\n}\n\n################################################################\n# Docker machine\nprompt_docker_machine() {\n  local docker_machine=\"$DOCKER_MACHINE_NAME\"\n\n  if [[ -n \"$docker_machine\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"magenta\" \"$DEFAULT_COLOR\" \"$docker_machine\" 'SERVER_ICON'\n  fi\n}\n\n################################################################\n# GO prompt\nprompt_go_version() {\n  local go_version\n  local go_path\n  go_version=$(go version 2>/dev/null | sed -E \"s/.*(go[0-9.]*).*/\\1/\")\n  go_path=$(go env GOPATH 2>/dev/null)\n\n  if [[ -n \"$go_version\" && \"${PWD##$go_path}\" != \"$PWD\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"green\" \"grey93\" \"$go_version\" \"GO_ICON\"\n  fi\n}\n\n################################################################\n# Command number (in local history)\nprompt_history() {\n  \"$1_prompt_segment\" \"$0\" \"$2\" \"grey50\" \"$DEFAULT_COLOR\" '%h'\n}\n\n################################################################\n# Detection for virtualization (systemd based systems only)\nprompt_detect_virt() {\n  local virt=$(systemd-detect-virt 2> /dev/null)\n  if [[ \"$virt\" == \"none\" ]]; then\n    if [[ \"$(ls -di / | grep -o 2)\" != \"2\" ]]; then\n      virt=\"chroot\"\n    fi\n  fi\n\n  if [[ -n \"${virt}\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"$DEFAULT_COLOR\" \"yellow\" \"$virt\"\n  fi\n}\n\n################################################################\n# Test icons\nprompt_icons_test() {\n  for key in ${(@k)icons}; do\n    # The lower color spectrum in ZSH makes big steps. Choosing\n    # the next color has enough contrast to read.\n    local random_color=$((RANDOM % 8))\n    local next_color=$((random_color+1))\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"$random_color\" \"$next_color\" \"$key\" \"$key\"\n  done\n}\n\n################################################################\n# Segment to display the current IP address\nprompt_ip() {\n  local ROOT_PREFIX=\"${4}\"\n  local ip=$(p9k::parseIp \"${POWERLEVEL9K_IP_INTERFACE}\" \"${ROOT_PREFIX}\")\n\n  if [[ -n \"$ip\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"cyan\" \"$DEFAULT_COLOR\" \"$ip\" 'NETWORK_ICON'\n  fi\n}\n\n################################################################\n# Segment to display if VPN is active\nset_default POWERLEVEL9K_VPN_IP_INTERFACE \"tun\"\n# prompt if vpn active\nprompt_vpn_ip() {\n  local ROOT_PREFIX=\"${4}\"\n  local ip=$(p9k::parseIp \"${POWERLEVEL9K_VPN_IP_INTERFACE}\" \"${ROOT_PREFIX}\")\n\n  if [[ -n \"${ip}\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"cyan\" \"$DEFAULT_COLOR\" \"$ip\" 'VPN_ICON'\n  fi\n}\n\n################################################################\n# Segment to display laravel version\nprompt_laravel_version() {\n  local laravel_version=\"$(php artisan --version 2> /dev/null)\"\n  if [[ -n \"${laravel_version}\" && \"${laravel_version}\" =~ \"Laravel Framework\" ]]; then\n    # Strip out everything but the version\n    laravel_version=\"${laravel_version//Laravel Framework /}\"\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"maroon\" \"white\" \"${laravel_version}\" 'LARAVEL_ICON'\n  fi\n}\n\n################################################################\n# Segment to display load\nset_default POWERLEVEL9K_LOAD_WHICH 5\nprompt_load() {\n  local ROOT_PREFIX=\"${4}\"\n  # The load segment can have three different states\n  local current_state=\"unknown\"\n  local load_select=2\n  local load_avg\n  local cores\n\n  typeset -AH load_states\n  load_states=(\n    'critical'      'red'\n    'warning'       'yellow'\n    'normal'        'green'\n  )\n\n  case \"$POWERLEVEL9K_LOAD_WHICH\" in\n    1)\n      load_select=1\n      ;;\n    5)\n      load_select=2\n      ;;\n    15)\n      load_select=3\n      ;;\n  esac\n\n  case \"$OS\" in\n    OSX|BSD)\n      load_avg=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\\.|,)[0-9]+' | sed -n ${load_select}p)\n      if [[ \"$OS\" == \"OSX\" ]]; then\n        cores=$(sysctl -n hw.logicalcpu)\n      else\n        cores=$(sysctl -n hw.ncpu)\n      fi\n      ;;\n    *)\n      load_avg=$(cut -d\" \" -f${load_select} ${ROOT_PREFIX}/proc/loadavg)\n      cores=$(nproc)\n  esac\n\n  # Replace comma\n  load_avg=${load_avg//,/.}\n\n  if [[ \"$load_avg\" -gt $((${cores} * 0.7)) ]]; then\n    current_state=\"critical\"\n  elif [[ \"$load_avg\" -gt $((${cores} * 0.5)) ]]; then\n    current_state=\"warning\"\n  else\n    current_state=\"normal\"\n  fi\n\n  \"$1_prompt_segment\" \"${0}_${current_state}\" \"$2\" \"${load_states[$current_state]}\" \"$DEFAULT_COLOR\" \"$load_avg\" 'LOAD_ICON'\n}\n\n################################################################\n# Segment to diplay Node version\nprompt_node_version() {\n  local node_version=$(node -v 2>/dev/null)\n  [[ -z \"${node_version}\" ]] && return\n\n  \"$1_prompt_segment\" \"$0\" \"$2\" \"green\" \"white\" \"${node_version:1}\" 'NODE_ICON'\n}\n\n################################################################\n# Segment to display Node version from NVM\n# Only prints the segment if different than the default value\nprompt_nvm() {\n  local node_version nvm_default\n  (( $+functions[nvm_version] )) || return\n\n  node_version=$(nvm_version current)\n  [[ -z \"${node_version}\" || ${node_version} == \"none\" ]] && return\n\n  nvm_default=$(nvm_version default)\n  [[ \"$node_version\" =~ \"$nvm_default\" ]] && return\n\n  $1_prompt_segment \"$0\" \"$2\" \"magenta\" \"black\" \"${node_version:1}\" 'NODE_ICON'\n}\n\n################################################################\n# Segment to display NodeEnv\nprompt_nodeenv() {\n  if [[ -n \"$NODE_VIRTUAL_ENV\" ]]; then\n    local info=\"$(node -v)[${NODE_VIRTUAL_ENV:t}]\"\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"black\" \"green\" \"$info\" 'NODE_ICON'\n  fi\n}\n\n################################################################\n# Segment to print a little OS icon\nprompt_os_icon() {\n  \"$1_prompt_segment\" \"$0\" \"$2\" \"black\" \"white\" \"$OS_ICON\"\n}\n\n################################################################\n# Segment to display PHP version number\nprompt_php_version() {\n  local php_version\n  php_version=$(php -v 2>&1 | grep -oe \"^PHP\\s*[0-9.]*\")\n\n  if [[ -n \"$php_version\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"fuchsia\" \"grey93\" \"$php_version\"\n  fi\n}\n\n################################################################\n# Segment to display free RAM and used Swap\nprompt_ram() {\n  local ROOT_PREFIX=\"${4}\"\n  local base=''\n  local ramfree=0\n  if [[ \"$OS\" == \"OSX\" ]]; then\n    # Available = Free + Inactive\n    # See https://support.apple.com/en-us/HT201538\n    ramfree=$(vm_stat | grep \"Pages free\" | grep -o -E '[0-9]+')\n    ramfree=$((ramfree + $(vm_stat | grep \"Pages inactive\" | grep -o -E '[0-9]+')))\n    # Convert pages into Bytes\n    ramfree=$(( ramfree * 4096 ))\n  else\n    if [[ \"$OS\" == \"BSD\" ]]; then\n      ramfree=$(grep 'avail memory' ${ROOT_PREFIX}/var/run/dmesg.boot | awk '{print $4}')\n    else\n      ramfree=$(grep -o -E \"MemAvailable:\\s+[0-9]+\" ${ROOT_PREFIX}/proc/meminfo | grep -o -E \"[0-9]+\")\n      base='K'\n    fi\n  fi\n\n  \"$1_prompt_segment\" \"$0\" \"$2\" \"yellow\" \"$DEFAULT_COLOR\" \"$(printSizeHumanReadable \"$ramfree\" $base)\" 'RAM_ICON'\n}\n\n################################################################\n# Segment to display rbenv information\n# https://github.com/rbenv/rbenv#choosing-the-ruby-version\nset_default POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW false\nprompt_rbenv() {\n  if [[ -n \"$RBENV_VERSION\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"red\" \"$DEFAULT_COLOR\" \"$RBENV_VERSION\" 'RUBY_ICON'\n  elif [ $commands[rbenv] ]; then\n    local rbenv_version_name=\"$(rbenv version-name)\"\n    local rbenv_global=\"$(rbenv global)\"\n    if [[ \"${rbenv_version_name}\" != \"${rbenv_global}\" || \"${POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW}\" == \"true\" ]]; then\n      \"$1_prompt_segment\" \"$0\" \"$2\" \"red\" \"$DEFAULT_COLOR\" \"$rbenv_version_name\" 'RUBY_ICON'\n    fi\n  fi\n}\n\n################################################################\n# Segment to display chruby information\n# see https://github.com/postmodern/chruby/issues/245 for chruby_auto issue with ZSH\nprompt_chruby() {\n  # Uses $RUBY_VERSION and $RUBY_ENGINE set by chruby\n  set_default POWERLEVEL9K_CHRUBY_SHOW_VERSION true\n  set_default POWERLEVEL9K_CHRUBY_SHOW_ENGINE true\n  local chruby_label=\"\"\n\n  if [[ \"$POWERLEVEL9K_CHRUBY_SHOW_ENGINE\" == true ]]; then\n    chruby_label+=\"$RUBY_ENGINE \"\n  fi\n  if [[ \"$POWERLEVEL9K_CHRUBY_SHOW_VERSION\" == true ]]; then\n    chruby_label+=\"$RUBY_VERSION\"\n  fi\n\n  # Truncate trailing spaces\n  chruby_label=\"${chruby_label%\"${chruby_label##*[![:space:]]}\"}\"\n\n  # Don't show anything if the chruby did not change the default ruby\n  if [[ \"$RUBY_ENGINE\" != \"\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"red\" \"$DEFAULT_COLOR\" \"${chruby_label}\" 'RUBY_ICON'\n  fi\n}\n\n################################################################\n# Segment to print an icon if user is root.\nprompt_root_indicator() {\n  if [[ \"$UID\" -eq 0 ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"$DEFAULT_COLOR\" \"yellow\" \"\" 'ROOT_ICON'\n  fi\n}\n\n################################################################\n# Segment to display Rust version number\nprompt_rust_version() {\n  local rust_version\n  rust_version=$(command rustc --version 2>/dev/null)\n  # Remove \"rustc \" (including the whitespace) from the beginning\n  # of the version string and remove everything after the next\n  # whitespace. This way we'll end up with only the version.\n  rust_version=${${rust_version/rustc /}%% *}\n\n  if [[ -n \"$rust_version\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"darkorange\" \"$DEFAULT_COLOR\" \"$rust_version\" 'RUST_ICON'\n  fi\n}\n\n# RSpec test ratio\nprompt_rspec_stats() {\n  if [[ (-d app && -d spec) ]]; then\n    local code_amount tests_amount\n    code_amount=$(ls -1 app/**/*.rb | wc -l)\n    tests_amount=$(ls -1 spec/**/*.rb | wc -l)\n\n    build_test_stats \"$1\" \"$0\" \"$2\" \"$code_amount\" \"$tests_amount\" \"RSpec\" 'TEST_ICON'\n  fi\n}\n\n################################################################\n# Segment to display Ruby Version Manager information\nprompt_rvm() {\n  if [ $commands[rvm-prompt] ]; then\n    local version_and_gemset=${$(rvm-prompt v p)/ruby-}\n\n    if [[ -n \"$version_and_gemset\" ]]; then\n      \"$1_prompt_segment\" \"$0\" \"$2\" \"240\" \"$DEFAULT_COLOR\" \"$version_and_gemset\" 'RUBY_ICON'\n    fi\n  fi\n}\n\n################################################################\n# Segment to display SSH icon when connected\nprompt_ssh() {\n  if [[ -n \"$SSH_CLIENT\" ]] || [[ -n \"$SSH_TTY\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"$DEFAULT_COLOR\" \"yellow\" \"\" 'SSH_ICON'\n  fi\n}\n\n################################################################\n# Status: When an error occur, return the error code, or a cross icon if option is set\n# Display an ok icon when no error occur, or hide the segment if option is set to false\n#\nset_default POWERLEVEL9K_STATUS_CROSS false\nset_default POWERLEVEL9K_STATUS_OK true\nset_default POWERLEVEL9K_STATUS_SHOW_PIPESTATUS true\nset_default POWERLEVEL9K_STATUS_HIDE_SIGNAME false\n# old options, retro compatibility\nset_default POWERLEVEL9K_STATUS_VERBOSE true\nset_default POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE false\n\nexit_code_or_status() {\n  local ec=$1\n  if [[ \"$POWERLEVEL9K_STATUS_HIDE_SIGNAME\" = true ]]; then\n    echo \"$ec\"\n  elif (( ec <= 128 )); then\n    echo \"$ec\"\n  else\n    local sig=$(( ec - 128 ))\n    local idx=$(( sig + 1 ))\n    echo \"SIG${signals[$idx]}(${sig})\"\n  fi\n}\n\nprompt_status() {\n  local ec_text\n  local ec_sum\n  local ec\n\n  if [[ $POWERLEVEL9K_STATUS_SHOW_PIPESTATUS == true ]]; then\n    if (( $#RETVALS > 1 )); then\n      ec_text=$(exit_code_or_status \"${RETVALS[1]}\")\n      ec_sum=${RETVALS[1]}\n    else\n      ec_text=$(exit_code_or_status \"${RETVAL}\")\n      ec_sum=${RETVAL}\n    fi\n\n    for ec in \"${(@)RETVALS[2,-1]}\"; do\n      ec_text=\"${ec_text}|$(exit_code_or_status \"$ec\")\"\n      ec_sum=$(( $ec_sum + $ec ))\n    done\n  else\n    # We use RETVAL instead of the right-most RETVALS item because\n    # PIPE_FAIL may be set.\n    ec_text=$(exit_code_or_status \"${RETVAL}\")\n    ec_sum=${RETVAL}\n  fi\n\n  if (( ec_sum > 0 )); then\n    if [[ \"$POWERLEVEL9K_STATUS_CROSS\" == false && \"$POWERLEVEL9K_STATUS_VERBOSE\" == true ]]; then\n      \"$1_prompt_segment\" \"$0_ERROR\" \"$2\" \"red\" \"yellow1\" \"$ec_text\" 'CARRIAGE_RETURN_ICON'\n    else\n      \"$1_prompt_segment\" \"$0_ERROR\" \"$2\" \"$DEFAULT_COLOR\" \"red\" \"\" 'FAIL_ICON'\n    fi\n  elif [[ \"$POWERLEVEL9K_STATUS_OK\" == true ]] && [[ \"$POWERLEVEL9K_STATUS_VERBOSE\" == true || \"$POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE\" == true ]]; then\n    \"$1_prompt_segment\" \"$0_OK\" \"$2\" \"$DEFAULT_COLOR\" \"green\" \"\" 'OK_ICON'\n  fi\n}\n\n################################################################\n# Segment to display Swap information\nprompt_swap() {\n  local ROOT_PREFIX=\"${4}\"\n  local swap_used=0\n  local base=''\n\n  if [[ \"$OS\" == \"OSX\" ]]; then\n    local raw_swap_used\n    raw_swap_used=$(sysctl vm.swapusage | grep -o \"used\\s*=\\s*[0-9,.A-Z]*\" | grep -o \"[0-9,.A-Z]*$\")\n\n    typeset -F 2 swap_used\n    swap_used=${$(echo $raw_swap_used | grep -o \"[0-9,.]*\")//,/.}\n    # Replace comma\n    swap_used=${swap_used//,/.}\n\n    base=$(echo \"$raw_swap_used\" | grep -o \"[A-Z]*$\")\n  else\n    swap_total=$(grep -o -E \"SwapTotal:\\s+[0-9]+\" ${ROOT_PREFIX}/proc/meminfo | grep -o -E \"[0-9]+\")\n    swap_free=$(grep -o -E \"SwapFree:\\s+[0-9]+\" ${ROOT_PREFIX}/proc/meminfo | grep -o -E \"[0-9]+\")\n    swap_used=$(( swap_total - swap_free ))\n    base='K'\n  fi\n\n  \"$1_prompt_segment\" \"$0\" \"$2\" \"yellow\" \"$DEFAULT_COLOR\" \"$(printSizeHumanReadable \"$swap_used\" $base)\" 'SWAP_ICON'\n}\n\n################################################################\n# Symfony2-PHPUnit test ratio\nprompt_symfony2_tests() {\n  if [[ (-d src && -d app && -f app/AppKernel.php) ]]; then\n    local code_amount tests_amount\n    code_amount=$(ls -1 src/**/*.php | grep -vc Tests)\n    tests_amount=$(ls -1 src/**/*.php | grep -c Tests)\n\n    build_test_stats \"$1\" \"$0\" \"$2\" \"$code_amount\" \"$tests_amount\" \"SF2\" 'TEST_ICON'\n  fi\n}\n\n################################################################\n# Segment to display Symfony2-Version\nprompt_symfony2_version() {\n  if [[ -f app/bootstrap.php.cache ]]; then\n    local symfony2_version\n    symfony2_version=$(grep \" VERSION \" app/bootstrap.php.cache | sed -e 's/[^.0-9]*//g')\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"grey35\" \"$DEFAULT_COLOR\" \"$symfony2_version\" 'SYMFONY_ICON'\n  fi\n}\n\n################################################################\n# Show a ratio of tests vs code\nbuild_test_stats() {\n  local code_amount=\"$4\"\n  local tests_amount=\"$5\"+0.00001\n  local headline=\"$6\"\n\n  # Set float precision to 2 digits:\n  typeset -F 2 ratio\n  local ratio=$(( (tests_amount/code_amount) * 100 ))\n\n  (( ratio >= 75 )) && \"$1_prompt_segment\" \"${2}_GOOD\" \"$3\" \"cyan\" \"$DEFAULT_COLOR\" \"$headline: $ratio%%\" \"$6\"\n  (( ratio >= 50 && ratio < 75 )) && \"$1_prompt_segment\" \"$2_AVG\" \"$3\" \"yellow\" \"$DEFAULT_COLOR\" \"$headline: $ratio%%\" \"$6\"\n  (( ratio < 50 )) && \"$1_prompt_segment\" \"$2_BAD\" \"$3\" \"red\" \"$DEFAULT_COLOR\" \"$headline: $ratio%%\" \"$6\"\n}\n\n################################################################\n# System time\nprompt_time() {\n  set_default POWERLEVEL9K_TIME_FORMAT \"%D{%H:%M:%S}\"\n\n  \"$1_prompt_segment\" \"$0\" \"$2\" \"$DEFAULT_COLOR_INVERTED\" \"$DEFAULT_COLOR\" \"$POWERLEVEL9K_TIME_FORMAT\" \"TIME_ICON\"\n}\n\n################################################################\n# System date\nprompt_date() {\n  set_default POWERLEVEL9K_DATE_FORMAT \"%D{%d.%m.%y}\"\n\n  \"$1_prompt_segment\" \"$0\" \"$2\" \"$DEFAULT_COLOR_INVERTED\" \"$DEFAULT_COLOR\" \"$POWERLEVEL9K_DATE_FORMAT\" \"DATE_ICON\"\n}\n\n################################################################\n# todo.sh: shows the number of tasks in your todo.sh file\nprompt_todo() {\n  if $(hash todo.sh 2>&-); then\n    count=$(todo.sh ls | egrep \"TODO: [0-9]+ of ([0-9]+) tasks shown\" | awk '{ print $4 }')\n    if [[ \"$count\" = <-> ]]; then\n      \"$1_prompt_segment\" \"$0\" \"$2\" \"grey50\" \"$DEFAULT_COLOR\" \"$count\" 'TODO_ICON'\n    fi\n  fi\n}\n\n################################################################\n# VCS segment: shows the state of your repository, if you are in a folder under\n# version control\nset_default POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND \"red\"\n# Default: Just display the first 8 characters of our changeset-ID.\nset_default POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH \"8\"\npowerlevel9k_vcs_init() {\n  if [[ -n \"$POWERLEVEL9K_CHANGESET_HASH_LENGTH\" ]]; then\n    POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH=\"$POWERLEVEL9K_CHANGESET_HASH_LENGTH\"\n  fi\n\n  # Load VCS_INFO\n  autoload -Uz vcs_info\n\n  VCS_WORKDIR_DIRTY=false\n  VCS_WORKDIR_HALF_DIRTY=false\n\n  # The vcs segment can have three different states - defaults to 'clean'.\n  typeset -gAH vcs_states\n  vcs_states=(\n    'clean'         'green'\n    'modified'      'yellow'\n    'untracked'     'green'\n  )\n\n  VCS_CHANGESET_PREFIX=''\n  if [[ \"$POWERLEVEL9K_SHOW_CHANGESET\" == true ]]; then\n    VCS_CHANGESET_PREFIX=\"$(print_icon 'VCS_COMMIT_ICON')%0.$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH\"\"i \"\n  fi\n\n  zstyle ':vcs_info:*' enable git hg svn\n  zstyle ':vcs_info:*' check-for-changes true\n\n  VCS_DEFAULT_FORMAT=\"$VCS_CHANGESET_PREFIX%b%c%u%m\"\n  zstyle ':vcs_info:*' formats \"$VCS_DEFAULT_FORMAT\"\n\n  zstyle ':vcs_info:*' actionformats \"%b %F{${POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND}}| %a%f\"\n\n  zstyle ':vcs_info:*' stagedstr \" $(print_icon 'VCS_STAGED_ICON')\"\n  zstyle ':vcs_info:*' unstagedstr \" $(print_icon 'VCS_UNSTAGED_ICON')\"\n\n  defined POWERLEVEL9K_VCS_GIT_HOOKS || POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname)\n  zstyle ':vcs_info:git*+set-message:*' hooks $POWERLEVEL9K_VCS_GIT_HOOKS\n  defined POWERLEVEL9K_VCS_HG_HOOKS || POWERLEVEL9K_VCS_HG_HOOKS=(vcs-detect-changes)\n  zstyle ':vcs_info:hg*+set-message:*' hooks $POWERLEVEL9K_VCS_HG_HOOKS\n  defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(vcs-detect-changes svn-detect-changes)\n  zstyle ':vcs_info:svn*+set-message:*' hooks $POWERLEVEL9K_VCS_SVN_HOOKS\n\n  # For Hg, only show the branch name\n  zstyle ':vcs_info:hg*:*' branchformat \"$(print_icon 'VCS_BRANCH_ICON')%b\"\n  # The `get-revision` function must be turned on for dirty-check to work for Hg\n  zstyle ':vcs_info:hg*:*' get-revision true\n  zstyle ':vcs_info:hg*:*' get-bookmarks true\n  zstyle ':vcs_info:hg*+gen-hg-bookmark-string:*' hooks hg-bookmarks\n\n  # For svn, only\n  # TODO fix the %b (branch) format for svn. Using %b breaks\n  # color-encoding of the foreground for the rest of the powerline.\n  zstyle ':vcs_info:svn*:*' formats \"$VCS_CHANGESET_PREFIX%c%u\"\n  zstyle ':vcs_info:svn*:*' actionformats \"$VCS_CHANGESET_PREFIX%c%u %F{${POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND}}| %a%f\"\n\n  if [[ \"$POWERLEVEL9K_SHOW_CHANGESET\" == true ]]; then\n    zstyle ':vcs_info:*' get-revision true\n  fi\n}\n\n################################################################\n# Segment to show VCS information\nprompt_vcs() {\n  VCS_WORKDIR_DIRTY=false\n  VCS_WORKDIR_HALF_DIRTY=false\n  local current_state=\"\"\n\n  # Actually invoke vcs_info manually to gather all information.\n  vcs_info\n  local vcs_prompt=\"${vcs_info_msg_0_}\"\n\n  if [[ -n \"$vcs_prompt\" ]]; then\n    if [[ \"$VCS_WORKDIR_DIRTY\" == true ]]; then\n      # $vcs_visual_identifier gets set in +vi-vcs-detect-changes in functions/vcs.zsh,\n      # as we have there access to vcs_info internal hooks.\n      current_state='modified'\n    else\n      if [[ \"$VCS_WORKDIR_HALF_DIRTY\" == true ]]; then\n        current_state='untracked'\n      else\n        current_state='clean'\n      fi\n    fi\n    \"$1_prompt_segment\" \"${0}_${(U)current_state}\" \"$2\" \"${vcs_states[$current_state]}\" \"$DEFAULT_COLOR\" \"$vcs_prompt\" \"$vcs_visual_identifier\"\n  fi\n}\n\n################################################################\n# Vi Mode: show editing mode (NORMAL|INSERT)\nset_default POWERLEVEL9K_VI_INSERT_MODE_STRING \"INSERT\"\nset_default POWERLEVEL9K_VI_COMMAND_MODE_STRING \"NORMAL\"\nprompt_vi_mode() {\n  case ${KEYMAP} in\n    vicmd)\n      \"$1_prompt_segment\" \"$0_NORMAL\" \"$2\" \"$DEFAULT_COLOR\" \"white\" \"$POWERLEVEL9K_VI_COMMAND_MODE_STRING\"\n    ;;\n    main|viins|*)\n      if [[ -z $POWERLEVEL9K_VI_INSERT_MODE_STRING ]]; then return; fi\n      \"$1_prompt_segment\" \"$0_INSERT\" \"$2\" \"$DEFAULT_COLOR\" \"blue\" \"$POWERLEVEL9K_VI_INSERT_MODE_STRING\"\n    ;;\n  esac\n}\n\n################################################################\n# Virtualenv: current working virtualenv\n# More information on virtualenv (Python):\n# https://virtualenv.pypa.io/en/latest/\nprompt_virtualenv() {\n  local virtualenv_path=\"$VIRTUAL_ENV\"\n\n  # Early exit; $virtualenv_path must always be set.\n  [[ -z \"$virtualenv_path\" ]] && return\n\n  \"$1_prompt_segment\" \"$0\" \"$2\" \"blue\" \"$DEFAULT_COLOR\" \"${virtualenv_path:t}\" 'PYTHON_ICON'\n}\n\n################################################################\n# Segment to display pyenv information\n# https://github.com/pyenv/pyenv#choosing-the-python-version\nset_default POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW false\nprompt_pyenv() {\n  if [[ -n \"$PYENV_VERSION\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"blue\" \"$DEFAULT_COLOR\" \"$PYENV_VERSION\" 'PYTHON_ICON'\n  elif [ $commands[pyenv] ]; then\n    local pyenv_version_name=\"$(pyenv version-name)\"\n    local pyenv_global=\"system\"\n    local pyenv_root=\"$(pyenv root)\"\n    if [[ -f \"${pyenv_root}/version\" ]]; then\n      pyenv_global=\"$(pyenv version-file-read ${pyenv_root}/version)\"\n    fi\n    if [[ \"${pyenv_version_name}\" != \"${pyenv_global}\" || \"${POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW}\" == \"true\" ]]; then\n      \"$1_prompt_segment\" \"$0\" \"$2\" \"blue\" \"$DEFAULT_COLOR\" \"$pyenv_version_name\" 'PYTHON_ICON'\n    fi\n  fi\n}\n\n################################################################\n# Display openfoam information\nprompt_openfoam() {\n  local wm_project_version=\"$WM_PROJECT_VERSION\"\n  local wm_fork=\"$WM_FORK\"\n  if [[ -n \"$wm_project_version\" ]] &&  [[ -z \"$wm_fork\" ]] ; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"yellow\" \"$DEFAULT_COLOR\" \"OF: $(basename \"$wm_project_version\")\"\n  elif [[ -n \"$wm_project_version\" ]] && [[ -n \"$wm_fork\" ]] ; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"yellow\" \"$DEFAULT_COLOR\" \"F-X: $(basename \"$wm_project_version\")\"\n  fi\n}\n\n################################################################\n# Segment to display Swift version\nprompt_swift_version() {\n  # Get the first number as this is probably the \"main\" version number..\n  local swift_version=$(swift --version 2>/dev/null | grep -o -E \"[0-9.]+\" | head -n 1)\n  [[ -z \"${swift_version}\" ]] && return\n\n  \"$1_prompt_segment\" \"$0\" \"$2\" \"magenta\" \"white\" \"${swift_version}\" 'SWIFT_ICON'\n}\n\n################################################################\n# dir_writable: Display information about the user's permission to write in the current directory\nprompt_dir_writable() {\n  if [[ ! -w \"$PWD\" ]]; then\n    \"$1_prompt_segment\" \"$0_FORBIDDEN\" \"$2\" \"red\" \"yellow1\" \"\" 'LOCK_ICON'\n  fi\n}\n\n################################################################\n# Kubernetes Current Context/Namespace\nprompt_kubecontext() {\n  local kubectl_version=\"$(kubectl version --client 2>/dev/null)\"\n\n  if [[ -n \"$kubectl_version\" ]]; then\n    # Get the current Kuberenetes context\n    local cur_ctx=$(kubectl config view -o=jsonpath='{.current-context}')\n    cur_namespace=\"$(kubectl config view -o=jsonpath=\"{.contexts[?(@.name==\\\"${cur_ctx}\\\")].context.namespace}\")\"\n    # If the namespace comes back empty set it default.\n    if [[ -z \"${cur_namespace}\" ]]; then\n      cur_namespace=\"default\"\n    fi\n\n    local k8s_final_text=\"\"\n\n    if [[ \"$cur_ctx\" == \"$cur_namespace\" ]]; then\n      # No reason to print out the same identificator twice\n      k8s_final_text=\"$cur_ctx\"\n    else\n      k8s_final_text=\"$cur_ctx/$cur_namespace\"\n    fi\n\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"magenta\" \"white\" \"$k8s_final_text\" \"KUBERNETES_ICON\"\n  fi\n}\n\n################################################################\n# Dropbox status\nprompt_dropbox() {\n  # The first column is just the directory, so cut it\n  local dropbox_status=\"$(dropbox-cli filestatus . | cut -d\\  -f2-)\"\n\n  # Only show if the folder is tracked and dropbox is running\n  if [[ \"$dropbox_status\" != 'unwatched' && \"$dropbox_status\" != \"isn't running!\" ]]; then\n    # If \"up to date\", only show the icon\n    if [[ \"$dropbox_status\" =~ 'up to date' ]]; then\n      dropbox_status=\"\"\n    fi\n\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"white\" \"blue\" \"$dropbox_status\" \"DROPBOX_ICON\"\n  fi\n}\n\n# print Java version number\nprompt_java_version() {\n  local java_version\n  # Stupid: Java prints its version on STDERR.\n  # The first version ouput will print nothing, we just\n  # use it to transport whether the command was successful.\n  # If yes, we parse the version string (and need to\n  # redirect the stderr to stdout to make the pipe work).\n  java_version=$(java -version 2>/dev/null && java -fullversion 2>&1 | cut -d '\"' -f 2)\n\n  if [[ -n \"$java_version\" ]]; then\n    \"$1_prompt_segment\" \"$0\" \"$2\" \"red\" \"white\" \"$java_version\" \"JAVA_ICON\"\n  fi\n}\n\n################################################################\n# Prompt processing and drawing\n################################################################\n# Main prompt\nbuild_left_prompt() {\n  local index=1\n  local element\n  for element in \"${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[@]}\"; do\n    # Remove joined information in direct calls\n    element=${element%_joined}\n\n    # Check if it is a custom command, otherwise interpet it as\n    # a prompt.\n    if [[ $element[0,7] =~ \"custom_\" ]]; then\n      \"prompt_custom\" \"left\" \"$index\" $element[8,-1]\n    else\n      \"prompt_$element\" \"left\" \"$index\"\n    fi\n\n    index=$((index + 1))\n  done\n\n  left_prompt_end\n}\n\n# Right prompt\nbuild_right_prompt() {\n  local index=1\n  local element\n  for element in \"${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[@]}\"; do\n    # Remove joined information in direct calls\n    element=${element%_joined}\n\n    # Check if it is a custom command, otherwise interpet it as\n    # a prompt.\n    if [[ $element[0,7] =~ \"custom_\" ]]; then\n      \"prompt_custom\" \"right\" \"$index\" $element[8,-1]\n    else\n      \"prompt_$element\" \"right\" \"$index\"\n    fi\n\n    index=$((index + 1))\n  done\n\n  # Clear to the end of the line\n  echo -n \"%E\"\n}\n\npowerlevel9k_preexec() {\n  _P9K_TIMER_START=$EPOCHREALTIME\n}\n\nset_default POWERLEVEL9K_PROMPT_ADD_NEWLINE false\npowerlevel9k_prepare_prompts() {\n  # Return values. These need to be global, because\n  # they are used in prompt_status. Also, we need\n  # to get the return value of the last command at\n  # very first in this function. Do not move the\n  # lines down, otherwise the last command is not\n  # what you expected it to be.\n  RETVAL=$?\n  RETVALS=( \"$pipestatus[@]\" )\n\n  local RPROMPT_SUFFIX RPROMPT_PREFIX\n  _P9K_COMMAND_DURATION=$((EPOCHREALTIME - _P9K_TIMER_START))\n\n  # Reset start time\n  _P9K_TIMER_START=0x7FFFFFFF\n\n  if [[ \"$POWERLEVEL9K_PROMPT_ON_NEWLINE\" == true ]]; then\n    PROMPT='$(print_icon 'MULTILINE_FIRST_PROMPT_PREFIX')%f%b%k$(build_left_prompt)\n$(print_icon 'MULTILINE_LAST_PROMPT_PREFIX')'\n    if [[ \"$POWERLEVEL9K_RPROMPT_ON_NEWLINE\" != true ]]; then\n      # The right prompt should be on the same line as the first line of the left\n      # prompt. To do so, there is just a quite ugly workaround: Before zsh draws\n      # the RPROMPT, we advise it, to go one line up. At the end of RPROMPT, we\n      # advise it to go one line down. See:\n      # http://superuser.com/questions/357107/zsh-right-justify-in-ps1\n      local LC_ALL=\"\" LC_CTYPE=\"en_US.UTF-8\" # Set the right locale to protect special characters\n      RPROMPT_PREFIX='%{'$'\\e[1A''%}' # one line up\n      RPROMPT_SUFFIX='%{'$'\\e[1B''%}' # one line down\n    else\n      RPROMPT_PREFIX=''\n      RPROMPT_SUFFIX=''\n    fi\n  else\n    PROMPT='%f%b%k$(build_left_prompt)'\n    RPROMPT_PREFIX=''\n    RPROMPT_SUFFIX=''\n  fi\n\n  if [[ \"$POWERLEVEL9K_DISABLE_RPROMPT\" != true ]]; then\n    RPROMPT=\"${RPROMPT_PREFIX}\"'%f%b%k$(build_right_prompt)%{$reset_color%}'\"${RPROMPT_SUFFIX}\"\n  fi\n\nlocal NEWLINE='\n'\n\n  if [[ $POWERLEVEL9K_PROMPT_ADD_NEWLINE == true ]]; then\n    NEWLINES=\"\"\n    repeat ${POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT:-1} { NEWLINES+=$NEWLINE }\n    PROMPT=\"$NEWLINES$PROMPT\"\n  fi\n\n  # Allow iTerm integration to work\n  [[ $ITERM_SHELL_INTEGRATION_INSTALLED == \"Yes\" ]] && PROMPT=\"%{$(iterm2_prompt_mark)%}$PROMPT\"\n}\n\nzle-keymap-select () {\n\tzle reset-prompt\n\tzle -R\n}\n\nset_default POWERLEVEL9K_IGNORE_TERM_COLORS false\nset_default POWERLEVEL9K_IGNORE_TERM_LANG false\n\nprompt_powerlevel9k_setup() {\n  # The value below was set to better support 32-bit CPUs.\n  # It's the maximum _signed_ integer value on 32-bit CPUs.\n  # Please don't change it until 19 January of 2038. ;)\n\n  # Disable false display of command execution time\n  _P9K_TIMER_START=0x7FFFFFFF\n\n  # The prompt function will set these prompt_* options after the setup function\n  # returns. We need prompt_subst so we can safely run commands in the prompt\n  # without them being double expanded and we need prompt_percent to expand the\n  # common percent escape sequences.\n  prompt_opts=(cr percent sp subst)\n\n  # Borrowed from promptinit, sets the prompt options in case the theme was\n  # not initialized via promptinit.\n  setopt noprompt{bang,cr,percent,sp,subst} \"prompt${^prompt_opts[@]}\"\n\n  # Display a warning if the terminal does not support 256 colors\n  termColors\n\n  # If the terminal `LANG` is set to `C`, this theme will not work at all.\n  if [[ $POWERLEVEL9K_IGNORE_TERM_LANG == false ]]; then\n      local term_lang\n      term_lang=$(echo $LANG)\n      if [[ $term_lang == 'C' ]]; then\n          print -P \"\\t%F{red}WARNING!%f Your terminal's 'LANG' is set to 'C', which breaks this theme!\"\n          print -P \"\\t%F{red}WARNING!%f Please set your 'LANG' to a UTF-8 language, like 'en_US.UTF-8'\"\n          print -P \"\\t%F{red}WARNING!%f _before_ loading this theme in your \\~\\.zshrc. Putting\"\n          print -P \"\\t%F{red}WARNING!%f %F{blue}export LANG=\\\"en_US.UTF-8\\\"%f at the top of your \\~\\/.zshrc is sufficient.\"\n      fi\n  fi\n\n  defined POWERLEVEL9K_LEFT_PROMPT_ELEMENTS || POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs)\n  defined POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS || POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time)\n\n  # Display a warning if deprecated segments are in use.\n  typeset -AH deprecated_segments\n  # old => new\n  deprecated_segments=(\n    'longstatus'      'status'\n  )\n  print_deprecation_warning deprecated_segments\n\n  # initialize colors\n  autoload -U colors && colors\n\n  if segment_in_use \"vcs\"; then\n    powerlevel9k_vcs_init\n  fi\n\n  # initialize timing functions\n  zmodload zsh/datetime\n\n  # Initialize math functions\n  zmodload zsh/mathfunc\n\n  # initialize hooks\n  autoload -Uz add-zsh-hook\n\n  # prepare prompts\n  add-zsh-hook precmd powerlevel9k_prepare_prompts\n  add-zsh-hook preexec powerlevel9k_preexec\n\n  zle -N zle-keymap-select\n}\n\nprompt_powerlevel9k_teardown() {\n  add-zsh-hook -D precmd powerlevel9k_\\*\n  add-zsh-hook -D preexec powerlevel9k_\\*\n  PROMPT='%m%# '\n  RPROMPT=\n}\n\nprompt_powerlevel9k_setup \"$@\"\n"
  },
  {
    "path": "test/core/color_overriding.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n}\n\nfunction testDynamicColoringOfSegmentsWork() {\n  local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(date)\n  local POWERLEVEL9K_DATE_ICON=\"date-icon\"\n  local POWERLEVEL9K_DATE_BACKGROUND='red'\n\n  assertEquals \"%K{001} %F{000}date-icon %F{000}%D{%d.%m.%y} %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testDynamicColoringOfVisualIdentifiersWork() {\n  local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(date)\n  local POWERLEVEL9K_DATE_ICON=\"date-icon\"\n  local POWERLEVEL9K_DATE_VISUAL_IDENTIFIER_COLOR='green'\n\n  assertEquals \"%K{007} %F{002}date-icon %F{000}%D{%d.%m.%y} %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {\n  local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(date)\n  local POWERLEVEL9K_DATE_ICON=\"date-icon\"\n  local POWERLEVEL9K_DATE_VISUAL_IDENTIFIER_COLOR='green'\n  local POWERLEVEL9K_DATE_FOREGROUND='red'\n  local POWERLEVEL9K_DATE_BACKGROUND='yellow'\n\n  assertEquals \"%K{003} %F{002}date-icon %F{001}%D{%d.%m.%y} %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testColorOverridingOfStatefulSegment() {\n  local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(host)\n  local POWERLEVEL9K_SSH_ICON=\"ssh-icon\"\n  local POWERLEVEL9K_HOST_REMOTE_BACKGROUND='red'\n  local POWERLEVEL9K_HOST_REMOTE_FOREGROUND='green'\n  # Provoke state\n  local SSH_CLIENT=\"x\"\n\n  assertEquals \"%K{001} %F{002}ssh-icon %F{002}%m %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testColorOverridingOfCustomSegment() {\n  local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  local POWERLEVEL9K_CUSTOM_WORLD_ICON='CW'\n  local POWERLEVEL9K_CUSTOM_WORLD_VISUAL_IDENTIFIER_COLOR='green'\n  local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND='red'\n  local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND='red'\n\n  assertEquals \"%K{001} %F{002}CW %F{001}world %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/core/joining_segments.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n}\n\nfunction testLeftNormalSegmentsShouldNotBeJoined() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3 custom_world4_joined custom_world5 custom_world6)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo world2\"\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD4=\"echo world4\"\n  local POWERLEVEL9K_CUSTOM_WORLD5=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD6=\"echo world6\"\n  \n  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)\"\n}\n\nfunction testLeftJoinedSegments() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo world2\"\n\n  assertEquals \"%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testLeftTransitiveJoinedSegments() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined custom_world3_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo world2\"\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo world3\"\n\n  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)\"\n}\n\nfunction testLeftTransitiveJoiningWithConditionalJoinedSegment() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined custom_world3_joined custom_world4_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo world2\"\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD4=\"echo world4\"\n\n  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)\"\n}\n\nfunction testLeftPromotingSegmentWithConditionalPredecessor() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo world3\"\n\n  assertEquals \"%K{007} %F{000}world1 %K{007}%F{000} %F{000}world3 %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testLeftPromotingSegmentWithJoinedConditionalPredecessor() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined custom_world4_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD4=\"echo world4\"\n\n  assertEquals \"%K{007} %F{000}world1 %K{007}%F{000} %F{000}world4 %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testLeftPromotingSegmentWithDeepJoinedConditionalPredecessor() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined custom_world4_joined custom_world5_joined custom_world6_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD4=\"echo world4\"\n  local POWERLEVEL9K_CUSTOM_WORLD5=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD6=\"echo world6\"\n\n  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)\"\n}\n\nfunction testLeftJoiningBuiltinSegmentWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version php_version_joined)\n  alias php=\"echo PHP 1.2.3\"\n\n  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)\"\n\n  unalias php\n}\n\nfunction testRightNormalSegmentsShouldNotBeJoined() {\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3 custom_world4 custom_world5_joined custom_world6)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo world2\"\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD4=\"echo world4\"\n  local POWERLEVEL9K_CUSTOM_WORLD5=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD6=\"echo world6\"\n\n  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)\"\n}\n\nfunction testRightJoinedSegments() {\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo world2\"\n\n  assertEquals \"%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2%E\" \"$(build_right_prompt)\"\n}\n\nfunction testRightTransitiveJoinedSegments() {\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined custom_world3_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo world2\"\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo world3\"\n\n  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)\"\n}\n\nfunction testRightTransitiveJoiningWithConditionalJoinedSegment() {\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2_joined custom_world3_joined custom_world4_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo world2\"\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD4=\"echo world4\"\n\n  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)\"\n}\n\nfunction testRightPromotingSegmentWithConditionalPredecessor() {\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo world3\"\n\n  assertEquals \"%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world3%E\" \"$(build_right_prompt)\"\n}\n\nfunction testRightPromotingSegmentWithJoinedConditionalPredecessor() {\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined custom_world4_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD4=\"echo world4\"\n\n  assertEquals \"%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world4%E\" \"$(build_right_prompt)\"\n}\n\nfunction testRightPromotingSegmentWithDeepJoinedConditionalPredecessor() {\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2 custom_world3_joined custom_world4_joined custom_world5_joined custom_world6_joined)\n  local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n  local POWERLEVEL9K_CUSTOM_WORLD2=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD3=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD4=\"echo world4\"\n  local POWERLEVEL9K_CUSTOM_WORLD5=\"echo \" # Print nothing to simulate unmet conditions\n  local POWERLEVEL9K_CUSTOM_WORLD6=\"echo world6\"\n\n  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)\"\n}\n\nfunction testRightJoiningBuiltinSegmentWorks() {\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(php_version php_version_joined)\n  alias php=\"echo PHP 1.2.3\"\n\n  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)\"\n\n  unalias php\n}\nsource shunit2/shunit2"
  },
  {
    "path": "test/core/prompt.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n}\n\nfunction testSegmentOnRightSide() {\n    # Reset RPROMPT, so a running P9K does not interfere with the test\n    local RPROMPT=\n    local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n    POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2)\n    local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n    local POWERLEVEL9K_CUSTOM_WORLD2='echo world2'\n\n    powerlevel9k_prepare_prompts\n\n    local reset_attributes=$'\\e[00m'\n    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}\"\n}\n\nfunction testDisablingRightPrompt() {\n    # Reset RPROMPT, so a running P9K does not interfere with the test\n    local RPROMPT=\n    local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n    POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1 custom_world2)\n    local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n    local POWERLEVEL9K_CUSTOM_WORLD2='echo world2'\n    local POWERLEVEL9K_DISABLE_RPROMPT=true\n\n    powerlevel9k_prepare_prompts\n\n    assertEquals \"\" \"${(e)RPROMPT}\"\n}\n\nfunction testLeftMultilinePrompt() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)\n    local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n    local POWERLEVEL9K_PROMPT_ON_NEWLINE=true\n\n    powerlevel9k_prepare_prompts\n\n    local nl=$'\\n'\n    assertEquals \"╭─%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}╰─ \" \"${(e)PROMPT}\"\n}\n\nfunction testRightPromptOnSameLine() {\n    # Reset RPROMPT, so a running P9K does not interfere with the test\n    local RPROMPT=\n    local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n    POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1)\n    local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n\n    local POWERLEVEL9K_PROMPT_ON_NEWLINE=true\n    local POWERLEVEL9K_RPROMPT_ON_NEWLINE=false # We want the RPROMPT on the same line as our left prompt\n\n    # Skip test, as this cannot be tested properly.\n    # The \"go one line up\" instruction does not get\n    # printed as real characters in RPROMPT.\n    # On command line the assert statement produces\n    # a visually identical output as we expect, but\n    # it fails anyway. :(\n    startSkipping\n\n    powerlevel9k_prepare_prompts\n    assertEquals \"%{\\e[1A%}%F{007}%f%K{007}%F{000} world1 %f%{\\e[1B%}\" \"${(e)RPROMPT}\"\n}\n\nfunction testPrefixingFirstLineOnLeftPrompt() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)\n    local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n\n    local POWERLEVEL9K_PROMPT_ON_NEWLINE=true\n    local POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='XXX'\n\n    powerlevel9k_prepare_prompts\n\n    local nl=$'\\n'\n    assertEquals \"XXX%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}╰─ \" \"${(e)PROMPT}\"\n}\n\nfunction testPrefixingSecondLineOnLeftPrompt() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)\n    local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n\n    local POWERLEVEL9K_PROMPT_ON_NEWLINE=true\n    local POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='XXX'\n\n    powerlevel9k_prepare_prompts\n\n    local nl=$'\\n'\n    assertEquals \"╭─%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}XXX\" \"${(e)PROMPT}\"\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/core/visual_identifier.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  source functions/*\n}\n\nfunction testOverwritingIconsWork() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)\n  local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n  local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'\n\n  assertEquals \"%K{007} %F{000}icon-here %F{000}world1 %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testVisualIdentifierAppearsBeforeSegmentContentOnLeftSegments() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)\n  local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n  local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'\n\n  assertEquals \"%K{007} %F{000}icon-here %F{000}world1 %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testVisualIdentifierAppearsAfterSegmentContentOnRightSegments() {\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_world1)\n  local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n  local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'\n\n  assertEquals \"%F{007}%f%K{007}%F{000} world1%F{000} icon-here%E\" \"$(build_right_prompt)\"\n}\n\nfunction testVisualIdentifierPrintsNothingIfNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)\n  local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n\n  assertEquals \"%K{007} %F{000}world1 %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testVisualIdentifierIsPrintedInNumericalColorCode() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)\n  local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'\n  local POWERLEVEL9K_CUSTOM_WORLD1_ICON=\"xxx\"\n  local POWERLEVEL9K_CUSTOM_WORLD1_VISUAL_IDENTIFIER_COLOR=\"purple3\"\n\n  assertEquals \"%K{007} %F{056}xxx %F{000}world1 %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/functions/colors.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  # Load Powerlevel9k\n  source functions/colors.zsh\n}\n\nfunction testGetColorCodeWithAnsiForegroundColor() {\n  assertEquals '002' \"$(getColorCode 'green')\"\n}\n\nfunction testGetColorCodeWithAnsiBackgroundColor() {\n  assertEquals '002' \"$(getColorCode 'bg-green')\"\n}\n\nfunction testGetColorCodeWithNumericalColor() {\n  assertEquals '002' \"$(getColorCode '002')\"\n}\n\nfunction testGetColorCodeWithNoneColor() {\n  assertEquals 'none' \"$(getColorCode 'NONE')\"\n}\n\nfunction testIsSameColorComparesAnsiForegroundAndNumericalColorCorrectly() {\n  assertTrue \"isSameColor 'green' '002'\"\n}\n\nfunction testIsSameColorComparesAnsiBackgroundAndNumericalColorCorrectly() {\n  assertTrue \"isSameColor 'bg-green' '002'\"\n}\n\nfunction testIsSameColorComparesShortCodesCorrectly() {\n  assertTrue \"isSameColor '002' '2'\"\n}\n\nfunction testIsSameColorDoesNotYieldNotEqualColorsTruthy() {\n  assertFalse \"isSameColor 'green' '003'\"\n}\n\nfunction testIsSameColorHandlesNoneCorrectly() {\n  assertTrue \"isSameColor 'none' 'NOnE'\"\n}\n\nfunction testIsSameColorCompareTwoNoneColorsCorrectly() {\n  assertTrue \"isSameColor 'none' 'none'\"\n}\n\nfunction testIsSameColorComparesColorWithNoneCorrectly() {\n  assertFalse \"isSameColor 'green' 'none'\"\n}\n\nfunction testBrightColorsWork() {\n  # We had some code in the past that equalized bright colors\n  # with normal ones. This code is now gone, and this test should\n  # ensure that all input channels for bright colors are handled\n  # correctly.\n  assertTrue \"isSameColor 'cyan' '006'\"\n  assertEquals '006' \"$(getColorCode 'cyan')\"\n  assertEquals '006' \"$(getColor 'cyan')\"\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/functions/icons.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n    # Store old value for LC_CTYPE\n    _OLD_LC_CTYPE=\"${LC_CTYPE}\"\n    # Reset actual LC_CTYPE\n    unset LC_CTYPE\n}\n\nfunction tearDown() {\n    # Restore LC_CTYPE\n    LC_CTYPE=\"${_OLD_LC_CTYPE}\"\n}\n\nfunction testLcCtypeIsNotOverwrittenInDefaultMode() {\n  local POWERLEVEL9K_MODE=\"default\"\n  local LC_CTYPE=\"my-locale\"\n  # Load Powerlevel9k\n  source functions/icons.zsh\n\n  assertEquals 'my-locale' \"${LC_CTYPE}\"\n}\n\nfunction testLcCtypeIsNotOverwrittenInAwesomePatchedMode() {\n  local POWERLEVEL9K_MODE=\"awesome-patched\"\n  local LC_CTYPE=\"my-locale\"\n  # Load Powerlevel9k\n  source functions/icons.zsh\n\n  assertEquals 'my-locale' \"${LC_CTYPE}\"\n}\n\nfunction testLcCtypeIsNotOverwrittenInAwesomeFontconfigMode() {\n  local POWERLEVEL9K_MODE=\"awesome-fontconfig\"\n  local LC_CTYPE=\"my-locale\"\n  # Load Powerlevel9k\n  source functions/icons.zsh\n\n  assertEquals 'my-locale' \"${LC_CTYPE}\"\n}\n\nfunction testLcCtypeIsNotOverwrittenInNerdfontFontconfigMode() {\n  local POWERLEVEL9K_MODE=\"nerdfont-fontconfig\"\n  local LC_CTYPE=\"my-locale\"\n  # Load Powerlevel9k\n  source functions/icons.zsh\n\n  assertEquals 'my-locale' \"${LC_CTYPE}\"\n}\n\nfunction testLcCtypeIsNotOverwrittenInFlatMode() {\n  local POWERLEVEL9K_MODE=\"flat\"\n  local LC_CTYPE=\"my-locale\"\n  # Load Powerlevel9k\n  source functions/icons.zsh\n\n  assertEquals 'my-locale' \"${LC_CTYPE}\"\n}\n\nfunction testLcCtypeIsNotOverwrittenInCompatibleMode() {\n  local POWERLEVEL9K_MODE=\"compatible\"\n  local LC_CTYPE=\"my-locale\"\n  # Load Powerlevel9k\n  source functions/icons.zsh\n\n  assertEquals 'my-locale' \"${LC_CTYPE}\"\n}\n\n# Go through all icons defined in default mode, and\n# check if all of them are defined in the other modes.\nfunction testAllIconsAreDefinedLikeInDefaultMode() {\n  # Always compare against this mode\n  local _P9K_TEST_MODE=\"default\"\n  local POWERLEVEL9K_MODE=\"${_P9K_TEST_MODE}\"\n  source functions/icons.zsh\n  # _ICONS_UNDER_TEST is an array of just the keys of $icons.\n  # We later check via (r) \"subscript\" flag that our key\n  # is in the values of our flat array.\n  typeset -ah _ICONS_UNDER_TEST\n  _ICONS_UNDER_TEST=(${(k)icons[@]})\n\n  # Switch to \"awesome-patched\" mode\n  POWERLEVEL9K_MODE=\"awesome-patched\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    # Iterate over all keys found in the _ICONS_UNDER_TEST\n    # array and compare it with the icons array of the\n    # current POWERLEVEL9K_MODE.\n    # Use parameter expansion, to directly check if the\n    # key exists in the flat current array of keys. That\n    # is quite complicated, but there seems no easy way\n    # to check the mere existance of a key in an array.\n    # The usual way would always return the value, so that\n    # would do the wrong thing as we have some (on purpose)\n    # empty values.\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"awesome-fontconfig\" mode\n  POWERLEVEL9K_MODE=\"awesome-fontconfig\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"nerdfont-fontconfig\" mode\n  POWERLEVEL9K_MODE=\"nerdfont-fontconfig\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"nerdfont-complete\" mode\n  POWERLEVEL9K_MODE=\"nerdfont-complete\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"flat\" mode\n  POWERLEVEL9K_MODE=\"flat\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"compatible\" mode\n  POWERLEVEL9K_MODE=\"compatible\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  unset current_icons\n  unset _ICONS_UNDER_TEST\n}\n\n# Go through all icons defined in awesome-patched mode, and\n# check if all of them are defined in the other modes.\nfunction testAllIconsAreDefinedLikeInAwesomePatchedMode() {\n  # Always compare against this mode\n  local _P9K_TEST_MODE=\"awesome-patched\"\n  local POWERLEVEL9K_MODE=\"$_P9K_TEST_MODE\"\n  source functions/icons.zsh\n  # _ICONS_UNDER_TEST is an array of just the keys of $icons.\n  # We later check via (r) \"subscript\" flag that our key\n  # is in the values of our flat array.\n  typeset -ah _ICONS_UNDER_TEST\n  _ICONS_UNDER_TEST=(${(k)icons[@]})\n\n  # Switch to \"default\" mode\n  POWERLEVEL9K_MODE=\"default\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    # Iterate over all keys found in the _ICONS_UNDER_TEST\n    # array and compare it with the icons array of the\n    # current POWERLEVEL9K_MODE.\n    # Use parameter expansion, to directly check if the\n    # key exists in the flat current array of keys. That\n    # is quite complicated, but there seems no easy way\n    # to check the mere existance of a key in an array.\n    # The usual way would always return the value, so that\n    # would do the wrong thing as we have some (on purpose)\n    # empty values.\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"awesome-fontconfig\" mode\n  POWERLEVEL9K_MODE=\"awesome-fontconfig\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"nerdfont-fontconfig\" mode\n  POWERLEVEL9K_MODE=\"nerdfont-fontconfig\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"nerdfont-complete\" mode\n  POWERLEVEL9K_MODE=\"nerdfont-complete\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"flat\" mode\n  POWERLEVEL9K_MODE=\"flat\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"compatible\" mode\n  POWERLEVEL9K_MODE=\"compatible\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  unset current_icons\n  unset _ICONS_UNDER_TEST\n}\n\n# Go through all icons defined in awesome-fontconfig mode, and\n# check if all of them are defined in the other modes.\nfunction testAllIconsAreDefinedLikeInAwesomeFontconfigMode() {\n  # Always compare against this mode\n  local _P9K_TEST_MODE=\"awesome-fontconfig\"\n  local POWERLEVEL9K_MODE=\"$_P9K_TEST_MODE\"\n  source functions/icons.zsh\n  # _ICONS_UNDER_TEST is an array of just the keys of $icons.\n  # We later check via (r) \"subscript\" flag that our key\n  # is in the values of our flat array.\n  typeset -ah _ICONS_UNDER_TEST\n  _ICONS_UNDER_TEST=(${(k)icons[@]})\n\n  # Switch to \"default\" mode\n  POWERLEVEL9K_MODE=\"default\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    # Iterate over all keys found in the _ICONS_UNDER_TEST\n    # array and compare it with the icons array of the\n    # current POWERLEVEL9K_MODE.\n    # Use parameter expansion, to directly check if the\n    # key exists in the flat current array of keys. That\n    # is quite complicated, but there seems no easy way\n    # to check the mere existance of a key in an array.\n    # The usual way would always return the value, so that\n    # would do the wrong thing as we have some (on purpose)\n    # empty values.\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"awesome-patched\" mode\n  POWERLEVEL9K_MODE=\"awesome-patched\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"nerdfont-fontconfig\" mode\n  POWERLEVEL9K_MODE=\"nerdfont-fontconfig\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"nerdfont-complete\" mode\n  POWERLEVEL9K_MODE=\"nerdfont-complete\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"flat\" mode\n  POWERLEVEL9K_MODE=\"flat\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"compatible\" mode\n  POWERLEVEL9K_MODE=\"compatible\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  unset current_icons\n  unset _ICONS_UNDER_TEST\n}\n\n# Go through all icons defined in nerdfont-fontconfig mode, and\n# check if all of them are defined in the other modes.\nfunction testAllIconsAreDefinedLikeInNerdfontFontconfigMode() {\n  # Always compare against this mode\n  local _P9K_TEST_MODE=\"nerdfont-fontconfig\"\n  local POWERLEVEL9K_MODE=\"$_P9K_TEST_MODE\"\n  source functions/icons.zsh\n  # _ICONS_UNDER_TEST is an array of just the keys of $icons.\n  # We later check via (r) \"subscript\" flag that our key\n  # is in the values of our flat array.\n  typeset -ah _ICONS_UNDER_TEST\n  _ICONS_UNDER_TEST=(${(k)icons[@]})\n\n  # Switch to \"default\" mode\n  POWERLEVEL9K_MODE=\"default\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    # Iterate over all keys found in the _ICONS_UNDER_TEST\n    # array and compare it with the icons array of the\n    # current POWERLEVEL9K_MODE.\n    # Use parameter expansion, to directly check if the\n    # key exists in the flat current array of keys. That\n    # is quite complicated, but there seems no easy way\n    # to check the mere existance of a key in an array.\n    # The usual way would always return the value, so that\n    # would do the wrong thing as we have some (on purpose)\n    # empty values.\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"awesome-patched\" mode\n  POWERLEVEL9K_MODE=\"awesome-patched\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"awesome-fontconfig\" mode\n  POWERLEVEL9K_MODE=\"awesome-fontconfig\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"nerdfont-complete\" mode\n  POWERLEVEL9K_MODE=\"nerdfont-complete\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"flat\" mode\n  POWERLEVEL9K_MODE=\"flat\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"compatible\" mode\n  POWERLEVEL9K_MODE=\"compatible\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  unset current_icons\n  unset _ICONS_UNDER_TEST\n}\n\n# Go through all icons defined in nerdfont-complete mode, and\n# check if all of them are defined in the other modes.\nfunction testAllIconsAreDefinedLikeInNerdfontCompleteMode() {\n  # Always compare against this mode\n  local _P9K_TEST_MODE=\"nerdfont-complete\"\n  local POWERLEVEL9K_MODE=\"$_P9K_TEST_MODE\"\n  source functions/icons.zsh\n  # _ICONS_UNDER_TEST is an array of just the keys of $icons.\n  # We later check via (r) \"subscript\" flag that our key\n  # is in the values of our flat array.\n  typeset -ah _ICONS_UNDER_TEST\n  _ICONS_UNDER_TEST=(${(k)icons[@]})\n\n  # Switch to \"default\" mode\n  POWERLEVEL9K_MODE=\"default\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    # Iterate over all keys found in the _ICONS_UNDER_TEST\n    # array and compare it with the icons array of the\n    # current POWERLEVEL9K_MODE.\n    # Use parameter expansion, to directly check if the\n    # key exists in the flat current array of keys. That\n    # is quite complicated, but there seems no easy way\n    # to check the mere existance of a key in an array.\n    # The usual way would always return the value, so that\n    # would do the wrong thing as we have some (on purpose)\n    # empty values.\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"awesome-patched\" mode\n  POWERLEVEL9K_MODE=\"awesome-patched\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"awesome-fontconfig\" mode\n  POWERLEVEL9K_MODE=\"awesome-fontconfig\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"nerdfont-fontconfig\" mode\n  POWERLEVEL9K_MODE=\"nerdfont-fontconfig\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"flat\" mode\n  POWERLEVEL9K_MODE=\"flat\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  # Switch to \"compatible\" mode\n  POWERLEVEL9K_MODE=\"compatible\"\n  source functions/icons.zsh\n  typeset -ah current_icons\n  current_icons=(${(k)icons[@]})\n  for key in ${_ICONS_UNDER_TEST}; do\n    assertTrue \"The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!\" \"(( ${+current_icons[(r)$key]} ))\"\n  done\n\n  unset current_icons\n  unset _ICONS_UNDER_TEST\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/functions/utilities.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  # Load Powerlevel9k\n  source functions/icons.zsh\n  source functions/utilities.zsh\n}\n\nfunction testDefinedFindsDefinedVariable() {\n  my_var='X'\n\n  assertTrue \"defined 'my_var'\"\n  unset my_var\n}\n\nfunction testDefinedDoesNotFindUndefinedVariable() {\n  assertFalse \"defined 'my_var'\"\n}\n\nfunction testSetDefaultSetsVariable() {\n  set_default 'my_var' 'x'\n\n  assertEquals 'x' \"$my_var\"\n  unset my_var\n}\n\nfunction testPrintSizeHumanReadableWithBigNumber() {\n  # Interesting: Currently we can't support numbers bigger than that.\n  assertEquals '0.87E' \"$(printSizeHumanReadable 1000000000000000000)\"\n}\n\nfunction testPrintSizeHumanReadableWithExabytesAsBase() {\n  assertEquals '9.77Z' \"$(printSizeHumanReadable 10000 'E')\"\n}\n\nfunction testGetRelevantItem() {\n  typeset -a list\n  list=(a b c)\n  local callback='[[ \"$item\" == \"b\" ]] && echo \"found\"'\n\n  local result=$(getRelevantItem \"$list\" \"$callback\")\n  assertEquals 'found' \"$result\"\n\n  unset list\n}\n\nfunction testGetRelevantItemDoesNotReturnNotFoundItems() {\n  typeset -a list\n  list=(a b c)\n  local callback='[[ \"$item\" == \"d\" ]] && echo \"found\"'\n\n  local result=$(getRelevantItem \"$list\" \"$callback\")\n  assertEquals '' ''\n\n  unset list\n}\n\nfunction testSegmentShouldBeJoinedIfDirectPredecessingSegmentIsJoined() {\n  typeset -a segments\n  segments=(a b_joined c_joined)\n  # Look at the third segment\n  local current_index=3\n  local last_element_index=2\n\n  local joined\n  segmentShouldBeJoined $current_index $last_element_index \"$segments\" && joined=true || joined=false\n  assertTrue \"$joined\"\n\n  unset segments\n}\n\nfunction testSegmentShouldBeJoinedIfPredecessingSegmentIsJoinedTransitivley() {\n  typeset -a segments\n  segments=(a b_joined c_joined)\n  # Look at the third segment\n  local current_index=3\n  # The last printed segment was the first one,\n  # the second segmend was conditional.\n  local last_element_index=1\n\n  local joined\n  segmentShouldBeJoined $current_index $last_element_index \"$segments\" && joined=true || joined=false\n  assertTrue \"$joined\"\n\n  unset segments\n}\n\nfunction testSegmentShouldNotBeJoinedIfPredecessingSegmentIsNotJoinedButConditional() {\n  typeset -a segments\n  segments=(a b_joined c d_joined)\n  # Look at the fourth segment\n  local current_index=4\n  # The last printed segment was the first one,\n  # the second segmend was conditional.\n  local last_element_index=1\n\n  local joined\n  segmentShouldBeJoined $current_index $last_element_index \"$segments\" && joined=true || joined=false\n  assertFalse \"$joined\"\n\n  unset segments\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/powerlevel9k.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  source functions/*\n\n  # Unset mode, so that user settings\n  # do not interfere with tests\n  unset POWERLEVEL9K_MODE\n}\n\nfunction testJoinedSegments() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_joined)\n  cd /tmp\n\n  assertEquals \"%K{004} %F{000}/tmp %K{004}%F{000}%F{000}/tmp %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testTransitiveJoinedSegments() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir root_indicator_joined dir_joined)\n  cd /tmp\n\n  assertEquals \"%K{004} %F{000}/tmp %K{004}%F{000}%F{000}/tmp %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testJoiningWithConditionalSegment() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir background_jobs dir_joined)\n  cd /tmp\n\n  assertEquals \"%K{004} %F{000}/tmp %K{004}%F{000} %F{000}/tmp %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testDynamicColoringOfSegmentsWork() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red'\n  cd /tmp\n\n  assertEquals \"%K{001} %F{000}/tmp %k%F{001}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testDynamicColoringOfVisualIdentifiersWork() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR='green'\n  local POWERLEVEL9K_FOLDER_ICON=\"icon-here\"\n\n  cd /tmp\n\n  assertEquals \"%K{004} %F{002}icon-here %F{000}/tmp %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR='green'\n  local POWERLEVEL9K_DIR_DEFAULT_FOREGROUND='red'\n  local POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='yellow'\n  local POWERLEVEL9K_FOLDER_ICON=\"icon-here\"\n\n  # Re-Source the icons, as the POWERLEVEL9K_MODE is directly\n  # evaluated there.\n  source functions/icons.zsh\n\n  cd /tmp\n\n  assertEquals \"%K{003} %F{002}icon-here %F{001}/tmp %k%F{003}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testOverwritingIconsWork() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_FOLDER_ICON='icon-here'\n  #local testFolder=$(mktemp -d -p p9k)\n  # Move testFolder under home folder\n  #mv testFolder ~\n  # Go into testFolder\n  #cd ~/$testFolder\n\n  cd /tmp\n  assertEquals \"%K{004} %F{000}icon-here %F{000}/tmp %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  # rm -fr ~/$testFolder\n}\n\nfunction testNewlineOnRpromptCanBeDisabled() {\n  local POWERLEVEL9K_PROMPT_ON_NEWLINE=true\n  local POWERLEVEL9K_RPROMPT_ON_NEWLINE=false\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  local POWERLEVEL9K_CUSTOM_RWORLD='echo rworld'\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)\n  local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_rworld)\n\n  powerlevel9k_prepare_prompts\n  assertEquals '$(print_icon MULTILINE_FIRST_PROMPT_PREFIX)\u001b[39m\u001b[0m\u001b[49m\u001b[47m \u001b[30mworld \u001b[49m\u001b[37m\u001b[39m  $(print_icon MULTILINE_LAST_PROMPT_PREFIX)\u001b[1A\u001b[39m\u001b[0m\u001b[49m\u001b[37m\u001b[39m\u001b[47m\u001b[30m rworld\u001b[K\u001b[00m\u001b[1B' \"$(print -P ${PROMPT}${RPROMPT})\"\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/segments/anaconda.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() {\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda custom_world)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    # Unset anacona variables\n    unset CONDA_ENV_PATH\n    unset CONDA_PREFIX\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)\n    local POWERLEVEL9K_PYTHON_ICON=\"icon-here\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    CONDA_ENV_PATH=/tmp\n    unset CONDA_PREFIX\n\n    assertEquals \"%K{004} %F{000}icon-here %F{000}(tmp) %k%F{004}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)\n    local POWERLEVEL9K_PYTHON_ICON=\"icon-here\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    unset CONDA_ENV_PATH\n    local CONDA_PREFIX=\"test\"\n\n    assertEquals \"%K{004} %F{000}icon-here %F{000}(test) %k%F{004}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testAnacondaSegmentWorks() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)\n    local POWERLEVEL9K_PYTHON_ICON=\"icon-here\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    local CONDA_ENV_PATH=/tmp\n    local CONDA_PREFIX=\"test\"\n\n    assertEquals \"%K{004} %F{000}icon-here %F{000}(tmptest) %k%F{004}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/aws_eb_env.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction testAwsEbEnvSegmentPrintsNothingIfNoElasticBeanstalkEnvironmentIsSet() {\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env custom_world)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk\n    echo \"test:\\n    environment: test\" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml\n    cd /tmp/powerlevel9k-test\n\n    assertEquals \"%K{000} %F{002}🌱  %F{002}test %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    rm -fr /tmp/powerlevel9k-test\n    cd -\n}\n\nfunction testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirectory() {\n    # Skip test, because currently we cannot detect\n    # if the configuration is in a parent directory\n    startSkipping # Skip test\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk\n    mkdir -p /tmp/powerlevel9k-test/1/12/123/1234/12345\n    echo \"test:\\n    environment: test\" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml\n    cd /tmp/powerlevel9k-test/1/12/123/1234/12345\n\n    assertEquals \"%K{000} %F{002}🌱  %F{002}test %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    rm -fr /tmp/powerlevel9k-test\n    cd -\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/background_jobs.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() {\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs custom_world)\n    alias jobs=\"nojobs 2>/dev/null\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n    unalias jobs\n}\n\nfunction testBackgroundJobsSegmentWorksWithOneBackgroundJob() {\n    unset POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs)\n    jobs() {\n        echo '[1]  + 30444 suspended  nvim xx'\n    }\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{006}⚙ %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unfunction jobs\n}\n\nfunction testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() {\n    local POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs)\n    jobs() {\n        echo \"[1]    31190 suspended  nvim xx\"\n        echo \"[2]  - 31194 suspended  nvim xx2\"\n        echo \"[3]  + 31206 suspended  nvim xx3\"\n    }\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{006}⚙ %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unfunction jobs\n}\n\nfunction testBackgroundJobsSegmentWithVerboseMode() {\n    local POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs)\n    jobs() {\n        echo \"[1]    31190 suspended  nvim xx\"\n        echo \"[2]  - 31194 suspended  nvim xx2\"\n        echo \"[3]  + 31206 suspended  nvim xx3\"\n    }\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{006}⚙ %F{006}3 %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unfunction jobs\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/battery.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder\n  FOLDER=/tmp/powerlevel9k-test\n  mkdir -p \"${FOLDER}\"\n  cd $FOLDER\n\n  # Prepare folder for pmset (OSX)\n  PMSET_PATH=$FOLDER/usr/bin\n  mkdir -p $PMSET_PATH\n  # Prepare folder for $BATTERY (Linux)\n  BATTERY_PATH=$FOLDER/sys/class/power_supply\n  mkdir -p $BATTERY_PATH\n  mkdir -p $BATTERY_PATH/BAT0\n  mkdir -p $BATTERY_PATH/BAT1\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\" &>/dev/null\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test &>/dev/null\n  unset PMSET_PATH\n  unset BATTERY_PATH\n  unset FOLDER\n  unset P9K_HOME\n}\n\n# Mock Battery\n# For mocking pmset on OSX this function takes one argument (the\n# content that pmset should echo).\n# For mocking the battery on Linux this function takes two\n# arguments: $1 is the capacity; $2 the battery status.\nfunction makeBatterySay() {\n  if [[ -z \"${FOLDER}\" ]]; then\n    echo \"Fake root path is not correctly set!\"\n    exit 1\n  fi\n  # OSX\n  echo \"#!/bin/sh\" > $PMSET_PATH/pmset\n  echo \"echo \\\"$1\\\"\" >> $PMSET_PATH/pmset\n  chmod +x $PMSET_PATH/pmset\n\n  # Linux\n  local capacity=\"$1\"\n  echo \"$capacity\" > $BATTERY_PATH/BAT0/capacity\n  echo \"$capacity\" > $BATTERY_PATH/BAT1/capacity\n  local battery_status=\"$2\"\n  echo \"$battery_status\" > $BATTERY_PATH/BAT0/status\n  echo \"$battery_status\" > $BATTERY_PATH/BAT1/status\n}\n\nfunction testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() {\n  local OS='OSX' # Fake OSX\n  makeBatterySay \"Now drawing from 'Battery Power'\n -InternalBattery-0 (id=1234567)\t4%; discharging; 0:05 remaining present: true\"\n\n  assertEquals \"%K{000} %F{001}🔋 %F{001}4%% (0:05) \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {\n  local OS='OSX' # Fake OSX\n  makeBatterySay \"Now drawing from 'Battery Power'\n -InternalBattery-0 (id=1234567)\t4%; charging; 0:05 remaining present: true\"\n\n  assertEquals \"%K{000} %F{003}🔋 %F{003}4%% (0:05) \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {\n  local OS='OSX' # Fake OSX\n  makeBatterySay \"Now drawing from 'Battery Power'\n -InternalBattery-0 (id=1234567)\t98%; discharging; 3:57 remaining present: true\"\n\n  assertEquals \"%K{000} %F{007}🔋 %F{007}98%% (3:57) \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {\n  local OS='OSX' # Fake OSX\n  makeBatterySay \"Now drawing from 'Battery Power'\n -InternalBattery-0 (id=1234567)\t98%; charging; 3:57 remaining present: true\"\n\n  assertEquals \"%K{000} %F{003}🔋 %F{003}98%% (3:57) \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsFullOnOSX() {\n  local OS='OSX' # Fake OSX\n  makeBatterySay \"Now drawing from 'AC Power'\n -InternalBattery-0 (id=1234567)\t99%; charged; 0:00 remaining present: true\"\n\n  assertEquals \"%K{000} %F{002}🔋 %F{002}99%% \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsCalculatingOnOSX() {\n  local OS='OSX' # Fake OSX\n  makeBatterySay \"Now drawing from 'Battery Power'\n -InternalBattery-0 (id=1234567)\t99%; discharging; (no estimate) present: true\"\n\n  assertEquals \"%K{000} %F{007}🔋 %F{007}99%% (...) \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() {\n  local OS='Linux' # Fake Linux\n  makeBatterySay \"4\" \"Discharging\"\n\n  assertEquals \"%K{000} %F{001}🔋 %F{001}4%% \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() {\n  local OS='Linux' # Fake Linux\n  makeBatterySay \"4\" \"Charging\"\n\n  assertEquals \"%K{000} %F{003}🔋 %F{003}4%% \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() {\n  local OS='Linux' # Fake Linux\n  makeBatterySay \"10\" \"Discharging\"\n\n  assertEquals \"%K{000} %F{007}🔋 %F{007}10%% \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() {\n  local OS='Linux' # Fake Linux\n  makeBatterySay \"10\" \"Charging\"\n\n  assertEquals \"%K{000} %F{003}🔋 %F{003}10%% \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsFullOnLinux() {\n  local OS='Linux' # Fake Linux\n  makeBatterySay \"100\" \"Full\"\n\n  assertEquals \"%K{000} %F{002}🔋 %F{002}100%% \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nfunction testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {\n  local OS='Linux' # Fake Linux\n  makeBatterySay \"50\" \"Discharging\"\n  echo \"echo 'Batter 0: Discharging, 50%, 01:38:54 remaining'\" > ${FOLDER}/usr/bin/acpi\n  chmod +x ${FOLDER}/usr/bin/acpi\n  # For running on Mac, we need to mock date :(\n  [[ -f /usr/local/bin/gdate ]] && alias date=gdate\n\n  assertEquals \"%K{000} %F{007}🔋 %F{007}50%% (1:38) \" \"$(prompt_battery left 1 false ${FOLDER})\"\n\n  unalias date &>/dev/null\n  # unaliasing date fails where it was never aliased (e.g. on Linux).\n  # This causes the whole test to fail, because the return code is\n  # non-zero.\n  return 0\n}\n\nfunction testBatterySegmentIfBatteryIsCalculatingWithAcpiEnabledOnLinux() {\n  local OS='Linux' # Fake Linux\n  makeBatterySay \"50\" \"Discharging\"\n  # Todo: Include real acpi output!\n  echo \"echo 'Batter 0: Discharging, 50%, rate remaining'\" > ${FOLDER}/usr/bin/acpi\n  chmod +x ${FOLDER}/usr/bin/acpi\n\n  assertEquals \"%K{000} %F{007}🔋 %F{007}50%% (...) \" \"$(prompt_battery left 1 false ${FOLDER})\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/command_execution_time.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction testCommandExecutionTimeIsNotShownIfTimeIsBelowThreshold() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world command_execution_time)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  # Override payload\n  local _P9K_COMMAND_DURATION=2\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testCommandExecutionTimeThresholdCouldBeChanged() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)\n  local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  # Override payload\n  local _P9K_COMMAND_DURATION=2.03\n\n  assertEquals \"%K{001} %F{226}Dur %F{226}2.03 %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testCommandExecutionTimeThresholdCouldBeSetToZero() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)\n  local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0\n  local _P9K_COMMAND_DURATION=0.03\n\n  assertEquals \"%K{001} %F{226}Dur %F{226}0.03 %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testCommandExecutionTimePrecisionCouldBeChanged() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)\n  local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0\n  local POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=4\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  # Override payload\n  local _P9K_COMMAND_DURATION=0.0001\n\n  assertEquals \"%K{001} %F{226}Dur %F{226}0.0001 %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testCommandExecutionTimePrecisionCouldBeSetToZero() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)\n  local POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  # Override payload\n  local _P9K_COMMAND_DURATION=23.5001\n\n  assertEquals \"%K{001} %F{226}Dur %F{226}23 %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  # Override payload\n  local _P9K_COMMAND_DURATION=180\n\n  assertEquals \"%K{001} %F{226}Dur %F{226}03:00 %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  # Override payload\n  local _P9K_COMMAND_DURATION=7200\n\n  assertEquals \"%K{001} %F{226}Dur %F{226}02:00:00 %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/context.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  # Test specific settings\n  OLD_DEFAULT_USER=$DEFAULT_USER\n  unset DEFAULT_USER\n\n  # Fix leaked state for travis\n  OLD_POWERLEVEL9K_CONTEXT_ALWAYS_SHOW=$POWERLEVEL9K_CONTEXT_ALWAYS_SHOW\n  unset POWERLEVEL9K_CONTEXT_ALWAYS_SHOW\n  OLD_SSH_CLIENT=$SSH_CLIENT\n  unset SSH_CLIENT\n  OLD_SSH_TTY=$SSH_TTY\n  unset SSH_TTY\n}\n\nfunction tearDown() {\n  # Restore old variables\n  [[ -n \"$OLD_DEFAULT_USER\" ]] && DEFAULT_USER=$OLD_DEFAULT_USER\n  unset OLD_DEFAULT_USER\n\n  [[ -n \"$OLD_POWERLEVEL9K_CONTEXT_ALWAYS_SHOW\" ]] && POWERLEVEL9K_CONTEXT_ALWAYS_SHOW=$OLD_POWERLEVEL9K_CONTEXT_ALWAYS_SHOW\n  unset OLD_POWERLEVEL9K_CONTEXT_ALWAYS_SHOW\n\n  [[ -n \"$OLD_SSH_CLIENT\" ]] && SSH_CLIENT=$OLD_SSH_CLIENT\n  unset OLD_SSH_CLIENT\n\n  [[ -n \"$OLD_SSH_TTY\" ]] && SSH_TTY=$OLD_SSH_TTY\n  unset OLD_SSH_TTY\n\n  return 0\n}\n\nfunction testContextSegmentDoesNotGetRenderedWithDefaultUser() {\n    local DEFAULT_USER=$(whoami)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context custom_world)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() {\n    function sudo() {\n        return 0\n    }\n    local SSH_CLIENT=\"putty\"\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{003}%n@%m %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unfunction sudo\n}\n\nfunction testContextSegmentWithForeignUser() {\n    function sudo() {\n        return 0\n    }\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{003}%n@%m %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unfunction sudo\n}\n\n# TODO: How to test root?\nfunction testContextSegmentWithRootUser() {\n    startSkipping # Skip test\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{003}%n@%m %k%F{000}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testOverridingContextTemplate() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)\n    local POWERLEVEL9K_CONTEXT_TEMPLATE=xx\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{003}xx %k%F{000}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testContextSegmentIsShownIfDefaultUserIsSetWhenForced() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)\n    local POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true\n    local DEFAULT_USER=$(whoami)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{003}%n@%m %k%F{000}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testContextSegmentIsShownIfForced() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)\n    local POWERLEVEL9K_ALWAYS_SHOW_USER=true\n    local DEFAULT_USER=$(whoami)\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{003}$(whoami) %k%F{000}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/custom.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction testCustomDirectOutputSegment() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD=\"echo world\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testCustomClosureSegment() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)\n    function p9k_hello_world() {\n        echo \"world\"\n    }\n    local POWERLEVEL9K_CUSTOM_WORLD='p9k_hello_world'\n    \n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testSettingBackgroundForCustomSegment() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD=\"echo world\"\n    local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND=\"yellow\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{003} %F{000}world %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testSettingForegroundForCustomSegment() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD=\"echo world\"\n    local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND=\"red\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{001}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testSettingVisualIdentifierForCustomSegment() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD=\"echo world\"\n    local POWERLEVEL9K_CUSTOM_WORLD_ICON=\"hw\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}hw %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testSettingVisualIdentifierForegroundColorForCustomSegment() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD=\"echo world\"\n    local POWERLEVEL9K_CUSTOM_WORLD_ICON=\"hw\"\n    local POWERLEVEL9K_CUSTOM_WORLD_VISUAL_IDENTIFIER_COLOR=\"red\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{001}hw %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/detect_virt.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n}\n\nfunction testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    alias systemd-detect-virt=\"novirt\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n    unalias systemd-detect-virt\n}\n\nfunction testDetectVirtSegmentIfSystemdReturnsPlainName() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)\n    alias systemd-detect-virt=\"echo 'xxx'\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{003}xxx %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unalias systemd-detect-virt\n}\n\nfunction testDetectVirtSegmentIfRootFsIsOnExpectedInode() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)\n    # Well. This is a weak test, as it fixates the implementation,\n    # but it is necessary, as the implementation relys on the root\n    # directory having the inode number \"2\"..\n    alias systemd-detect-virt=\"echo 'none'\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    # The original command in the implementation is \"ls -di / | grep -o 2\",\n    # which translates to: Show the inode number of \"/\" and test if it is \"2\".\n    alias ls=\"echo '2'\"\n\n    assertEquals \"%K{000} %F{003}none %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unalias ls\n    unalias systemd-detect-virt\n}\n\nfunction testDetectVirtSegmentIfRootFsIsNotOnExpectedInode() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)\n    # Well. This is a weak test, as it fixates the implementation,\n    # but it is necessary, as the implementation relys on the root\n    # directory having the inode number \"2\"..\n    alias systemd-detect-virt=\"echo 'none'\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    # The original command in the implementation is \"ls -di / | grep -o 2\",\n    # which translates to: Show the inode number of \"/\" and test if it is \"2\".\n    alias ls=\"echo '3'\"\n\n    assertEquals \"%K{000} %F{003}chroot %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unalias ls\n    unalias systemd-detect-virt\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/dir.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=\"${PWD}\"\n}\n\nfunction tearDown() {\n  unset P9K_HOME\n}\n\nfunction testDirPathAbsoluteWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_ABSOLUTE=true\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd ~\n\n  # Unfortunately, we cannot fake Linux or OSX here, because\n  # of /home or /Users path.. That is why we change the test\n  # according to the OS of the host.\n  if [[ \"${OS}\" == 'Linux' ]]; then\n    assertEquals \"%K{004} %F{000}/home/${USER} %k%F{004}%f \" \"$(build_left_prompt)\"\n  elif [[ \"${OS}\" == 'OSX' ]]; then\n    assertEquals \"%K{004} %F{000}/Users/${USER} %k%F{004}%f \" \"$(build_left_prompt)\"\n  fi\n\n  cd -\n}\n\nfunction testTruncateFoldersWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  assertEquals \"%K{004} %F{000}…/12345678/123456789 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testTruncateFolderWithHomeDirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=1\n  local CURRENT_DIR=$(pwd)\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd ~\n  local FOLDER=\"powerlevel9k-test-${RANDOM}\"\n  mkdir -p $FOLDER\n  cd $FOLDER\n  # Switch back to home folder as this causes the problem.\n  cd ..\n\n  assertEquals \"%K{004} %F{000}~ %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  rmdir $FOLDER\n  cd ${CURRENT_DIR}\n}\n\nfunction testTruncateMiddleWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  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)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testTruncationFromRightWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  assertEquals \"%K{004} %F{000}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testTruncateToLastWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY=\"truncate_to_last\"\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  assertEquals \"%K{004} %F{000}123456789 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testTruncateToFirstAndLastWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY=\"truncate_to_first_and_last\"\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  assertEquals \"%K{004} %F{000}/tmp/powerlevel9k-test/…/…/…/…/…/…/…/12345678/123456789 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testTruncateAbsoluteWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY=\"truncate_absolute\"\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  assertEquals \"%K{004} %F{000}…89 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testTruncationFromRightWithEmptyDelimiter() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_DELIMITER=\"\"\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  assertEquals \"%K{004} %F{000}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testTruncateWithFolderMarkerWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_STRATEGY=\"truncate_with_folder_marker\"\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local BASEFOLDER=/tmp/powerlevel9k-test\n  local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567\n  mkdir -p $FOLDER\n  # Setup folder marker\n  touch $BASEFOLDER/1/12/.shorten_folder_marker\n  cd $FOLDER\n  assertEquals \"%K{004} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr $BASEFOLDER\n}\n\nfunction testTruncateWithFolderMarkerWithChangedFolderMarker() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_STRATEGY=\"truncate_with_folder_marker\"\n  local POWERLEVEL9K_SHORTEN_FOLDER_MARKER='.xxx'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local BASEFOLDER=/tmp/powerlevel9k-test\n  local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567\n  mkdir -p $FOLDER\n  # Setup folder marker\n  touch $BASEFOLDER/1/12/.xxx\n  cd $FOLDER\n  assertEquals \"%K{004} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr $BASEFOLDER\n}\n\nfunction testTruncateWithPackageNameWorks() {\n  local p9kFolder=$(pwd)\n  local BASEFOLDER=/tmp/powerlevel9k-test\n  local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n\n  cd /tmp/powerlevel9k-test\n  echo '\n{\n  \"name\": \"My_Package\"\n}\n' > package.json\n  # Unfortunately: The main folder must be a git repo..\n  git init &>/dev/null\n\n  # Go back to deeper folder\n  cd \"${FOLDER}\"\n\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{004} %F{000}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  # Go back\n  cd $p9kFolder\n  rm -fr $BASEFOLDER\n}\n\nfunction testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() {\n  local p9kFolder=$(pwd)\n  local BASEFOLDER=/tmp/powerlevel9k-test\n  local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  # Unfortunately: The main folder must be a git repo..\n  git init &>/dev/null\n\n  echo '\n{\n  \"name\": \"My_Package\"\n}\n' > package.json\n\n  # Create a subdir inside the repo\n  mkdir -p asdfasdf/qwerqwer\n\n  cd $BASEFOLDER\n  ln -s ${FOLDER} linked-repo\n\n  # Go to deep folder inside linked repo\n  cd linked-repo/asdfasdf/qwerqwer\n\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{004} %F{000}My_Package/as…/qwerqwer %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  # Go back\n  cd $p9kFolder\n  rm -fr $BASEFOLDER\n}\n\nfunction testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() {\n  local p9kFolder=$(pwd)\n  local BASEFOLDER=/tmp/powerlevel9k-test\n  local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567/12345678/123456789\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  # Unfortunately: The main folder must be a git repo..\n  git init &>/dev/null\n\n  echo '\n{\n  \"name\": \"My_Package\"\n}\n' > package.json\n\n  cd $BASEFOLDER\n  ln -s ${FOLDER} linked-repo\n\n  cd linked-repo/.git/refs/heads\n\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{004} %F{000}My_Package/.g…/re…/heads %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  # Go back\n  cd $p9kFolder\n  rm -fr $BASEFOLDER\n}\n\nfunction testHomeFolderDetectionWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_HOME_ICON='home-icon'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd ~\n  assertEquals \"%K{004} %F{000}home-icon %F{000}~ %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testHomeSubfolderDetectionWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_HOME_SUB_ICON='sub-icon'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=~/powerlevel9k-test\n  mkdir $FOLDER\n  cd $FOLDER\n  assertEquals \"%K{004} %F{000}sub-icon %F{000}~/powerlevel9k-test %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr $FOLDER\n}\n\nfunction testOtherFolderDetectionWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_FOLDER_ICON='folder-icon'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=/tmp/powerlevel9k-test\n  mkdir $FOLDER\n  cd $FOLDER\n  assertEquals \"%K{004} %F{000}folder-icon %F{000}/tmp/powerlevel9k-test %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr $FOLDER\n}\n\nfunction testChangingDirPathSeparator() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  local FOLDER=\"/tmp/powerlevel9k-test/1/2\"\n  mkdir -p $FOLDER\n  cd $FOLDER\n\n  assertEquals \"%K{004} %F{000}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testHomeFolderAbbreviation() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local dir=$PWD\n\n  cd ~/\n  # default\n  local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'\n  \n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{004} %F{000}~ %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  # substituted\n  local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{004} %F{000}qQq %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd /tmp\n  # default\n  local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{004} %F{000}/tmp %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  # substituted\n  local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{004} %F{000}/tmp %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd \"$dir\"\n}\n\nfunction testOmittingFirstCharacterWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true\n  local POWERLEVEL9K_FOLDER_ICON='folder-icon'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd /tmp\n\n  assertEquals \"%K{004} %F{000}folder-icon %F{000}tmp %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testOmittingFirstCharacterWorksWithChangingPathSeparator() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true\n  local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'\n  local POWERLEVEL9K_FOLDER_ICON='folder-icon'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p /tmp/powerlevel9k-test/1/2\n  cd /tmp/powerlevel9k-test/1/2\n\n  assertEquals \"%K{004} %F{000}folder-icon %F{000}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\n# This test makes it obvious that combining a truncation strategy\n# that cuts off folders from the left and omitting the the first\n# character does not make much sense. The truncation strategy\n# comes first, prints an ellipsis and that gets then cut off by\n# POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER..\n# But it does more sense in combination with other truncation\n# strategies.\nfunction testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTruncation() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true\n  local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p /tmp/powerlevel9k-test/1/2\n  cd /tmp/powerlevel9k-test/1/2\n\n  assertEquals \"%K{004} %F{000}xXx1xXx2 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTruncation() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true\n  local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p /tmp/powerlevel9k-test/1/2\n  cd /tmp/powerlevel9k-test/1/2\n\n  assertEquals \"%K{004} %F{000}tmpxXxpo…stxXx1xXx2 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncation() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true\n  local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p /tmp/powerlevel9k-test/1/2\n  cd /tmp/powerlevel9k-test/1/2\n\n  assertEquals \"%K{004} %F{000}tmpxXxpo…xXx1xXx2 %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testTruncateToUniqueWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true\n  local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'\n  local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2\n  local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_to_unique'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p /tmp/powerlevel9k-test/adam/devl\n  mkdir -p /tmp/powerlevel9k-test/alice/devl\n  mkdir -p /tmp/powerlevel9k-test/alice/docs\n  mkdir -p /tmp/powerlevel9k-test/bob/docs\n  cd /tmp/powerlevel9k-test/alice/devl\n\n  assertEquals \"%K{004} %F{000}txXxpxXxalxXxde %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testBoldHomeDirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd ~\n\n  assertEquals \"%K{004} %F{000}%B~%b %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testBoldHomeSubdirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p ~/powerlevel9k-test\n  cd ~/powerlevel9k-test\n\n  assertEquals \"%K{004} %F{000}~/%Bpowerlevel9k-test%b %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr ~/powerlevel9k-test\n}\n\nfunction testBoldRootDirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd /\n\n  assertEquals \"%K{004} %F{000}%B/%b %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testBoldRootSubdirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd /tmp\n\n  assertEquals \"%K{004} %F{000}/%Btmp%b %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testBoldRootSubSubdirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p /tmp/powerlevel9k-test\n  cd /tmp/powerlevel9k-test\n\n  assertEquals \"%K{004} %F{000}/tmp/%Bpowerlevel9k-test%b %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testHighlightHomeWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd ~\n\n  assertEquals \"%K{004} %F{000}%F{red}~ %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testHighlightHomeSubdirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p ~/powerlevel9k-test\n  cd ~/powerlevel9k-test\n\n  assertEquals \"%K{004} %F{000}~/%F{red}powerlevel9k-test %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr ~/powerlevel9k-test\n}\n\nfunction testHighlightRootWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd /\n\n  assertEquals \"%K{004} %F{000}%F{red}/ %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testHighlightRootSubdirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  cd /tmp\n\n  assertEquals \"%K{004} %F{000}/%F{red}tmp %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n}\n\nfunction testHighlightRootSubSubdirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir /tmp/powerlevel9k-test\n  cd /tmp/powerlevel9k-test\n\n  assertEquals \"%K{004} %F{000}/tmp/%F{red}powerlevel9k-test %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testDirSeparatorColorHomeSubdirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p ~/powerlevel9k-test\n  cd ~/powerlevel9k-test\n\n  assertEquals \"%K{004} %F{000}~%F{red}/%F{black}powerlevel9k-test %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr ~/powerlevel9k-test\n}\n\nfunction testDirSeparatorColorRootSubSubdirWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n  local POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  mkdir -p /tmp/powerlevel9k-test\n  cd /tmp/powerlevel9k-test\n\n  assertEquals \"%K{004} %F{000}%F{red}/%F{black}tmp%F{red}/%F{black}powerlevel9k-test %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testDirHomeTruncationWorksOnlyAtTheBeginning() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)\n\n  local FOLDER=/tmp/p9ktest\n  local SAVED_HOME=\"${HOME}\"\n  HOME=\"/p9ktest\"\n\n  mkdir -p $FOLDER\n  # Setup folder marker\n  cd $FOLDER\n  assertEquals \"%K{004} %F{000}/tmp/p9ktest %k%F{004}%f \" \"$(build_left_prompt)\"\n\n  cd -\n  rm -fr $FOLDER\n  HOME=\"${SAVED_HOME}\"\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/segments/disk_usage.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  # Test specific\n  P9K_HOME=$(pwd)\n  FOLDER=/tmp/powerlevel9k-test\n  mkdir -p $FOLDER\n  cd $FOLDER\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n  unset FOLDER\n  unset P9K_HOME\n\n  # Remove IP cache file\n  rm -f ${POWERLEVEL9K_PUBLIC_IP_FILE}\n}\n\nfunction testDiskUsageSegmentWhenDiskIsAlmostFull() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)\n  df() {\n      echo \"Filesystem     1K-blocks      Used Available Use% Mounted on\n/dev/disk1     487219288 471466944  15496344  97% /\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{001} %F{007}hdd  %F{007}97%% %k%F{001}%f \" \"$(build_left_prompt)\"\n\n  unfunction df\n}\n\nfunction testDiskUsageSegmentWhenDiskIsVeryFull() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)\n  df() {\n      echo \"Filesystem     1K-blocks      Used Available Use% Mounted on\n/dev/disk1     487219288 471466944  15496344  94% /\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{000}hdd  %F{000}94%% %k%F{003}%f \" \"$(build_left_prompt)\"\n\n  unfunction df\n}\n\nfunction testDiskUsageSegmentWhenDiskIsQuiteEmpty() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)\n  df() {\n      echo \"Filesystem     1K-blocks      Used Available Use% Mounted on\n/dev/disk1     487219288 471466944  15496344  4% /\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{003}hdd  %F{003}4%% %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unfunction df\n}\n\nfunction testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShouldBeDisplayed() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage custom_world)\n  df() {\n      echo \"Filesystem     1K-blocks      Used Available Use% Mounted on\n/dev/disk1     487219288 471466944  15496344  4% /\"\n  }\n\n  local POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=true\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n  unfunction df\n}\n\nfunction testDiskUsageSegmentWarningLevelCouldBeAdjusted() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)\n  local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=10\n  df() {\n    echo \"Filesystem     1K-blocks      Used Available Use% Mounted on\n/dev/disk1     487219288 471466944  15496344  11% /\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{000}hdd  %F{000}11%% %k%F{003}%f \" \"$(build_left_prompt)\"\n\n  unfunction df\n}\n\nfunction testDiskUsageSegmentCriticalLevelCouldBeAdjusted() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)\n  local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=5\n  local POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=10\n  df() {\n    echo \"Filesystem     1K-blocks      Used Available Use% Mounted on\n/dev/disk1     487219288 471466944  15496344  11% /\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{001} %F{007}hdd  %F{007}11%% %k%F{001}%f \" \"$(build_left_prompt)\"\n\n  unfunction df\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/go_version.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction mockGo() {\n  case \"$1\" in\n  'version')\n    echo 'go version go1.5.3 darwin/amd64'\n    ;;\n  'env')\n    echo \"$HOME/go\"\n    ;;\n  esac\n}\n\nfunction mockGoEmptyGopath() {\n  case \"$1\" in\n  'version')\n    echo 'go version go1.5.3 darwin/amd64'\n    ;;\n  'env')\n    echo \"\"\n    ;;\n  esac\n}\n\nfunction testGo() {\n  alias go=mockGo\n  local POWERLEVEL9K_GO_ICON=\"\"\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(go_version)\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  local PWD=\"$HOME/go/src/github.com/bhilburn/powerlevel9k\"\n\n  assertEquals \"%K{002} %F{255} %F{255}go1.5.3 %k%F{002}%f \" \"$(build_left_prompt)\"\n\n  unalias go\n}\n\nfunction testGoSegmentPrintsNothingIfEmptyGopath() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world go_version)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  alias go=mockGoEmptyGopath\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testGoSegmentPrintsNothingIfNotInGopath() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world go_version)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  alias go=mockGo\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testGoSegmentPrintsNothingIfGoIsNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world go_version)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  alias go=noGo\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n  unalias go\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/segments/ip.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  # Test specific\n  P9K_HOME=$(pwd)\n  FOLDER=/tmp/powerlevel9k-test\n  mkdir -p $FOLDER\n  mkdir $FOLDER/sbin\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n\n  unset FOLDER\n  unset P9K_HOME\n}\n\nfunction fakeIfconfig() {\n  local INTERFACE1=\"${1}\"\n  [[ -z \"${INTERFACE1}\" ]] && INTERFACE1=\"eth0\"\n  local INTERFACE1_IP=\"1.2.3.4\"\n  local INTERFACE2=\"${2}\"\n  [[ -z \"${INTERFACE2}\" ]] && INTERFACE2=\"disabled-if2\"\n  local INTERFACE2_IP=\"5.6.7.8\"\n    # Fake ifconfig\n  cat > $FOLDER/sbin/ifconfig <<EOF\n#!/usr/bin/env zsh\n\nif [[ \"\\$*\" =~ '-l' ]]; then\n  echo \"docker0 tun1 ${INTERFACE1} ${INTERFACE2} lo\"\n  exit 0\nfi\n\nif [[ \"\\$*\" =~ '${INTERFACE1}' ]]; then\n  cat <<INNER\ntun1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet ${INTERFACE1_IP}  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\nINNER\n  exit 0\nfi\n\nif [[ \"\\$*\" =~ '${INTERFACE2}' ]]; then\n  cat <<INNER\ntun1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet ${INTERFACE2_IP}  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\nINNER\n  exit 0\nfi\n\n\n# If neither INTERFACE1 nor INTERFACE2 is queried, fake a offline (DOWN) interface.\n# We assume if there is at least one argument, we queried for a specific interface.\nif [[ \"\\$#\" -gt 0 ]]; then\n  cat <<INNER\ntun1: flags=4099<DOWN,BROADCAST,MULTICAST>  mtu 1500\n        inet 5.5.5.5  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\nINNER\n  exit 0\nfi\n\nif [[ \"\\$#\" -eq 0 ]]; then\n  cat <<INNER\ndocker0: flags=4099<DOWN,BROADCAST,MULTICAST>  mtu 1500\n        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255\n        ether 02:42:8f:5c:ed:51  txqueuelen 0  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\ntun1: flags=4099<DOWN,BROADCAST,MULTICAST>  mtu 1500\n        inet 10.20.30.40  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\n\n${INTERFACE1}: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet ${INTERFACE1_IP}  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\n\n${INTERFACE2}: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet ${INTERFACE2_IP}  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\n\nlo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536\n        inet 127.0.0.1  netmask 255.0.0.0\n        inet6 ::1  prefixlen 128  scopeid 0x10<host>\n        loop  txqueuelen 1000  (Local Loopback)\n        RX packets 5136  bytes 328651 (320.9 KiB)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 5136  bytes 328651 (320.9 KiB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\nINNER\nexit 0\nfi\nEOF\n  chmod +x $FOLDER/sbin/ifconfig\n}\n\nfunction fakeIp() {\n  local INTERFACE1=\"${1}\"\n  [[ -z \"${INTERFACE1}\" ]] && INTERFACE1=\"eth0\"\n  local INTERFACE2=\"${2}\"\n  [[ -z \"${INTERFACE2}\" ]] && INTERFACE2=\"disabled-if2\"\n  cat > $FOLDER/sbin/ip <<EOF\n#!/usr/bin/env zsh\n\n  if [[ \"\\$*\" =~ '-brief.*show' ]]; then\n    cat <<INNER\nlo               UNKNOWN        127.0.0.1/8\n${INTERFACE1}    UP             1.2.3.4/24\n${INTERFACE2}    UP             5.4.3.2/16\ndocker0          DOWN           172.17.0.1/16\nINNER\n  fi\n\n  if [[ \"\\$*\" =~ 'show ${INTERFACE1}' ]]; then\n    cat <<INNER\n2: ${INTERFACE1}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n  inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0\n  valid_lft forever preferred_lft forever\nINNER\n  fi\n\n  if [[ \"\\$*\" =~ 'show ${INTERFACE2}' ]]; then\n    cat <<INNER\n3: ${INTERFACE2}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n  inet 1.2.3.4 brd 10.0.2.255 scope global eth0\n  valid_lft forever preferred_lft forever\nINNER\n  fi\nEOF\n\n  chmod +x $FOLDER/sbin/ip\n}\n\nfunction testIpSegmentPrintsNothingOnOsxIfNotConnected() {\n  cat > $FOLDER/sbin/ifconfig <<EOF\n#!/usr/bin/env zsh\n\necho \"not connected\"\nEOF\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  local OS=\"OSX\" # Fake OSX\n\n  assertEquals \"\" \"$(prompt_ip left 1 false \"$FOLDER\")\"\n}\n\nfunction testIpSegmentPrintsNothingOnLinuxIfNotConnected() {\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  local OS=\"Linux\" # Fake Linux\n\n  cat > $FOLDER/sbin/ip <<EOF\n#!/usr/bin/env zsh\n\necho \"not connected\"\nEOF\n  chmod +x $FOLDER/sbin/ip\n\n  assertEquals \"\" \"$(prompt_ip left 1 false \"$FOLDER\")\"\n}\n\nfunction testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  local OS='OSX' # Fake OSX\n\n  fakeIfconfig \"eth1\" \"eth2\"\n\n  assertEquals \"%K{006} %F{000}IP %F{000}1.2.3.4 \" \"$(prompt_ip left 1 false \"$FOLDER\")\"\n}\n\nfunction testIpSegmentWorksOnOsxWithInterfaceSpecified() {\n  fakeIfconfig \"eth1\"\n\n  local POWERLEVEL9K_IP_INTERFACE=\"eth1\"\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  local OS='OSX' # Fake OSX\n\n  assertEquals \"%K{006} %F{000}IP %F{000}1.2.3.4 \" \"$(prompt_ip left 1 false \"$FOLDER\")\"\n}\n\nfunction testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() {\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n    local OS='Linux' # Fake Linux\n\n    fakeIp \"eth0\"\n\n    assertEquals \"%K{006} %F{000}IP %F{000}1.2.3.4 \" \"$(prompt_ip left 1 false \"$FOLDER\")\"\n}\n\nfunction testIpSegmentWorksOnLinuxWithInterfaceSpecified() {\n  fakeIp \"eth3\"\n\n  local POWERLEVEL9K_IP_INTERFACE=\"eth3\"\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  local OS='Linux' # Fake Linux\n\n  assertEquals \"%K{006} %F{000}IP %F{000}1.2.3.4 \" \"$(prompt_ip left 1 false \"$FOLDER\")\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/kubecontext.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction mockKubectl() {\n  case \"$1\" in\n    'version')\n      echo 'non-empty text'\n      ;;\n    'config')\n      case \"$2\" in\n        'view')\n          case \"$3\" in\n            '-o=jsonpath={.current-context}')\n              echo 'minikube'\n              ;;\n            '-o=jsonpath={.contexts'*)\n              echo ''\n              ;;\n            *)\n              echo \"Mock value missed\"\n              exit 1\n              ;;\n          esac\n          ;;\n      esac\n      ;;\n  esac\n}\n\nfunction mockKubectlOtherNamespace() {\n  case \"$1\" in\n    'version')\n      echo 'non-empty text'\n      ;;\n    'config')\n      case \"$2\" in\n        'view')\n          case \"$3\" in\n            # Get Current Context\n            '-o=jsonpath={.current-context}')\n              echo 'minikube'\n              ;;\n            # Get current namespace\n            '-o=jsonpath={.contexts'*)\n              echo 'kube-system'\n              ;;\n            *)\n              echo \"Mock value missed\"\n              exit 1\n              ;;\n          esac\n          ;;\n      esac\n      ;;\n  esac\n}\n\nfunction testKubeContext() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)\n  alias kubectl=mockKubectl\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{005} %F{007}⎈ %F{007}minikube/default %k%F{005}%f \" \"$(build_left_prompt)\"\n\n  unalias kubectl\n}\nfunction testKubeContextOtherNamespace() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)\n  alias kubectl=mockKubectlOtherNamespace\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{005} %F{007}⎈ %F{007}minikube/kube-system %k%F{005}%f \" \"$(build_left_prompt)\"\n\n  unalias kubectl\n}\nfunction testKubeContextPrintsNothingIfKubectlNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world kubecontext)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  alias kubectl=noKubectl\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n  unalias kubectl\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/segments/laravel_version.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction mockLaravelVersion() {\n  case \"$1\" in\n    \"artisan\")\n      # artisan --version follows the format Laravel Framework <version>\n      echo \"Laravel Framework 5.4.23\"\n      ;;\n    default)\n  esac\n}\n\nfunction mockNoLaravelVersion() {\n  # When php can't find a file it will output a message\n  echo \"Could not open input file: artisan\"\n  return 0\n}\n\nfunction testLaravelVersionSegment() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(laravel_version)\n  local POWERLEVEL9K_LARAVEL_ICON='x'\n  alias php=mockLaravelVersion\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{009} %F{007}x %F{007}5.4.23 %k%F{009}%f \" \"$(build_left_prompt)\"\n\n  unalias php\n}\n\nfunction testLaravelVersionSegmentIfArtisanIsNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world laravel_version)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  local POWERLEVEL9K_LARAVEL_ICON='x'\n  alias php=mockNoLaravelVersion\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n  unalias php\n}\n\nfunction testLaravelVersionSegmentPrintsNothingIfPhpIsNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world laravel_version)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  local POWERLEVEL9K_LARAVEL_ICON='x'\n  alias php=noPhp\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n  unalias php\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/segments/load.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder and git init it.\n  FOLDER=/tmp/powerlevel9k-test/load-test\n  mkdir -p \"${FOLDER}\"\n  cd $FOLDER\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testLoadSegmentWorksOnOsx() {\n    sysctl() {\n        if [[ \"$*\" == 'vm.loadavg' ]]; then\n            echo \"vm.loadavg: { 1,38 1,45 2,16 }\";\n        fi\n\n        if [[ \"$*\" == '-n hw.logicalcpu' ]]; then\n            echo \"4\";\n        fi\n    }\n\n    local POWERLEVEL9K_LOAD_WHICH=1\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"OSX\" # Fake OSX\n\n    assertEquals \"%K{002} %F{000}L %F{000}1.38 \" \"$(prompt_load left 1 false ${FOLDER})\"\n\n    unfunction sysctl\n}\n\nfunction testLoadSegmentWorksOnBsd() {\n    sysctl() {\n        if [[ \"$*\" == 'vm.loadavg' ]]; then\n            echo \"vm.loadavg: { 1,38 1,45 2,16 }\";\n        fi\n\n        if [[ \"$*\" == '-n hw.ncpu' ]]; then\n            echo \"4\";\n        fi\n    }\n\n    local POWERLEVEL9K_LOAD_WHICH=1\n    \n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"BSD\" # Fake BSD\n\n    assertEquals \"%K{002} %F{000}L %F{000}1.38 \" \"$(prompt_load left 1 false ${FOLDER})\"\n\n    unfunction sysctl\n}\n\nfunction testLoadSegmentWorksOnLinux() {\n    # Prepare loadavg\n    mkdir proc\n    echo \"1.38 0.01 0.05 1/87 8641\" > proc/loadavg\n\n    alias nproc=\"echo 4\"\n    local POWERLEVEL9K_LOAD_WHICH=1\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"Linux\" # Fake Linux\n\n    assertEquals \"%K{002} %F{000}L %F{000}1.38 \" \"$(prompt_load left 1 false ${FOLDER})\"\n\n    unalias nproc\n}\n\n# Test normal state. This test is not OS specific.\n# We test it as the Linux version, but that\n# does not matter here.\nfunction testLoadSegmentNormalState() {\n    # Prepare loadavg\n    mkdir proc\n    echo \"1.00 0.01 0.05 1/87 8641\" > proc/loadavg\n\n    alias nproc=\"echo 4\"\n    local POWERLEVEL9K_LOAD_WHICH=1\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"Linux\" # Fake Linux\n\n    assertEquals \"%K{002} %F{000}L %F{000}1.00 \" \"$(prompt_load left 1 false ${FOLDER})\"\n\n    unalias nproc\n}\n\n# Test warning state. This test is not OS specific.\n# We test it as the Linux version, but that\n# does not matter here.\nfunction testLoadSegmentWarningState() {\n    # Prepare loadavg\n    mkdir proc\n    echo \"2.01 0.01 0.05 1/87 8641\" > proc/loadavg\n\n    alias nproc=\"echo 4\"\n    local POWERLEVEL9K_LOAD_WHICH=1\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"Linux\" # Fake Linux\n\n    assertEquals \"%K{003} %F{000}L %F{000}2.01 \" \"$(prompt_load left 1 false ${FOLDER})\"\n\n    unalias nproc\n}\n\n# Test critical state. This test is not OS specific.\n# We test it as the Linux version, but that\n# does not matter here.\nfunction testLoadSegmentCriticalState() {\n    # Prepare loadavg\n    mkdir proc\n    echo \"2.81 0.01 0.05 1/87 8641\" > proc/loadavg\n\n    alias nproc=\"echo 4\"\n    local POWERLEVEL9K_LOAD_WHICH=1\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"Linux\" # Fake Linux\n\n    assertEquals \"%K{001} %F{000}L %F{000}2.81 \" \"$(prompt_load left 1 false ${FOLDER})\"\n\n    unalias nproc\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/newline.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n}\n\nfunction testNewlineDoesNotCreateExtraSegmentSeparator() {\n    local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n    local POWERLEVEL9K_CUSTOM_WORLD2=\"echo world2\"\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 newline newline newline custom_world2)\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"OSX\" # Fake OSX\n\n    local newline=$'\\n'\n\n    assertEquals \"%K{007} %F{000}world1 %k%F{007}%f${newline}%k%f${newline}%k%f${newline}%K{007} %F{000}world2 %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testNewlineMakesPreviousSegmentEndWell() {\n    local POWERLEVEL9K_CUSTOM_WORLD1=\"echo world1\"\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 newline)\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"OSX\" # Fake OSX\n\n    local newline=$'\\n'\n\n    assertEquals \"%K{007} %F{000}world1 %k%F{007}%f${newline}%k%F{none}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/node_version.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction testNodeVersionSegmentPrintsNothingWithoutNode() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    alias node=\"nonode 2>/dev/null\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n    unalias node\n}\n\nfunction testNodeVersionSegmentWorks() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version)\n    node() {\n        echo \"v1.2.3\"\n    }\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{002} %F{007}⬢ %F{007}1.2.3 %k%F{002}%f \" \"$(build_left_prompt)\"\n\n    unfunction node\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/nodeenv.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  # Test specfic\n  # unset all possible user specified variables\n  unset NODE_VIRTUAL_ENV_DISABLE_PROMPT\n  unset NODE_VIRTUAL_ENV\n}\n\nfunction testNodeenvSegmentPrintsNothingWithoutNode() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    alias node=\"nonode 2>/dev/null\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n    unalias node\n}\n\nfunction testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    node() {\n        echo \"v1.2.3\"\n    }\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n    unfunction node\n}\n\nfunction testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv)\n    alias node=\"nonode 2>/dev/null\"\n    NODE_VIRTUAL_ENV=\"node-env\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{002}⬢ %F{002}[node-env] %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unset NODE_VIRTUAL_ENV\n    unalias node\n}\n\nfunction testNodeenvSegmentWorks() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv)\n    node() {\n        echo \"v1.2.3\"\n    }\n    NODE_VIRTUAL_ENV=\"node-env\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{002}⬢ %F{002}v1.2.3[node-env] %k%F{000}%f \" \"$(build_left_prompt)\"\n\n    unfunction node\n    unset NODE_VIRTUAL_ENV\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/nvm.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder and git init it.\n  FOLDER=/tmp/powerlevel9k-test/nvm-test\n  mkdir -p \"${FOLDER}/bin\"\n  OLD_PATH=$PATH\n  PATH=${FOLDER}/bin:$PATH\n  cd $FOLDER\n}\n\nfunction tearDown() {\n  # Restore old path\n  PATH=\"${OLD_PATH}\"\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testNvmSegmentPrintsNothingIfNvmIsNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testNvmSegmentWorksWithoutHavingADefaultAlias() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm)\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  function nvm_version() {\n    [[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v1.4.0'\n  }\n\n  assertEquals \"%K{005} %F{000}⬢ %F{000}4.6.0 %k%F{005}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testNvmSegmentPrintsNothingWhenOnDefaultVersion() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  function nvm_version() {\n    [[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v4.6.0'\n  }\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/php_version.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version custom_world)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  alias php=\"nophp\"\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n  unalias php\n}\n\nfunction testPhpVersionSegmentWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version)\n  alias php=\"echo 'PHP 5.6.27 (cli) (built: Oct 23 2016 11:47:58)\nCopyright (c) 1997-2016 The PHP Group\nZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies\n'\"\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{013} %F{255}PHP 5.6.27 %k%F{013}%f \" \"$(build_left_prompt)\"\n\n  unalias php\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/public_ip.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  # Test specific\n  P9K_HOME=$(pwd)\n  FOLDER=/tmp/powerlevel9k-test\n  mkdir -p $FOLDER\n  mkdir $FOLDER/sbin\n  cd $FOLDER\n\n  # Change cache file, so that the users environment don't\n  # interfere with the tests.\n  POWERLEVEL9K_PUBLIC_IP_FILE=$FOLDER/public_ip_file\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n  unset FOLDER\n  unset P9K_HOME\n\n  # Unset cache file\n  unset POWERLEVEL9K_PUBLIC_IP_FILE\n}\n\nfunction fakeIfconfig() {\n  local INTERFACE=\"${1}\"\n  [[ -z \"${INTERFACE}\" ]] && INTERFACE=\"tun0\"\n    # Fake ifconfig\n  cat > $FOLDER/sbin/ifconfig <<EOF\n#!/usr/bin/env zsh\n\nif [[ \"\\$*\" == \"-l\" ]]; then\n  echo \"lo0 gif0 stf0 EHC250 EHC253 tun1 tun0 ${INTERFACE} fw0 en0 en2 en1 p2p0 bridge0 utun0\"\n  exit 0\nfi\n\nif [[ \"\\$*\" == \"${INTERFACE}\" ]]; then\n  cat <<INNER\n${INTERFACE}: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet 1.2.3.4  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\nINNER\n  exit 0\nfi\n\nif [[ \"\\$#\" == \"0\" ]]; then\n  cat <<INNER\ndocker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255\n        ether 02:42:8f:5c:ed:51  txqueuelen 0  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\n${INTERFACE}: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet 1.2.3.4  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\n\nlo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536\n        inet 127.0.0.1  netmask 255.0.0.0\n        inet6 ::1  prefixlen 128  scopeid 0x10<host>\n        loop  txqueuelen 1000  (Local Loopback)\n        RX packets 5136  bytes 328651 (320.9 KiB)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 5136  bytes 328651 (320.9 KiB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\nINNER\nfi\nEOF\n  chmod +x $FOLDER/sbin/ifconfig\n}\n\nfunction fakeIp() {\n  local INTERFACE1=\"${1}\"\n  [[ -z \"${INTERFACE1}\" ]] && INTERFACE1=\"tun0\"\n  local INTERFACE2=\"${2}\"\n  [[ -z \"${INTERFACE2}\" ]] && INTERFACE2=\"disabled-if2\"\n  cat > $FOLDER/sbin/ip <<EOF\n#!/usr/bin/env zsh\n\n  if [[ \"\\$*\" == 'link ls up' ]]; then\n    cat <<INNER\n1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default\n    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n2: ${INTERFACE1}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000\n    link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff\n3: ${INTERFACE2}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000\n    link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff\n4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000\n    link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff\nINNER\n  fi\n\n  if [[ \"\\$*\" =~ '-brief.*show' ]]; then\n    cat <<INNER\nlo               UNKNOWN        127.0.0.1/8\n${INTERFACE1}    UP             1.2.3.4/24\n${INTERFACE2}    UP             5.4.3.2/16\ndocker0          DOWN           172.17.0.1/16\nINNER\n  fi\n\n  if [[ \"\\$*\" =~ 'show ${INTERFACE1}' ]]; then\n    cat <<INNER\n2: ${INTERFACE1}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n  inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0\n  valid_lft forever preferred_lft forever\nINNER\n  fi\n\n  if [[ \"\\$*\" =~ 'show ${INTERFACE2}' ]]; then\n    cat <<INNER\n3: ${INTERFACE2}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n  inet 1.2.3.4 brd 10.0.2.255 scope global eth0\n  valid_lft forever preferred_lft forever\nINNER\n  fi\nEOF\n\n  chmod +x $FOLDER/sbin/ip\n}\n\nfunction testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip custom_world)\n  local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz'\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n  # We need to overwrite dig, as this is a fallback method that\n  # uses an alternative host.\n  alias dig='nodig'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n  unalias dig\n}\n\nfunction testPublicIpSegmentPrintsNoticeIfNotConnected() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)\n  local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz'\n  local POWERLEVEL9K_PUBLIC_IP_NONE=\"disconnected\"\n  # We need to overwrite dig, as this is a fallback method that\n  # uses an alternative host.\n  alias dig='nodig'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{007}disconnected %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unalias dig\n}\n\nfunction testPublicIpSegmentWorksWithWget() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)\n  alias dig='nodig'\n  alias curl='nocurl'\n  wget() {\n      echo \"wget 1.2.3.4\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{007}wget 1.2.3.4 %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unfunction wget\n  unalias dig\n  unalias curl\n}\n\nfunction testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)\n  alias dig='nodig'\n  alias wget='nowget'\n  curl() {\n      echo \"curl 1.2.3.4\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{007}curl 1.2.3.4 %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unfunction curl\n  unalias dig\n  unalias wget\n}\n\nfunction testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)\n  alias curl='nocurl'\n  alias wget='nowget'\n  dig() {\n      echo \"dig 1.2.3.4\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{007}dig 1.2.3.4 %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unfunction dig\n  unalias curl\n  unalias wget\n}\n\nfunction testPublicIpSegmentCachesFile() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)\n  dig() {\n      echo \"first\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{007}first %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  dig() {\n      echo \"second\"\n  }\n\n  # Segment should not have changed!\n  assertEquals \"%K{000} %F{007}first %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unfunction dig\n}\n\nfunction testPublicIpSegmentRefreshesCachesFileAfterTimeout() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)\n  local POWERLEVEL9K_PUBLIC_IP_TIMEOUT=2\n  dig() {\n      echo \"first\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{007}first %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  sleep 3\n  dig() {\n      echo \"second\"\n  }\n\n  # Segment should not have changed!\n  assertEquals \"%K{000} %F{007}second %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unfunction dig\n}\n\nfunction testPublicIpSegmentRefreshesCachesFileIfEmpty() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)\n  dig() {\n      echo \"first\"\n  }\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{007}first %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  # Truncate cache file\n  echo \"\" >! $POWERLEVEL9K_PUBLIC_IP_FILE\n\n  dig() {\n      echo \"second\"\n  }\n\n  # Segment should not have changed!\n  assertEquals \"%K{000} %F{007}second %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unfunction dig\n}\n\nfunction testPublicIpSegmentWhenGoingOnline() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)\n  local POWERLEVEL9K_PUBLIC_IP_METHODS=\"dig\"\n  local POWERLEVEL9K_PUBLIC_IP_NONE=\"disconnected\"\n  alias dig=\"nodig\"\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{007}disconnected %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unalias dig\n\n  dig() {\n      echo \"second\"\n  }\n\n  # Segment should not have changed!\n  assertEquals \"%K{000} %F{007}second %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unfunction dig\n}\n\nfunction testPublicIpSegmentWithVPNTurnedOnLinux() {\n  local OS='linux'\n\n  echo \"1.2.3.4\" > $POWERLEVEL9K_PUBLIC_IP_FILE\n  local POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE=\"tun1\"\n\n  # Fake ip command\n  fakeIp \"tun1\"\n\n  assertEquals \"%K{000} %F{007}(vpn) %F{007}1.2.3.4 \" \"$(prompt_public_ip left 1 false \"$FOLDER\")\"\n}\n\nfunction testPublicIpSegmentWithVPNTurnedOnOsx() {\n  typeset -F now\n  now=$(date +%s)\n\n  local OS='OSX'\n\n  echo \"1.2.3.4\" > $POWERLEVEL9K_PUBLIC_IP_FILE\n  local POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE=\"tun1\"\n\n  # Fake stat call\n  function stat() {\n    echo $now\n  }\n\n  # Fake ifconfig\n  fakeIfconfig \"tun1\"\n\n  assertEquals \"%K{000} %F{007}(vpn) %F{007}1.2.3.4 \" \"$(prompt_public_ip left 1 false \"$FOLDER\")\"\n\n  unfunction stat\n}\n\nfunction testPublicIpSegmentWithVPNTurnedOnAndFuzzyMatchingOnOsx() {\n  typeset -F now\n  now=$(date +%s)\n\n  local OS='OSX'\n\n  echo \"1.2.3.4\" > $POWERLEVEL9K_PUBLIC_IP_FILE\n  local POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE=\"tun\"\n\n  # Fake stat call\n  function stat() {\n    echo $now\n  }\n\n  # Fake ifconfig\n  fakeIfconfig \"tun3\"\n\n  assertEquals \"%K{000} %F{007}(vpn) %F{007}1.2.3.4 \" \"$(prompt_public_ip left 1 false \"$FOLDER\")\"\n\n  unfunction stat\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/ram.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder and git init it.\n  FOLDER=/tmp/powerlevel9k-test/ram-test\n  mkdir -p \"${FOLDER}\"\n  cd $FOLDER\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testRamSegmentWorksOnOsx() {\n    alias vm_stat=\"echo 'Mach Virtual Memory Statistics: (page size of 4096 bytes)\nPages free:                              299687.\nPages active:                           1623792.\nPages inactive:                         1313411.\n'\"\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"OSX\" # Fake OSX\n\n    assertEquals \"%K{003} %F{000}RAM %F{000}6.15G \" \"$(prompt_ram left 1 false ${FOLDER})\"\n\n    unalias vm_stat\n}\n\nfunction testRamSegmentWorksOnBsd() {\n    mkdir -p var/run\n    echo \"avail memory 5678B 299687 4444G 299\" > var/run/dmesg.boot\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"BSD\" # Fake BSD\n\n    assertEquals \"%K{003} %F{000}RAM %F{000}0.29M \" \"$(prompt_ram left 1 false ${FOLDER})\"\n}\n\nfunction testRamSegmentWorksOnLinux() {\n    mkdir proc\n    echo \"MemAvailable: 299687\" > proc/meminfo\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"Linux\" # Fake Linux\n\n    assertEquals \"%K{003} %F{000}RAM %F{000}0.29G \" \"$(prompt_ram left 1 false ${FOLDER})\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/rust_version.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nTEST_BASE_FOLDER=/tmp/powerlevel9k-test\nRUST_TEST_FOLDER=\"${TEST_BASE_FOLDER}/rust-test\"\n\nfunction setUp() {\n  OLDPATH=\"${PATH}\"\n  mkdir -p \"${RUST_TEST_FOLDER}\"\n  PATH=\"${RUST_TEST_FOLDER}:${PATH}\"\n\n  export TERM=\"xterm-256color\"\n}\n\nfunction tearDown() {\n  PATH=\"${OLDPATH}\"\n  rm -fr \"${TEST_BASE_FOLDER}\"\n}\n\nfunction mockRust() {\n  echo \"#!/bin/sh\\n\\necho 'rustc 0.4.1a-alpha'\" > \"${RUST_TEST_FOLDER}/rustc\"\n  chmod +x \"${RUST_TEST_FOLDER}/rustc\"\n}\n\nfunction testRust() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version)\n  mockRust\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{208} %F{000}Rust %F{000}0.4.1a-alpha %k%F{208}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testRustPrintsNothingIfRustIsNotAvailable() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world rust_version)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/segments/ssh.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction testSshSegmentPrintsNothingIfNoSshConnection() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh custom_world)\n  local POWERLEVEL9K_CUSTOM_WORLD='echo \"world\"'\n  local POWERLEVEL9K_SSH_ICON=\"ssh-icon\"\n  # Weak test: Emulate No SSH connection by unsetting\n  # $SSH_CLIENT and $SSH_TTY\n  unset SSH_CLIENT\n  unset SSH_TTY\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testSshSegmentWorksIfOnlySshClientIsSet() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh)\n  local POWERLEVEL9K_SSH_ICON=\"ssh-icon\"\n  # Weak test: Emulate No SSH connection by unsetting\n  # $SSH_CLIENT and $SSH_TTY\n  SSH_CLIENT='ssh-client'\n  unset SSH_TTY\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{003}ssh-icon %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unset SSH_CLIENT\n}\n\nfunction testSshSegmentWorksIfOnlySshTtyIsSet() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh)\n  local POWERLEVEL9K_SSH_ICON=\"ssh-icon\"\n  # Weak test: Emulate No SSH connection by unsetting\n  # $SSH_CLIENT and $SSH_TTY\n  SSH_TTY='ssh-tty'\n  unset SSH_CLIENT\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{003}ssh-icon %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unset SSH_TTY\n}\n\nfunction testSshSegmentWorksIfAllNecessaryVariablesAreSet() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh)\n  local POWERLEVEL9K_SSH_ICON=\"ssh-icon\"\n  # Weak test: Emulate No SSH connection by unsetting\n  # $SSH_CLIENT and $SSH_TTY\n  SSH_CLIENT='ssh-client'\n  SSH_TTY='ssh-tty'\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{003}ssh-icon %k%F{000}%f \" \"$(build_left_prompt)\"\n\n  unset SSH_TTY\n  unset SSH_CLIENT\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/status.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  ### Test specific\n  # Resets if someone has set these in his/hers env\n  unset POWERLEVEL9K_STATUS_VERBOSE\n  unset POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE\n}\n\nfunction testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    local POWERLEVEL9K_STATUS_VERBOSE=false\n    local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)\n    local POWERLEVEL9K_STATUS_VERBOSE=true\n    local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false\n    local POWERLEVEL9K_STATUS_HIDE_SIGNAME=true\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    assertEquals \"%K{000} %F{002}✔ %k%F{000}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testStatusInGeneralErrorCase() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)\n    local POWERLEVEL9K_STATUS_VERBOSE=true\n    local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n    local RETVAL=1\n\n    assertEquals \"%K{001} %F{226}↵ %F{226}1 %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testPipestatusInErrorCase() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)\n    local POWERLEVEL9K_STATUS_VERBOSE=true\n    local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n    local -a RETVALS\n    RETVALS=(0 0 1 0)\n\n    assertEquals \"%K{001} %F{226}↵ %F{226}0|0|1|0 %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testStatusCrossWinsOverVerbose() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)\n    local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false\n    local POWERLEVEL9K_STATUS_VERBOSE=true\n    local POWERLEVEL9K_STATUS_CROSS=true\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n    local RETVAL=1\n\n    assertEquals \"%K{000} %F{001}✘ %k%F{000}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testStatusShowsSignalNameInErrorCase() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)\n    local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false\n    local POWERLEVEL9K_STATUS_VERBOSE=true\n    local POWERLEVEL9K_STATUS_HIDE_SIGNAME=false\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n    local RETVAL=132\n\n    assertEquals \"%K{001} %F{226}↵ %F{226}SIGILL(4) %k%F{001}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testStatusSegmentIntegrated() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)\n    local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS\n    POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()\n    local POWERLEVEL9K_STATUS_CROSS=true\n    \n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n\n    false; powerlevel9k_prepare_prompts\n\n    assertEquals \"%f%b%k%K{000} %F{001}✘ %k%F{000}%f \" \"${(e)PROMPT}\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/swap.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder and git init it.\n  FOLDER=/tmp/powerlevel9k-test/swap-test\n  mkdir -p \"${FOLDER}\"\n  cd $FOLDER\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testSwapSegmentWorksOnOsx() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap)\n    sysctl() {\n        echo \"vm.swapusage: total = 3072,00M  used = 1620,50M  free = 1451,50M  (encrypted)\"\n    }\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"OSX\" # Fake OSX\n\n    assertEquals \"%K{003} %F{000}SWP %F{000}1.58G \" \"$(prompt_swap left 1 false ${FOLDER})\"\n\n    unfunction sysctl\n}\n\nfunction testSwapSegmentWorksOnLinux() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap)\n    mkdir proc\n    echo \"SwapTotal: 1000000\" > proc/meminfo\n    echo \"SwapFree: 1000\" >> proc/meminfo\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n    local OS=\"Linux\" # Fake Linux\n\n    assertEquals \"%K{003} %F{000}SWP %F{000}0.95G \" \"$(prompt_swap left 1 false ${FOLDER})\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/swift_version.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder and git init it.\n  FOLDER=/tmp/powerlevel9k-test\n  mkdir -p \"${FOLDER}\"\n  cd $FOLDER\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    alias swift=\"noswift\"\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n    unalias swift\n}\n\nfunction testSwiftSegmentWorks() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version)\n    function swift() {\n        echo \"Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)\\nTarget: x86_64-apple-macosx10.9\"\n    }\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n    assertEquals \"%K{005} %F{007}Swift %F{007}3.0.1 %k%F{005}%f \" \"$(build_left_prompt)\"\n\n    unfunction swift\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/symfony_version.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder and git init it.\n  FOLDER=/tmp/powerlevel9k-test\n  mkdir -p \"${FOLDER}\"\n  cd $FOLDER\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    alias php=\"nophp\"\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n    unalias php\n}\n\nfunction testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world)\n    # \"Symfony\" is not a command, but rather a framework.\n    # To sucessfully execute this test, we just need to\n    # navigate into a folder that does not contain symfony.\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testSymfonyVersionPrintsNothingIfPhpThrowsAnError() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n    mkdir app\n    touch app/AppKernel.php\n    function php() {\n        echo \"Warning: Unsupported declare strict_types in /Users/dr/Privat/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php on line 19\n\n        Parse error: parse error, expecting `;´ or `{´ in /Users/dr/Privat/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php on line 97\"\n    }\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n\n    unfunction php\n}\n\nfunction testSymfonyVersionSegmentWorks() {\n    startSkipping # Skip test\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version)\n    mkdir app\n    touch app/AppKernel.php\n\n    function php() {\n        echo \"Symfony version 3.1.4 - app/dev/debug\"\n    }\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n    assertEquals \"%K{240} %F{000}SF %f%F{000}3.1.4 %k%F{240}%f \" \"$(build_left_prompt)\"\n\n    unfunction php\n}\n\nfunction testSymfonyVersionSegmentWorksInNestedFolder() {\n    startSkipping # Skip test\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version)\n    mkdir app\n    touch app/AppKernel.php\n\n    function php() {\n        echo \"Symfony version 3.1.4 - app/dev/debug\"\n    }\n\n    mkdir -p src/P9K/AppBundle\n    cd src/P9K/AppBundle\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n    assertEquals \"%K{240} %F{000}SF %f%F{000}3.1.4 %k%F{240}%f \" \"$(build_left_prompt)\"\n\n    unfunction php\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/todo.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder and git init it.\n  FOLDER=/tmp/powerlevel9k-test\n  mkdir -p \"${FOLDER}\"\n  mkdir ${FOLDER}/bin\n  OLD_PATH=$PATH\n  PATH=${FOLDER}/bin:$PATH\n  cd $FOLDER\n}\n\nfunction tearDown() {\n  # Reset PATH\n  PATH=$OLD_PATH\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n}\n\nfunction testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() {\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo custom_world)\n    local POWERLEVEL9K_CUSTOM_WORLD='echo world'\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n    assertEquals \"%K{007} %F{000}world %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testTodoSegmentWorksAsExpected() {\n    # TODO: Skript in den PATH legen!\n    local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo)\n    echo '#!/bin/sh' > ${FOLDER}/bin/todo.sh\n    echo 'echo \"TODO: 34 of 100 tasks shown\";' >> ${FOLDER}/bin/todo.sh\n    chmod +x ${FOLDER}/bin/todo.sh\n\n    # Load Powerlevel9k\n    source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n    assertEquals \"%K{244} %F{000}☑ %F{000}100 %k%F{244}%f \" \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/vcs-git.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder and git init it.\n  FOLDER=/tmp/powerlevel9k-test/vcs-test\n  mkdir -p \"${FOLDER}\"\n  cd $FOLDER\n\n  # Set username and email\n  OLD_GIT_AUTHOR_NAME=$GIT_AUTHOR_NAME\n  GIT_AUTHOR_NAME=\"Testing Tester\"\n  OLD_GIT_AUTHOR_EMAIL=$GIT_AUTHOR_EMAIL\n  GIT_AUTHOR_EMAIL=\"test@powerlevel9k.theme\"\n\n  # Set default username if not already set!\n  if [[ -z $(git config user.name) ]]; then\n    GIT_AUTHOR_NAME_SET_BY_TEST=true\n    git config --global user.name \"${GIT_AUTHOR_NAME}\"\n  fi\n  # Set default email if not already set!\n  if [[ -z $(git config user.email) ]]; then\n    GIT_AUTHOR_EMAIL_SET_BY_TEST=true\n    git config --global user.email \"${GIT_AUTHOR_EMAIL}\"\n  fi\n\n  # Initialize FOLDER as git repository\n  git init 1>/dev/null\n}\n\nfunction tearDown() {\n  if [[ -n \"${OLD_GIT_AUTHOR_NAME}\" ]]; then\n    GIT_AUTHOR_NAME=$OLD_GIT_AUTHOR\n    unset OLD_GIT_AUTHOR_NAME\n  else\n    unset GIT_AUTHOR_NAME\n  fi\n\n  if [[ -n \"${OLD_GIT_AUTHOR_EMAIL}\" ]]; then\n    GIT_AUTHOR_EMAIL=$OLD_GIT_AUTHOR_EMAIL\n    unset OLD_GIT_AUTHOR_EMAIL\n  else\n    unset GIT_AUTHOR_EMAIL\n  fi\n\n  if [[ \"${GIT_AUTHOR_NAME_SET_BY_TEST}\" == \"true\" ]]; then\n    git config --global --unset user.name\n  fi\n  if [[ \"${GIT_AUTHOR_EMAIL_SET_BY_TEST}\" == \"true\" ]]; then\n    git config --global --unset user.email\n  fi\n\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test\n  unset FOLDER\n}\n\nfunction testColorOverridingForCleanStateWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'\n  local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{006} master %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testColorOverridingForModifiedStateWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red'\n  local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'\n\n  touch testfile\n  git add testfile\n  git commit -m \"test\" 1>/dev/null\n  echo \"test\" > testfile\n  \n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{001} master ● %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testColorOverridingForUntrackedStateWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='cyan'\n  local POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow'\n\n  touch testfile\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{006} master ? %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testGitIconWorks() {\n  local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_GIT_ICON='Git-Icon'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000}Git-Icon %F{000} master %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testGitlabIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_GIT_GITLAB_ICON='GL-Icon'\n\n  # Add a GitLab project as remote origin. This is\n  # sufficient to show the GitLab-specific icon.\n  git remote add origin https://gitlab.com/dritter/gitlab-test-project.git\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000}GL-Icon %F{000} master %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testBitbucketIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON='BB-Icon'\n\n  # Add a BitBucket project as remote origin. This is\n  # sufficient to show the BitBucket-specific icon.\n  git remote add origin https://dritter@bitbucket.org/dritter/dr-test.git\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000}BB-Icon %F{000} master %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testGitHubIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_GIT_GITHUB_ICON='GH-Icon'\n\n  # Add a GitHub project as remote origin. This is\n  # sufficient to show the GitHub-specific icon.\n  git remote add origin https://github.com/dritter/test.git\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000}GH-Icon %F{000} master %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testUntrackedFilesIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_UNTRACKED_ICON='?'\n\n  # Create untracked file\n  touch \"i-am-untracked.txt\"\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} master ? %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testStagedFilesIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_STAGED_ICON='+'\n\n  # Create staged file\n  touch \"i-am-added.txt\"\n  git add i-am-added.txt &>/dev/null\n  git commit -m \"initial commit\" &>/dev/null\n  echo \"xx\" >> i-am-added.txt\n  git add i-am-added.txt &>/dev/null\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{000} master + %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testUnstagedFilesIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_UNSTAGED_ICON='M'\n\n  # Create unstaged (modified, but not added to index) file\n  touch \"i-am-modified.txt\"\n  git add i-am-modified.txt\n  git commit -m \"Add File\" 1>/dev/null\n  echo \"xx\" > i-am-modified.txt\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{000} master M %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testStashIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_STASH_ICON='S'\n\n  # Create modified file\n  touch \"i-am-modified.txt\"\n  git add i-am-modified.txt\n  git commit -m \"Add File\" 1>/dev/null\n  echo \"xx\" > i-am-modified.txt\n  git stash 1>/dev/null\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} master S1 %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testTagIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_TAG_ICON='T'\n\n  touch \"file.txt\"\n  git add file.txt\n  git commit -m \"Add File\" 1>/dev/null\n  git tag \"v0.0.1\"\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} master Tv0.0.1 %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testTagIconInDetachedHeadState() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_TAG_ICON='T'\n\n  touch \"file.txt\"\n  git add file.txt\n  git commit -m \"Add File\" &>/dev/null\n  git tag \"v0.0.1\"\n  touch \"file2.txt\"\n  git add file2.txt\n  git commit -m \"Add File2\" &>/dev/null\n  git checkout v0.0.1 &>/dev/null\n  local hash=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD)\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} ${hash} Tv0.0.1 %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testActionHintWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n\n  touch \"i-am-modified.txt\"\n  git add i-am-modified.txt\n  git commit -m \"Add File\" &>/dev/null\n\n  git clone . ../vcs-test2 &>/dev/null\n  echo \"xx\" >> i-am-modified.txt\n  git commit -a -m \"Modified file\" &>/dev/null\n\n  cd ../vcs-test2\n  echo \"yy\" >> i-am-modified.txt\n  git commit -a -m \"Provoke conflict\" &>/dev/null\n  git pull &>/dev/null\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{000} master %F{red}| merge%f %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testIncomingHintWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='I'\n\n  touch \"i-am-modified.txt\"\n  git add i-am-modified.txt\n  git commit -m \"Add File\" &>/dev/null\n\n  git clone . ../vcs-test2 &>/dev/null\n  echo \"xx\" >> i-am-modified.txt\n  git commit -a -m \"Modified file\" &>/dev/null\n\n  cd ../vcs-test2\n  git fetch &>/dev/null\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} master I1 %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testOutgoingHintWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='o'\n\n  touch \"i-am-modified.txt\"\n  git add i-am-modified.txt\n  git commit -m \"Add File\" &>/dev/null\n\n  git clone . ../vcs-test2 &>/dev/null\n\n  cd ../vcs-test2\n\n  echo \"xx\" >> i-am-modified.txt\n  git commit -a -m \"Modified file\" &>/dev/null\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} master o1 %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testShorteningCommitHashWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_SHOW_CHANGESET=true\n  local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'\n\n  touch \"file.txt\"\n  git add file.txt\n  git commit -m \"Add File\" 1>/dev/null\n  local hash=$(git rev-list -n 1 --abbrev-commit --abbrev=3 HEAD)\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  # This test needs to call powerlevel9k_vcs_init, where\n  # the changeset is truncated.\n  powerlevel9k_vcs_init\n  assertEquals \"%K{002} %F{000}${hash}  master %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_SHOW_CHANGESET=false\n  local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'\n\n  touch \"file.txt\"\n  git add file.txt\n  git commit -m \"Add File\" 1>/dev/null\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  # This test needs to call powerlevel9k_vcs_init, where\n  # the changeset is truncated.\n  powerlevel9k_vcs_init\n  assertEquals \"%K{002} %F{000} master %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testDetectingUntrackedFilesInSubmodulesWork() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=\"true\"\n  unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND\n\n  mkdir ../submodule\n  cd ../submodule\n  git init 1>/dev/null\n  touch \"i-am-tracked.txt\"\n  git add . 1>/dev/null && git commit -m \"Initial Commit\" 1>/dev/null\n\n  local submodulePath=\"${PWD}\"\n\n  cd -\n  git submodule add \"${submodulePath}\" 2>/dev/null\n  git commit -m \"Add submodule\" 1>/dev/null\n\n  # Go into checked-out submodule path\n  cd submodule\n  # Create untracked file\n  touch \"i-am-untracked.txt\"\n  cd -\n\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} master ? %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testDetectinUntrackedFilesInMainRepoWithDirtySubmodulesWork() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=\"true\"\n  unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND\n\n  mkdir ../submodule\n  cd ../submodule\n  git init 1>/dev/null\n  touch \"i-am-tracked.txt\"\n  git add . 1>/dev/null && git commit -m \"Initial Commit\" 1>/dev/null\n\n  local submodulePath=\"${PWD}\"\n\n  cd -\n  git submodule add \"${submodulePath}\" 2>/dev/null\n  git commit -m \"Add submodule\" 1>/dev/null\n\n  # Create untracked file\n  touch \"i-am-untracked.txt\"\n\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} master ? %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testDetectingUntrackedFilesInNestedSubmodulesWork() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=\"true\"\n  unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND\n\n  local mainRepo=\"${PWD}\"\n\n  mkdir ../submodule\n  cd ../submodule\n  git init 1>/dev/null\n  touch \"i-am-tracked.txt\"\n  git add . 1>/dev/null && git commit -m \"Initial Commit\" 1>/dev/null\n\n  local submodulePath=\"${PWD}\"\n\n  mkdir ../subsubmodule\n  cd ../subsubmodule\n  git init 1>/dev/null\n  touch \"i-am-tracked-too.txt\"\n  git add . 1>/dev/null && git commit -m \"Initial Commit\" 1>/dev/null\n\n  local subsubmodulePath=\"${PWD}\"\n\n  cd \"${submodulePath}\"\n  git submodule add \"${subsubmodulePath}\" 2>/dev/null\n  git commit -m \"Add subsubmodule\" 1>/dev/null\n  cd \"${mainRepo}\"\n  git submodule add \"${submodulePath}\" 2>/dev/null\n  git commit -m \"Add submodule\" 1>/dev/null\n\n  git submodule update --init --recursive 2>/dev/null\n\n  cd submodule/subsubmodule\n  # Create untracked file\n  touch \"i-am-untracked.txt\"\n  cd -\n\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} master ? %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testDetectingUntrackedFilesInCleanSubdirectoryWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=\"true\"\n  unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND\n   mkdir clean-folder\n  touch clean-folder/file.txt\n   mkdir dirty-folder\n  touch dirty-folder/file.txt\n   git add . 2>/dev/null\n  git commit -m \"Initial commit\" >/dev/null\n   touch dirty-folder/new-file.txt\n  cd clean-folder\n   source ${P9K_HOME}/powerlevel9k.zsh-theme\n   assertEquals \"%K{002} %F{000} master ? %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testBranchNameScriptingVulnerability() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  echo \"#!/bin/sh\\n\\necho 'hacked'\\n\" > evil_script.sh\n  chmod +x evil_script.sh\n\n  git checkout -b '$(./evil_script.sh)' 2>/dev/null\n  git add . 2>/dev/null\n  git commit -m \"Initial commit\" >/dev/null\n\n  assertEquals '%K{002} %F{000} $(./evil_script.sh) %k%F{002}%f ' \"$(build_left_prompt)\"\n}\n\nfunction testGitSubmoduleWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=\"true\"\n  unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND\n\n  mkdir ../submodule\n  cd ../submodule\n  git init 1>/dev/null\n  touch \"i-am-tracked.txt\"\n  git add . 1>/dev/null && git commit -m \"Initial Commit\" 1>/dev/null\n\n  local submodulePath=\"${PWD}\"\n\n  cd -\n  git submodule add \"${submodulePath}\" 2>/dev/null\n  git commit -m \"Add submodule\" 1>/dev/null\n\n  cd submodule\n\n  source \"${P9K_HOME}/powerlevel9k.zsh-theme\"\n\n  local result=\"$(build_left_prompt)\"\n  [[ \"$result\" =~ \".*(is outside repository)+\" ]] && return 1\n\n  assertEquals \"%K{002} %F{000} master %k%F{002}%f \" \"$result\"\n}\n\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/segments/vcs-hg.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  P9K_HOME=$(pwd)\n  ### Test specific\n  # Create default folder and hg init it.\n  FOLDER=/tmp/powerlevel9k-test/vcs-test\n  mkdir -p \"${FOLDER}\"\n  cd $FOLDER\n\n  export HGUSER=\"Test bot <bot@example.com>\"\n\n  hg init 1>/dev/null\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\" &>/dev/null\n  # At least remove test folder completely\n  rm -fr /tmp/powerlevel9k-test &>/dev/null\n  unset FOLDER\n  unset HGUSER\n}\n\nfunction testColorOverridingForCleanStateWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'\n  local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{007} %F{006} default %k%F{007}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testColorOverridingForModifiedStateWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red'\n  local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'\n\n  touch testfile\n  hg add testfile\n  hg commit -m \"test\" 1>/dev/null\n  echo \"test\" > testfile\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{001} default ● %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\n# There is no staging area in mercurial, therefore there are no \"untracked\"\n# files.. In case there are added files, we show the VCS segment with a\n# yellow background.\n# This may be improved in future versions, to be a bit more consistent with\n# the git part.\nfunction testAddedFilesIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  touch \"myfile.txt\"\n  hg add myfile.txt\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{000} default ● %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\n# We don't support tagging in mercurial right now..\nfunction testTagIconWorks() {\n  startSkipping # Skip test\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_TAG_ICON='T'\n\n  touch \"file.txt\"\n  hg add file.txt\n  hg commit -m \"Add File\" 1>/dev/null\n  hg tag \"v0.0.1\"\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} default Tv0.0.1 %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testTagIconInDetachedHeadState() {\n  startSkipping # Skip test\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_TAG_ICON='T'\n\n  touch \"file.txt\"\n  hg add file.txt\n  hg commit -m \"Add File\" &>/dev/null\n  hg tag \"v0.0.1\"\n  touch \"file2.txt\"\n  hg add file2.txt\n  hg commit -m \"Add File2\" &>/dev/null\n  hg checkout v0.0.1 &>/dev/null\n  local hash=$(hg id)\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} ${hash} Tv0.0.1 %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testActionHintWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  touch \"i-am-modified.txt\"\n  hg add i-am-modified.txt\n  hg commit -m \"Add File\" &>/dev/null\n\n  hg clone . ../vcs-test2 &>/dev/null\n  echo \"xx\" >> i-am-modified.txt\n  hg commit -m \"Modified file\" &>/dev/null\n\n  cd ../vcs-test2\n  echo \"yy\" >> i-am-modified.txt\n  hg commit -m \"Provoke conflict\" 2>/dev/null\n  hg pull 1>/dev/null\n  hg merge --tool internal:merge >/dev/null 2>&1\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{003} %F{000} default %F{red}| merging%f %k%F{003}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testShorteningCommitHashWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_SHOW_CHANGESET=true\n  local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'\n\n  touch \"file.txt\"\n  hg add file.txt\n  hg commit -m \"Add File\" 1>/dev/null\n  local hash=$(hg id | head -c ${POWERLEVEL9K_CHANGESET_HASH_LENGTH})\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  # This test needs to call powerlevel9k_vcs_init, where\n  # the changeset is truncated.\n  powerlevel9k_vcs_init\n\n  assertEquals \"%K{002} %F{000}${hash}  default %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_SHOW_CHANGESET=false\n  local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'\n\n  touch \"file.txt\"\n  hg add file.txt\n  hg commit -m \"Add File\" 1>/dev/null\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  # This test needs to call powerlevel9k_vcs_init, where\n  # the changeset is truncated.\n  powerlevel9k_vcs_init\n\n  assertEquals \"%K{002} %F{000} default %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testMercurialIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_HG_ICON='HG-Icon'\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000}HG-Icon %F{000} default %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testBookmarkIconWorks() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  local POWERLEVEL9K_VCS_BOOKMARK_ICON='B'\n  hg bookmark \"initial\"\n\n  # Load Powerlevel9k\n  source ${P9K_HOME}/powerlevel9k.zsh-theme\n\n  assertEquals \"%K{002} %F{000} default Binitial %k%F{002}%f \" \"$(build_left_prompt)\"\n}\n\nfunction testBranchNameScriptingVulnerability() {\n  local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS\n  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)\n  echo \"#!/bin/sh\\n\\necho 'hacked'\\n\" > evil_script.sh\n  chmod +x evil_script.sh\n\n  hg branch '$(./evil_script.sh)' >/dev/null\n  hg add . >/dev/null\n  hg commit -m \"Initial commit\" >/dev/null\n\n  assertEquals '%K{002} %F{000} $(./evil_script.sh) %k%F{002}%f ' \"$(build_left_prompt)\"\n}\n\nsource shunit2/shunit2\n"
  },
  {
    "path": "test/segments/vi_mode.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n}\n\nfunction testViInsertModeWorks() {\n  local KEYMAP='viins'\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{004}INSERT \" \"$(prompt_vi_mode left 1 false)\"\n}\n\nfunction testViInsertModeWorksWhenLabeledAsMain() {\n  local KEYMAP='main'\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{004}INSERT \" \"$(prompt_vi_mode left 1 false)\"\n}\n\nfunction testViCommandModeWorks() {\n  local KEYMAP='vicmd'\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{007}NORMAL \" \"$(prompt_vi_mode left 1 false)\"\n}\n\nfunction testViInsertModeStringIsCustomizable() {\n  local KEYMAP='viins'\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n\n  assertEquals \"%K{000} %F{004}INSERT \" \"$(prompt_vi_mode left 1 false)\"\n}\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/segments/vpn_ip.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\n# Required for shunit2 to run correctly\nsetopt shwordsplit\nSHUNIT_PARENT=$0\n\nfunction setUp() {\n  export TERM=\"xterm-256color\"\n\n  # Test specific\n  P9K_HOME=$(pwd)\n  FOLDER=/tmp/powerlevel9k-test\n  mkdir -p $FOLDER\n  mkdir $FOLDER/sbin\n}\n\nfunction tearDown() {\n  # Go back to powerlevel9k folder\n  cd \"${P9K_HOME}\"\n  # Remove eventually created test-specific folder\n  rm -fr \"${FOLDER}\"\n\n  unset FOLDER\n  unset P9K_HOME\n}\n\nfunction fakeIfconfig() {\n    # Fake ifconfig\n  cat > $FOLDER/sbin/ifconfig <<EOF\n#!/usr/bin/env zsh\n\nif [[ \"\\$#\" -gt 0 ]]; then\n  cat <<INNER\ntun1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet 1.2.3.4  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\nINNER\n  exit 0\nfi\n\n  cat <<INNER\ndocker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255\n        ether 02:42:8f:5c:ed:51  txqueuelen 0  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\ntun1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet 1.2.3.4  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device interrupt 16  memory 0xe8200000-e8220000\n\nlo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536\n        inet 127.0.0.1  netmask 255.0.0.0\n        inet6 ::1  prefixlen 128  scopeid 0x10<host>\n        loop  txqueuelen 1000  (Local Loopback)\n        RX packets 5136  bytes 328651 (320.9 KiB)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 5136  bytes 328651 (320.9 KiB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\nINNER\nEOF\n  chmod +x $FOLDER/sbin/ifconfig\n}\n\nfunction fakeIp() {\n  local INTERFACE1=\"${1}\"\n  [[ -z \"${INTERFACE1}\" ]] && INTERFACE1=\"tun0\"\n  local INTERFACE2=\"${2}\"\n  [[ -z \"${INTERFACE2}\" ]] && INTERFACE2=\"disabled-if2\"\n  cat > $FOLDER/sbin/ip <<EOF\n#!/usr/bin/env zsh\n\n  if [[ \"\\$*\" == 'link ls up' ]]; then\n    cat <<INNER\n1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default\n    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n2: ${INTERFACE1}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000\n    link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff\n3: ${INTERFACE2}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000\n    link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff\n4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000\n    link/ether 08:00:27:7e:84:45 brd ff:ff:ff:ff:ff:ff\nINNER\n  fi\n\n  if [[ \"\\$*\" =~ '-brief.*show' ]]; then\n    cat <<INNER\nlo               UNKNOWN        127.0.0.1/8\n${INTERFACE1}    UP             1.2.3.4/24\n${INTERFACE2}    UP             5.4.3.2/16\ndocker0          DOWN           172.17.0.1/16\nINNER\n  fi\n\n  if [[ \"\\$*\" =~ 'show ${INTERFACE1}' ]]; then\n    cat <<INNER\n2: ${INTERFACE1}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n  inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0\n  valid_lft forever preferred_lft forever\nINNER\n  fi\n\n  if [[ \"\\$*\" =~ 'show ${INTERFACE2}' ]]; then\n    cat <<INNER\n3: ${INTERFACE2}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n  inet 1.2.3.4 brd 10.0.2.255 scope global eth0\n  valid_lft forever preferred_lft forever\nINNER\n  fi\nEOF\n\n  chmod +x $FOLDER/sbin/ip\n}\n\nfunction testVpnIpSegmentPrintsNothingOnOsxIfNotConnected() {\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  local OS=\"OSX\" # Fake OSX\n\n  cat > $FOLDER/sbin/ifconfig <<EOF\n#!/usr/bin/env zsh\n\necho \"not connected\"\nEOF\n  chmod +x $FOLDER/sbin/ifconfig\n\n  assertEquals \"\" \"$(prompt_vpn_ip left 1 false \"$FOLDER\")\"\n}\n\nfunction testVpnIpSegmentPrintsNothingOnLinuxIfNotConnected() {\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  local OS=\"Linux\" # Fake Linux\n\n  cat > $FOLDER/sbin/ip <<EOF\n#!/usr/bin/env zsh\n\necho \"not connected\"\nEOF\n  chmod +x $FOLDER/sbin/ip\n\n  assertEquals \"\" \"$(prompt_vpn_ip left 1 false \"$FOLDER\")\"\n}\n\nfunction testVpnIpSegmentWorksOnOsxWithInterfaceSpecified() {\n  local POWERLEVEL9K_VPN_IP_INTERFACE='tun1'\n\n  fakeIfconfig\n\n  # Load Powerlevel9k\n  source powerlevel9k.zsh-theme\n  local OS='OSX' # Fake OSX\n\n  assertEquals \"%K{006} %F{000}(vpn) %F{000}1.2.3.4 \" \"$(prompt_vpn_ip left 1 false \"$FOLDER\")\"\n}\n\nfunction testVpnIpSegmentWorksOnLinuxWithInterfaceSpecified() {\n    local POWERLEVEL9K_VPN_IP_INTERFACE='tun1'\n    \n    fakeIp \"tun1\"\n\n    # Load Powerlevel9k\n    source powerlevel9k.zsh-theme\n    local OS='Linux' # Fake Linux\n\n    assertEquals \"%K{006} %F{000}(vpn) %F{000}1.2.3.4 \" \"$(prompt_vpn_ip left 1 false \"$FOLDER\")\"\n}\n\n# vpn_ip is not capable of handling multiple vpn interfaces ATM.\n# function testVpnIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() {\n#     local POWERLEVEL9K_VPN_IP_INTERFACE=(tun0 tun1)\n    \n#     fakeIp \"tun0\" \"tun1\"\n\n#     # Load Powerlevel9k\n#     source powerlevel9k.zsh-theme\n#     local OS='Linux' # Fake Linux\n\n# setopt xtrace\n#     assertEquals \"%K{006} %F{000}(vpn) %F{000}10.0.2.15 \" \"$(prompt_vpn_ip left 1 false \"$FOLDER\")\"\n#     unsetopt xtrace\n# }\n\nsource shunit2/shunit2"
  },
  {
    "path": "test/suite.spec",
    "content": "#!/usr/bin/env zsh\n#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8\n\nlocal failed=false\n\nfor test in **/*.spec; do\n    echo\n    echo \"Now executing ${test}\"\n    if [[ \"${test}\" == \"test/suite.spec\" ]]; then\n        continue;\n    fi\n    ./${test} || failed=true\ndone\n\nif [[ \"${failed}\" == \"true\" ]]; then\n    exit 1\nfi"
  },
  {
    "path": "test-bsd-vm/Vagrantfile",
    "content": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\n# All Vagrant configuration is done below. The \"2\" in Vagrant.configure\n# configures the configuration version (we support older styles for\n# backwards compatibility). Please don't change it unless you know what\n# you're doing.\nVagrant.configure(\"2\") do |config|\n  # The most common configuration options are documented and commented below.\n  # For a complete reference, please see the online documentation at\n  # https://docs.vagrantup.com.\n\n  # Every Vagrant development environment requires a box. You can search for\n  # boxes at https://atlas.hashicorp.com/search.\n  config.vm.box = \"freebsd/FreeBSD-11.0-STABLE\"\n\n  # Bootstrap\n  config.vm.provision :shell, path: \"bootstrap-zero.sh\", privileged: true\n  config.vm.provision :shell, path: \"bootstrap.sh\", privileged: false\n  config.vm.provision :shell, path: \"../test-vm-providers/plain.sh\", privileged: false\n\n  # Disable automatic box update checking. If you disable this, then\n  # boxes will only be checked for updates when the user runs\n  # `vagrant box outdated`. This is not recommended.\n  # config.vm.box_check_update = false\n\n  # Create a forwarded port mapping which allows access to a specific port\n  # within the machine from a port on the host machine. In the example below,\n  # accessing \"localhost:8080\" will access port 80 on the guest machine.\n  # config.vm.network \"forwarded_port\", guest: 80, host: 8080\n\n  # Create a private network, which allows host-only access to the machine\n  # using a specific IP.\n  config.vm.network \"private_network\", ip: \"192.168.33.10\"\n\n  # Create a public network, which generally matched to bridged network.\n  # Bridged networks make the machine appear as another physical device on\n  # your network.\n  #config.vm.network \"public_network\"\n\n  # The BSD base box does not define a MAC address. Whysoever.\n  config.vm.base_mac = \"8AAB4975994A\"\n\n  # There is no BASH for root on BSD. We need to set another shell.\n  # See https://www.freebsd.org/doc/en/articles/linux-users/shells.html\n  config.ssh.shell = \"/bin/sh\"\n\n  # Share an additional folder to the guest VM. The first argument is\n  # the path on the host to the actual folder. The second argument is\n  # the path on the guest to mount the folder. And the optional third\n  # argument is a set of non-required options.\n  config.vm.synced_folder \"..\", \"/vagrant_data\", type: \"nfs\"\n  config.vm.synced_folder \".\", \"/vagrant\", type: \"nfs\"\n\n  # Provider-specific configuration so you can fine-tune various\n  # backing providers for Vagrant. These expose provider-specific options.\n  # Example for VirtualBox:\n  config.vm.provider \"virtualbox\" do |vb|\n\n     # Change name to \"powerlevel9k-bsd\"\n     vb.name = \"powerlevel9k-bsd\"\n\n     # Display the VirtualBox GUI when booting the machine\n     #vb.gui = true\n  \n     # Customize the amount of memory on the VM:\n     vb.memory = \"256\"\n  end\n  \n  # View the documentation for the provider you are using for more\n  # information on available options.\n\n  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies\n  # such as FTP and Heroku are also available. See the documentation at\n  # https://docs.vagrantup.com/v2/push/atlas.html for more information.\n  # config.push.define \"atlas\" do |push|\n  #   push.app = \"YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME\"\n  # end\n\n  # Enable provisioning with a shell script. Additional provisioners such as\n  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the\n  # documentation for more information about their specific syntax and use.\n  # config.vm.provision \"shell\", inline: <<-SHELL\n  #   apt-get update\n  #   apt-get install -y apache2\n  # SHELL\nend\n"
  },
  {
    "path": "test-bsd-vm/bootstrap-zero.sh",
    "content": "#!/bin/sh\n\npkg install -y sudo"
  },
  {
    "path": "test-bsd-vm/bootstrap.sh",
    "content": "#!/bin/sh\n\n# Install ZSH\nsudo pkg install -y zsh\nsudo chsh -s `which zsh` vagrant\nsudo ln -s /usr/local/bin/zsh /usr/bin/zsh\n\n# Install git\nsudo pkg install -y git\n# Install mercurial\nsudo pkg install -y mercurial\n# Install subversion\nsudo pkg install -y subversion"
  },
  {
    "path": "test-in-docker",
    "content": "#!/usr/bin/env zsh\n\nset -eu\n\n# The default ZSH to use; it can just be the first few characters.\n# This should be the oldest version we support.\ndefault_version='4.'\n\nsetopt extended_glob glob_subst numeric_glob_sort\nsetopt warn_create_global warn_nested_var 2> /dev/null\ncd \"${${(%):-%x}:A:h}\"\n\n# TODO: Crazy Logic to munge TERM to something supported in Ubuntu 14.04\nterm=screen-256color\n\n# Note: If versions and frameworks looks complicated, it isn't that bad...\n# ...see Modifiers in zshexpn(1) for details.\n\n# List of ZSH versions\ntypeset -aU versions\nversions=( docker/base-*/Dockerfile(N.on:h:t:s/base-//) )\ntypeset -r versions\n\n# List of frameworks\ntypeset -aU frameworks\nframeworks=( docker/*/Dockerfile(N.on:h:t) )\nfor i in {$#frameworks..1}; do\n  # Remove all base entries\n  [[ \"${frameworks[$i]}\" == base-* ]] && frameworks[$i]=()\ndone\ntypeset -r frameworks\n\n# Known Issues\ntypeset -A known_issues\nknown_issues[\"4.3.11-antigen\"]=\"Antigen commands that need git won't work; it needs a newer version of git.\"\nknown_issues[\"4.3.11-zim\"]=\"BROKEN: Zim wants ZSH 5.2 or newer.\"\nknown_issues[\"5.0.3-zim\"]=\"DEPRECATED: Zim wants ZSH 5.2 or newer.\"\nknown_issues[\"5.1.1-zim\"]=\"DEPRECATED: Zim wants ZSH 5.2 or newer.\"\nknown_issues[\"4.3.11-zulu\"]=\"Zulu doesn't work; it needs a newer version of git.\"\ntypeset -r known_issues\n\nerr()\n{\n  print -P \"%F{red}Error:%f $*\"\n  exit 2\n}\n\nresolve_framework() {\n  local f=$1 found\n  found=${frameworks[(In:-1:)$f*]}\n  if (( found <= $#frameworks )); then\n    echo \"${frameworks[$found]}\"\n  fi\n}\n\nresolve_version() {\n  local v=$1 found\n  found=${versions[(In:-1:)$v*]}\n  if (( found <= $#versions )); then\n    echo \"${versions[$found]}\"\n  fi\n}\n\ncheck_for_known_issues() {\n  local version=\"$1\"\n  local framework=\"$2\"\n  local name=\"${version}-${framework}\"\n\n  if (( ${+known_issues[\"$name\"]} )); then\n    echo\n    print -P \"%F{red}Known Issue: %F{yellow}${known_issues[\"$name\"]}%f\"\n    echo\n  fi\n}\n\ncmd() {\n  if (( dry_run )); then\n    echo \"${(@q)*}\" 1>&2\n  else\n    \"${(@)*}\"\n  fi\n}\n\nbuild_and_run() {\n  local version=\"$1\"\n  local framework=\"$2\"\n  local name=\"${version}-${framework}\"\n\n  check_for_known_issues \"$version\" \"$framework\"\n\n  print -P \"%F{green}Preparing containers...%f\"\n\n  echo -n \"p9k:base-${version}: \"\n  cmd docker build \\\n    --quiet \\\n    --tag \"p9k:base-${version}\" \\\n    --file \"docker/base-${version}/Dockerfile\" \\\n    .\n\n  echo -n \"p9k:${version}-${framework}: \"\n  cmd docker build \\\n    --quiet \\\n    --build-arg=\"base=base-${version}\" \\\n    --tag \"p9k:${version}-${framework}\" \\\n    --file \"docker/${framework}/Dockerfile\" \\\n    .\n\n  print -P \"%F{green}Starting ${name} container...%f\"\n  cmd docker run \\\n    --rm \\\n    --interactive \\\n    --tty \\\n    --hostname=\"${name//./_}\" \\\n    --env=\"TERM=${term}\" \\\n    \"p9k:${version}-${framework}\"\n}\n\nshow_help() {\n  local f v\n  echo \"Usage: ${(%):-%x} <framework>|--list\"\n  echo\n  echo \"Loads up a docker image with powershell9k configured in <framework>\"\n  echo\n  echo \"  -f --frameworks  Lists all available frameworks, newline separated.\"\n  echo \"  -v --versions    Lists all available ZSH versions, newline separated.\"\n  echo \"  -z --zsh VER     Uses ZSH with version VER.\"\n  echo \"  -n --dry-run     Just prints the docker commands that would be run.\"\n  echo \"  --help        You're soaking in it.\"\n  echo\n  echo \"ZSH versions:\"\n  for v in \"${(@)versions}\"; do\n    echo \"  $v\"\n  done\n  echo\n  echo \"Framework containers:\"\n  for f in \"${(@)frameworks}\"; do\n    echo \"  $f\"\n  done\n}\n\n# No arguments\nif (( $# == 0 )); then\n  show_help\n  exit\nfi\n\n# Parse flags and such.\nasked_for_version=$default_version\nasked_for_framework=\ndry_run=0\nwhile (( $# > 0 )); do\n  case \"$1\" in\n    -f | --frameworks )\n      print -l \"${(@)frameworks}\"\n      exit\n      ;;\n    -v | --versions )\n      print -l \"${(@)versions}\"\n      exit\n      ;;\n    -z | --zsh )\n      shift\n      asked_for_version=$1\n      ;;\n    -n | --dry-run ) dry_run=1 ;;\n    -h | --help )\n      show_help\n      exit\n      ;;;\n    -* )\n      err \"Unknown option ${1}\"\n      show_help\n      exit 1\n      ;;\n    * )\n      if [[ -z \"$asked_for_framework\" ]]; then\n        asked_for_framework=$1\n      else\n        err \"You can only specify one framework at a time; you already specified '${asked_for_framework}'\"\n      fi\n      ;;\n  esac\n  shift\ndone\n\ntypeset -r asked_for_version asked_for_framework\n\ntypeset -r use_version=\"$(resolve_version \"${asked_for_version}\")\"\nif [[ -z \"$use_version\" ]]; then\n  err \"No such ZSH version '${asked_for_version}'\"\nfi\n\ntypeset -r use_framework=\"$(resolve_framework \"${asked_for_framework}\")\"\nif [[ -z \"$use_framework\" ]]; then\n  err \"No such framework '${asked_for_framework}'\"\nfi\n\nbuild_and_run \"$use_version\" \"$use_framework\"\n\n# EOF\n"
  },
  {
    "path": "test-vm/README.md",
    "content": "# Test-VM for powerlevel9k\n\nIn this virtual machine you will find a recent ubuntu with preinstalled ZSH, oh-my-zsh, antigen, prezto and - of course - powerlevel9k. The main use-case is to test the powerlevel9k theme.\n\n## Installation\n\nIn order to run this virtual machine, you need [vagrant](https://www.vagrantup.com/) and [VirtualBox](http://www.virtualbox.org/).\n\n## Running\n\n`vagrant` is a quite easy to use command line tool to configure a virtual machine. To fire the machine up, just run `vagrant up`. At the first run, it will install a whole ubuntu. With `vagrant ssh` you can log in into the machine.\n\n## Testing\n\nOnce you have SSH'd into the machine, you'll see a plain ZSH. To test the other frameworks, you just have to switch to one of the following users:\n\n  * `vagrant-antigen`\n  * `vagrant-prezto`\n  * `vagrant-omz`\n\nTo switch use `sudo -i -H -u <USERNAME>`. `-i` stands for \"simulate initial login\", `-H` sets the \"$HOME\" variable to the directory of the user , `-u` for the username. \n\nAll users have `vagrant` as password and are in the /etc/sudoers.\n\nThe regular `vagrant` user has a plain ZSH with the powerlevel9k theme.\n"
  },
  {
    "path": "test-vm/Vagrantfile",
    "content": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\n# All Vagrant configuration is done below. The \"2\" in Vagrant.configure\n# configures the configuration version (we support older styles for\n# backwards compatibility). Please don't change it unless you know what\n# you're doing.\nVagrant.configure(2) do |config|\n  # The most common configuration options are documented and commented below.\n  # For a complete reference, please see the online documentation at\n  # https://docs.vagrantup.com.\n\n  # Every Vagrant development environment requires a box. You can search for\n  # boxes at https://atlas.hashicorp.com/search.\n  config.vm.box = \"ubuntu/precise64\"\n\n  # Bootstrap\n  config.vm.provision :shell, path: \"bootstrap.sh\", privileged: false\n  config.vm.provision :shell, path: \"../test-vm-providers/plain.sh\", privileged: false\n  config.vm.provision :shell, path: \"antigen.sh\"\n  config.vm.provision :shell, path: \"prezto.sh\"\n  config.vm.provision :shell, path: \"omz.sh\"\n\n  # Disable automatic box update checking. If you disable this, then\n  # boxes will only be checked for updates when the user runs\n  # `vagrant box outdated`. This is not recommended.\n  # config.vm.box_check_update = false\n\n  # Create a forwarded port mapping which allows access to a specific port\n  # within the machine from a port on the host machine. In the example below,\n  # accessing \"localhost:8080\" will access port 80 on the guest machine.\n  # config.vm.network \"forwarded_port\", guest: 80, host: 8080\n\n  # Create a private network, which allows host-only access to the machine\n  # using a specific IP.\n  # config.vm.network \"private_network\", ip: \"192.168.33.10\"\n\n  # Create a public network, which generally matched to bridged network.\n  # Bridged networks make the machine appear as another physical device on\n  # your network.\n  # config.vm.network \"public_network\"\n\n  # Share an additional folder to the guest VM. The first argument is\n  # the path on the host to the actual folder. The second argument is\n  # the path on the guest to mount the folder. And the optional third\n  # argument is a set of non-required options.\n  config.vm.synced_folder \"..\", \"/vagrant_data\"\n\n  # Provider-specific configuration so you can fine-tune various\n  # backing providers for Vagrant. These expose provider-specific options.\n  # Example for VirtualBox:\n  \n  config.vm.provider \"virtualbox\" do |vb|\n\n     # Change name to \"powerlevel9k\"\n     vb.name = \"powerlevel9k\"\n\n     # Display the VirtualBox GUI when booting the machine\n     #vb.gui = true\n  \n     # Customize the amount of memory on the VM:\n     vb.memory = \"256\"\n  end\n  #\n  # View the documentation for the provider you are using for more\n  # information on available options.\n\n  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies\n  # such as FTP and Heroku are also available. See the documentation at\n  # https://docs.vagrantup.com/v2/push/atlas.html for more information.\n  # config.push.define \"atlas\" do |push|\n  #   push.app = \"YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME\"\n  # end\n\n  # Enable provisioning with a shell script. Additional provisioners such as\n  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the\n  # documentation for more information about their specific syntax and use.\n  # config.vm.provision \"shell\", inline: <<-SHELL\n  #   sudo apt-get update\n  #   sudo apt-get install -y apache2\n  # SHELL\nend\n"
  },
  {
    "path": "test-vm/antigen.sh",
    "content": "#!/usr/bin/zsh\n# We need to run this script in ZSH, so that switching user works!\nNEW_USER=vagrant-antigen\n# Create User\nPASSWORD='$6$OgLg9v2Z$Db38Jr9inZG7y8BzL8kqFK23fF5jZ7FU1oiIBLFjNYR9XVX03fwQayMgA6Rm1rzLbXaf.gkZaTWhB9pv5XLq11'\nuseradd -p $PASSWORD -g vagrant -s $(which zsh) -m $NEW_USER\necho \"$NEW_USER ALL=(ALL) NOPASSWD:ALL\" >> /etc/sudoers.d/$NEW_USER\nchmod 440 /etc/sudoers.d/$NEW_USER\n\n(\n        # Change User (See http://unix.stackexchange.com/questions/86778/why-cant-we-execute-a-list-of-commands-as-different-user-without-sudo)\n        USERNAME=$NEW_USER\n        #UID=$(id -u $NEW_USER)\n        #EUID=$(id -u $NEW_USER)\n        HOME=/home/$NEW_USER\n\n        echo \"\nsource ~/antigen/antigen.zsh\\n\nantigen theme /vagrant_data powerlevel9k --no-local-clone\\n\nantigen apply\n\" > ~/.zshrc\n\n        # install antigen\n        mkdir ~/antigen\n        curl -qL https://raw.githubusercontent.com/zsh-users/antigen/master/antigen.zsh > ~/antigen/antigen.zsh\n        source ~/antigen/antigen.zsh\n\n        # setup environment\n        /vagrant_data/test-vm-providers/setup-environment.sh\n)\n"
  },
  {
    "path": "test-vm/bootstrap.sh",
    "content": "#!/bin/sh\n\n#sudo apt-get update\n\nsudo apt-get install -y curl\nsudo apt-get install -y git\n\nsudo apt-get install -y zsh\nsudo chsh -s $(which zsh) vagrant\n\n# Install mercurial\nsudo apt-get install -y mercurial\n# Install Subversion\nsudo apt-get install -y subversion\n# install golang\necho 'golang-go golang-go/dashboard boolean false' | sudo debconf-set-selections\nsudo apt-get install -y golang\n# Install dependencies for tests\nsudo apt-get install -y jq node ruby python python-virtualenv"
  },
  {
    "path": "test-vm/omz.sh",
    "content": "#!/usr/bin/zsh\n# We need to run this script in ZSH, so that switching user works!\nNEW_USER=vagrant-omz\n# Create User\nPASSWORD='$6$OgLg9v2Z$Db38Jr9inZG7y8BzL8kqFK23fF5jZ7FU1oiIBLFjNYR9XVX03fwQayMgA6Rm1rzLbXaf.gkZaTWhB9pv5XLq11'\nuseradd -p $PASSWORD -g vagrant -s $(which zsh) -m $NEW_USER\necho \"$NEW_USER ALL=(ALL) NOPASSWD:ALL\" >> /etc/sudoers.d/$NEW_USER\nchmod 440 /etc/sudoers.d/$NEW_USER\n\n(\n        # Change User (See http://unix.stackexchange.com/questions/86778/why-cant-we-execute-a-list-of-commands-as-different-user-without-sudo)\n        USERNAME=$NEW_USER\n        #UID=$(id -u $NEW_USER)\n        #EUID=$(id -u $NEW_USER)\n        HOME=/home/$NEW_USER\n\tSHELL=$(which zsh)\n\n        sh -c \"$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)\"\n\n        mkdir -p ~/.oh-my-zsh/custom/themes\n        ln -s /vagrant_data ~/.oh-my-zsh/custom/themes/powerlevel9k\n\n        echo '\nexport ZSH=$HOME/.oh-my-zsh\nZSH_THEME=\"powerlevel9k/powerlevel9k\"\nplugins=(git rake ruby)\n\nsource $ZSH/oh-my-zsh.sh\n' > $HOME/.zshrc\n\n        # setup environment\n        /vagrant_data/test-vm-providers/setup-environment.sh\n)\n"
  },
  {
    "path": "test-vm/prezto.sh",
    "content": "#!/usr/bin/zsh\n# We need to run this script in ZSH, so that switching user works!\nNEW_USER=vagrant-prezto\n# Create User\nPASSWORD='$6$OgLg9v2Z$Db38Jr9inZG7y8BzL8kqFK23fF5jZ7FU1oiIBLFjNYR9XVX03fwQayMgA6Rm1rzLbXaf.gkZaTWhB9pv5XLq11'\nuseradd -p $PASSWORD -g vagrant -s $(which zsh) -m $NEW_USER\necho \"$NEW_USER ALL=(ALL) NOPASSWD:ALL\" >> /etc/sudoers.d/$NEW_USER\nchmod 440 /etc/sudoers.d/$NEW_USER\n\n(\n        # Change User (See http://unix.stackexchange.com/questions/86778/why-cant-we-execute-a-list-of-commands-as-different-user-without-sudo)\n        USERNAME=$NEW_USER\n        #UID=$(id -u $NEW_USER)\n        #EUID=$(id -u $NEW_USER)\n        HOME=/home/$NEW_USER\n\n        git clone --recursive https://github.com/sorin-ionescu/prezto.git \"${ZDOTDIR:-$HOME}/.zprezto\"\n\n        setopt EXTENDED_GLOB\n        for rcfile in \"${ZDOTDIR:-$HOME}\"/.zprezto/runcoms/^README.md(.N); do\n                ln -s \"$rcfile\" \"${ZDOTDIR:-$HOME}/.${rcfile:t}\"\n        done\n\n        ln -s /vagrant_data/powerlevel9k.zsh-theme ~/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup\n        sed -i \"s/theme\\ 'sorin'/theme\\ 'powerlevel9k'/g\" ~/.zpreztorc\n\n        # setup environment\n        /vagrant_data/test-vm-providers/setup-environment.sh\n)\n"
  },
  {
    "path": "test-vm-providers/plain.sh",
    "content": "#!/usr/bin/zsh\n\necho 'LANG=en_US.UTF-8' >! ~/.zshrc\necho 'source /vagrant_data/powerlevel9k.zsh-theme' >> ~/.zshrc\n\necho 'echo \"Have a look at the ~/p9k folder for prepared test setups.\"' >> ~/.zshrc\n\n# setup environment\n/vagrant_data/test-vm-providers/setup-environment.sh"
  },
  {
    "path": "test-vm-providers/setup-environment.sh",
    "content": "#!/usr/bin/zsh\n\nOLDPWD=\"$(pwd)\"\ncd $HOME\n\nTESTFOLDER=\"${HOME}/p9k\"\nmkdir -p $TESTFOLDER\ncd $TESTFOLDER\n\n# Make a deep test folder\nmkdir -p deep-folder/1/12/123/1234/12345/123456/1234567/123455678/123456789\n\n# Make a git repo\nmkdir git-repo\ncd git-repo\ngit config --global user.email \"test@powerlevel9k.theme\"\ngit config --global user.name  \"Testing Tester\"\ngit init\necho \"TEST\" >> testfile\ngit add testfile\ngit commit -m \"Initial commit\"\ncd $TESTFOLDER\n\n# Make a Mercurial repo\nmkdir hg-repo\ncd hg-repo\nexport HGUSER=\"Test bot <bot@example.com>\"\nhg init\necho \"TEST\" >> testfile\nhg add testfile\nhg ci -m \"Initial commit\"\ncd $TESTFOLDER\n\n# Setup a SVN folder\nsvnadmin create ~/.svn-repo\nmkdir svn-repo\nsvn checkout \"file://${HOME}/.svn-repo\" \"svn-repo\"\ncd svn-repo\necho \"TEST\" >> testfile\nsvn add testfile\nsvn commit -m \"Initial commit\"\ncd $TESTFOLDER\n\ncd $OLDPWD"
  }
]