[
  {
    "path": ".gitignore",
    "content": "# Running tests creates this completion dump file.\n.zcompdump*\n\n# Test failure reports\ntests/*.t.err\n\n# If the $ADOTDIR is the same as the antigen's clone directory itself, the\n# following would be shown as untracked.\nrepos/\nbundles/\nrevert-info\n\n# Cache directory for ext/zcache\n.cache/\n\n# Default antigen.log location\n*.log\n\n# Release archives and signatures\n*.tar.gz\n*.tar.gz.sign\n\n# Ignore compiled zsh files\n*.zwc\n\n# Ignore timestamp file for zcache auto-reset config\n*.timestamp\n\n# Cache init\n/init.zsh\n.antigenrc\n.zshrc\n.zcomp*\n\n# Config files\n.resources\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: required\ndist: trusty\nlanguage: generic\nservices:\n  - docker\ncache:\n  pip: true\nenv:\n  global:\n    - USE_CONTAINER=docker\nmatrix:\n  include:\n    - os: linux\n      env: ZSH_VERSION=zsh-5.7\n    - os: linux\n      env: ZSH_VERSION=zsh-5.6\n    - os: linux\n      env: ZSH_VERSION=zsh-5.5\n    - os: linux\n      env: ZSH_VERSION=zsh-5.4.2\n    - os: linux\n      env: ZSH_VERSION=zsh-5.4.1\n    - os: linux\n      env: ZSH_VERSION=zsh-5.4\n    - os: linux\n      env: ZSH_VERSION=zsh-5.3.1\n    - os: linux\n      env: ZSH_VERSION=zsh-5.3\n    - os: linux\n      env: ZSH_VERSION=zsh-5.2\n    - os: linux\n      env: ZSH_VERSION=zsh-5.1.1\n    - os: linux\n      env: ZSH_VERSION=zsh-5.0.0\n    - os: linux\n      env: ZSH_VERSION=zsh-4.3.17\n    - os: linux\n      env: ZSH_VERSION=zsh-4.3.11\nnotifications:\n  webhooks:\n    urls:\n      - \"https://webhooks.gitter.im/e/30fdb3abe241aa03af20\"\n    on_success: always\n    on_failure: always\n    on_start: always\nscript:\n  - if [ $TRAVIS_OS_NAME == 'osx' ]; then brew install zsh; pip install cram; fi\n  - make info tests stats USE_CONTAINER=$USE_CONTAINER\n\n  # Ensure the checked-in build matches the build produced in CI. Since the CI\n  # will run this on both OS X and Linux, the two platforms must also produce\n  # the same build, else one of them will fail.\n  - SHASUM=$(shasum -a 256 ./bin/antigen.zsh)\n  - VERSION=$(cat ./VERSION) make USE_CONTAINER=$USE_CONTAINER\n  - SHACHECK=$(shasum -a 256 ./bin/antigen.zsh)\n\n  - echo -e \"$SHASUM\\n$SHACHECK\"\n  - test \"$SHASUM\" == \"$SHACHECK\"\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# CHANGELOG\n\nAll notable changes to this project will be documented in this file.\nThis project adheres to [Semantic Versioning](http://semver.org/) [v2.0.0](http://semver.org/spec/v2.0.0.html).\n\n## [2.2.3] - 2017-12-31\n\n## Added\n- [#630] Add zsh version 5.4.x to travis ci\n- [#633, #634] Add configuration `ANTIGEN_COMPINIT_OPTS` for `compinit` command\n\n## Changed\n- [#636] Show built-date to version command\n\n## Fixed\n- [#635] Fix missing common resource file\n- [#628, #629] Handle `GREP_OPTIONS` env variable\n\n\n## [2.2.2] - 2017-11-19\n\n## Added\n- [#605] Create `CODE_OF_CONDUCT.md`\n\n## Changed\n- [#611] Remove \"no extensions loaded\" message\n- [#610, #596, #608] Fix cache generation with `cache-gen` command\n- [#609, #593] Add autoload for is-at-least\n- [#615] Oh-my-zsh themes backward compatibility\n\n## Fixed\n- [#590, #588, #587, #606] Fix multiple issues with caching generation\n- [#613] Defer cache loading to `antigen-apply` command\n- [#618, #617] Unalias built-in `cd`\n\n\n## [2.2.1] - 2017-06-24\n\nWe're adding a new environment variable:\n\n  - `ANTIGEN_MUTEX` - Use to configure whether to check for mutex or ignore it.\n\nThis configuration effectively controls if the `lock` should work. Alternatively you\nmay configure which extension you want to load:\n\n    _ANTIGEN_BUILTIN_EXTENSIONS='lock parallel defer cache'\n\nJust remove `lock` from the `_ANTIGEN_BUILTIN_EXTENSIONS` environment variable. Take\ninto account that this may change in the future.\n\n## Added\n- [#561, #563] Add flag to disable mutex check\n\n## Changed\n- [#559, #562] Update wiki with all installation options (Debian package, OpenSUSE, Homebrew, etc)\n- [#564] Improve README.md installation section and content\n\n## Fixed\n- [#569, #565] Avoid compiled theme artifact showing up on completion\n- [#558] Fix Makefile's glob used to build logging library if required\n- [#555, #557, #556] Fix issue with `ps` command's output being discarded (breaking parallel extension)\n- [#571, #568] Fix issues with `typeset` on zsh 5.0.x and below\n\nThanks everyone who reported issues and provided feedback.\n\n## [2.2.0] - 2017-06-18\n\nWe're deploying an extension system to further extend Antigen's functionality.\nCore functionality such as parallel install and cache are built upon this system,\nsee `src/ext`.\n\nExtensions must adhere to a basic interface:\n\n    - `-antigen-{extension-name}-init`\n    - `-antigen-{extension-name}-execute`\n\nBoth these functions must return 0 or 1 to abort initialization. Example:\n\n    antigen ext custom\n    # -antigen-custom-init\n    # -antigne-custom-execute\n\nInternally an extension must use Antigen's hook system to retrieve arguments and run custom\nfunctionality:\n\n    - `antigen-add-hook`: antigen-add-hook [antigen-function] [hook-function] [\"replace\"|\"pre\"|\"post\"] [\"once\"|\"repeat\"]\n    - `antigen-remove-hook`: antigen-remove-hook [hook-function]\n\n### Added\n- [#529, #506] Parallel bundle install\n- [#542] Reset default library url with antigen-use\n\n### Changed\n- [#547, #552] `antigen-theme` command won't switch between themes\n\n### Fixed\n- [#550, #548] Fix parallel extension running multiple clone instances\n- [#549, #463] Fix compdump missing completions\n- [#553] Catch spurious error message by `ps`\n\nThanks everyone who reported issues and provided feedback.\n\n## [2.1.1] - 2017-05-20\n\n### Changed\n- [#537] Clean up README.mkd\n- [#534] Add new article on zsh and antigen\n\n### Fixed\n- [#540] Don't require confirmation when removing lock\n- [#535, #536] Avoid duplicate paths\n\nThanks everyone who reported issues and provided feedback.\n\n## [2.1.0] - 2017-05-14\n\n### Fixed\n- [#525] Use `GIT_TERMINAL_PROMPT=0` to avoid password prompt on clone\n- [#511] Clean up globally defined variables\n\n### Added\n- [#527] Internal extension system\n- [#526] Use mutex to prevent concurrent installations\n- [#501] Autodetect config files\n\n### Changed\n- [#513] Defer bundle loading to `antigen-apply` command\n- [#512] Show warning message when bundle is already \n- [#520] Remove runtime hack to load themes\n\nThanks everyone who reported issues and provided feedback.\n\n## [2.0.2] - 2017-04-22\n\n### Changed\n- [#521, #515] Update TravisCI Badges' labels\n- [#509] Use \"Roadmap\" for Trello where possible\n\n### Added\n- [#514] FAQ for dynamic `antigen-theme` usage\n\n### Fixed\n- [#510] Remove possibly destructive command on broken tests\n- [#508, #507] Fix status code non-zero when last command is `antigen` wrapper\n\nThanks everyone who reported issues and provided feedback.\n\n## [2.0.1] - 2017-04-15\n\n### Changed\n- [#489] Update `CHANGELOG` link to semver documentation\n- [#497, #498] Improve `antigen-list` command performance\n\n### Fixed\n- [#487] Fix documentation regarding `ANTIGEN_CHECK_FILES`\n- [#486, #485] Missing env vars for Oh-My-Zsh \n- [#492, #490] Fix parsing git/ssh URLS\n- [#495, #494] Fix `antigen-theme` command changing CWD\n- [#493, #491] Fix `no-local-clone` flag being ignored\n\nThanks everyone who reported issues and provided feedback.\n\n## [2.0.0] - 2017-04-08\n\nThere are functions and configurations being either removed or renamed, please\nreview this document before updating your Antigen installation.\n\nRemoved functions:\n\n  - `-antigen-lib`        - Deprecated since v1\n  - `-antigen-prezto-lib` - Deprecated since v1\n\nDeprecated configuration:\n\n  - `_ANTIGEN_FORCE_RESET_COMPDUMP`\n  - `_ANTIGEN_RESET_THEME_HOOKS`\n  - `_ANTIGEN_AUTODETECT_CONFIG_CHANGES`\n  - `_ANTIGEN_CACHE_ENABLED`\n  - `_ANTIGEN_COMP_ENABLED`\n\nRenamed configuration:\n\n  - `_ANTIGEN_LOG_PATH`     ~> `ANTIGEN_LOG`\n  - `_ANTIGEN_CACHE_PATH`   ~> `ANTIGEN_CACHE`\n  - `_ANTIGEN_COMPDUMPFILE` ~> `ANTIGEN_COMPDUMP`\n\nAdded configurations:\n\n  - `ANTIGEN_CHECK_FILES`     - Use to configure which files to check for changes\n  - `ANTIGEN_SUBMODULE_OPTS`  - Use to pass arguments to `git submodule` command\n  - `ANTIGEN_CLONE_OPTS`      - Use to pass arguments to `git clone` command\n  - `ANTIGEN_BUNDLES`         - Use to configure bundle path location\n  - `ANTIGEN_PREZTO_REPO_URL` - Use to configure Prezto default url\n\n### Removed\n- [#197, #298] Removed `-antigen-lib`, `-antigen-prezto-lib`\n\n### Added\n- [#309] Use `git` shallow cloning to speed up bundle install\n- [#299, #261] Handles `$PATH`\n- [#415] Added link to multiple OS install methods\n- [#423, #262] Support semver-like bundling\n- [#461] Use Docker container for tests and stats generation\n- [#462, #466] Add extended help text for `antigen-help` command\n- [#467, #465] Show version hash on `antgen-version` command\n- [#469] Function to migrate old bundle paths to new format\n- [#464] Update wiki pages for new version\n\n### Changed\n- [#326, #259] Support updating a single bundle\n- [#352] Support `antigen-update` tab completion\n- [#351, #379] Update `Makefile` release tasks\n- [#411, #371, #445] `antigen-list` show version information (tag, branch, git hash)\n- [#420] Support reference cache (vs bundle cache)\n- [#450] Refactor `_ANTIGEN_BUNDLE_RECORD`\n- [#454] Simplify change detection\n- [#457, #460] Change bundle path generation function\n\n### Fixed\n- [#353] `antigen-update` properly handles `--no-local-clone`\n- [#419] Don't require confirmation when cleaning up\n- [#439, #442, #438] Fix `antigen-selfupdate` failing with sym-links\n- [#441, #440] `antigen-init` command checks input\n- [#453, #452] Respect `_ANTIGEN_COMPDUMP` configuration\n\nThanks everyone who reported issues and provided feedback.\n\n## [1.4.1] - 2017-02-26\n\n### Changed\n- [#402, #409] `antigen-use` command handle library url\n- [#404, #408] Update README.md with new antigen-related articles\n\n### Fixed\n- [#403, #407] Disable OS X builds on TravisCI\n\nThanks everyone who reported issues and provided feedback.\n\n## [1.4.0] - 2017-02-11\n\n### Changed\n- [#386, #387] Use reference cache rather than source bundle\n\n### Fixed\n- [#400, #391] Cache library handle environment variables for default libraries\n\nThanks @lukechilds, @shoeffner and everyone who reported issues and provided feedback.\n\n## [1.3.5] - 2017-02-03\n\n### Changed\n- [#393, #392] Add hint in readme to alternative install methods \n\n### Fixed\n- [#398, #396] Add argument completion for `antigen-list` command \n- [#394, #395] Fix syntax issue on zsh 4.3.11 \n\nThanks @TBird2001, @einSelbst and everyone who reported issues and provided feedback.\n\n## [1.3.4] - 2017-01-16\n\n### Changed\n- [#389, #385] `antigen-theme` command load themes from path \n\n### Fixed\n- [#384] Fix updating version references \n\nThanks to everyone who reported issues and provided feedback.\n\n## [1.3.3] - 2017-01-07\n\n### Changed\n- [#379, #382] Update makefile release tasks\n- [#378] Add entry in wiki regarding COMPDUMP location configuration\n- [#376] Update README.md with external articles\n- [#375, #374] Add LICENSE file to repository\n\nThanks to everyone who reported issues and provided feedback.\n\n## [1.3.2] - 2016-12-29\n\n### Fixed\n- [#367, #368] Fix interactively changing between themes\n\n### Changed\n- [#369] Enforce coding style\n- [#370, #372] Update README.md with new external articles\n\nThanks to everyone who reported issues and provided feedback.\n\n## [1.3.1] - 2016-12-17\n\n### Fixed\n- [#360, #361] Avoid error when CLOBBER is unset\n- [#355, #356] Bundle short name breaks on OSX (BSD sed)\n\n### Changed\n- [#363] Added zsh 5.3 to the build pipeline\n- [#365, #357] Configure Travis-Ci to build against OS X (10.11, xcode 7.3)\n- [#350] Add makefile task to create signed releases\n- [#364, #362] Add note about variable handling inside `antigen-bundles` heredoc\n\nThanks @rltbennett, @rherrick and everyone who reported issues and provided feedback.\n\n## [1.3.0] - 2016-12-10\n\n### Fixed\n- [#340, #347] Fix bundle short name broken with branched bundles\n- [#341] Improve TravisCI performance\n\n### Changed\n- [#343, #344] Add `--short` option for `antigen-list` command\n\n### Added\n- [#301, #348] Sign git commits & releases (tags)\n- [#337, #345] Theme command tab completion\n- [#335, #342] Purge command for removing bundles from file system\n\nThanks @rugk and everyone who reported issues and provided feedback.\n\n## [1.2.4] - 2016-12-03\n\n### Fixed\n- [#321, #322] Fix `antigen-init` command unable to detect bundles\n- [#328, #331] Display error message if `antigen-theme` fails to load theme\n\n### Changed\n- [#327, #330] Moved `-antigen-echo-record` to `helpers` directory\n\n### Added\n- [#323, #329] Add `antigen-init` command entry in `README.md`\n\nThanks @orf, @VincentBel, @wsargent and everyone who reported issues and\nprovided feedback.\n\n## [1.2.3] - 2016-11-21\n\n### Fixed\n- [#318, #317] Fixed issue with sed regexp format between BSD and GNU\n\nThanks @john-kurkowski and everyone who reported issues and\nprovided feedback.\n\n## [1.2.2] - 2016-11-18\n\n### Changed\n- [#315, #308] Bundle command returns error if repository is not found \n- [#313, #314] Enhanced cache process-source function \n\n### Fixed\n- [#310, #307] Disabling cache-related commands if cache is disabled\n- [#311, #304] Handle bundle's default branch different than master\n\nThanks @DestyNova, @yacoob, @qstrahl and everyone who reported issues and\nprovided feedback.\n\n## [1.2.1] - 2016-10-15\n\nAntigen now resets compdump file on `antigen-apply` or with cache resetting (be\nit with `antigen-reset` or auto-detecting changes in bundling configuration).\nThis is necessary to handle completions correctly.\nActivate this functionality with `_ANTIGEN_FORCE_RESET_COMPDUMP`, defaults to `true`.\n\nAntigen previously didn't created `$ADOTDIR` explicitly, now it does so on start up.\nThis directory defaults to `$HOME/.antigen` and it's used to store logs, repositories\nand cache files.\n    \nTheme switching, with `antigen-theme` command, now removes hooks applied by themes.\nThis is done in order to be able to interactively switch between themes without\nissues, such as prompt broken by hooks left by previous themes.\nThis functionality is actived by default and can be disabled with `_ANTIGEN_RESET_THEME_HOOKS`.\n\nNew environment variables:\n    - `_ANTIGEN_FORCE_RESET_COMPDUMP`: Whether to force compdump to be reset with\n    `antigen-apply` or cache reset.\n\n    - `_ANTIGEN_RESET_THEME_HOOKS`: Whether to remove theme hooks on `antigen-theme`\n    command.\n\n### Added\n- [#289, #286] Check $ADOTDIR exists on start up\n\n### Changed\n- [#291, #281] Reset compdump on apply and cache reset\n- [#282] Fixed a simple typo in a code comment regarding git availability\n\n### Fixed\n- [#290, #283] Remove theme hooks when changing themes\n- [#288, #285] Fix keybindings hook disabled in zcache-done\n- [#284] Fix `local`s in themes\n\nThanks @jordi9, @edqu3, @jmusal, @ming13, @kmikolaj and everyone who reported\nissues and provided feedback.\n\n## [1.2.0] - 2016-10-09\n\nAntigen now auto-detects configuration changes. This is done by detecting\nnew/removed bundles/ordering changes in configuration (bundles, themes, use etc).\nWhen a change is detected next time Antigen is loaded it'll rebuild cache.\n\n`cache-reset` command is now deprecated and should be used `reset` instead.\n\n`-antigen-parse-args` function was removed in favor of a more flexible, lax\nand performant implementation.\n\nThe following errors are not present anymore:\n  - Positional argument count mismatch\n  - Argument repeated\n  - No argument required\n\nPositional argument count mismatch: There is no `spec` argument from now on so there is\nno definition on arguments.\n\nArgument repeated: All arguments are parsed and returned. Last value is used.\n\nNo argument required: The case is `--no-local-clone` and the value passed is ignored.\n\n\nNew environment variables:\n  - `_ANTIGEN_AUTODETECT_CONFIG_CHANGES`: Whether to check for configuration\n  changes (true by default).\n\n### Changed\n- [#257, #271] Remove parse-args function\n- [#255, #265, #275, #253] Refactor/clean up code\n- [#274, #267] Hook antigen-bundles command\n- [#266, #258] Deprecate cache-reset command in favor of reset\n- [#256, #264] Auto detect changes in bundling\n- [#277] Fix for antigen 1.1.4\n\n### Fixed\n- [#273] Missing antigen-apply on zcache-done\n- [#272] Fix bundle-short-name function to handle gist urls\n\nThanks everyone who reported issues and provided feedback.\n\n## [1.1.4] - 2016-09-25\n\nDefault cache and bundles path is now `$ADOTDIR/.cache` and `$ADOTDIR/repos`\n(it was `$_ANTIGEN_INSTALL_DIR/.cache` and `$_ANTIGEN_INSTALL_DIR/repos`).\n\nNew environment variables:\n\n  - `_ANTIGEN_INTERACTIVE_MODE`: Use to force Antigen into running the caching\n  mechanism even in interactive mode (by default it deactivate caching in\n  interactive shells).\n\n### Changed\n- [#248] Enhanced caching performance\n- [#245, #244] Changed default caching and logging paths\n \n### Fixed\n- [#249, #240, #246] Makefile BSD compatibility\n- [#247, #228] Fix apply and antigen-apply command\n- [#251] Fix Makefile publish task\n\nThanks @fladi, @jdkbx, @extink and everyone who reported\nissues and provided feedback.\n\n## [1.1.3] - 2016-09-20\n\n### Changed\n- [#236] Add Makefile release and publish tasks\n \n### Fixed\n- [#239] Issue with BSD sed (MacOS, FreeBSD) \n\nThanks @pawelad, @laurenbenichou, @zawadzkip and everyone who reported\nissues and provided feedback.\n\n## [1.1.2] - 2016-09-16\n\n### Changed\n- [#234] Cache process-source function now handles function-context\n- [#233] Antigen selfupdate command now clears cache automatically\n \n### Fixed\n- [#219] Issue with zsh-navigation-tools plugin and powerlevel9k theme\n- [#230] Issue with stalled cache\n\nThanks @xasx, @ilkka, @NelsonBrandao and everyone who reported\nissues and provided feedback.\n\n## [1.1.1] - 2016-09-13\n\n### Changed\n- [#223] Update tests cases\n \n### Fixed\n- [#220] Fpath was not updated correctly\n- [#221, #217] Fix various typos in CHANGELOG.md\n- [#224] Update README.md\n\nThanks @xasx, @azu and @mikeys\n\n## [1.1.0] - 2016-09-10 \n\nNew environment variables:\n    \n  - `_ANTIGEN_LOG_PATH`: Antigen path for logging (mostly git commands).\n\n  - `_ANTIGEN_COMP_ENABLED`: Flag to enable/disable Antigen own completions\n  `compinit`, which adds `~0.02s` to load time.\n\n  - `_ANTIGEN_CACHE_ENABLED`: Flag to enable/disable cache system.\n\nNew commands:\n\n- `init`: Use this command to load antigen configuration. Example set up:\n    \n    .zshrc:\n        \n        source antigen.zsh\n        antigen init .antigenrc\n        \n    .antigenrc:\n\n        antigen use oh-my-zsh\n        \n        antigen bundle ...\n        antigen theme ...\n        \n        antigen apply\n\n    \nThis setup further improves cache performance (`~0.02s`). It's fully optional.\n        \n- `cache-reset`: Clears current cache. Doesn't removes your bundles. This is done automatically after `antigen update` command.\n    \n- `version`: Show antigen running version.\n\n### Added\n- [#129] Cache system for better performance\n- [#191] Version command\n- [#211] Option to disable antigen's own completions compinit on start up \n\n### Changed\n- [#205] Bundle short syntax on install/update\n- [#156, #213] Improved continuos integration set up \n- [#195] Restructured project directory \n\n### Fixed\n- [#210] Prezto issue with environment variable\n- [#162] Fix issue with antigen update after revert\n\n## [1.0.4] - 2016-08-27\n\n### Added\n- [#188] Add CONTRIBUTING.md to documentation\n- [#183] Update README.md to use rawgit in examples\n- [#182] Add Gitter, Trello and Travis CI badges\n\n### Changed\n- [#171] Continuous integration against multiple Zsh versions\n\n### Fixed\n- [#170] Check git dependency on sourcing\n- [#169] Load Antigen's own completions at load time\n\n## [1.0.3] - 2016-08-20\n\n### Changed\n- [#172] Fix TravisCI configuration \n\n## [1.0.2] - 2016-08-11\n\n### Changed\n- [#168] Update README.md example code thanks to @chadmoore\n\n## [1.0.1] - 2016-07-21\n\n### Added\n- [#141] Performance improvements thanks to @outcoldman\n- Added CHANGELOG.md\n- Following [Semantic Versioning](http://semver.org/)\n\n[2.2.3]: https://github.com/zsh-users/antigen/compare/v2.2.2...v2.2.3\n[2.2.2]: https://github.com/zsh-users/antigen/compare/v2.2.1...v2.2.2\n[2.2.1]: https://github.com/zsh-users/antigen/compare/v2.2.0...v2.2.1\n[2.2.0]: https://github.com/zsh-users/antigen/compare/v2.1.1...v2.2.0\n[2.1.1]: https://github.com/zsh-users/antigen/compare/v2.1.0...v2.1.1\n[2.1.0]: https://github.com/zsh-users/antigen/compare/v2.0.2...v2.1.0\n[2.0.2]: https://github.com/zsh-users/antigen/compare/v2.0.1...v2.0.2\n[2.0.1]: https://github.com/zsh-users/antigen/compare/v2.0.0...v2.0.1\n[2.0.0]: https://github.com/zsh-users/antigen/compare/v1.4.1...v2.0.0\n[1.4.1]: https://github.com/zsh-users/antigen/compare/v1.4.0...v1.4.1\n[1.4.0]: https://github.com/zsh-users/antigen/compare/v1.3.5...v1.4.0\n[1.3.5]: https://github.com/zsh-users/antigen/compare/v1.3.4...v1.3.5\n[1.3.4]: https://github.com/zsh-users/antigen/compare/v1.3.3...v1.3.4\n[1.3.3]: https://github.com/zsh-users/antigen/compare/v1.3.2...v1.3.3\n[1.3.2]: https://github.com/zsh-users/antigen/compare/v1.3.1...v1.3.2\n[1.3.1]: https://github.com/zsh-users/antigen/compare/v1.3.0...v1.3.1\n[1.3.0]: https://github.com/zsh-users/antigen/compare/v1.2.4...v1.3.0\n[1.2.4]: https://github.com/zsh-users/antigen/compare/v1.2.3...v1.2.4\n[1.2.3]: https://github.com/zsh-users/antigen/compare/v1.2.2...v1.2.3\n[1.2.2]: https://github.com/zsh-users/antigen/compare/v1.2.1...v1.2.2\n[1.2.1]: https://github.com/zsh-users/antigen/compare/v1.2.0...v1.2.1\n[1.2.0]: https://github.com/zsh-users/antigen/compare/v1.1.4...v1.2.0\n[1.1.4]: https://github.com/zsh-users/antigen/compare/v1.1.3...v1.1.4\n[1.1.3]: https://github.com/zsh-users/antigen/compare/v1.1.2...v1.1.3\n[1.1.2]: https://github.com/zsh-users/antigen/compare/v1.1.1...v1.1.2\n[1.1.1]: https://github.com/zsh-users/antigen/compare/v1.1.0...v1.1.1\n[1.1.0]: https://github.com/zsh-users/antigen/compare/v1.0.4...v1.1.0\n[1.0.4]: https://github.com/zsh-users/antigen/compare/v1.0.3...v1.0.4\n[1.0.3]: https://github.com/zsh-users/antigen/compare/v1.0.2...v1.0.3\n[1.0.2]: https://github.com/zsh-users/antigen/compare/v1.0.1...v1.0.2\n[1.0.1]: https://github.com/zsh-users/antigen/compare/v1...v1.0.1\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Code of Conduct\n\n## 1. Purpose\n\nA primary goal of Antigen is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).\n\nThis code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.\n\nWe invite all those who participate in Antigen to help us create safe and positive experiences for everyone.\n\n## 2. Open Source Citizenship\n\nA supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community.\n\nCommunities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society.\n\nIf you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know.\n\n## 3. Expected Behavior\n\nThe following behaviors are expected and requested of all community members:\n\n*   Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community.\n*   Exercise consideration and respect in your speech and actions.\n*   Attempt collaboration before conflict.\n*   Refrain from demeaning, discriminatory, or harassing behavior and speech.\n*   Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.\n*   Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations.\n\n## 4. Unacceptable Behavior\n\nThe following behaviors are considered harassment and are unacceptable within our community:\n\n*   Violence, threats of violence or violent language directed against another person.\n*   Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language.\n*   Posting or displaying sexually explicit or violent material.\n*   Posting or threatening to post other people’s personally identifying information (\"doxing\").\n*   Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.\n*   Inappropriate photography or recording.\n*   Inappropriate physical contact. You should have someone’s consent before touching them.\n*   Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances.\n*   Deliberate intimidation, stalking or following (online or in person).\n*   Advocating for, or encouraging, any of the above behavior.\n*   Sustained disruption of community events, including talks and presentations.\n\n## 5. Consequences of Unacceptable Behavior\n\nUnacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated.\n\nAnyone asked to stop unacceptable behavior is expected to comply immediately.\n\nIf a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event).\n\n## 6. Reporting Guidelines\n\nIf you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. desyncr@riseup.net.\n\n\n\nAdditionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.\n\n## 7. Addressing Grievances\n\nIf you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Zsh Users with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.\n\n\n\n## 8. Scope\n\nWe expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues–online and in-person–as well as in all one-on-one communications pertaining to community business.\n\nThis code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members.\n\n## 9. Contact info\n\ndesyncr@riseup.net\n\n## 10. License and attribution\n\nThis Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).\n\nPortions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).\n\nRetrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/)\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to this project\n\nPlease take a moment to review this document in order to make the contribution\nprocess easy and effective for everyone involved.\n\nFollowing these guidelines helps to communicate that you respect the time of\nthe developers managing and developing this open source project. In return,\nthey should reciprocate that respect in addressing your issue or assessing\npatches and features.\n\n\n## Using the issue tracker\n\nThe [issue tracker](issues) is the preferred channel for [bug reports](#bug-reports),\n[features requests](#feature-requests) and [submitting pull requests](#pull-requests),\nbut please respect the following restrictions:\n\n* Please **do not** use the issue tracker for personal support requests (use\n  [Stack Overflow](http://stackoverflow.com/search?q=antigen) or [Gitter](https://gitter.im/antigen-zsh/develop)).\n\n* Please **do not** derail or troll issues. Keep the discussion on topic and\n  respect the opinions of others.\n\n## Bug reports\n\nA bug is a _demonstrable problem_ that is caused by the code in the repository.\nGood bug reports are extremely helpful - thank you!\n\nGuidelines for bug reports:\n\n1. **Use the GitHub issue search** &mdash; check if the issue has already been\n   reported.\n\n2. **Check if the issue has been fixed** &mdash; try to reproduce it using the\n   latest `master` or development branch in the repository.\n\n3. **Isolate the problem** &mdash; create a reduced test\n   case and a live example.\n\nA good bug report shouldn't leave others needing to chase you up for more\ninformation.\n\nPlease try to be as detailed as possible in your report. Be sure to include:\n\n- Antigen, Zsh and OS version\n- Antigen and Zsh configurations (usually `~/.zshrc` and `~/.antigenrc`)\n- What would you expect to be the outcome?\n- What are the steps to reproduce the issue\n\nAll these details will help people to fix any potential bugs.\n\nExample:\n\n> Short and descriptive example bug report title\n>\n> A summary of the issue and the Zsh version/OS environment in which it occurs.\n> If suitable, include the steps required to reproduce the bug.\n>\n> 1. This is the first step\n> 2. This is the second step\n> 3. Further steps, etc.\n>\n> `<url>` - a link to the zsh configuration\n>\n> Any other information you want to share that is relevant to the issue being\n> reported. This might include the lines of code that you have identified as\n> causing the bug, and potential solutions (and your opinions on their\n> merits).\n\n\n## Feature requests\n\nFeature requests are welcome. But take a moment to find out whether your idea\nfits with the scope and aims of the project. It's up to *you* to make a strong\ncase to convince the project's developers of the merits of this feature. Please\nprovide as much detail and context as possible.\n\n\n## Pull requests\n\nGood pull requests (patches, improvements, new features) are a fantastic\nhelp. They should remain focused in scope and avoid containing unrelated\ncommits.\n\n**Please ask first** before embarking on any significant pull request (e.g.\nimplementing features, refactoring code, porting to a different language),\notherwise you risk spending a lot of time working on something that the\nproject's developers might not want to merge into the project.\n\nPlease adhere to the coding conventions used throughout a project (indentation,\naccurate comments, etc.) and any other requirements (such as test coverage).\n\nFollow this process if you'd like your work considered for inclusion in the\nproject:\n\n1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,\n   and configure the remotes:\n\n   ```bash\n   # Clone your fork of the repo into the current directory\n   git clone https://github.com/<your-username>/<repo-name>\n   # Navigate to the newly cloned directory\n   cd <repo-name>\n   # Assign the original repo to a remote called \"upstream\"\n   git remote add upstream https://github.com/zsh-users/antigen\n   ```\n\n2. If you cloned a while ago, get the latest changes from upstream:\n\n   ```bash\n   git checkout <dev-branch>\n   git pull upstream <dev-branch>\n   ```\n\n3. Create a new topic branch (off the main project development branch `develop`) to\n   contain your feature, change, or fix:\n\n   ```bash\n   git checkout -b <topic-branch-name>\n   ```\n\n   > Please use `documentation/<descriptive-branch-name>`, `feature/<descriptive-branch-name>` or `bugfix/<descriptive-branch-name>` for branch names if you are enhancing documentation, adding a new feature or creating a bugfix.\n\n4. Commit your changes in logical chunks. Please adhere to these [git commit\n   message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)\n   or your code is unlikely be merged into the main project. Use Git's\n   [interactive rebase](https://help.github.com/articles/interactive-rebase)\n   feature to tidy up your commits before making them public.\n\n5. Locally merge (or rebase) the upstream development branch into your topic branch:\n\n   ```bash\n   git pull [--rebase] upstream <dev-branch>\n   ```\n\n6. Push your topic branch up to your fork:\n\n   ```bash\n   git push origin <topic-branch-name>\n   ```\n\n7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)\n    with a clear title and description.\n\n**IMPORTANT**: By submitting a patch, you agree to allow the project owner to\nlicense your work under the same license as that used by the project.\n"
  },
  {
    "path": "ISSUE_TEMPLATE.md",
    "content": "Description\n-----------\n\nSmall paragraph to describe the issue/bug.\n\n\nSteps to reproduce\n------------------\n\nMinimal steps to reproduce this behavior. Example:\n\n    1 - Open terminal\n    2 - cd<TAB>\n    3 - 'compinit not found...' is displayed\n\nExpected behavior:\n\n    - Tab completion of `cd` command.\n \n\n## Software version\n\n- `antigen version`\n- `zsh --version`\n- `uname -a`\n\n## Configuration\n\n- gist of `.antigenrc`\n- gist of `.zshrc`\n\n## More information\n\nScreenshot or any other information you may find relevant to troubleshoot the issue.\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright © Shrikant Sharat Kandula, http://sharats.me.\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": "Makefile",
    "content": "######################################################################\n# This file was autogenerated by 'configure'. Do not edit it directly!\n# Invocation was: ./configure \n######################################################################\nWITH_LOCK=yes\nWITH_DEFER=yes\nWITH_CACHE=yes\nWITH_DEBUG=yes\nWITH_PARALLEL=yes\nWITH_EXTENSIONS=yes\nWITH_COMPLETION=yes\n######################################################################\nSHELL     ?= sh\nPREFIX    ?= /usr/local\n\nCRAM_OPTS ?= -v\n\nPROJECT   ?= $(CURDIR)\nBIN       ?= ${PROJECT}/bin\nSRC       ?= ${PROJECT}/src\nTESTS     ?= ${PROJECT}/tests\nTOOLS     ?= ${PROJECT}/tools\nTEST      ?= ${PROJECT}/tests\n\nZSH_VERSION     ?= zsh-5.3\nCONTAINER_ROOT  ?= /antigen\nUSE_CONTAINER   ?= docker\nCONTAINER_IMAGE ?= desyncr/zsh-docker-\n\nTARGET     ?= ${BIN}/antigen.zsh\nSRC        ?= ${SRC}\nEXTENSIONS ?= \nGLOB       ?= \n\nWITH_DEBUG      ?= yes\nWITH_EXTENSIONS ?= yes\nWITH_DEFER      ?= yes\nWITH_LOCK       ?= yes\nWITH_PARALLEL   ?= yes\nWITH_CACHE      ?= yes\nWITH_COMPLETION ?= yes\n\nifeq (${WITH_EXTENSIONS}, yes)\nEXTENSIONS += ${SRC}/ext/ext.zsh\nendif\nifeq (${WITH_DEFER}, yes)\nEXTENSIONS += ${SRC}/ext/defer.zsh\nendif\nifeq (${WITH_LOCK}, yes)\nEXTENSIONS += ${SRC}/ext/lock.zsh\nendif\nifeq (${WITH_PARALLEL}, yes)\nEXTENSIONS += ${SRC}/ext/parallel.zsh\nendif\nifeq (${WITH_CACHE}, yes)\nGLOB       += ${SRC}/boot.zsh\nEXTENSIONS += ${SRC}/ext/cache.zsh\nendif\n\nLIB     = $(filter-out ${SRC}/lib/log.zsh,$(sort $(wildcard ${PWD}/src/lib/*.zsh)))\nHELPERS = $(sort $(wildcard ${PWD}/src/helpers/*.zsh)) \nCOMMANDS= $(sort $(wildcard ${PWD}/src/commands/*.zsh))\nGLOB   += ${SRC}/antigen.zsh ${HELPERS} ${LIB} ${COMMANDS} ${EXTENSIONS}\n\nifeq (${WITH_COMPLETION}, yes)\nGLOB  += ${SRC}/_antigen\nendif\n# If debug is enabled then load debug functions\nifeq (${WITH_DEBUG}, yes)\nGLOB  += ${SRC}/lib/log.zsh\nendif\n\nVERSION      ?= develop\nVERSION_FILE  = ${PROJECT}/VERSION\n\nBANNER_SEP    =$(shell printf '%*s' 70 | tr ' ' '\\#')\nBANNER_TEXT   =This file was autogenerated by \\`make\\`. Do not edit it directly!\nBANNER        =${BANNER_SEP}\\n\\# ${BANNER_TEXT}\\n${BANNER_SEP}\\n\n\nHEADER_TEXT   =\\# Antigen: A simple plugin manager for zsh\\n\\\n\\# Authors: Shrikant Sharat Kandula\\n\\\n\\#          and Contributors <https://github.com/zsh-users/antigen/contributors>\\n\\\n\\# Homepage: http://antigen.sharats.me\\n\\\n\\# License: MIT License <mitl.sharats.me>\\n\n\ndefine ised\n\tsed $(1) $(2) > \"$(2).1\"\n\tmv \"$(2).1\" \"$(2)\"\nendef\n\ndefine isede\n\tsed -E $(1) $(2) > \"$(2).1\"\n\tmv \"$(2).1\" \"$(2)\"\nendef\n\n.PHONY: itests tests install all\n\nbuild:\n\t@echo Building Antigen...\n\t@printf \"${BANNER}\" > ${BIN}/antigen.zsh\n\t@printf \"${HEADER_TEXT}\" >> ${BIN}/antigen.zsh\n\t@for src in ${GLOB}; do echo \"----> $$src\"; cat \"$$src\" >> ${TARGET}; done\n\t@echo \"-antigen-env-setup\" >> ${TARGET}\n\t@echo \"${VERSION}\" > ${VERSION_FILE}\n\t@$(call ised,\"s/{{ANTIGEN_VERSION}}/$$(cat ${VERSION_FILE})/\",${TARGET})\n\t@$(call ised,\"s/{{ANTIGEN_REVISION}}/$$(git log -n1 --format=%h -- src)/\",${TARGET})\n\t@$(call ised,\"s/{{ANTIGEN_REVISION_DATE}}/$$(git log -n1 --format='%ai' -- src)/\",${TARGET})\nifeq (${WITH_DEBUG}, no)\n\t@$(call isede,\"s/ (WARN|LOG|ERR|TRACE) .*&//\",${TARGET})\n\t@$(call isede,\"/ (WARN|LOG|ERR|TRACE) .*/d\",${TARGET})\nendif\n\t@echo Done.\n\t@ls -sh ${TARGET}\n\nrelease:\n\t# Move to release branch\n\tgit checkout develop\n\tgit checkout -b release/${VERSION}\n\t# Run build and tests\n\t${MAKE} build tests\n\t# Update changelog\n\t${EDITOR} CHANGELOG.md\n\t# Build release commit\n\tgit add CHANGELOG.md README.mkd ${VERSION_FILE}\n\tgit commit -S -m \"Update changelog for ${VERSION}\"\n\t# Update binary artifact\n\tgit add ${TARGET}\n\tgit commit -S -m \"Build release ${VERSION}\"\n\npublish:\n\tgit push origin release/${VERSION}\n\t# Merge release branch into develop before deploying\n\ndeploy:\n\tgit checkout develop\n\tgit tag -m \"Build release ${VERSION}\" -s ${VERSION}\n\tgit archive --output=${VERSION}.tar.gz --prefix=antigen-$$(echo ${VERSION}|sed s/v//)/ ${VERSION}\n\tzcat ${VERSION}.tar.gz | gpg --armor --detach-sign >${VERSION}.tar.gz.sign\n\t# Verify signature\n\tzcat ${VERSION}.tar.gz | gpg --verify ${VERSION}.tar.gz.sign -\n\t# Push upstream\n\tgit push upstream ${VERSION}\n\n.container:\nifeq (${USE_CONTAINER}, docker)\n\t@docker run --rm --privileged=true -it -v ${PROJECT}:/antigen ${CONTAINER_IMAGE}${ZSH_VERSION} $(shell echo \"${COMMAND}\" | sed \"s|${PROJECT}|${CONTAINER_ROOT}|g\")\nelse ifeq (${USE_CONTAINER}, no)\n\t${COMMAND}\nendif\n\ninfo:\n\t@${MAKE} .container COMMAND=\"sh -c 'cat ${PROJECT}/VERSION; zsh --version; git --version; env'\"\n\nitests:\n\t@${MAKE} tests CRAM_OPTS=-i\n\ntests:\n\t@${MAKE} .container COMMAND=\"sh -c 'ZDOTDIR=${TESTS} ANTIGEN=${PROJECT} cram ${CRAM_OPTS} --shell=zsh ${TEST}'\"\n\nstats:\n\t@${MAKE} .container COMMAND=\"${TOOLS}/stats --zsh zsh --antigen ${PROJECT}\"\n\ninstall:\n\tmkdir -p ${PREFIX}/share && cp ${TARGET} ${PREFIX}/share/antigen.zsh\n\nclean:\n\trm -f ${PREFIX}/share/antigen.zsh\n\ninstall-deps:\n\tsudo pip install cram=='0.6.*'\n\nall: clean build install\n"
  },
  {
    "path": "Makefile.in",
    "content": "SHELL     ?= sh\nPREFIX    ?= /usr/local\n\nCRAM_OPTS ?= -v\n\nPROJECT   ?= $(CURDIR)\nBIN       ?= ${PROJECT}/bin\nSRC       ?= ${PROJECT}/src\nTESTS     ?= ${PROJECT}/tests\nTOOLS     ?= ${PROJECT}/tools\nTEST      ?= ${PROJECT}/tests\n\nZSH_VERSION     ?= zsh-5.3\nCONTAINER_ROOT  ?= /antigen\nUSE_CONTAINER   ?= docker\nCONTAINER_IMAGE ?= desyncr/zsh-docker-\n\nTARGET     ?= ${BIN}/antigen.zsh\nSRC        ?= ${SRC}\nEXTENSIONS ?= \nGLOB       ?= \n\nWITH_DEBUG      ?= yes\nWITH_EXTENSIONS ?= yes\nWITH_DEFER      ?= yes\nWITH_LOCK       ?= yes\nWITH_PARALLEL   ?= yes\nWITH_CACHE      ?= yes\nWITH_COMPLETION ?= yes\n\nifeq (${WITH_EXTENSIONS}, yes)\nEXTENSIONS += ${SRC}/ext/ext.zsh\nendif\nifeq (${WITH_DEFER}, yes)\nEXTENSIONS += ${SRC}/ext/defer.zsh\nendif\nifeq (${WITH_LOCK}, yes)\nEXTENSIONS += ${SRC}/ext/lock.zsh\nendif\nifeq (${WITH_PARALLEL}, yes)\nEXTENSIONS += ${SRC}/ext/parallel.zsh\nendif\nifeq (${WITH_CACHE}, yes)\nGLOB       += ${SRC}/boot.zsh\nEXTENSIONS += ${SRC}/ext/cache.zsh\nendif\n\nLIB     = $(filter-out ${SRC}/lib/log.zsh,$(sort $(wildcard ${PWD}/src/lib/*.zsh)))\nHELPERS = $(sort $(wildcard ${PWD}/src/helpers/*.zsh)) \nCOMMANDS= $(sort $(wildcard ${PWD}/src/commands/*.zsh))\nGLOB   += ${SRC}/antigen.zsh ${HELPERS} ${LIB} ${COMMANDS} ${EXTENSIONS}\n\nifeq (${WITH_COMPLETION}, yes)\nGLOB  += ${SRC}/_antigen\nendif\n# If debug is enabled then load debug functions\nifeq (${WITH_DEBUG}, yes)\nGLOB  += ${SRC}/lib/log.zsh\nendif\n\nVERSION      ?= develop\nVERSION_FILE  = ${PROJECT}/VERSION\n\nBANNER_SEP    =$(shell printf '%*s' 70 | tr ' ' '\\#')\nBANNER_TEXT   =This file was autogenerated by \\`make\\`. Do not edit it directly!\nBANNER        =${BANNER_SEP}\\n\\# ${BANNER_TEXT}\\n${BANNER_SEP}\\n\n\nHEADER_TEXT   =\\# Antigen: A simple plugin manager for zsh\\n\\\n\\# Authors: Shrikant Sharat Kandula\\n\\\n\\#          and Contributors <https://github.com/zsh-users/antigen/contributors>\\n\\\n\\# Homepage: http://antigen.sharats.me\\n\\\n\\# License: MIT License <mitl.sharats.me>\\n\n\ndefine ised\n\tsed $(1) $(2) > \"$(2).1\"\n\tmv \"$(2).1\" \"$(2)\"\nendef\n\ndefine isede\n\tsed -E $(1) $(2) > \"$(2).1\"\n\tmv \"$(2).1\" \"$(2)\"\nendef\n\n.PHONY: itests tests install all\n\nbuild:\n\t@echo Building Antigen...\n\t@printf \"${BANNER}\" > ${BIN}/antigen.zsh\n\t@printf \"${HEADER_TEXT}\" >> ${BIN}/antigen.zsh\n\t@for src in ${GLOB}; do echo \"----> $$src\"; cat \"$$src\" >> ${TARGET}; done\n\t@echo \"-antigen-env-setup\" >> ${TARGET}\n\t@echo \"${VERSION}\" > ${VERSION_FILE}\n\t@$(call ised,\"s/{{ANTIGEN_VERSION}}/$$(cat ${VERSION_FILE})/\",${TARGET})\n\t@$(call ised,\"s/{{ANTIGEN_REVISION}}/$$(git log -n1 --format=%h -- src)/\",${TARGET})\n\t@$(call ised,\"s/{{ANTIGEN_REVISION_DATE}}/$$(git log -n1 --format='%ai' -- src)/\",${TARGET})\nifeq (${WITH_DEBUG}, no)\n\t@$(call isede,\"s/ (WARN|LOG|ERR|TRACE) .*&//\",${TARGET})\n\t@$(call isede,\"/ (WARN|LOG|ERR|TRACE) .*/d\",${TARGET})\nendif\n\t@echo Done.\n\t@ls -sh ${TARGET}\n\nrelease:\n\t# Move to release branch\n\tgit checkout develop\n\tgit checkout -b release/${VERSION}\n\t# Run build and tests\n\t${MAKE} build tests\n\t# Update changelog\n\t${EDITOR} CHANGELOG.md\n\t# Build release commit\n\tgit add CHANGELOG.md README.mkd ${VERSION_FILE}\n\tgit commit -S -m \"Update changelog for ${VERSION}\"\n\t# Update binary artifact\n\tgit add ${TARGET}\n\tgit commit -S -m \"Build release ${VERSION}\"\n\npublish:\n\tgit push origin release/${VERSION}\n\t# Merge release branch into develop before deploying\n\ndeploy:\n\tgit checkout develop\n\tgit tag -m \"Build release ${VERSION}\" -s ${VERSION}\n\tgit archive --output=${VERSION}.tar.gz --prefix=antigen-$$(echo ${VERSION}|sed s/v//)/ ${VERSION}\n\tzcat ${VERSION}.tar.gz | gpg --armor --detach-sign >${VERSION}.tar.gz.sign\n\t# Verify signature\n\tzcat ${VERSION}.tar.gz | gpg --verify ${VERSION}.tar.gz.sign -\n\t# Push upstream\n\tgit push upstream ${VERSION}\n\n.container:\nifeq (${USE_CONTAINER}, docker)\n\t@docker run --rm --privileged=true -it -v ${PROJECT}:/antigen ${CONTAINER_IMAGE}${ZSH_VERSION} $(shell echo \"${COMMAND}\" | sed \"s|${PROJECT}|${CONTAINER_ROOT}|g\")\nelse ifeq (${USE_CONTAINER}, no)\n\t${COMMAND}\nendif\n\ninfo:\n\t@${MAKE} .container COMMAND=\"sh -c 'cat ${PROJECT}/VERSION; zsh --version; git --version; env'\"\n\nitests:\n\t@${MAKE} tests CRAM_OPTS=-i\n\ntests:\n\t@${MAKE} .container COMMAND=\"sh -c 'ZDOTDIR=${TESTS} ANTIGEN=${PROJECT} cram ${CRAM_OPTS} --shell=zsh ${TEST}'\"\n\nstats:\n\t@${MAKE} .container COMMAND=\"${TOOLS}/stats --zsh zsh --antigen ${PROJECT}\"\n\ninstall:\n\tmkdir -p ${PREFIX}/share && cp ${TARGET} ${PREFIX}/share/antigen.zsh\n\nclean:\n\trm -f ${PREFIX}/share/antigen.zsh\n\ninstall-deps:\n\tsudo pip install cram=='0.6.*'\n\nall: clean build install\n"
  },
  {
    "path": "README.mkd",
    "content": "<h1 align=\"center\">\n  <a href=\"https://github.com/zsh-users/antigen\"><img src=\"antigen.png\" alt=\"Antigen\"></a>\n  <br>\n  Antigen <sup>v2</sup>\n</h1>\n<h4 align=\"center\">The plugin manager for zsh.</h2>\n\n<p align=\"center\">\n  <a href=\"https://github.com/zsh-users/antigen/releases/latest\"><img src=\"https://img.shields.io/github/release/zsh-users/antigen.svg?label=latest\" alt=\"Latest\"></a> <a href=\"http://travis-ci.org/zsh-users/antigen\"><img src=\"https://img.shields.io/travis/zsh-users/antigen/develop.svg?label=develop\" alt=\"Build Status\"></a> <a href=\"http://travis-ci.org/zsh-users/antigen\"><img src=\"https://img.shields.io/travis/zsh-users/antigen/next.svg?label=next\" alt=\"Build Status\"></a>\n</p>\n<p align=\"center\">\n  <a href=\"#installation\">Installation</a> | <a href=\"https://github.com/zsh-users/antigen/wiki\">Documentation</a> | <a href=\"https://github.com/zsh-users/antigen/issues\">Bug tracker</a> | <a href=\"https://trello.com/b/P0xrGgfT/antigen\">Roadmap</a> | <a href=\"https://gitter.im/antigen-zsh/develop\">Chat</a> | <a href=\"http://mit.sharats.me/\">License</a>\n</p>\n\nAntigen is a small set of functions that help you easily manage your shell (zsh)\nplugins, called bundles. The concept is pretty much the same as bundles in a\ntypical vim+pathogen setup. Antigen is to zsh, what [Vundle][] is to vim.\n\n\nAntigen has reached a certain level of stability and has been used in the wild\nfor around a couple of years. If you face any problems, please open an issue.\n\nAntigen works with zsh versions `>= 4.3.11`.\n\n## Installation\n\nInstall Antigen from our main repository with the latest stable version available:\n\n    curl -L git.io/antigen > antigen.zsh\n    # or use git.io/antigen-nightly for the latest version\n\nThere are several installation methods using your System Package manager, just look\nat the [Installation][] wiki page.\n\nNow you may head towards the [Commands][] and [Configuration][] wiki pages to further\nunderstand Antigen's functionallity and customization.\n\n## Usage\n\nThe usage should be very familiar to you if you use Vundle. A typical `.zshrc`\nmight look like this:\n\n    source /path-to-antigen/antigen.zsh\n\n    # Load the oh-my-zsh's library.\n    antigen use oh-my-zsh\n\n    # Bundles from the default repo (robbyrussell's oh-my-zsh).\n    antigen bundle git\n    antigen bundle heroku\n    antigen bundle pip\n    antigen bundle lein\n    antigen bundle command-not-found\n\n    # Syntax highlighting bundle.\n    antigen bundle zsh-users/zsh-syntax-highlighting\n\n    # Load the theme.\n    antigen theme robbyrussell\n\n    # Tell Antigen that you're done.\n    antigen apply\n\nOpen your zsh with this `.zshrc` and you should see all the bundles you defined\nhere, getting installed. Once it's done, you are ready to roll. The complete\nsyntax for the `antigen bundle` command is discussed in the [Commands][] page.\n\nFurthermore, [In the wild][wild] wiki section has more configuration examples. You may\nas well take a look at the [Show off][] wiki page\nfor interactive mode usage.\n\n## Meta\n\n### Motivation\n\nIf you use zsh and [oh-my-zsh][], you know that having many different plugins\nthat are developed by many different authors in a single (sub)repo is not very\neasy to maintain. There are some really fantastic plugins and utilities in\noh-my-zsh, but having them all in a single repo doesn't really scale well. And I\nadmire robbyrussell's efforts for reviewing and merging the gigantic number of\npull requests the project gets. We need a better way of plugin management.\n\nThis was discussed on [a][1] [few][2] [issues][3], but it doesn't look like\nthere was any progress made. So, I'm trying to start this off with Antigen,\nhoping to better this situation. Please note that I'm by no means a zsh or any\nshell script expert (far from it).\n\n[1]: https://github.com/robbyrussell/oh-my-zsh/issues/465\n[2]: https://github.com/robbyrussell/oh-my-zsh/issues/377\n[3]: https://github.com/robbyrussell/oh-my-zsh/issues/1014\n\nInspired by vundle, Antigen can pull oh-my-zsh style plugins from various github\nrepositories. You are not limited to use plugins from the oh-my-zsh repository\nonly and you don't need to maintain your own fork and pull from upstream every\nnow and then. I actually encourage you to grab plugins and scripts from various\nsources, straight from the authors, before they even submit it to oh-my-zsh as a\npull request.\n\nAntigen also lets you switch the prompt theme with one command, just like that\n\n    antigen theme candy\n\nand your prompt is changed, just for this session of course (unless you put this\nline in your `.zshrc`).\n\n### Helping out\n\nWe are always looking for new contributors! We have a number of issues marked\nas [\"Help wanted\"][Help wanted] that are good places to jump in and get started. Take a look at\nour [Roadmap][] to see future projects and discuss ideas.\n\nPlease be sure to check out our [Contributing guidelines][] to understand our workflow,\nand our [Coding conventions][].\n\n### Feedback\n\nAny comments/suggestions/feedback is truly welcome. Please say hello to us on [Gitter][]. Or\nopen an issue to discuss something (anything!) about the project ;).\n\n### Articles\n\nThere are many articles written by Antigen users out there. Be sure to check them out\nin the [Articles][Articles] page.\n\n### Plugins and Alternatives\n\nThe [awesome-zsh-plugins][] list is a directory of plugins, themes and alternatives that\nyou may find useful.\n\n[Vundle]: https://github.com/gmarik/vundle\n[awesome-zsh-plugins]: https://github.com/unixorn/awesome-zsh-plugins\n[wild]: https://github.com/zsh-users/antigen/wiki/In-the-wild\n[oh-my-zsh]: https://github.com/robbyrussell/oh-my-zsh\n[issue]: https://github.com/zsh-users/antigen/issues\n[license]: http://mit.sharats.me\n[contributing]: https://github.com/zsh-users/antigen/wiki/Contributing\n[wiki]: https://github.com/zsh-users/antigen/wiki\n[Commands]: https://github.com/zsh-users/antigen/wiki/Commands\n[Installation]: https://github.com/zsh-users/antigen/wiki/Installation\n[Configuration]: https://github.com/zsh-users/antigen/wiki/Configuration\n[Show off]: https://github.com/zsh-users/antigen/wiki/Show-off\n[Help wanted]: https://github.com/zsh-users/antigen/issues?q=is%3Aissue+is%3Aopen+label%3A%22Help+wanted%22\n[Roadmap]: https://trello.com/b/P0xrGgfT/antigen\n[Contributing guidelines]: https://github.com/zsh-users/antigen/wiki/Contributing\n[Coding conventions]: https://github.com/zsh-users/antigen/wiki/Styleguide\n[Gitter]: https://gitter.im/antigen-zsh/develop\n[Articles]: https://github.com/zsh-users/antigen/wiki/Articles \n"
  },
  {
    "path": "VERSION",
    "content": "develop\n"
  },
  {
    "path": "antigen.zsh",
    "content": "_ANTIGEN_INSTALL_DIR=${0:A:h}\nsource $_ANTIGEN_INSTALL_DIR/bin/antigen.zsh\n"
  },
  {
    "path": "bin/antigen.zsh",
    "content": "######################################################################\n# This file was autogenerated by `make`. Do not edit it directly!\n######################################################################\n# Antigen: A simple plugin manager for zsh\n # Authors: Shrikant Sharat Kandula\n #          and Contributors <https://github.com/zsh-users/antigen/contributors>\n # Homepage: http://antigen.sharats.me\n # License: MIT License <mitl.sharats.me>\nzmodload zsh/parameter\nautoload -U is-at-least\n\n# While boot.zsh is part of the ext/cache functionallity it may be disabled\n# with ANTIGEN_CACHE flag, and it's always compiled with antigen.zsh\nif [[ $ANTIGEN_CACHE != false ]]; then\n  ANTIGEN_CACHE=\"${ANTIGEN_CACHE:-${ADOTDIR:-$HOME/.antigen}/init.zsh}\"\n  ANTIGEN_RSRC=\"${ANTIGEN_RSRC:-${ADOTDIR:-$HOME/.antigen}/.resources}\"\n\n  # It may not be necessary to check ANTIGEN_AUTO_CONFIG.\n  if [[ $ANTIGEN_AUTO_CONFIG != false && -f $ANTIGEN_RSRC ]]; then\n    # Check the list of files for configuration changes (uses -nt comp)\n    ANTIGEN_CHECK_FILES=$(cat $ANTIGEN_RSRC 2> /dev/null)\n    ANTIGEN_CHECK_FILES=(${(@f)ANTIGEN_CHECK_FILES})\n\n    for config in $ANTIGEN_CHECK_FILES; do\n      if [[ \"$config\" -nt \"$config.zwc\" ]]; then\n        # Flag configuration file as newer\n        { zcompile \"$config\" } &!\n        # Kill cache file in order to force full loading (see a few lines below)\n        [[ -f \"$ANTIGEN_CACHE\" ]] && rm -f \"$ANTIGEN_CACHE\"\n      fi\n    done\n  fi\n\n  # If there is a cache file do load from it\n  if [[ -f $ANTIGEN_CACHE && ! $_ANTIGEN_CACHE_LOADED == true ]]; then\n    # Wrap antigen in order to defer cache source until `antigen-apply`\n    antigen() {\n      if [[ $1 == \"apply\" ]]; then\n        source \"$ANTIGEN_CACHE\"\n      # Handle `antigen-init` command properly\n      elif [[ $1 == \"init\" ]]; then\n        source \"$2\"\n      fi\n    }\n    # Do not continue loading antigen as cache bundle takes care of it.\n    return 0\n  fi\nfi\n[[ -z \"$_ANTIGEN_INSTALL_DIR\" ]] && _ANTIGEN_INSTALL_DIR=${0:A:h}\n\n# Each line in this string has the following entries separated by a space\n# character.\n# <repo-url>, <plugin-location>, <bundle-type>, <has-local-clone>\n[[ $_ANTIGEN_CACHE_LOADED != true ]] && typeset -aU _ANTIGEN_BUNDLE_RECORD\n\n# Do not load anything if git is not available.\nif (( ! $+commands[git] )); then\n    echo 'Antigen: Please install git to use Antigen.' >&2\n    return 1\nfi\n\n# Used to defer compinit/compdef\ntypeset -a __deferred_compdefs\ncompdef () { __deferred_compdefs=($__deferred_compdefs \"$*\") }\n\n# A syntax sugar to avoid the `-` when calling antigen commands. With this\n# function, you can write `antigen-bundle` as `antigen bundle` and so on.\nantigen () {\n  local cmd=\"$1\"\n  if [[ -z \"$cmd\" ]]; then\n    antigen-help >&2\n    return 1\n  fi\n  shift\n\n  if (( $+functions[antigen-$cmd] )); then\n      \"antigen-$cmd\" \"$@\"\n      return $?\n  else\n      echo \"Antigen: Unknown command: $cmd\" >&2\n      return 1\n  fi\n}\n# Returns the bundle's git revision\n#\n# Usage\n#   -antigen-bundle-rev bundle-name [is_local_clone]\n#\n# Returns\n#   Bundle rev-parse output (branch name or short ref name)\n-antigen-bundle-rev () {\n  local bundle=$1\n  local is_local_clone=$2\n\n  local bundle_path=$bundle\n  # Get bunde path inside $ADOTDIR if bundle was effectively cloned\n  if [[ \"$is_local_clone\" == \"true\" ]]; then\n    bundle_path=$(-antigen-get-clone-dir $bundle)\n  fi\n\n  local ref\n  ref=$(git --git-dir=\"$bundle_path/.git\" rev-parse --abbrev-ref '@' 2>/dev/null)\n\n  # Avoid 'HEAD' when in detached mode\n  if [[ $ref == \"HEAD\" ]]; then\n    ref=$(git --git-dir=\"$bundle_path/.git\" describe --tags --exact-match 2>/dev/null \\\n\t    || git --git-dir=\"$bundle_path/.git\" rev-parse --short '@' 2>/dev/null || \"-\")\n  fi\n  echo $ref\n}\n# Usage:\n#   -antigen-bundle-short-name \"https://github.com/user/repo.git[|*]\" \"[branch/name]\"\n# Returns:\n#   user/repo@branch/name\n-antigen-bundle-short-name () {\n  local bundle_name=\"${1%|*}\"\n  local bundle_branch=\"$2\"\n  local match mbegin mend MATCH MBEGIN MEND\n\n  [[ \"$bundle_name\" =~ '.*/(.*/.*).*$' ]] && bundle_name=$match[1]\n  bundle_name=\"${bundle_name%.git*}\"\n\n  if [[ -n $bundle_branch ]]; then\n    bundle_name=\"$bundle_name@$bundle_branch\"\n  fi\n\n  echo $bundle_name\n}\n# Echo the bundle specs as in the record. The first line is not echoed since it\n# is a blank line.\n-antigen-echo-record () {\n  echo ${(j:\\n:)_ANTIGEN_BUNDLE_RECORD}\n}\n# Filters _ANTIGEN_BUNDLE_RECORD for $1\n#\n# Usage\n#   -antigen-find-bundle example/bundle\n#\n# Returns\n#   String if bundle is found\n-antigen-find-bundle () {\n  echo $(-antigen-find-record $1 | cut -d' ' -f1)\n}\n\n# Filters _ANTIGEN_BUNDLE_RECORD for $1\n#\n# Usage\n#   -antigen-find-record example/bundle\n#\n# Returns\n#   String if record is found\n-antigen-find-record () {\n  local bundle=$1\n  \n  if [[ $# -eq 0 ]]; then\n    return 1\n  fi\n\n  local record=${bundle/\\|/\\\\\\|}\n  echo \"${_ANTIGEN_BUNDLE_RECORD[(r)*$record*]}\"\n}\n# Returns bundle names from _ANTIGEN_BUNDLE_RECORD\n#\n# Usage\n#   -antigen-get-bundles [--short|--simple|--long]\n#\n# Returns\n#   List of bundles installed\n-antigen-get-bundles () {\n  local mode revision url bundle_name bundle_entry loc no_local_clone\n  local record bundle make_local_clone\n  mode=${1:-\"--short\"}\n\n  for record in $_ANTIGEN_BUNDLE_RECORD; do\n    bundle=(${(@s/ /)record})\n    url=$bundle[1]\n    loc=$bundle[2]\n    make_local_clone=$bundle[4]\n\n    bundle_name=$(-antigen-bundle-short-name $url)\n\n    case \"$mode\" in\n        --short)\n          # Only check revision for bundle with a requested branch\n          if [[ $url == *\\|* ]]; then\n            revision=$(-antigen-bundle-rev $url $make_local_clone)\n          else\n            revision=\"master\"\n          fi\n\n          if [[ $loc != '/' ]]; then\n            bundle_name=\"$bundle_name ~ $loc\"\n          fi\n          echo \"$bundle_name @ $revision\"\n        ;;\n        --simple)\n          echo \"$bundle_name\"\n        ;;\n        --long)\n          echo \"$record\"\n        ;;\n     esac\n  done\n}\n# Usage:\n#  -antigen-get-clone-dir \"https://github.com/zsh-users/zsh-syntax-highlighting.git[|feature/branch]\"\n# Returns:\n#  $ANTIGEN_BUNDLES/zsh-users/zsh-syntax-highlighting[-feature-branch]\n-antigen-get-clone-dir () {\n  local bundle=\"$1\"\n  local url=\"${bundle%|*}\"\n  local branch match mbegin mend MATCH MBEGIN MEND\n  [[ \"$bundle\" =~ \"\\|\" ]] && branch=\"${bundle#*|}\"\n\n  # Takes a repo url and mangles it, giving the path that this url will be\n  # cloned to. Doesn't actually clone anything.\n  local clone_dir=\"$ANTIGEN_BUNDLES\"\n\n  url=$(-antigen-bundle-short-name $url)\n\n  # Suffix with branch/tag name\n  [[ -n \"$branch\" ]] && url=\"$url-${branch//\\//-}\"\n  url=${url//\\*/x}\n\n  echo \"$clone_dir/$url\"\n}\n# Returns bundles flagged as make_local_clone\n#\n# Usage\n#    -antigen-cloned-bundles\n#\n# Returns\n#    Bundle metadata\n-antigen-get-cloned-bundles() {\n  -antigen-echo-record |\n      awk '$4 == \"true\" {print $1}' |\n      sort -u\n}\n# Returns a list of themes from a default library (omz)\n#\n# Usage\n#   -antigen-get-themes\n#\n# Returns\n#   List of themes by name\n-antigen-get-themes () {\n  local library='robbyrussell/oh-my-zsh'\n  local bundle=$(-antigen-find-bundle $library)\n\n  if [[ -n \"$bundle\" ]]; then\n    local dir=$(-antigen-get-clone-dir $ANTIGEN_DEFAULT_REPO_URL)\n    echo $(ls $dir/themes/ | eval \"$_ANTIGEN_GREP_COMMAND '.zsh-theme$'\" | sed 's/.zsh-theme//')\n  fi\n\n  return 0\n}\n\n# This function check ZSH_EVAL_CONTEXT to determine if running in interactive shell. \n#\n# Usage\n#   -antigen-interactive-mode\n#\n# Returns\n#   Either true or false depending if we are running in interactive mode\n-antigen-interactive-mode () {\n  WARN \"-antigen-interactive-mode: $ZSH_EVAL_CONTEXT \\$_ANTIGEN_INTERACTIVE = $_ANTIGEN_INTERACTIVE\"\n  if [[ $_ANTIGEN_INTERACTIVE != \"\" ]]; then\n    [[ $_ANTIGEN_INTERACTIVE == true ]];\n    return\n  fi\n\n  [[ \"$ZSH_EVAL_CONTEXT\" == toplevel* || \"$ZSH_EVAL_CONTEXT\" == cmdarg* ]];\n}\n# Parses and retrieves a remote branch given a branch name.\n#\n# If the branch name contains '*' it will retrieve remote branches\n# and try to match against tags and heads, returning the latest matching.\n#\n# Usage\n#     -antigen-parse-branch https://github.com/user/repo.git x.y.z\n#\n# Returns\n#     Branch name\n-antigen-parse-branch () {\n  local url=\"$1\" branch=\"$2\" branches\n  \n  local match mbegin mend MATCH MBEGIN MEND\n\n  if [[ \"$branch\" =~ '\\*' ]]; then\n    branches=$(git ls-remote --tags -q \"$url\" \"$branch\"|cut -d'/' -f3|sort -n|tail -1)\n    # There is no --refs flag in git 1.8 and below, this way we\n    # emulate this flag -- also git 1.8 ref order is undefined.\n    branch=${${branches#*/*/}%^*} # Why you are like this?\n  fi\n\n  echo $branch\n}\n-antigen-update-repos () {\n  local repo bundle url target\n  local log=/tmp/antigen-v2-migrate.log\n\n  echo \"It seems you have bundles cloned with Antigen v1.x.\"\n  echo \"We'll try to convert directory structure to v2.\"\n  echo\n\n  echo -n \"Moving bundles to '\\$ADOTDIR/bundles'... \"\n\n  # Migrate old repos -> bundles\n  local errors=0\n  for repo in $ADOTDIR/repos/*; do\n    bundle=${repo/$ADOTDIR\\/repos\\//}\n    bundle=${bundle//-SLASH-/\\/}\n    bundle=${bundle//-COLON-/\\:}\n    bundle=${bundle//-STAR-/\\*}\n    url=${bundle//-PIPE-/\\|}\n    target=$(-antigen-get-clone-dir $url)\n    mkdir -p \"${target:A:h}\"\n    echo \" ---> ${repo/$ADOTDIR\\/} -> ${target/$ADOTDIR\\/}\" | tee > $log\n    mv \"$repo\" \"$target\" &> $log\n    if [[ $? != 0 ]]; then\n      echo \"Failed to migrate '$repo'!.\"\n      errors+=1\n    fi\n  done\n\n  if [[ $errors == 0 ]]; then\n    echo \"Done.\"\n  else\n    echo \"An error ocurred!\"\n  fi\n  echo\n\n  if [[ \"$(ls -A $ADOTDIR/repos | wc -l | xargs)\" == 0 ]]; then\n    echo \"You can safely remove \\$ADOTDIR/repos.\"\n  else\n    echo \"Some bundles couldn't be migrated. See \\$ADOTDIR/repos.\"\n  fi\n\n  echo\n  if [[ $errors == 0 ]]; then\n    echo \"Bundles migrated successfuly.\"\n    rm $log\n  else\n    echo \"Some errors occured. Review migration log in '$log'.\"\n  fi\n  antigen-reset\n}\n# Ensure that a clone exists for the given repo url and branch. If the first\n# argument is `update` and if a clone already exists for the given repo\n# and branch, it is pull-ed, i.e., updated.\n#\n# This function expects three arguments in order:\n# - 'url=<url>'\n# - 'update=true|false'\n# - 'verbose=true|false'\n#\n# Returns true|false Whether cloning/pulling was succesful\n-antigen-ensure-repo () {\n  # Argument defaults. Previously using ${1:?\"missing url argument\"} format\n  # but it seems to mess up with cram\n  if (( $# < 1 )); then\n    echo \"Antigen: Missing url argument.\"\n    return 1\n  fi\n\n  # The url. No sane default for this, so just empty.\n  local url=$1\n  # Check if we have to update.\n  local update=${2:-false}\n  # Verbose output.\n  local verbose=${3:-false}\n\n  shift $#\n\n  # Get the clone's directory as per the given repo url and branch.\n  local clone_dir=$(-antigen-get-clone-dir $url)\n  if [[ -d \"$clone_dir\" && $update == false ]]; then\n    return true\n  fi\n\n  # A temporary function wrapping the `git` command with repeated arguments.\n  --plugin-git () {\n    (\\cd -q \"$clone_dir\" && eval ${ANTIGEN_CLONE_ENV} git --git-dir=\"$clone_dir/.git\" --no-pager \"$@\" &>>! $ANTIGEN_LOG)\n  }\n\n  local success=false\n\n  # If its a specific branch that we want, checkout that branch.\n  local branch=\"master\" # TODO FIX THIS\n  if [[ $url == *\\|* ]]; then\n    branch=\"$(-antigen-parse-branch ${url%|*} ${url#*|})\"\n  fi\n\n  if [[ ! -d $clone_dir ]]; then\n    eval ${ANTIGEN_CLONE_ENV} git clone ${=ANTIGEN_CLONE_OPTS} --branch \"$branch\" -- \"${url%|*}\" \"$clone_dir\" &>> $ANTIGEN_LOG\n    success=$?\n  elif $update; then\n    # Save current revision.\n    local old_rev=\"$(--plugin-git rev-parse HEAD)\"\n    # Pull changes if update requested.\n    --plugin-git checkout \"$branch\"\n    --plugin-git pull origin \"$branch\"\n    success=$?\n\n    # Update submodules.\n    --plugin-git submodule update ${=ANTIGEN_SUBMODULE_OPTS}\n    # Get the new revision.\n    local new_rev=\"$(--plugin-git rev-parse HEAD)\"\n  fi\n\n  if [[ -n $old_rev && $old_rev != $new_rev ]]; then\n    echo Updated from $old_rev[0,7] to $new_rev[0,7].\n    if $verbose; then\n      --plugin-git log --oneline --reverse --no-merges --stat '@{1}..'\n    fi\n  fi\n\n  # Remove the temporary git wrapper function.\n  unfunction -- --plugin-git\n\n  return $success\n}\n# Helper function: Same as `$1=$2`, but will only happen if the name\n# specified by `$1` is not already set.\n-antigen-set-default () {\n  local arg_name=\"$1\"\n  local arg_value=\"$2\"\n  eval \"test -z \\\"\\$$arg_name\\\" && typeset -g $arg_name='$arg_value'\"\n}\n\n-antigen-env-setup () {\n  typeset -gU fpath path\n\n  # Pre-startup initializations.\n  -antigen-set-default ANTIGEN_OMZ_REPO_URL \\\n    https://github.com/robbyrussell/oh-my-zsh.git\n  -antigen-set-default ANTIGEN_PREZTO_REPO_URL \\\n    https://github.com/sorin-ionescu/prezto.git\n  -antigen-set-default ANTIGEN_DEFAULT_REPO_URL $ANTIGEN_OMZ_REPO_URL\n\n  # Default Antigen directory.\n  -antigen-set-default ADOTDIR $HOME/.antigen\n  [[ ! -d $ADOTDIR ]] && mkdir -p $ADOTDIR\n\n  # Defaults bundles directory.\n  -antigen-set-default ANTIGEN_BUNDLES $ADOTDIR/bundles\n\n  # If there is no bundles directory, create it.\n  if [[ ! -d $ANTIGEN_BUNDLES ]]; then\n    mkdir -p $ANTIGEN_BUNDLES\n    # Check for v1 repos directory, transform it to v2 format.\n    [[ -d $ADOTDIR/repos ]] && -antigen-update-repos\n  fi\n\n  -antigen-set-default ANTIGEN_COMPDUMP \"${ADOTDIR:-$HOME}/.zcompdump\"\n  -antigen-set-default ANTIGEN_COMPINIT_OPTS \"-i\"\n  -antigen-set-default ANTIGEN_LOG /dev/null\n\n  # CLONE_OPTS uses ${=CLONE_OPTS} expansion so don't use spaces\n  # for arguments that can be passed as `--key=value`.\n  -antigen-set-default ANTIGEN_CLONE_ENV \"GIT_TERMINAL_PROMPT=0\"\n  -antigen-set-default ANTIGEN_CLONE_OPTS \"--single-branch --recursive --depth=1\"\n  -antigen-set-default ANTIGEN_SUBMODULE_OPTS \"--recursive --depth=1\"\n\n  # Complain when a bundle is already installed.\n  -antigen-set-default _ANTIGEN_WARN_DUPLICATES true\n\n  # Compatibility with oh-my-zsh themes.\n  -antigen-set-default _ANTIGEN_THEME_COMPAT true\n\n  -antigen-set-default _ANTIGEN_GREP_COMMAND 'GREP_OPTIONS= command grep '\n\n  # Add default built-in extensions to load at start up\n  -antigen-set-default _ANTIGEN_BUILTIN_EXTENSIONS 'lock parallel defer cache'\n  \n  # Set up configured theme\n  -antigen-set-default _ANTIGEN_THEME ''\n\n  # Setup antigen's own completion.\n  if -antigen-interactive-mode; then\n    TRACE \"Gonna create compdump file @ env-setup\" COMPDUMP\n    autoload -Uz compinit\n    compinit $ANTIGEN_COMPINIT_OPTS -d \"$ANTIGEN_COMPDUMP\"\n    compdef _antigen antigen\n  else\n    (( $+functions[antigen-ext-init] )) && antigen-ext-init\n  fi\n}\n# Load a given bundle by sourcing it.\n#\n# The function also modifies fpath to add the bundle path.\n#\n# Usage\n#   -antigen-load \"bundle-url\" [\"location\"] [\"make_local_clone\"] [\"btype\"]\n#\n# Returns\n#   Integer. 0 if success 1 if an error ocurred.\n-antigen-load () {\n  local bundle list\n  typeset -A bundle; bundle=($@)\n\n  typeset -Ua list; list=()\n  local location=\"${bundle[dir]}/${bundle[loc]}\"\n\n  # Prioritize location when given.\n  if [[ -f \"${location}\" ]]; then\n    list=(${location})\n  else\n    # Directory locations must be suffixed with slash\n    location=\"$location/\"\n\n    # Prioritize theme with antigen-theme\n    if [[ ${bundle[btype]} == \"theme\" ]]; then\n      list=(${location}*.zsh-theme(N[1]))\n    fi\n\n    # Common frameworks\n    if [[ $#list == 0 ]]; then\n      # dot-plugin, init and functions support (omz, prezto)\n      # Support prezto function loading. See https://github.com/zsh-users/antigen/pull/428\n      list=(${location}*.plugin.zsh(N[1]) ${location}init.zsh(N[1]) ${location}/functions(N[1]))\n    fi\n\n    # Default to zsh and sh\n    if [[ $#list == 0 ]]; then\n      list=(${location}*.zsh(N) ${location}*.sh(N))\n    fi\n  fi\n\n  -antigen-load-env ${(kv)bundle}\n\n  # If there is any sourceable try to load it\n  if ! -antigen-load-source \"${list[@]}\" && [[ ! -d ${location} ]]; then\n    return 1\n  fi\n\n  return 0\n}\n\n-antigen-load-env () {\n  typeset -A bundle; bundle=($@)\n  local location=${bundle[dir]}/${bundle[loc]}\n\n  # Load to path if there is no sourceable\n  if [[ -d ${location} ]]; then\n    PATH=\"$PATH:${location:A}\"\n    fpath+=(\"${location:A}\")\n    return\n  fi\n\n  PATH=\"$PATH:${location:A:h}\"\n  fpath+=(\"${location:A:h}\")\n}\n\n-antigen-load-source () {\n  typeset -a list\n  list=($@)\n  local src match mbegin mend MATCH MBEGIN MEND\n\n  # Return error when we're given an empty list\n  if [[ $#list == 0 ]]; then\n    return 1\n  fi\n  \n  # Using a for rather than `source $list` as we need to check for zsh-themes\n  # In order to create antigen-compat file. This is only needed for interactive-mode\n  # theme switching, for static loading (cache) there is no need.\n  for src in $list; do\n    if [[ $_ANTIGEN_THEME_COMPAT == true  && -f \"$src\" && \"$src\" == *.zsh-theme* ]]; then\n      local compat=\"${src:A}.antigen-compat\"\n      echo \"# Generated by Antigen. Do not edit!\" >! \"$compat\"\n      cat $src | sed -Ee '/\\{$/,/^\\}/!{\n             s/^local //\n         }' >>! \"$compat\"\n      src=\"$compat\"\n    fi\n\n    if ! source \"$src\" 2>/dev/null; then\n      return 1\n    fi\n  done\n}\n# Usage:\n#   -antigen-parse-args output_assoc_arr <args...>\n-antigen-parse-args () {\n  local argkey key value index=0 args\n  local match mbegin mend MATCH MBEGIN MEND\n\n  local var=$1\n  shift\n\n  # Bundle spec arguments' default values.\n  #setopt XTRACE VERBOSE\n  builtin typeset -A args\n  args[url]=\"$ANTIGEN_DEFAULT_REPO_URL\"\n  #unsetopt XTRACE VERBOSE\n  args[loc]=/\n  args[make_local_clone]=true\n  args[btype]=plugin\n  #args[branch]= # commented out as it may cause assoc array kv mismatch\n\n  while [[ $# -gt 0 ]]; do\n    argkey=\"${1%\\=*}\"\n    key=\"${argkey//--/}\"\n    value=\"${1#*=}\"\n\n    case \"$argkey\" in\n      --url|--loc|--branch|--btype)\n        if [[ \"$value\" == \"$argkey\" ]]; then\n          printf \"Required argument for '%s' not provided.\\n\" $key >&2\n        else\n          args[$key]=\"$value\"\n        fi\n      ;;\n      --no-local-clone)\n        args[make_local_clone]=false\n      ;;\n      --*)\n        printf \"Unknown argument '%s'.\\n\" $key >&2\n      ;;\n      *)\n        value=$key\n        case $index in\n          0)\n            key=url\n            local domain=\"\"\n            local url_path=$value\n            # Full url with protocol or ssh github url (github.com:org/repo)\n            if [[ \"$value\" =~ \"://\" || \"$value\" =~ \":\" ]]; then\n              if [[ \"$value\" =~ [@.][^/:]+[:]?[0-9]*[:/]?(.*)@?$ ]]; then\n                url_path=$match[1]\n                domain=${value/$url_path/}\n              fi\n            fi\n\n            if [[ \"$url_path\" =~ '@' ]]; then\n              args[branch]=\"${url_path#*@}\"\n              value=\"$domain${url_path%@*}\"\n            else\n              value=\"$domain$url_path\"\n            fi\n          ;;\n          1) key=loc ;;\n        esac\n        let index+=1\n        args[$key]=\"$value\"\n      ;;\n    esac\n\n    shift\n  done\n  \n  # Check if url is just the plugin name. Super short syntax.\n  if [[ \"${args[url]}\" != */* ]]; then\n    case \"$ANTIGEN_DEFAULT_REPO_URL\" in\n      \"$ANTIGEN_OMZ_REPO_URL\")\n        args[loc]=\"plugins/${args[url]}\"\n      ;;\n      \"$ANTIGEN_PREZTO_REPO_URL\")\n        args[loc]=\"modules/${args[url]}\"\n      ;;\n      *)\n        args[loc]=\"${args[url]}\"\n      ;;\n    esac\n    args[url]=\"$ANTIGEN_DEFAULT_REPO_URL\"\n  fi\n\n  # Resolve the url.\n  # Expand short github url syntax: `username/reponame`.\n  local url=\"${args[url]}\"\n  if [[ $url != git://* &&\n          $url != https://* &&\n          $url != http://* &&\n          $url != ssh://* &&\n          $url != /* &&\n          $url != *github.com:*/*\n          ]]; then\n    url=\"https://github.com/${url%.git}.git\"\n  fi\n  args[url]=\"$url\"\n\n  # Ignore local clone if url given is not a git directory\n  if [[ ${args[url]} == /* && ! -d ${args[url]}/.git ]]; then\n    args[make_local_clone]=false\n  fi\n\n  # Add the branch information to the url if we need to create a local clone.\n  # Format url in bundle-metadata format: url[|branch]\n  if [[ ! -z \"${args[branch]}\" && ${args[make_local_clone]} == true ]]; then\n    args[url]=\"${args[url]}|${args[branch]}\"\n  fi\n\n  # Add the theme extension to `loc`, if this is a theme, but only\n  # if it's especified, ie, --loc=theme-name, in case when it's not\n  # specified antige-load-list will look for *.zsh-theme files\n  if [[ ${args[btype]} == \"theme\" &&\n      ${args[loc]} != \"/\" && ${args[loc]} != *.zsh-theme ]]; then\n      args[loc]=\"${args[loc]}.zsh-theme\"\n  fi\n\n  local name=\"${args[url]%|*}\"\n  local branch=\"${args[branch]}\"\n\n  # Extract bundle name.\n  if [[ \"$name\" =~ '.*/(.*/.*).*$' ]]; then\n    name=\"${match[1]}\"\n  fi\n  name=\"${name%.git*}\"\n\n  # Format bundle name with optional branch.\n  if [[ -n \"${branch}\" ]]; then\n    args[name]=\"${name}@${branch}\"\n  else\n    args[name]=\"${name}\"\n  fi\n\n  # Format bundle path.\n  if [[ ${args[make_local_clone]} == true ]]; then\n    local bpath=\"$name\"\n    # Suffix with branch/tag name\n    if [[ -n \"$branch\" ]]; then\n      # bpath is in the form of repo/name@version => repo/name-version\n      # Replace / with - in bundle branch.\n      local bbranch=${branch//\\//-}\n      # If branch/tag is semver-like do replace * by x.\n      bbranch=${bbranch//\\*/x}\n      bpath=\"${name}-${bbranch}\"\n    fi\n\n    bpath=\"$ANTIGEN_BUNDLES/$bpath\"\n    args[dir]=\"${(qq)bpath}\"\n  else\n    # if it's local then path is just the \"url\" argument, loc remains the same\n    args[dir]=${args[url]}\n  fi\n  \n  # Escape url and branch (may contain semver-like and pipe characters)\n  args[url]=\"${(qq)args[url]}\"\n  if [[ -n \"${args[branch]}\" ]]; then\n    args[branch]=\"${(qq)args[branch]}\"\n  fi\n  \n  # Escape bundle name (may contain semver-like characters)\n  args[name]=\"${(qq)args[name]}\"\n\n  eval \"${var}=(${(kv)args})\"\n\n  return 0\n}\n# Updates revert-info data with git hash.\n#\n# This does process only cloned bundles.\n#\n# Usage\n#    -antigen-revert-info\n#\n# Returns\n#    Nothing. Generates/updates $ADOTDIR/revert-info.\n-antigen-revert-info() {\n  local url\n  # Update your bundles, i.e., `git pull` in all the plugin repos.\n  date >! $ADOTDIR/revert-info\n\n  -antigen-get-cloned-bundles | while read url; do\n    local clone_dir=\"$(-antigen-get-clone-dir \"$url\")\"\n    if [[ -d \"$clone_dir\" ]]; then\n      (echo -n \"$clone_dir:\"\n        \\cd -q \"$clone_dir\"\n        git rev-parse HEAD) >> $ADOTDIR/revert-info\n    fi\n  done\n}\n-antigen-use-oh-my-zsh () {\n  typeset -g ZSH ZSH_CACHE_DIR\n  ANTIGEN_DEFAULT_REPO_URL=$ANTIGEN_OMZ_REPO_URL\n  if [[ -z \"$ZSH\" ]]; then\n    ZSH=\"$(-antigen-get-clone-dir \"$ANTIGEN_DEFAULT_REPO_URL\")\"\n  fi\n  if [[ -z \"$ZSH_CACHE_DIR\" ]]; then\n    ZSH_CACHE_DIR=\"$ZSH/cache/\"\n  fi\n  antigen-bundle --loc=lib\n}\n-antigen-use-prezto () {\n  ANTIGEN_DEFAULT_REPO_URL=$ANTIGEN_PREZTO_REPO_URL\n  antigen-bundle \"$ANTIGEN_PREZTO_REPO_URL\"\n}\n# Initialize completion\nantigen-apply () {\n  LOG \"Called antigen-apply\"\n\n  # Load the compinit module. This will readefine the `compdef` function to\n  # the one that actually initializes completions.\n  TRACE \"Gonna create compdump file @ apply\" COMPDUMP\n  autoload -Uz compinit\n  compinit $ANTIGEN_COMPINIT_OPTS -d \"$ANTIGEN_COMPDUMP\"\n\n  # Apply all `compinit`s that have been deferred.\n  local cdef\n  for cdef in \"${__deferred_compdefs[@]}\"; do\n    compdef \"$cdef\"\n  done\n\n  { zcompile \"$ANTIGEN_COMPDUMP\" } &!\n\n  unset __deferred_compdefs\n}\n# Syntaxes\n#   antigen-bundle <url> [<loc>=/]\n# Keyword only arguments:\n#   branch - The branch of the repo to use for this bundle.\nantigen-bundle () {\n  TRACE \"Called antigen-bundle with $@\" BUNDLE\n  if [[ -z \"$1\" ]]; then\n    printf \"Antigen: Must provide a bundle url or name.\\n\" >&2\n    return 1\n  fi\n\n  builtin typeset -A bundle; -antigen-parse-args 'bundle' ${=@}\n  if [[ -z ${bundle[btype]} ]]; then\n    bundle[btype]=bundle\n  fi\n\n  local record=\"${bundle[url]} ${bundle[loc]} ${bundle[btype]} ${bundle[make_local_clone]}\"\n  if [[ $_ANTIGEN_WARN_DUPLICATES == true && ! ${_ANTIGEN_BUNDLE_RECORD[(I)$record]} == 0 ]]; then\n    printf \"Seems %s is already installed!\\n\" ${bundle[name]}\n    return 1\n  fi\n \n  # Clone bundle if we haven't done do already.\n  if [[ ! -d \"${bundle[dir]}\" ]]; then\n    if ! -antigen-bundle-install ${(kv)bundle}; then\n      return 1\n    fi\n  fi\n\n  # Load the plugin.\n  if ! -antigen-load ${(kv)bundle}; then\n    TRACE \"-antigen-load failed to load ${bundle[name]}\" BUNDLE\n    printf \"Antigen: Failed to load %s.\\n\" ${bundle[btype]} >&2\n    return 1\n  fi\n  \n  # Only add it to the record if it could be installed and loaded.\n  _ANTIGEN_BUNDLE_RECORD+=(\"$record\")\n}\n\n#\n# Usage:\n#   -antigen-bundle-install <record>\n# Returns:\n#   1 if it fails to install bundle\n-antigen-bundle-install () {\n  typeset -A bundle; bundle=($@)\n\n  # Ensure a clone exists for this repo, if needed.\n  # Get the clone's directory as per the given repo url and branch.\n  local bpath=\"${bundle[dir]}\"\n  # Clone if it doesn't already exist.\n  local start=$(date +'%s')\n\n  printf \"Installing %s... \" \"${bundle[name]}\"\n\n  if ! -antigen-ensure-repo \"${bundle[url]}\"; then\n    # Return immediately if there is an error cloning\n    TRACE \"-antigen-bundle-instal failed to clone ${bundle[url]}\" BUNDLE\n    printf \"Error! Activate logging and try again.\\n\" >&2\n    return 1\n  fi\n\n  local took=$(( $(date +'%s') - $start ))\n  printf \"Done. Took %ds.\\n\" $took\n}\nantigen-bundles () {\n  # Bulk add many bundles at one go. Empty lines and lines starting with a `#`\n  # are ignored. Everything else is given to `antigen-bundle` as is, no\n  # quoting rules applied.\n  local line\n  setopt localoptions no_extended_glob # See https://github.com/zsh-users/antigen/issues/456\n  eval \"$_ANTIGEN_GREP_COMMAND '^[[:space:]]*[^[:space:]#]'\" | while read line; do\n    antigen-bundle ${=line%#*}\n  done\n}\n# Cleanup unused repositories.\nantigen-cleanup () {\n  local force=false\n  if [[ $1 == --force ]]; then\n    force=true\n  fi\n\n  if [[ ! -d \"$ANTIGEN_BUNDLES\" || -z \"$(\\ls -A \"$ANTIGEN_BUNDLES\")\" ]]; then\n    echo \"You don't have any bundles.\"\n    return 0\n  fi\n\n  # Find directores in ANTIGEN_BUNDLES, that are not in the bundles record.\n  typeset -a unused_clones clones\n\n  local url record clone\n  for record in $(-antigen-get-cloned-bundles); do\n    url=${record% /*}\n    clones+=(\"$(-antigen-get-clone-dir $url)\")\n  done\n\n  for clone in $ANTIGEN_BUNDLES/*/*(/); do\n    if [[ $clones[(I)$clone] == 0 ]]; then\n      unused_clones+=($clone)\n    fi\n  done\n\n  if [[ -z $unused_clones ]]; then\n    echo \"You don't have any unidentified bundles.\"\n    return 0\n  fi\n\n  echo 'You have clones for the following repos, but are not used.'\n  echo \"\\n${(j:\\n:)unused_clones}\"\n\n  if $force || (echo -n '\\nDelete them all? [y/N] '; read -q); then\n    echo\n    echo\n    for clone in $unused_clones; do\n      echo -n \"Deleting clone \\\"$clone\\\"...\"\n      \\rm -rf \"$clone\"\n\n      echo ' done.'\n    done\n  else\n    echo\n    echo \"Nothing deleted.\"\n  fi\n}\nantigen-help () {\n  antigen-version\n\n  cat <<EOF\n\nAntigen is a plugin management system for zsh. It makes it easy to grab awesome\nshell scripts and utilities, put up on Github.\n\nUsage: antigen <command> [args]\n\nCommands:\n  apply        Must be called in the zshrc after all calls to 'antigen bundle'.\n  bundle       Install and load a plugin.\n  cache-gen    Generate Antigen's cache with currently loaded bundles.\n  cleanup      Remove clones of repos not used by any loaded plugins.\n  init         Use caching to quickly load bundles.\n  list         List currently loaded plugins.\n  purge        Remove a bundle from the filesystem.\n  reset        Clean the generated cache.\n  restore      Restore plugin state from a snapshot file.\n  revert       Revert plugins to their state prior to the last time 'antigen\n               update' was run.\n  selfupdate   Update antigen.\n  snapshot     Create a snapshot of all active plugin repos and save it to a\n               snapshot file.\n  update       Update plugins.\n  use          Load a supported zsh pre-packaged framework.\n\nFor further details and complete documentation, visit the project's page at\n'http://antigen.sharats.me'.\nEOF\n}\n# Antigen command to load antigen configuration\n#\n# This method is slighlty more performing than using various antigen-* methods.\n#\n# Usage\n#   Referencing an antigen configuration file:\n#\n#       antigen-init \"/path/to/antigenrc\"\n#\n#   or using HEREDOCS:\n#\n#       antigen-init <<EOBUNDLES\n#           antigen use oh-my-zsh\n#\n#           antigen bundle zsh/bundle\n#           antigen bundle zsh/example\n#\n#           antigen theme zsh/theme\n#\n#           antigen apply\n#       EOBUNDLES\n#\n# Returns\n#   Nothing\nantigen-init () {\n  local src=\"$1\" line\n\n  # If we're given an argument it should be a path to a file\n  if [[ -n \"$src\" ]]; then\n    if [[ -f \"$src\" ]]; then\n      source \"$src\"\n      return\n    else\n      printf \"Antigen: invalid argument provided.\\n\" >&2\n      return 1\n    fi\n  fi\n\n  # Otherwise we expect it to be a heredoc\n  eval \"$_ANTIGEN_GREP_COMMAND '^[[:space:]]*[^[:space:]#]'\" | while read -r line; do\n    eval $line\n  done\n}\n# List instaled bundles either in long (record), short or simple format.\n#\n# Usage\n#    antigen-list [--short|--long|--simple]\n#\n# Returns\n#    List of bundles\nantigen-list () {\n  local format=$1\n\n  # List all currently installed bundles.\n  if [[ -z $_ANTIGEN_BUNDLE_RECORD ]]; then\n    echo \"You don't have any bundles.\" >&2\n    return 1\n  fi\n\n  -antigen-get-bundles $format\n}\n# Remove a bundle from filesystem\n#\n# Usage\n#   antigen-purge example/bundle [--force]\n#\n# Returns\n#   Nothing. Removes bundle from filesystem.\nantigen-purge () {\n  local bundle=$1\n  local force=$2\n\n  if [[ $# -eq 0  ]]; then\n    echo \"Antigen: Missing argument.\" >&2\n    return 1\n  fi\n\n  if -antigen-purge-bundle $bundle $force; then\n    antigen-reset\n  else\n    return $?\n  fi\n\n  return 0\n}\n\n# Remove a bundle from filesystem\n#\n# Usage\n#   antigen-purge example/bundle [--force]\n#\n# Returns\n#   Nothing. Removes bundle from filesystem.\n-antigen-purge-bundle () {\n  local bundle=$1\n  local force=$2\n  local clone_dir=\"\"\n\n  local record=\"\"\n  local url=\"\"\n  local make_local_clone=\"\"\n\n  if [[ $# -eq 0  ]]; then\n    echo \"Antigen: Missing argument.\" >&2\n    return 1\n  fi\n\n  # local keyword doesn't work on zsh <= 5.0.0\n  record=$(-antigen-find-record $bundle)\n\n  if [[ ! -n \"$record\" ]]; then\n    echo \"Bundle not found in record. Try 'antigen bundle $bundle' first.\" >&2\n    return 1\n  fi\n\n  url=\"$(echo \"$record\" | cut -d' ' -f1)\"\n  make_local_clone=$(echo \"$record\" | cut -d' ' -f4)\n\n  if [[ $make_local_clone == \"false\" ]]; then\n    echo \"Bundle has no local clone. Will not be removed.\" >&2\n    return 1\n  fi\n\n  clone_dir=$(-antigen-get-clone-dir \"$url\")\n  if [[ $force == \"--force\" ]] || read -q \"?Remove '$clone_dir'? (y/n) \"; then\n    # Need empty line after read -q\n    [[ ! -n $force ]] && echo \"\" || echo \"Removing '$clone_dir'.\";\n    rm -rf \"$clone_dir\"\n    return $?\n  fi\n\n  return 1\n}\n# Removes cache payload and metadata if available\n#\n# Usage\n#   antigen-reset\n#\n# Returns\n#   Nothing\nantigen-reset () {\n  [[ -f \"$ANTIGEN_CACHE\" ]] && rm -f \"$ANTIGEN_CACHE\" \"$ANTIGEN_CACHE.zwc\" 1> /dev/null\n  [[ -f \"$ANTIGEN_RSRC\" ]] && rm -f \"$ANTIGEN_RSRC\" 1> /dev/null\n  [[ -f \"$ANTIGEN_COMPDUMP\" ]] && rm -f \"$ANTIGEN_COMPDUMP\" \"$ANTIGEN_COMPDUMP.zwc\" 1> /dev/null\n  [[ -f \"$ANTIGEN_LOCK\" ]] && rm -f \"$ANTIGEN_LOCK\" 1> /dev/null\n  echo 'Done. Please open a new shell to see the changes.'\n}\nantigen-restore () {\n  local line\n  if [[ $# == 0 ]]; then\n    echo 'Please provide a snapshot file to restore from.' >&2\n    return 1\n  fi\n\n  local snapshot_file=\"$1\"\n\n  # TODO: Before doing anything with the snapshot file, verify its checksum.\n  # If it fails, notify this to the user and confirm if restore should\n  # proceed.\n\n  echo -n \"Restoring from $snapshot_file...\"\n\n  sed -n '1!p' \"$snapshot_file\" |\n    while read line; do\n      local version_hash=\"${line%% *}\"\n      local url=\"${line##* }\"\n      local clone_dir=\"$(-antigen-get-clone-dir \"$url\")\"\n\n      if [[ ! -d $clone_dir ]]; then\n          git clone \"$url\" \"$clone_dir\" &> /dev/null\n      fi\n\n      (\\cd -q \"$clone_dir\" && git checkout $version_hash) &> /dev/null\n    done\n\n  echo ' done.'\n  echo 'Please open a new shell to get the restored changes.'\n}\n# Reads $ADORDIR/revert-info and restores bundles' revision\nantigen-revert () {\n  local line\n  if [[ -f $ADOTDIR/revert-info ]]; then\n    cat $ADOTDIR/revert-info | sed -n '1!p' | while read line; do\n      local dir=\"$(echo \"$line\" | cut -d: -f1)\"\n      git --git-dir=\"$dir/.git\" --work-tree=\"$dir\" \\\n        checkout \"$(echo \"$line\" | cut -d: -f2)\" 2> /dev/null\n    done\n\n    echo \"Reverted to state before running -update on $(\n            cat $ADOTDIR/revert-info | sed -n '1p').\"\n\n  else\n    echo 'No revert information available. Cannot revert.' >&2\n    return 1\n  fi\n}\n# Update (with `git pull`) antigen itself.\n# TODO: Once update is finished, show a summary of the new commits, as a kind of\n# \"what's new\" message.\nantigen-selfupdate () {\n  (\\cd -q $_ANTIGEN_INSTALL_DIR\n   if [[ ! ( -d .git || -f .git ) ]]; then\n     echo \"Your copy of antigen doesn't appear to be a git clone. \" \\\n       \"The 'selfupdate' command cannot work in this case.\"\n     return 1\n   fi\n   local head=\"$(git rev-parse --abbrev-ref HEAD)\"\n   if [[ $head == \"HEAD\" ]]; then\n     # If current head is detached HEAD, checkout to master branch.\n     git checkout master\n   fi\n   git pull\n\n   # TODO Should be transparently hooked by zcache\n   antigen-reset &>> /dev/null\n  )\n}\nantigen-snapshot () {\n  local snapshot_file=\"${1:-antigen-shapshot}\"\n  local urls url dir version_hash snapshot_content\n  local -a bundles\n\n  # The snapshot content lines are pairs of repo-url and git version hash, in\n  # the form:\n  #   <version-hash> <repo-url>\n  urls=$(-antigen-echo-record | awk '$4 == \"true\" {print $1}' | sort -u)\n  for url in ${(f)urls}; do\n    dir=\"$(-antigen-get-clone-dir \"$url\")\"\n    version_hash=\"$(\\cd -q \"$dir\" && git rev-parse HEAD)\"\n    bundles+=(\"$version_hash $url\");\n  done\n  snapshot_content=${(j:\\n:)bundles}\n\n  {\n    # The first line in the snapshot file is for metadata, in the form:\n    #   key='value'; key='value'; key='value';\n    # Where `key`s are valid shell variable names.\n\n    # Snapshot version. Has no relation to antigen version. If the snapshot\n    # file format changes, this number can be incremented.\n    echo -n \"version='1';\"\n\n    # Snapshot creation date+time.\n    echo -n \" created_on='$(date)';\"\n\n    # Add a checksum with the md5 checksum of all the snapshot lines.\n    chksum() { (md5sum; test $? = 127 && md5) 2>/dev/null | cut -d' ' -f1 }\n    local checksum=\"$(echo \"$snapshot_content\" | chksum)\"\n    unset -f chksum;\n    echo -n \" checksum='${checksum%% *}';\"\n\n    # A newline after the metadata and then the snapshot lines.\n    echo \"\\n$snapshot_content\"\n\n  } > \"$snapshot_file\"\n}\n# Loads a given theme.\n#\n# Shares the same syntax as antigen-bundle command.\n#\n# Usage\n#   antigen-theme [path] [zsh/theme[.zsh-theme]]\n#\n# Returns\n#   0 if everything was succesfully\nantigen-theme () {\n  local name=$1 result=0 record=$1\n\n  # Verify arguments are passed properly.\n  if [[ -z \"$name\" ]]; then\n    printf \"Antigen: Must provide a theme url or name.\\n\" >&2\n    return 1\n  fi\n\n  # Generate record name based off path and name for themes loaded from local paths,\n  # this also supports themes loaded from the same repository.\n  if [[ $name = */* ]]; then\n     record=\"$1 ${2:-/}\"\n  fi\n\n  local match mbegin mend MATCH MBEGIN MEND\n\n  # Verify theme hasn't been loaded previously.\n  if [[ \"$_ANTIGEN_THEME\" == \"$record\" ]]; then\n    printf \"Antigen: Theme \\\"%s\\\" is already active.\\n\" $name >&2\n    return 1\n  fi\n\n  # Remove currently active hooks, this may leave the prompt broken if the\n  # new theme is not found/can not be loaded. We should have a way to test if\n  # a theme/bundle can be loaded/exists.\n  #-antigen-theme-reset-hooks\n\n  if [[ \"$1\" != */* && \"$1\" != --* ]]; then\n    # The first argument is just a name of the plugin, to be picked up from\n    # the default repo.\n    antigen-bundle --loc=themes/$name --btype=theme\n\n  else\n    antigen-bundle \"$@\" --btype=theme\n\n  fi\n  result=$?\n\n  # Do remove theme record if we're successful at loading this one.\n  if [[ $result == 0 ]]; then\n    # Remove theme from record if there was one registered.\n    if [[ \"$_ANTIGEN_THEME\" != \"\" && $_ANTIGEN_BUNDLE_RECORD[(I)*$_ANTIGEN_THEME*] > 0 ]]; then\n      _ANTIGEN_BUNDLE_RECORD[$_ANTIGEN_BUNDLE_RECORD[(I)*$_ANTIGEN_THEME*]]=()\n    fi\n    \n    # Set new theme as active.\n    _ANTIGEN_THEME=$record\n  fi\n\n  return $result\n}\n\n-antigen-theme-reset-hooks () {\n  # This is only needed on interactive mode\n  autoload -U add-zsh-hook is-at-least\n  local hook\n\n  # Clear out prompts\n  PROMPT=\"\"\n  if [[ -n $RPROMPT ]]; then\n    RPROMPT=\"\"\n  fi\n\n  for hook in chpwd precmd preexec periodic; do\n    add-zsh-hook -D \"${hook}\" \"prompt_*\"\n    # common in omz themes\n    add-zsh-hook -D \"${hook}\" \"*_${hook}\"\n    add-zsh-hook -d \"${hook}\" \"vcs_info\"\n  done\n}\n# Updates the bundles or a single bundle.\n#\n# Usage\n#    antigen-update [example/bundle]\n#\n# Returns\n#    Nothing. Performs a `git pull`.\nantigen-update () {\n  local bundle=$1 url\n\n  # Clear log\n  :> $ANTIGEN_LOG\n\n  # Update revert-info data\n  -antigen-revert-info\n\n  # If no argument is given we update all bundles\n  if [[ $# -eq 0  ]]; then\n    # Here we're ignoring all non cloned bundles (ie, --no-local-clone)\n    -antigen-get-cloned-bundles | while read url; do\n      -antigen-update-bundle $url\n    done\n    # TODO next minor version\n    # antigen-reset\n  else\n    if -antigen-update-bundle $bundle; then\n      # TODO next minor version\n      # antigen-reset\n    else\n      return $?\n    fi\n  fi\n}\n\n# Updates a bundle performing a `git pull`.\n#\n# Usage\n#    -antigen-update-bundle example/bundle\n#\n# Returns\n#    Nothing. Performs a `git pull`.\n-antigen-update-bundle () {\n  local bundle=\"$1\"\n  local record=\"\"\n  local url=\"\"\n  local make_local_clone=\"\"\n  local start=$(date +'%s')\n    \n  if [[ $# -eq 0 ]]; then\n    printf \"Antigen: Missing argument.\\n\" >&2\n    return 1\n  fi\n\n  record=$(-antigen-find-record $bundle)\n  if [[ ! -n \"$record\" ]]; then\n    printf \"Bundle not found in record. Try 'antigen bundle %s' first.\\n\" $bundle >&2\n    return 1\n  fi\n\n  url=\"$(echo \"$record\" | cut -d' ' -f1)\"\n  make_local_clone=$(echo \"$record\" | cut -d' ' -f4)\n  \n  local branch=\"master\"\n  if [[ $url == *\\|* ]]; then\n    branch=\"$(-antigen-parse-branch ${url%|*} ${url#*|})\"\n  fi\n\n  printf \"Updating %s... \" $(-antigen-bundle-short-name \"$url\" \"$branch\")\n  \n  if [[ $make_local_clone == \"false\" ]]; then\n    printf \"Bundle has no local clone. Will not be updated.\\n\" >&2\n    return 1\n  fi\n\n  # update=true verbose=false\n  if ! -antigen-ensure-repo \"$url\" true false; then\n    printf \"Error! Activate logging and try again.\\n\" >&2\n    return 1\n  fi\n  \n  local took=$(( $(date +'%s') - $start ))\n  printf \"Done. Took %ds.\\n\" $took\n}\nantigen-use () {\n  if [[ $1 == oh-my-zsh ]]; then\n    -antigen-use-oh-my-zsh\n  elif [[ $1 == prezto ]]; then\n    -antigen-use-prezto\n  elif [[ $1 != \"\" ]]; then\n    ANTIGEN_DEFAULT_REPO_URL=$1\n    antigen-bundle $@\n  else\n    echo 'Usage: antigen-use <library-name|url>' >&2\n    echo 'Where <library-name> is any one of the following:' >&2\n    echo ' * oh-my-zsh' >&2\n    echo ' * prezto' >&2\n    echo '<url> is the full url.' >&2\n    return 1\n  fi\n}\nantigen-version () {\n  local extensions\n\n  printf \"Antigen %s (%s)\\nRevision date: %s\\n\" \"develop\" \"d1dd78b\" \"2018-01-15 14:37:21 -0300\"\n\n  # Show extension information if any is available\n  if (( $+functions[antigen-ext] )); then\n    typeset -a extensions; extensions=($(antigen-ext-list))\n    if [[ $#extensions -gt 0 ]]; then\n      printf \"Extensions loaded: %s\\n\" ${(j:, :)extensions}\n    fi\n  fi\n}\ntypeset -Ag _ANTIGEN_HOOKS; _ANTIGEN_HOOKS=()\ntypeset -Ag _ANTIGEN_HOOKS_META; _ANTIGEN_HOOKS_META=()\ntypeset -g _ANTIGEN_HOOK_PREFIX=\"-antigen-hook-\"\ntypeset -g _ANTIGEN_EXTENSIONS; _ANTIGEN_EXTENSIONS=()\n\n# -antigen-add-hook antigen-apply antigen-apply-hook replace\n#   - Replaces hooked function with hook, do not call hooked function\n#   - Return -1 to stop calling further hooks\n# -antigen-add-hook antigen-apply antigen-apply-hook pre (pre-call)\n#   - By default it will call hooked function\n# -antigen-add-hook antigen-pply antigen-apply-hook post (post-call)\n#   - Calls antigen-apply and then calls hook function\n# Usage:\n#  -antigen-add-hook antigen-apply antigen-apply-hook [\"replace\"|\"pre\"|\"post\"] [\"once\"|\"repeat\"]\nantigen-add-hook () {\n  local target=\"$1\" hook=\"$2\" type=\"$3\" mode=\"${4:-repeat}\"\n  \n  if (( ! $+functions[$target] )); then\n    printf \"Antigen: Function %s doesn't exist.\\n\" $target\n    return 1\n  fi\n\n  if (( ! $+functions[$hook] )); then\n    printf \"Antigen: Function %s doesn't exist.\\n\" $hook\n    return 1\n  fi\n\n  if [[ \"${_ANTIGEN_HOOKS[$target]}\" == \"\" ]]; then\n    _ANTIGEN_HOOKS[$target]=\"${hook}\"\n  else\n    _ANTIGEN_HOOKS[$target]=\"${_ANTIGEN_HOOKS[$target]}:${hook}\"\n  fi\n\n  _ANTIGEN_HOOKS_META[$hook]=\"target $target type $type mode $mode called 0\"\n  \n  # Do shadow for this function if there is none already\n  local hook_function=\"${_ANTIGEN_HOOK_PREFIX}$target\"\n  if (( ! $+functions[$hook_function] )); then\n    # Preserve hooked function\n    eval \"function ${_ANTIGEN_HOOK_PREFIX}$(functions -- $target)\"\n\n    # Create hook, call hook-handler to further process hook functions\n    eval \"function $target () {\n      noglob -antigen-hook-handler $target \\$@\n      return \\$?\n    }\"\n  fi\n  \n  return 0\n}\n\n# Private function to handle multiple hooks in a central point.\n-antigen-hook-handler () {\n  local target=\"$1\" args hook called\n  local hooks meta\n  shift\n  typeset -a args; args=(${@})\n\n  typeset -a pre_hooks replace_hooks post_hooks;\n  typeset -a hooks; hooks=(${(s|:|)_ANTIGEN_HOOKS[$target]})\n  \n  typeset -A meta;\n  for hook in $hooks; do\n    meta=(${(s: :)_ANTIGEN_HOOKS_META[$hook]})\n    if [[ ${meta[mode]} == \"once\" && ${meta[called]} == 1 ]]; then\n      WARN \"Ignoring hook due to mode ${meta[mode]}: $hook\"\n      continue\n    fi\n\n    let called=${meta[called]}+1\n    meta[called]=$called\n    _ANTIGEN_HOOKS_META[$hook]=\"${(kv)meta}\"\n    WARN \"Updated meta: \"${(kv)meta}\n\n    case \"${meta[type]}\" in\n      \"pre\")\n      pre_hooks+=($hook)\n      ;;\n      \"replace\")\n      replace_hooks+=($hook)\n      ;;\n      \"post\")\n      post_hooks+=($hook)\n      ;;\n    esac\n  done\n\n  WARN \"Processing hooks: ${hooks}\"\n\n  for hook in $pre_hooks; do\n    WARN \"Pre hook:\" $hook $args\n    noglob $hook $args\n    [[ $? == -1 ]] && WARN \"$hook shortcircuited\" && return $ret\n  done\n\n  # A replace hook will return inmediately\n  local replace_hook=0 ret=0\n  for hook in $replace_hooks; do\n    replace_hook=1\n    # Should not be needed if `antigen-remove-hook` removed unneeded hooks.\n    if (( $+functions[$hook] )); then\n      WARN \"Replace hook:\" $hook $args\n      noglob $hook $args\n      [[ $? == -1 ]] && WARN \"$hook shortcircuited\" && return $ret\n    fi\n  done\n  \n  if [[ $replace_hook == 0 ]]; then\n    WARN \"${_ANTIGEN_HOOK_PREFIX}$target $args\"\n    noglob ${_ANTIGEN_HOOK_PREFIX}$target $args\n    ret=$?\n  else\n    WARN \"Replaced hooked function.\"\n  fi\n\n  for hook in $post_hooks; do\n    WARN \"Post hook:\" $hook $args\n    noglob $hook $args\n    [[ $? == -1 ]] && WARN \"$hook shortcircuited\" && return $ret\n  done\n  \n  LOG \"Return from hook ${target} with ${ret}\"\n\n  return $ret\n}\n\n# Usage:\n#  -antigen-remove-hook antigen-apply-hook\nantigen-remove-hook () {\n  local hook=\"$1\"\n  typeset -A meta; meta=(${(s: :)_ANTIGEN_HOOKS_META[$hook]})\n  local target=\"${meta[target]}\"\n  local -a hooks; hooks=(${(s|:|)_ANTIGEN_HOOKS[$target]})\n\n  # Remove registered hook\n  if [[ $#hooks > 0 ]]; then\n    hooks[$hooks[(I)$hook]]=()\n  fi\n  _ANTIGEN_HOOKS[${target}]=\"${(j|:|)hooks}\"\n  \n  if [[ $#hooks == 0 ]]; then\n    # Destroy base hook\n    eval \"function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)\"\n    if (( $+functions[${_ANTIGEN_HOOK_PREFIX}$target] )); then\n      unfunction -- \"${_ANTIGEN_HOOK_PREFIX}$target\"\n    fi\n  fi\n\n  unfunction -- $hook 2> /dev/null\n}\n\n# Remove all defined hooks.\n-antigen-reset-hooks () {\n  local target\n\n  for target in ${(k)_ANTIGEN_HOOKS}; do\n    # Release all hooked functions\n    eval \"function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)\"\n    unfunction -- \"${_ANTIGEN_HOOK_PREFIX}$target\" 2> /dev/null\n  done\n  \n  _ANTIGEN_HOOKS=()\n  _ANTIGEN_HOOKS_META=()\n  _ANTIGEN_EXTENSIONS=()\n}\n\n# Initializes an extension\n# Usage:\n#  antigen-ext ext-name\nantigen-ext () {\n  local ext=$1\n  local func=\"-antigen-$ext-init\"\n  if (( $+functions[$func] && $_ANTIGEN_EXTENSIONS[(I)$ext] == 0 )); then\n    eval $func\n    local ret=$?\n    WARN \"$func return code was $ret\"\n    if (( $ret == 0 )); then \n      LOG \"LOADED EXTENSION $ext\" EXT\n      -antigen-$ext-execute && _ANTIGEN_EXTENSIONS+=($ext)\n    else\n      WARN \"IGNORING EXTENSION $func\" EXT\n      return 1\n    fi\n    \n  else\n    printf \"Antigen: No extension defined or already loaded: %s\\n\" $func >&2\n    return 1\n  fi\n}\n\n# List installed extensions\n# Usage:\n#   antigen ext-list\nantigen-ext-list () {\n  echo $_ANTIGEN_EXTENSIONS\n}\n\n# Initializes built-in extensions\n# Usage:\n#   antigen-ext-init\nantigen-ext-init () {\n  # Initialize extensions. unless in interactive mode.\n  local ext\n  for ext in ${(s/ /)_ANTIGEN_BUILTIN_EXTENSIONS}; do\n    # Check if extension is loaded before intializing it\n    (( $+functions[-antigen-$ext-init] )) && antigen-ext $ext\n  done\n}\n# Initialize defer lib\n-antigen-defer-init () {\n  typeset -ga _DEFERRED_BUNDLE; _DEFERRED_BUNDLE=()\n  if -antigen-interactive-mode; then\n    return 1\n  fi\n}\n\n-antigen-defer-execute () {\n  # Hooks antigen-bundle in order to defer its execution.\n  antigen-bundle-defer () {\n    _DEFERRED_BUNDLE+=(\"${(j: :)${@}}\")\n    return -1 # Stop right there\n  }\n  antigen-add-hook antigen-bundle antigen-bundle-defer replace\n  \n  # Hooks antigen-apply in order to release hooked functions\n  antigen-apply-defer () {\n    WARN \"Defer pre-apply\" DEFER PRE-APPLY\n    antigen-remove-hook antigen-bundle-defer\n\n    # Process all deferred bundles.\n    local bundle\n    for bundle in ${_DEFERRED_BUNDLE[@]}; do\n      LOG \"Processing deferred bundle: ${bundle}\" DEFER\n      antigen-bundle $bundle\n    done\n\n    unset _DEFERRED_BUNDLE\n  }\n  antigen-add-hook antigen-apply antigen-apply-defer pre once\n}\n# Initialize lock lib\n-antigen-lock-init () {\n  # Default lock path.\n  -antigen-set-default ANTIGEN_LOCK $ADOTDIR/.lock\n  typeset -g _ANTIGEN_LOCK_PROCESS=false\n  \n  # Use env variable to determine if we should load this extension\n  -antigen-set-default ANTIGEN_MUTEX true\n  # Set ANTIGEN_MUTEX to false to avoid loading this extension\n  if [[ $ANTIGEN_MUTEX == true ]]; then\n    return 0;\n  fi\n  \n  # Do not use mutex\n  return 1;\n}\n\n-antigen-lock-execute () {\n  # Hook antigen command in order to check/create a lock file.\n  # This hook is only run once then releases itself.\n  antigen-lock () {\n    LOG \"antigen-lock called\"\n    # If there is a lock set up then we won't process anything.\n    if [[ -f $ANTIGEN_LOCK ]]; then\n      # Set up flag do the message is not repeated for each antigen-* command\n      [[ $_ANTIGEN_LOCK_PROCESS == false ]] && printf \"Antigen: Another process in running.\\n\"\n      _ANTIGEN_LOCK_PROCESS=true\n      # Do not further process hooks. For this hook to properly work it\n      # should be registered first.\n      return -1\n    fi\n\n    WARN \"Creating antigen-lock file at $ANTIGEN_LOCK\"\n    touch $ANTIGEN_LOCK\n  }\n  antigen-add-hook antigen antigen-lock pre once\n\n  # Hook antigen-apply in order to release .lock file.\n  antigen-apply-lock () {\n    WARN \"Freeing antigen-lock file at $ANTIGEN_LOCK\"\n    unset _ANTIGEN_LOCK_PROCESS\n    rm -f $ANTIGEN_LOCK &> /dev/null\n  }\n  antigen-add-hook antigen-apply antigen-apply-lock post once\n}\n# Initialize parallel lib\n-antigen-parallel-init () {\n  WARN \"Init parallel extension\" PARALLEL\n  typeset -ga _PARALLEL_BUNDLE; _PARALLEL_BUNDLE=()\n  if -antigen-interactive-mode; then\n    return 1\n  fi\n}\n\n-antigen-parallel-execute() {\n  WARN \"Exec parallel extension\" PARALLEL\n  # Install bundles in parallel\n  antigen-bundle-parallel-execute () {\n    WARN \"Parallel antigen-bundle-parallel-execute\" PARALLEL\n    typeset -a pids; pids=()\n    local args pid\n\n    WARN \"Gonna install in parallel ${#_PARALLEL_BUNDLE} bundles.\" PARALLEL\n    # Do ensure-repo in parallel\n    WARN \"${_PARALLEL_BUNDLE}\" PARALLEL\n    typeset -Ua repositories # Used to keep track of cloned repositories to avoid\n                             # trying to clone it multiple times.\n    for args in ${_PARALLEL_BUNDLE}; do\n      typeset -A bundle; -antigen-parse-args 'bundle' ${=args}\n\n      if [[ ! -d ${bundle[dir]} && $repositories[(I)${bundle[url]}] == 0 ]]; then\n        WARN \"Install in parallel ${bundle[name]}.\" PARALLEL\n        echo \"Installing ${bundle[name]}!...\"\n        # $bundle[url]'s format is \"url|branch\" as to create \"$ANTIGEN_BUNDLES/bundle/name-branch\",\n        # this way you may require multiple branches from the same repository.\n        -antigen-ensure-repo \"${bundle[url]}\" > /dev/null &!\n        pids+=($!)\n      else\n        WARN \"Bundle ${bundle[name]} already cloned locally.\" PARALLEL\n      fi\n      \n      repositories+=(${bundle[url]})\n    done\n\n    # Wait for all background processes to end\n    while [[ $#pids > 0 ]]; do\n      for pid in $pids; do\n        # `ps` may diplay an error message such \"Signal 18 (CONT) caught by ps\n        # (procps-ng version 3.3.9).\", see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732410\n        if [[ $(ps -o pid= -p $pid 2>/dev/null) == \"\" ]]; then\n          pids[$pids[(I)$pid]]=()\n        fi\n      done\n      sleep .5\n    done\n\n    builtin local bundle &> /dev/null\n    for bundle in ${_PARALLEL_BUNDLE[@]}; do\n      antigen-bundle $bundle\n    done\n    \n\n    WARN \"Parallel install done\" PARALLEL\n  }\n\n  # Hooks antigen-apply in order to release hooked functions\n  antigen-apply-parallel () {\n    WARN \"Parallel pre-apply\" PARALLEL PRE-APPLY\n    #antigen-remove-hook antigen-pre-apply-parallel\n    # Hooks antigen-bundle in order to parallel its execution.\n    antigen-bundle-parallel () {\n      TRACE \"antigen-bundle-parallel: $@\" PARALLEL\n      _PARALLEL_BUNDLE+=(\"${(j: :)${@}}\")\n    }\n    antigen-add-hook antigen-bundle antigen-bundle-parallel replace\n  }\n  antigen-add-hook antigen-apply antigen-apply-parallel pre once\n  \n  antigen-apply-parallel-execute () {\n      WARN \"Parallel replace-apply\" PARALLEL REPLACE-APPLY\n      antigen-remove-hook antigen-bundle-parallel\n      # Process all parallel bundles.\n      antigen-bundle-parallel-execute\n\n      unset _PARALLEL_BUNDLE\n      antigen-remove-hook antigen-apply-parallel-execute\n      antigen-apply\n  }\n  antigen-add-hook antigen-apply antigen-apply-parallel-execute replace once\n}\ntypeset -ga _ZCACHE_BUNDLE_SOURCE _ZCACHE_CAPTURE_BUNDLE\ntypeset -g _ZCACHE_CAPTURE_PREFIX\n\n# Generates cache from listed bundles.\n#\n# Iterates over _ANTIGEN_BUNDLE_RECORD and join all needed sources into one,\n# if this is done through -antigen-load-list.\n# Result is stored in ANTIGEN_CACHE.\n#\n# _ANTIGEN_BUNDLE_RECORD and fpath is stored in cache.\n#\n# Usage\n#   -zcache-generate-cache\n#\n# Returns\n#   Nothing. Generates ANTIGEN_CACHE\n-antigen-cache-generate () {\n  local -aU _fpath _PATH _sources\n  local record\n\n  LOG \"Gonna generate cache for $_ZCACHE_BUNDLE_SOURCE\"\n  for record in $_ZCACHE_BUNDLE_SOURCE; do\n    record=${record:A}\n    # LOG \"Caching $record\"\n    if [[ -f $record ]]; then\n      # Adding $'\\n' as a suffix as j:\\n: doesn't work inside a heredoc.\n      if [[ $_ANTIGEN_THEME_COMPAT == true && \"$record\" == *.zsh-theme* ]]; then\n        local compat=\"${record:A}.antigen-compat\"\n        echo \"# Generated by Antigen. Do not edit!\" >! \"$compat\"\n        cat $record | sed -Ee '/\\{$/,/^\\}/!{\n             s/^local //\n         }' >>! \"$compat\"\n        record=\"$compat\"\n      fi\n      _sources+=(\"source '${record}';\"$'\\n')\n    elif [[ -d $record ]]; then\n      _PATH+=(\"${record}\")\n      _fpath+=(\"${record}\")\n    fi\n  done\n\ncat > $ANTIGEN_CACHE <<EOC\n#-- START ZCACHE GENERATED FILE\n#-- GENERATED: $(date)\n#-- ANTIGEN develop\n$(functions -- _antigen)\nantigen () {\n  local MATCH MBEGIN MEND\n  [[ \"\\$ZSH_EVAL_CONTEXT\" =~ \"toplevel:*\" || \"\\$ZSH_EVAL_CONTEXT\" =~ \"cmdarg:*\" ]] && source \"$_ANTIGEN_INSTALL_DIR/antigen.zsh\" && eval antigen \\$@;\n  return 0;\n}\ntypeset -gaU fpath path\nfpath+=(${_fpath[@]}) path+=(${_PATH[@]})\n_antigen_compinit () {\n  autoload -Uz compinit; compinit $ANTIGEN_COMPINIT_OPTS -d \"$ANTIGEN_COMPDUMP\"; compdef _antigen antigen\n  add-zsh-hook -D precmd _antigen_compinit\n}\nautoload -Uz add-zsh-hook; add-zsh-hook precmd _antigen_compinit\ncompdef () {}\n\nif [[ -n \"$ZSH\" ]]; then\n  ZSH=\"$ZSH\"; ZSH_CACHE_DIR=\"$ZSH_CACHE_DIR\"\nfi\n#--- BUNDLES BEGIN\n${(j::)_sources}\n#--- BUNDLES END\ntypeset -gaU _ANTIGEN_BUNDLE_RECORD; _ANTIGEN_BUNDLE_RECORD=($(print ${(qq)_ANTIGEN_BUNDLE_RECORD}))\ntypeset -g _ANTIGEN_CACHE_LOADED; _ANTIGEN_CACHE_LOADED=true\ntypeset -ga _ZCACHE_BUNDLE_SOURCE; _ZCACHE_BUNDLE_SOURCE=($(print ${(qq)_ZCACHE_BUNDLE_SOURCE}))\ntypeset -g _ANTIGEN_CACHE_VERSION; _ANTIGEN_CACHE_VERSION='develop'\ntypeset -g _ANTIGEN_THEME; _ANTIGEN_THEME='$_ANTIGEN_THEME'\n\n#-- END ZCACHE GENERATED FILE\nEOC\n\n  { zcompile \"$ANTIGEN_CACHE\" } &!\n\n  # Compile config files, if any\n  LOG \"CHECK_FILES $ANTIGEN_CHECK_FILES\"\n  [[ $ANTIGEN_AUTO_CONFIG == true && -n $ANTIGEN_CHECK_FILES ]] && {\n    echo ${(j:\\n:)ANTIGEN_CHECK_FILES} >! \"$ANTIGEN_RSRC\"\n    for rsrc in $ANTIGEN_CHECK_FILES; do\n      zcompile $rsrc\n    done\n  } &!\n\n  return true\n}\n\n# Initializes caching mechanism.\n#\n# Hooks `antigen-bundle` and `antigen-apply` in order to defer bundle install\n# and load. All bundles are loaded from generated cache rather than dynamically\n# as these are bundled.\n#\n# Usage\n#  -antigen-cache-init\n# Returns\n#  Nothing\n-antigen-cache-init () {\n  if -antigen-interactive-mode; then\n    return 1\n  fi\n\n  _ZCACHE_CAPTURE_PREFIX=${_ZCACHE_CAPTURE_PREFIX:-\"--zcache-\"}\n  _ZCACHE_BUNDLE_SOURCE=(); _ZCACHE_CAPTURE_BUNDLE=()\n\n  # Cache auto config files to check for changes (.zshrc, .antigenrc etc)\n  -antigen-set-default ANTIGEN_AUTO_CONFIG true\n  \n  # Default cache path.\n  -antigen-set-default ANTIGEN_CACHE $ADOTDIR/init.zsh\n  -antigen-set-default ANTIGEN_RSRC $ADOTDIR/.resources\n  if [[ $ANTIGEN_CACHE == false ]]; then\n    return 1\n  fi\n  \n  return 0\n}\n\n-antigen-cache-execute () {\n  # Main function. Deferred antigen-apply.\n  antigen-apply-cached () {\n    # TRACE \"APPLYING CACHE\" EXT\n    # Auto determine check_files\n    # There always should be 5 steps from original source as the correct way is to use\n    # `antigen` wrapper not `antigen-apply` directly and it's called by an extension.\n    LOG \"TRACE: ${funcfiletrace}\"\n    if [[ $ANTIGEN_AUTO_CONFIG == true && $#ANTIGEN_CHECK_FILES -eq 0 ]]; then\n      # Check common configuration file does exist.\n      if [[ -f ${ZDOTDIR:-$HOME}/.zshrc ]]; then\n        ANTIGEN_CHECK_FILES+=(${ZDOTDIR:-$HOME}/.zshrc)\n      fi\n      # TODO Fix: Fuzzy match shoud be replaced by a sane way to determine it.\n      if [[ $#funcfiletrace -ge 6 ]]; then\n        ANTIGEN_CHECK_FILES+=(\"${${funcfiletrace[6]%:*}##* }\")\n      fi\n    fi\n\n    # Generate and compile cache\n    -antigen-cache-generate\n    [[ -f \"$ANTIGEN_CACHE\" ]] && source \"$ANTIGEN_CACHE\";\n\n    # Commented out in order to have a working `cache-gen` command\n    #unset _ZCACHE_BUNDLE_SOURCE\n    unset _ZCACHE_CAPTURE_BUNDLE _ZCACHE_CAPTURE_FUNCTIONS\n\n    # Release all hooked functions\n    antigen-remove-hook -antigen-load-env-cached\n    antigen-remove-hook -antigen-load-source-cached\n    antigen-remove-hook antigen-bundle-cached\n  }\n  \n  antigen-add-hook antigen-apply antigen-apply-cached post once\n  \n  # Defer antigen-bundle.\n  antigen-bundle-cached () {\n    # Return an error is not bundle name/url is passed or a heredoc is misused,\n    # see https://github.com/zsh-users/antigen/issues/602\n    if [[ $# -eq 0 ]]; then\n      printf \"Antigen: Must provide a bundle url or name.\\n\" >&2\n      return 1\n    fi\n    _ZCACHE_CAPTURE_BUNDLE+=(\"${(j: :)${@}}\")\n  }\n  antigen-add-hook antigen-bundle antigen-bundle-cached pre\n  \n  # Defer loading.\n  -antigen-load-env-cached () {\n    local bundle\n    typeset -A bundle; bundle=($@)\n    local location=${bundle[dir]}/${bundle[loc]}\n    \n    # Load to path if there is no sourceable\n    if [[ ${bundle[loc]} == \"/\" ]]; then\n      _ZCACHE_BUNDLE_SOURCE+=(\"${location}\")\n      return\n    fi\n\n    _ZCACHE_BUNDLE_SOURCE+=(\"${location}\")\n  }\n  antigen-add-hook -antigen-load-env -antigen-load-env-cached replace\n  \n  # Defer sourcing.\n  -antigen-load-source-cached () {\n    _ZCACHE_BUNDLE_SOURCE+=($@)\n  }\n  antigen-add-hook -antigen-load-source -antigen-load-source-cached replace\n  \n  return 0\n}\n\n# Generate static-cache file at $ANTIGEN_CACHE using currently loaded\n# bundles from $_ANTIGEN_BUNDLE_RECORD\n#\n# Usage\n#   antigen-cache-gen\n#\n# Returns\n#   Nothing\nantigen-cache-gen () {\n  -antigen-cache-generate\n}\n#compdef _antigen\n# Setup antigen's autocompletion\n_antigen () {\n  local -a _1st_arguments\n  _1st_arguments=(\n    'apply:Load all bundle completions'\n    'bundle:Install and load the given plugin'\n    'bundles:Bulk define bundles'\n    'cleanup:Clean up the clones of repos which are not used by any bundles currently loaded'\n    'cache-gen:Generate cache'\n    'init:Load Antigen configuration from file'\n    'list:List out the currently loaded bundles'\n    'purge:Remove a cloned bundle from filesystem'\n    'reset:Clears cache'\n    'restore:Restore the bundles state as specified in the snapshot'\n    'revert:Revert the state of all bundles to how they were before the last antigen update'\n    'selfupdate:Update antigen itself'\n    'snapshot:Create a snapshot of all the active clones'\n    'theme:Switch the prompt theme'\n    'update:Update all bundles'\n    'use:Load any (supported) zsh pre-packaged framework'\n  );\n\n  _1st_arguments+=(\n    'help:Show this message'\n    'version:Display Antigen version'\n  )\n\n  __bundle() {\n    _arguments \\\n      '--loc[Path to the location <path-to/location>]' \\\n      '--url[Path to the repository <github-account/repository>]' \\\n      '--branch[Git branch name]' \\\n      '--no-local-clone[Do not create a clone]'\n  }\n  __list() {\n    _arguments \\\n      '--simple[Show only bundle name]' \\\n      '--short[Show only bundle name and branch]' \\\n      '--long[Show bundle records]'\n  }\n\n\n  __cleanup() {\n    _arguments \\\n      '--force[Do not ask for confirmation]'\n  }\n\n  _arguments '*:: :->command'\n\n  if (( CURRENT == 1 )); then\n    _describe -t commands \"antigen command\" _1st_arguments\n    return\n  fi\n\n  local -a _command_args\n  case \"$words[1]\" in\n    bundle)\n      __bundle\n      ;;\n    use)\n      compadd \"$@\" \"oh-my-zsh\" \"prezto\"\n      ;;\n    cleanup)\n      __cleanup\n      ;;\n    (update|purge)\n      compadd $(type -f \\-antigen-get-bundles &> /dev/null || antigen &> /dev/null; -antigen-get-bundles --simple 2> /dev/null)\n      ;;\n    theme)\n      compadd $(type -f \\-antigen-get-themes &> /dev/null || antigen &> /dev/null; -antigen-get-themes 2> /dev/null)\n      ;;\n    list)\n      __list\n    ;;\n  esac\n}\nzmodload zsh/datetime\nANTIGEN_DEBUG_LOG=${ANTIGEN_DEBUG_LOG:-${ADOTDIR:-$HOME/.antigen}/debug.log}\nLOG () {\n  local PREFIX=\"[LOG][${EPOCHREALTIME}]\"\n  echo \"${PREFIX} ${funcfiletrace[1]}\\n${PREFIX} $@\" >> $ANTIGEN_DEBUG_LOG\n}\n\nERR () {\n  local PREFIX=\"[ERR][${EPOCHREALTIME}]\"\n  echo \"${PREFIX} ${funcfiletrace[1]}\\n${PREFIX} $@\" >> $ANTIGEN_DEBUG_LOG\n}\n\nWARN () {\n  local PREFIX=\"[WRN][${EPOCHREALTIME}]\"\n  echo \"${PREFIX} ${funcfiletrace[1]}\\n${PREFIX} $@\" >> $ANTIGEN_DEBUG_LOG\n}\n\nTRACE () {\n  local PREFIX=\"[TRA][${EPOCHREALTIME}]\"\n  echo \"${PREFIX} ${funcfiletrace[1]}\\n${PREFIX} $@\\n${PREFIX} ${(j:\\n:)funcstack}\" >> $ANTIGEN_DEBUG_LOG\n}\n-antigen-env-setup\n"
  },
  {
    "path": "configure",
    "content": "#!/bin/zsh\n# vim: sw=2 ts=2 et!\ntarget=Makefile\narguments=\"$@\"\ntypeset -A opts;\nopts=(\nwith-debug      yes\nwith-extensions yes\nwith-lock \t    yes\nwith-parallel\t  yes\nwith-cache \t    yes\nwith-defer \t    yes\nwith-completion yes\n)\n\nif [[ $1 == \"--help\" || $1 == \"-h\" ]]; then\ncat >&1 <<EOH\nUsage:\n    ./configure --with-option[=[yes|no]] --[enable|disable]-option\n\nAvailable options:\n\n    - debug      - Enable/disable debug library\n    - extensions - Enable/disable lock, parallel, cache and defer options\n    - lock       - Enable/disable lock\n    - parallel   - Enable/disable parallel\n    - cache      - Enable/disable cache\n    - defer      - Enable/disable defer\n    - completion - Enable/disable completion\n\nAll options are enabled by default.\n\nExample:\n\n    # Disable lock, parallel, cache and defer\n    ./configure --disable-extensions\n\n    # Disable completion\n    ./configure --disable-completion\n    \n    # Enable debug\n    ./configure --with-debug\n\nEOH\n  exit 0 \nfi\n\n\nwhile [[ $# -gt 0 ]]; do\n\targkey=\"${1%\\=*}\"\n\tkey=\"${argkey//--/}\"\n  if [[ $key = enable-* || $key = disable-* ]]; then\n    if [[ $1 = *=* ]]; then\n      printf \"No options required for: %s (%s)\\n\" $argkey $1 >&2\n      exit 1\n    fi\n    [[ $key = enable-* ]] && value=yes || value=no\n    key=\"with-${key//enable-/}\"\n    key=\"${key//disable-/}\"\n    if [[ ! $opts[$key] ]]; then\n      printf \"Invalid option argument: %s (%s)\\n\" $argkey $key >&2\n      printf \"Valid options are: %s\\n\" ${(kj:, :)opts} >&2\n      exit 1\n    fi\n    \n    # Disable all extentions\n    if [[ $key == \"with-extensions\" && $value == \"no\" ]]; then\n      opts[with-lock]=no\n      opts[with-parallel]=no\n      opts[with-cache]=no\n      opts[with-defer]=no\n    fi\n  else\n    if [[ $1 = *=* ]]; then\n      value=\"${1#*=}\"\n    else\n      value=$opts[$key]\n    fi\n  fi\n\n  if [[ $opts[$key] != \"\" ]]; then\n    opts[$key]=$value\n  else\n    printf \"Invalid argument: %s (%s)\\n\" $key $1 >&2\n    exit 1\n  fi\n\n  shift\n\ndone\n\nBANNER_SEP=$(printf '%*s' 70 | tr ' ' '\\#')\n\ncat > $target <<EOM\n${BANNER_SEP}\n# This file was autogenerated by 'configure'. Do not edit it directly!\n# Invocation was: $0 $arguments\n${BANNER_SEP}\nEOM\n\n{\n  for config in ${(k)opts}; do\n    echo \"${${config:u}//-/_}=${opts[$config]}\"\n  done\n\n  echo ${BANNER_SEP}\n  cat Makefile.in\n} >> $target\n"
  },
  {
    "path": "src/_antigen",
    "content": "#compdef _antigen\n# Setup antigen's autocompletion\n_antigen () {\n  local -a _1st_arguments\n  _1st_arguments=(\n    'apply:Load all bundle completions'\n    'bundle:Install and load the given plugin'\n    'bundles:Bulk define bundles'\n    'cleanup:Clean up the clones of repos which are not used by any bundles currently loaded'\n    'cache-gen:Generate cache'\n    'init:Load Antigen configuration from file'\n    'list:List out the currently loaded bundles'\n    'purge:Remove a cloned bundle from filesystem'\n    'reset:Clears cache'\n    'restore:Restore the bundles state as specified in the snapshot'\n    'revert:Revert the state of all bundles to how they were before the last antigen update'\n    'selfupdate:Update antigen itself'\n    'snapshot:Create a snapshot of all the active clones'\n    'theme:Switch the prompt theme'\n    'update:Update all bundles'\n    'use:Load any (supported) zsh pre-packaged framework'\n  );\n\n  _1st_arguments+=(\n    'help:Show this message'\n    'version:Display Antigen version'\n  )\n\n  __bundle() {\n    _arguments \\\n      '--loc[Path to the location <path-to/location>]' \\\n      '--url[Path to the repository <github-account/repository>]' \\\n      '--branch[Git branch name]' \\\n      '--no-local-clone[Do not create a clone]'\n  }\n  __list() {\n    _arguments \\\n      '--simple[Show only bundle name]' \\\n      '--short[Show only bundle name and branch]' \\\n      '--long[Show bundle records]'\n  }\n\n\n  __cleanup() {\n    _arguments \\\n      '--force[Do not ask for confirmation]'\n  }\n\n  _arguments '*:: :->command'\n\n  if (( CURRENT == 1 )); then\n    _describe -t commands \"antigen command\" _1st_arguments\n    return\n  fi\n\n  local -a _command_args\n  case \"$words[1]\" in\n    bundle)\n      __bundle\n      ;;\n    use)\n      compadd \"$@\" \"oh-my-zsh\" \"prezto\"\n      ;;\n    cleanup)\n      __cleanup\n      ;;\n    (update|purge)\n      compadd $(type -f \\-antigen-get-bundles &> /dev/null || antigen &> /dev/null; -antigen-get-bundles --simple 2> /dev/null)\n      ;;\n    theme)\n      compadd $(type -f \\-antigen-get-themes &> /dev/null || antigen &> /dev/null; -antigen-get-themes 2> /dev/null)\n      ;;\n    list)\n      __list\n    ;;\n  esac\n}\n"
  },
  {
    "path": "src/antigen.zsh",
    "content": "[[ -z \"$_ANTIGEN_INSTALL_DIR\" ]] && _ANTIGEN_INSTALL_DIR=${0:A:h}\n\n# Each line in this string has the following entries separated by a space\n# character.\n# <repo-url>, <plugin-location>, <bundle-type>, <has-local-clone>\n[[ $_ANTIGEN_CACHE_LOADED != true ]] && typeset -aU _ANTIGEN_BUNDLE_RECORD\n\n# Do not load anything if git is not available.\nif (( ! $+commands[git] )); then\n    echo 'Antigen: Please install git to use Antigen.' >&2\n    return 1\nfi\n\n# Used to defer compinit/compdef\ntypeset -a __deferred_compdefs\ncompdef () { __deferred_compdefs=($__deferred_compdefs \"$*\") }\n\n# A syntax sugar to avoid the `-` when calling antigen commands. With this\n# function, you can write `antigen-bundle` as `antigen bundle` and so on.\nantigen () {\n  local cmd=\"$1\"\n  if [[ -z \"$cmd\" ]]; then\n    antigen-help >&2\n    return 1\n  fi\n  shift\n\n  if (( $+functions[antigen-$cmd] )); then\n      \"antigen-$cmd\" \"$@\"\n      return $?\n  else\n      echo \"Antigen: Unknown command: $cmd\" >&2\n      return 1\n  fi\n}\n"
  },
  {
    "path": "src/boot.zsh",
    "content": "zmodload zsh/parameter\nautoload -U is-at-least\n\n# While boot.zsh is part of the ext/cache functionallity it may be disabled\n# with ANTIGEN_CACHE flag, and it's always compiled with antigen.zsh\nif [[ $ANTIGEN_CACHE != false ]]; then\n  ANTIGEN_CACHE=\"${ANTIGEN_CACHE:-${ADOTDIR:-$HOME/.antigen}/init.zsh}\"\n  ANTIGEN_RSRC=\"${ANTIGEN_RSRC:-${ADOTDIR:-$HOME/.antigen}/.resources}\"\n\n  # It may not be necessary to check ANTIGEN_AUTO_CONFIG.\n  if [[ $ANTIGEN_AUTO_CONFIG != false && -f $ANTIGEN_RSRC ]]; then\n    # Check the list of files for configuration changes (uses -nt comp)\n    ANTIGEN_CHECK_FILES=$(cat $ANTIGEN_RSRC 2> /dev/null)\n    ANTIGEN_CHECK_FILES=(${(@f)ANTIGEN_CHECK_FILES})\n\n    for config in $ANTIGEN_CHECK_FILES; do\n      if [[ \"$config\" -nt \"$config.zwc\" ]]; then\n        # Flag configuration file as newer\n        { zcompile \"$config\" } &!\n        # Kill cache file in order to force full loading (see a few lines below)\n        [[ -f \"$ANTIGEN_CACHE\" ]] && rm -f \"$ANTIGEN_CACHE\"\n      fi\n    done\n  fi\n\n  # If there is a cache file do load from it\n  if [[ -f $ANTIGEN_CACHE && ! $_ANTIGEN_CACHE_LOADED == true ]]; then\n    # Wrap antigen in order to defer cache source until `antigen-apply`\n    antigen() {\n      if [[ $1 == \"apply\" ]]; then\n        source \"$ANTIGEN_CACHE\"\n      # Handle `antigen-init` command properly\n      elif [[ $1 == \"init\" ]]; then\n        source \"$2\"\n      fi\n    }\n    # Do not continue loading antigen as cache bundle takes care of it.\n    return 0\n  fi\nfi\n"
  },
  {
    "path": "src/commands/apply.zsh",
    "content": "# Initialize completion\nantigen-apply () {\n  LOG \"Called antigen-apply\"\n\n  # Load the compinit module. This will readefine the `compdef` function to\n  # the one that actually initializes completions.\n  TRACE \"Gonna create compdump file @ apply\" COMPDUMP\n  autoload -Uz compinit\n  compinit $ANTIGEN_COMPINIT_OPTS -d \"$ANTIGEN_COMPDUMP\"\n\n  # Apply all `compinit`s that have been deferred.\n  local cdef\n  for cdef in \"${__deferred_compdefs[@]}\"; do\n    compdef \"$cdef\"\n  done\n\n  { zcompile \"$ANTIGEN_COMPDUMP\" } &!\n\n  unset __deferred_compdefs\n}\n"
  },
  {
    "path": "src/commands/bundle.zsh",
    "content": "# Syntaxes\n#   antigen-bundle <url> [<loc>=/]\n# Keyword only arguments:\n#   branch - The branch of the repo to use for this bundle.\nantigen-bundle () {\n  TRACE \"Called antigen-bundle with $@\" BUNDLE\n  if [[ -z \"$1\" ]]; then\n    printf \"Antigen: Must provide a bundle url or name.\\n\" >&2\n    return 1\n  fi\n\n  builtin typeset -A bundle; -antigen-parse-args 'bundle' ${=@}\n  if [[ -z ${bundle[btype]} ]]; then\n    bundle[btype]=bundle\n  fi\n\n  local record=\"${bundle[url]} ${bundle[loc]} ${bundle[btype]} ${bundle[make_local_clone]}\"\n  if [[ $_ANTIGEN_WARN_DUPLICATES == true && ! ${_ANTIGEN_BUNDLE_RECORD[(I)$record]} == 0 ]]; then\n    printf \"Seems %s is already installed!\\n\" ${bundle[name]}\n    return 1\n  fi\n \n  # Clone bundle if we haven't done do already.\n  if [[ ! -d \"${bundle[dir]}\" ]]; then\n    if ! -antigen-bundle-install ${(kv)bundle}; then\n      return 1\n    fi\n  fi\n\n  # Load the plugin.\n  if ! -antigen-load ${(kv)bundle}; then\n    TRACE \"-antigen-load failed to load ${bundle[name]}\" BUNDLE\n    printf \"Antigen: Failed to load %s.\\n\" ${bundle[btype]} >&2\n    return 1\n  fi\n  \n  # Only add it to the record if it could be installed and loaded.\n  _ANTIGEN_BUNDLE_RECORD+=(\"$record\")\n}\n\n#\n# Usage:\n#   -antigen-bundle-install <record>\n# Returns:\n#   1 if it fails to install bundle\n-antigen-bundle-install () {\n  typeset -A bundle; bundle=($@)\n\n  # Ensure a clone exists for this repo, if needed.\n  # Get the clone's directory as per the given repo url and branch.\n  local bpath=\"${bundle[dir]}\"\n  # Clone if it doesn't already exist.\n  local start=$(date +'%s')\n\n  printf \"Installing %s... \" \"${bundle[name]}\"\n\n  if ! -antigen-ensure-repo \"${bundle[url]}\"; then\n    # Return immediately if there is an error cloning\n    TRACE \"-antigen-bundle-instal failed to clone ${bundle[url]}\" BUNDLE\n    printf \"Error! Activate logging and try again.\\n\" >&2\n    return 1\n  fi\n\n  local took=$(( $(date +'%s') - $start ))\n  printf \"Done. Took %ds.\\n\" $took\n}\n"
  },
  {
    "path": "src/commands/bundles.zsh",
    "content": "antigen-bundles () {\n  # Bulk add many bundles at one go. Empty lines and lines starting with a `#`\n  # are ignored. Everything else is given to `antigen-bundle` as is, no\n  # quoting rules applied.\n  local line\n  setopt localoptions no_extended_glob # See https://github.com/zsh-users/antigen/issues/456\n  eval \"$_ANTIGEN_GREP_COMMAND '^[[:space:]]*[^[:space:]#]'\" | while read line; do\n    antigen-bundle ${=line%#*}\n  done\n}\n"
  },
  {
    "path": "src/commands/cleanup.zsh",
    "content": "# Cleanup unused repositories.\nantigen-cleanup () {\n  local force=false\n  if [[ $1 == --force ]]; then\n    force=true\n  fi\n\n  if [[ ! -d \"$ANTIGEN_BUNDLES\" || -z \"$(\\ls -A \"$ANTIGEN_BUNDLES\")\" ]]; then\n    echo \"You don't have any bundles.\"\n    return 0\n  fi\n\n  # Find directores in ANTIGEN_BUNDLES, that are not in the bundles record.\n  typeset -a unused_clones clones\n\n  local url record clone\n  for record in $(-antigen-get-cloned-bundles); do\n    url=${record% /*}\n    clones+=(\"$(-antigen-get-clone-dir $url)\")\n  done\n\n  for clone in $ANTIGEN_BUNDLES/*/*(/); do\n    if [[ $clones[(I)$clone] == 0 ]]; then\n      unused_clones+=($clone)\n    fi\n  done\n\n  if [[ -z $unused_clones ]]; then\n    echo \"You don't have any unidentified bundles.\"\n    return 0\n  fi\n\n  echo 'You have clones for the following repos, but are not used.'\n  echo \"\\n${(j:\\n:)unused_clones}\"\n\n  if $force || (echo -n '\\nDelete them all? [y/N] '; read -q); then\n    echo\n    echo\n    for clone in $unused_clones; do\n      echo -n \"Deleting clone \\\"$clone\\\"...\"\n      \\rm -rf \"$clone\"\n\n      echo ' done.'\n    done\n  else\n    echo\n    echo \"Nothing deleted.\"\n  fi\n}\n"
  },
  {
    "path": "src/commands/help.zsh",
    "content": "antigen-help () {\n  antigen-version\n\n  cat <<EOF\n\nAntigen is a plugin management system for zsh. It makes it easy to grab awesome\nshell scripts and utilities, put up on Github.\n\nUsage: antigen <command> [args]\n\nCommands:\n  apply        Must be called in the zshrc after all calls to 'antigen bundle'.\n  bundle       Install and load a plugin.\n  cache-gen    Generate Antigen's cache with currently loaded bundles.\n  cleanup      Remove clones of repos not used by any loaded plugins.\n  init         Use caching to quickly load bundles.\n  list         List currently loaded plugins.\n  purge        Remove a bundle from the filesystem.\n  reset        Clean the generated cache.\n  restore      Restore plugin state from a snapshot file.\n  revert       Revert plugins to their state prior to the last time 'antigen\n               update' was run.\n  selfupdate   Update antigen.\n  snapshot     Create a snapshot of all active plugin repos and save it to a\n               snapshot file.\n  update       Update plugins.\n  use          Load a supported zsh pre-packaged framework.\n\nFor further details and complete documentation, visit the project's page at\n'http://antigen.sharats.me'.\nEOF\n}\n"
  },
  {
    "path": "src/commands/init.zsh",
    "content": "# Antigen command to load antigen configuration\n#\n# This method is slighlty more performing than using various antigen-* methods.\n#\n# Usage\n#   Referencing an antigen configuration file:\n#\n#       antigen-init \"/path/to/antigenrc\"\n#\n#   or using HEREDOCS:\n#\n#       antigen-init <<EOBUNDLES\n#           antigen use oh-my-zsh\n#\n#           antigen bundle zsh/bundle\n#           antigen bundle zsh/example\n#\n#           antigen theme zsh/theme\n#\n#           antigen apply\n#       EOBUNDLES\n#\n# Returns\n#   Nothing\nantigen-init () {\n  local src=\"$1\" line\n\n  # If we're given an argument it should be a path to a file\n  if [[ -n \"$src\" ]]; then\n    if [[ -f \"$src\" ]]; then\n      source \"$src\"\n      return\n    else\n      printf \"Antigen: invalid argument provided.\\n\" >&2\n      return 1\n    fi\n  fi\n\n  # Otherwise we expect it to be a heredoc\n  eval \"$_ANTIGEN_GREP_COMMAND '^[[:space:]]*[^[:space:]#]'\" | while read -r line; do\n    eval $line\n  done\n}\n"
  },
  {
    "path": "src/commands/list.zsh",
    "content": "# List instaled bundles either in long (record), short or simple format.\n#\n# Usage\n#    antigen-list [--short|--long|--simple]\n#\n# Returns\n#    List of bundles\nantigen-list () {\n  local format=$1\n\n  # List all currently installed bundles.\n  if [[ -z $_ANTIGEN_BUNDLE_RECORD ]]; then\n    echo \"You don't have any bundles.\" >&2\n    return 1\n  fi\n\n  -antigen-get-bundles $format\n}\n"
  },
  {
    "path": "src/commands/purge.zsh",
    "content": "# Remove a bundle from filesystem\n#\n# Usage\n#   antigen-purge example/bundle [--force]\n#\n# Returns\n#   Nothing. Removes bundle from filesystem.\nantigen-purge () {\n  local bundle=$1\n  local force=$2\n\n  if [[ $# -eq 0  ]]; then\n    echo \"Antigen: Missing argument.\" >&2\n    return 1\n  fi\n\n  if -antigen-purge-bundle $bundle $force; then\n    antigen-reset\n  else\n    return $?\n  fi\n\n  return 0\n}\n\n# Remove a bundle from filesystem\n#\n# Usage\n#   antigen-purge example/bundle [--force]\n#\n# Returns\n#   Nothing. Removes bundle from filesystem.\n-antigen-purge-bundle () {\n  local bundle=$1\n  local force=$2\n  local clone_dir=\"\"\n\n  local record=\"\"\n  local url=\"\"\n  local make_local_clone=\"\"\n\n  if [[ $# -eq 0  ]]; then\n    echo \"Antigen: Missing argument.\" >&2\n    return 1\n  fi\n\n  # local keyword doesn't work on zsh <= 5.0.0\n  record=$(-antigen-find-record $bundle)\n\n  if [[ ! -n \"$record\" ]]; then\n    echo \"Bundle not found in record. Try 'antigen bundle $bundle' first.\" >&2\n    return 1\n  fi\n\n  url=\"$(echo \"$record\" | cut -d' ' -f1)\"\n  make_local_clone=$(echo \"$record\" | cut -d' ' -f4)\n\n  if [[ $make_local_clone == \"false\" ]]; then\n    echo \"Bundle has no local clone. Will not be removed.\" >&2\n    return 1\n  fi\n\n  clone_dir=$(-antigen-get-clone-dir \"$url\")\n  if [[ $force == \"--force\" ]] || read -q \"?Remove '$clone_dir'? (y/n) \"; then\n    # Need empty line after read -q\n    [[ ! -n $force ]] && echo \"\" || echo \"Removing '$clone_dir'.\";\n    rm -rf \"$clone_dir\"\n    return $?\n  fi\n\n  return 1\n}\n"
  },
  {
    "path": "src/commands/reset.zsh",
    "content": "# Removes cache payload and metadata if available\n#\n# Usage\n#   antigen-reset\n#\n# Returns\n#   Nothing\nantigen-reset () {\n  [[ -f \"$ANTIGEN_CACHE\" ]] && rm -f \"$ANTIGEN_CACHE\" \"$ANTIGEN_CACHE.zwc\" 1> /dev/null\n  [[ -f \"$ANTIGEN_RSRC\" ]] && rm -f \"$ANTIGEN_RSRC\" 1> /dev/null\n  [[ -f \"$ANTIGEN_COMPDUMP\" ]] && rm -f \"$ANTIGEN_COMPDUMP\" \"$ANTIGEN_COMPDUMP.zwc\" 1> /dev/null\n  [[ -f \"$ANTIGEN_LOCK\" ]] && rm -f \"$ANTIGEN_LOCK\" 1> /dev/null\n  echo 'Done. Please open a new shell to see the changes.'\n}\n"
  },
  {
    "path": "src/commands/restore.zsh",
    "content": "antigen-restore () {\n  local line\n  if [[ $# == 0 ]]; then\n    echo 'Please provide a snapshot file to restore from.' >&2\n    return 1\n  fi\n\n  local snapshot_file=\"$1\"\n\n  # TODO: Before doing anything with the snapshot file, verify its checksum.\n  # If it fails, notify this to the user and confirm if restore should\n  # proceed.\n\n  echo -n \"Restoring from $snapshot_file...\"\n\n  sed -n '1!p' \"$snapshot_file\" |\n    while read line; do\n      local version_hash=\"${line%% *}\"\n      local url=\"${line##* }\"\n      local clone_dir=\"$(-antigen-get-clone-dir \"$url\")\"\n\n      if [[ ! -d $clone_dir ]]; then\n          git clone \"$url\" \"$clone_dir\" &> /dev/null\n      fi\n\n      (\\cd -q \"$clone_dir\" && git checkout $version_hash) &> /dev/null\n    done\n\n  echo ' done.'\n  echo 'Please open a new shell to get the restored changes.'\n}\n"
  },
  {
    "path": "src/commands/revert.zsh",
    "content": "# Reads $ADORDIR/revert-info and restores bundles' revision\nantigen-revert () {\n  local line\n  if [[ -f $ADOTDIR/revert-info ]]; then\n    cat $ADOTDIR/revert-info | sed -n '1!p' | while read line; do\n      local dir=\"$(echo \"$line\" | cut -d: -f1)\"\n      git --git-dir=\"$dir/.git\" --work-tree=\"$dir\" \\\n        checkout \"$(echo \"$line\" | cut -d: -f2)\" 2> /dev/null\n    done\n\n    echo \"Reverted to state before running -update on $(\n            cat $ADOTDIR/revert-info | sed -n '1p').\"\n\n  else\n    echo 'No revert information available. Cannot revert.' >&2\n    return 1\n  fi\n}\n"
  },
  {
    "path": "src/commands/self-update.zsh",
    "content": "# Update (with `git pull`) antigen itself.\n# TODO: Once update is finished, show a summary of the new commits, as a kind of\n# \"what's new\" message.\nantigen-selfupdate () {\n  (\\cd -q $_ANTIGEN_INSTALL_DIR\n   if [[ ! ( -d .git || -f .git ) ]]; then\n     echo \"Your copy of antigen doesn't appear to be a git clone. \" \\\n       \"The 'selfupdate' command cannot work in this case.\"\n     return 1\n   fi\n   local head=\"$(git rev-parse --abbrev-ref HEAD)\"\n   if [[ $head == \"HEAD\" ]]; then\n     # If current head is detached HEAD, checkout to master branch.\n     git checkout master\n   fi\n   git pull\n\n   # TODO Should be transparently hooked by zcache\n   antigen-reset &>> /dev/null\n  )\n}\n"
  },
  {
    "path": "src/commands/snapshot.zsh",
    "content": "antigen-snapshot () {\n  local snapshot_file=\"${1:-antigen-shapshot}\"\n  local urls url dir version_hash snapshot_content\n  local -a bundles\n\n  # The snapshot content lines are pairs of repo-url and git version hash, in\n  # the form:\n  #   <version-hash> <repo-url>\n  urls=$(-antigen-echo-record | awk '$4 == \"true\" {print $1}' | sort -u)\n  for url in ${(f)urls}; do\n    dir=\"$(-antigen-get-clone-dir \"$url\")\"\n    version_hash=\"$(\\cd -q \"$dir\" && git rev-parse HEAD)\"\n    bundles+=(\"$version_hash $url\");\n  done\n  snapshot_content=${(j:\\n:)bundles}\n\n  {\n    # The first line in the snapshot file is for metadata, in the form:\n    #   key='value'; key='value'; key='value';\n    # Where `key`s are valid shell variable names.\n\n    # Snapshot version. Has no relation to antigen version. If the snapshot\n    # file format changes, this number can be incremented.\n    echo -n \"version='1';\"\n\n    # Snapshot creation date+time.\n    echo -n \" created_on='$(date)';\"\n\n    # Add a checksum with the md5 checksum of all the snapshot lines.\n    chksum() { (md5sum; test $? = 127 && md5) 2>/dev/null | cut -d' ' -f1 }\n    local checksum=\"$(echo \"$snapshot_content\" | chksum)\"\n    unset -f chksum;\n    echo -n \" checksum='${checksum%% *}';\"\n\n    # A newline after the metadata and then the snapshot lines.\n    echo \"\\n$snapshot_content\"\n\n  } > \"$snapshot_file\"\n}\n"
  },
  {
    "path": "src/commands/theme.zsh",
    "content": "# Loads a given theme.\n#\n# Shares the same syntax as antigen-bundle command.\n#\n# Usage\n#   antigen-theme [path] [zsh/theme[.zsh-theme]]\n#\n# Returns\n#   0 if everything was succesfully\nantigen-theme () {\n  local name=$1 result=0 record=$1\n\n  # Verify arguments are passed properly.\n  if [[ -z \"$name\" ]]; then\n    printf \"Antigen: Must provide a theme url or name.\\n\" >&2\n    return 1\n  fi\n\n  # Generate record name based off path and name for themes loaded from local paths,\n  # this also supports themes loaded from the same repository.\n  if [[ $name = */* ]]; then\n     record=\"$1 ${2:-/}\"\n  fi\n\n  local match mbegin mend MATCH MBEGIN MEND\n\n  # Verify theme hasn't been loaded previously.\n  if [[ \"$_ANTIGEN_THEME\" == \"$record\" ]]; then\n    printf \"Antigen: Theme \\\"%s\\\" is already active.\\n\" $name >&2\n    return 1\n  fi\n\n  # Remove currently active hooks, this may leave the prompt broken if the\n  # new theme is not found/can not be loaded. We should have a way to test if\n  # a theme/bundle can be loaded/exists.\n  #-antigen-theme-reset-hooks\n\n  if [[ \"$1\" != */* && \"$1\" != --* ]]; then\n    # The first argument is just a name of the plugin, to be picked up from\n    # the default repo.\n    antigen-bundle --loc=themes/$name --btype=theme\n\n  else\n    antigen-bundle \"$@\" --btype=theme\n\n  fi\n  result=$?\n\n  # Do remove theme record if we're successful at loading this one.\n  if [[ $result == 0 ]]; then\n    # Remove theme from record if there was one registered.\n    if [[ \"$_ANTIGEN_THEME\" != \"\" && $_ANTIGEN_BUNDLE_RECORD[(I)*$_ANTIGEN_THEME*] > 0 ]]; then\n      _ANTIGEN_BUNDLE_RECORD[$_ANTIGEN_BUNDLE_RECORD[(I)*$_ANTIGEN_THEME*]]=()\n    fi\n    \n    # Set new theme as active.\n    _ANTIGEN_THEME=$record\n  fi\n\n  return $result\n}\n\n-antigen-theme-reset-hooks () {\n  # This is only needed on interactive mode\n  autoload -U add-zsh-hook is-at-least\n  local hook\n\n  # Clear out prompts\n  PROMPT=\"\"\n  if [[ -n $RPROMPT ]]; then\n    RPROMPT=\"\"\n  fi\n\n  for hook in chpwd precmd preexec periodic; do\n    add-zsh-hook -D \"${hook}\" \"prompt_*\"\n    # common in omz themes\n    add-zsh-hook -D \"${hook}\" \"*_${hook}\"\n    add-zsh-hook -d \"${hook}\" \"vcs_info\"\n  done\n}\n"
  },
  {
    "path": "src/commands/update.zsh",
    "content": "# Updates the bundles or a single bundle.\n#\n# Usage\n#    antigen-update [example/bundle]\n#\n# Returns\n#    Nothing. Performs a `git pull`.\nantigen-update () {\n  local bundle=$1 url\n\n  # Clear log\n  :> $ANTIGEN_LOG\n\n  # Update revert-info data\n  -antigen-revert-info\n\n  # If no argument is given we update all bundles\n  if [[ $# -eq 0  ]]; then\n    # Here we're ignoring all non cloned bundles (ie, --no-local-clone)\n    -antigen-get-cloned-bundles | while read url; do\n      -antigen-update-bundle $url\n    done\n    # TODO next minor version\n    # antigen-reset\n  else\n    if -antigen-update-bundle $bundle; then\n      # TODO next minor version\n      # antigen-reset\n    else\n      return $?\n    fi\n  fi\n}\n\n# Updates a bundle performing a `git pull`.\n#\n# Usage\n#    -antigen-update-bundle example/bundle\n#\n# Returns\n#    Nothing. Performs a `git pull`.\n-antigen-update-bundle () {\n  local bundle=\"$1\"\n  local record=\"\"\n  local url=\"\"\n  local make_local_clone=\"\"\n  local start=$(date +'%s')\n    \n  if [[ $# -eq 0 ]]; then\n    printf \"Antigen: Missing argument.\\n\" >&2\n    return 1\n  fi\n\n  record=$(-antigen-find-record $bundle)\n  if [[ ! -n \"$record\" ]]; then\n    printf \"Bundle not found in record. Try 'antigen bundle %s' first.\\n\" $bundle >&2\n    return 1\n  fi\n\n  url=\"$(echo \"$record\" | cut -d' ' -f1)\"\n  make_local_clone=$(echo \"$record\" | cut -d' ' -f4)\n  \n  local branch=\"master\"\n  if [[ $url == *\\|* ]]; then\n    branch=\"$(-antigen-parse-branch ${url%|*} ${url#*|})\"\n  fi\n\n  printf \"Updating %s... \" $(-antigen-bundle-short-name \"$url\" \"$branch\")\n  \n  if [[ $make_local_clone == \"false\" ]]; then\n    printf \"Bundle has no local clone. Will not be updated.\\n\" >&2\n    return 1\n  fi\n\n  # update=true verbose=false\n  if ! -antigen-ensure-repo \"$url\" true false; then\n    printf \"Error! Activate logging and try again.\\n\" >&2\n    return 1\n  fi\n  \n  local took=$(( $(date +'%s') - $start ))\n  printf \"Done. Took %ds.\\n\" $took\n}\n"
  },
  {
    "path": "src/commands/use.zsh",
    "content": "antigen-use () {\n  if [[ $1 == oh-my-zsh ]]; then\n    -antigen-use-oh-my-zsh\n  elif [[ $1 == prezto ]]; then\n    -antigen-use-prezto\n  elif [[ $1 != \"\" ]]; then\n    ANTIGEN_DEFAULT_REPO_URL=$1\n    antigen-bundle $@\n  else\n    echo 'Usage: antigen-use <library-name|url>' >&2\n    echo 'Where <library-name> is any one of the following:' >&2\n    echo ' * oh-my-zsh' >&2\n    echo ' * prezto' >&2\n    echo '<url> is the full url.' >&2\n    return 1\n  fi\n}\n"
  },
  {
    "path": "src/commands/version.zsh",
    "content": "antigen-version () {\n  local extensions\n\n  printf \"Antigen %s (%s)\\nRevision date: %s\\n\" \"{{ANTIGEN_VERSION}}\" \"{{ANTIGEN_REVISION}}\" \"{{ANTIGEN_REVISION_DATE}}\"\n\n  # Show extension information if any is available\n  if (( $+functions[antigen-ext] )); then\n    typeset -a extensions; extensions=($(antigen-ext-list))\n    if [[ $#extensions -gt 0 ]]; then\n      printf \"Extensions loaded: %s\\n\" ${(j:, :)extensions}\n    fi\n  fi\n}\n"
  },
  {
    "path": "src/ext/cache.zsh",
    "content": "typeset -ga _ZCACHE_BUNDLE_SOURCE _ZCACHE_CAPTURE_BUNDLE\ntypeset -g _ZCACHE_CAPTURE_PREFIX\n\n# Generates cache from listed bundles.\n#\n# Iterates over _ANTIGEN_BUNDLE_RECORD and join all needed sources into one,\n# if this is done through -antigen-load-list.\n# Result is stored in ANTIGEN_CACHE.\n#\n# _ANTIGEN_BUNDLE_RECORD and fpath is stored in cache.\n#\n# Usage\n#   -zcache-generate-cache\n#\n# Returns\n#   Nothing. Generates ANTIGEN_CACHE\n-antigen-cache-generate () {\n  local -aU _fpath _PATH _sources\n  local record\n\n  LOG \"Gonna generate cache for $_ZCACHE_BUNDLE_SOURCE\"\n  for record in $_ZCACHE_BUNDLE_SOURCE; do\n    record=${record:A}\n    # LOG \"Caching $record\"\n    if [[ -f $record ]]; then\n      # Adding $'\\n' as a suffix as j:\\n: doesn't work inside a heredoc.\n      if [[ $_ANTIGEN_THEME_COMPAT == true && \"$record\" == *.zsh-theme* ]]; then\n        local compat=\"${record:A}.antigen-compat\"\n        echo \"# Generated by Antigen. Do not edit!\" >! \"$compat\"\n        cat $record | sed -Ee '/\\{$/,/^\\}/!{\n             s/^local //\n         }' >>! \"$compat\"\n        record=\"$compat\"\n      fi\n      _sources+=(\"source '${record}';\"$'\\n')\n    elif [[ -d $record ]]; then\n      _PATH+=(\"${record}\")\n      _fpath+=(\"${record}\")\n    fi\n  done\n\ncat > $ANTIGEN_CACHE <<EOC\n#-- START ZCACHE GENERATED FILE\n#-- GENERATED: $(date)\n#-- ANTIGEN {{ANTIGEN_VERSION}}\n$(functions -- _antigen)\nantigen () {\n  local MATCH MBEGIN MEND\n  [[ \"\\$ZSH_EVAL_CONTEXT\" =~ \"toplevel:*\" || \"\\$ZSH_EVAL_CONTEXT\" =~ \"cmdarg:*\" ]] && source \"$_ANTIGEN_INSTALL_DIR/antigen.zsh\" && eval antigen \\$@;\n  return 0;\n}\ntypeset -gaU fpath path\nfpath+=(${_fpath[@]}) path+=(${_PATH[@]})\n_antigen_compinit () {\n  autoload -Uz compinit; compinit $ANTIGEN_COMPINIT_OPTS -d \"$ANTIGEN_COMPDUMP\"; compdef _antigen antigen\n  add-zsh-hook -D precmd _antigen_compinit\n}\nautoload -Uz add-zsh-hook; add-zsh-hook precmd _antigen_compinit\ncompdef () {}\n\nif [[ -n \"$ZSH\" ]]; then\n  ZSH=\"$ZSH\"; ZSH_CACHE_DIR=\"$ZSH_CACHE_DIR\"\nfi\n#--- BUNDLES BEGIN\n${(j::)_sources}\n#--- BUNDLES END\ntypeset -gaU _ANTIGEN_BUNDLE_RECORD; _ANTIGEN_BUNDLE_RECORD=($(print ${(qq)_ANTIGEN_BUNDLE_RECORD}))\ntypeset -g _ANTIGEN_CACHE_LOADED; _ANTIGEN_CACHE_LOADED=true\ntypeset -ga _ZCACHE_BUNDLE_SOURCE; _ZCACHE_BUNDLE_SOURCE=($(print ${(qq)_ZCACHE_BUNDLE_SOURCE}))\ntypeset -g _ANTIGEN_CACHE_VERSION; _ANTIGEN_CACHE_VERSION='{{ANTIGEN_VERSION}}'\ntypeset -g _ANTIGEN_THEME; _ANTIGEN_THEME='$_ANTIGEN_THEME'\n\n#-- END ZCACHE GENERATED FILE\nEOC\n\n  { zcompile \"$ANTIGEN_CACHE\" } &!\n\n  # Compile config files, if any\n  LOG \"CHECK_FILES $ANTIGEN_CHECK_FILES\"\n  [[ $ANTIGEN_AUTO_CONFIG == true && -n $ANTIGEN_CHECK_FILES ]] && {\n    echo ${(j:\\n:)ANTIGEN_CHECK_FILES} >! \"$ANTIGEN_RSRC\"\n    for rsrc in $ANTIGEN_CHECK_FILES; do\n      zcompile $rsrc\n    done\n  } &!\n\n  return true\n}\n\n# Initializes caching mechanism.\n#\n# Hooks `antigen-bundle` and `antigen-apply` in order to defer bundle install\n# and load. All bundles are loaded from generated cache rather than dynamically\n# as these are bundled.\n#\n# Usage\n#  -antigen-cache-init\n# Returns\n#  Nothing\n-antigen-cache-init () {\n  if -antigen-interactive-mode; then\n    return 1\n  fi\n\n  _ZCACHE_CAPTURE_PREFIX=${_ZCACHE_CAPTURE_PREFIX:-\"--zcache-\"}\n  _ZCACHE_BUNDLE_SOURCE=(); _ZCACHE_CAPTURE_BUNDLE=()\n\n  # Cache auto config files to check for changes (.zshrc, .antigenrc etc)\n  -antigen-set-default ANTIGEN_AUTO_CONFIG true\n  \n  # Default cache path.\n  -antigen-set-default ANTIGEN_CACHE $ADOTDIR/init.zsh\n  -antigen-set-default ANTIGEN_RSRC $ADOTDIR/.resources\n  if [[ $ANTIGEN_CACHE == false ]]; then\n    return 1\n  fi\n  \n  return 0\n}\n\n-antigen-cache-execute () {\n  # Main function. Deferred antigen-apply.\n  antigen-apply-cached () {\n    # TRACE \"APPLYING CACHE\" EXT\n    # Auto determine check_files\n    # There always should be 5 steps from original source as the correct way is to use\n    # `antigen` wrapper not `antigen-apply` directly and it's called by an extension.\n    LOG \"TRACE: ${funcfiletrace}\"\n    if [[ $ANTIGEN_AUTO_CONFIG == true && $#ANTIGEN_CHECK_FILES -eq 0 ]]; then\n      # Check common configuration file does exist.\n      if [[ -f ${ZDOTDIR:-$HOME}/.zshrc ]]; then\n        ANTIGEN_CHECK_FILES+=(${ZDOTDIR:-$HOME}/.zshrc)\n      fi\n      # TODO Fix: Fuzzy match shoud be replaced by a sane way to determine it.\n      if [[ $#funcfiletrace -ge 6 ]]; then\n        ANTIGEN_CHECK_FILES+=(\"${${funcfiletrace[6]%:*}##* }\")\n      fi\n    fi\n\n    # Generate and compile cache\n    -antigen-cache-generate\n    [[ -f \"$ANTIGEN_CACHE\" ]] && source \"$ANTIGEN_CACHE\";\n\n    # Commented out in order to have a working `cache-gen` command\n    #unset _ZCACHE_BUNDLE_SOURCE\n    unset _ZCACHE_CAPTURE_BUNDLE _ZCACHE_CAPTURE_FUNCTIONS\n\n    # Release all hooked functions\n    antigen-remove-hook -antigen-load-env-cached\n    antigen-remove-hook -antigen-load-source-cached\n    antigen-remove-hook antigen-bundle-cached\n  }\n  \n  antigen-add-hook antigen-apply antigen-apply-cached post once\n  \n  # Defer antigen-bundle.\n  antigen-bundle-cached () {\n    # Return an error is not bundle name/url is passed or a heredoc is misused,\n    # see https://github.com/zsh-users/antigen/issues/602\n    if [[ $# -eq 0 ]]; then\n      printf \"Antigen: Must provide a bundle url or name.\\n\" >&2\n      return 1\n    fi\n    _ZCACHE_CAPTURE_BUNDLE+=(\"${(j: :)${@}}\")\n  }\n  antigen-add-hook antigen-bundle antigen-bundle-cached pre\n  \n  # Defer loading.\n  -antigen-load-env-cached () {\n    local bundle\n    typeset -A bundle; bundle=($@)\n    local location=${bundle[dir]}/${bundle[loc]}\n    \n    # Load to path if there is no sourceable\n    if [[ ${bundle[loc]} == \"/\" ]]; then\n      _ZCACHE_BUNDLE_SOURCE+=(\"${location}\")\n      return\n    fi\n\n    _ZCACHE_BUNDLE_SOURCE+=(\"${location}\")\n  }\n  antigen-add-hook -antigen-load-env -antigen-load-env-cached replace\n  \n  # Defer sourcing.\n  -antigen-load-source-cached () {\n    _ZCACHE_BUNDLE_SOURCE+=($@)\n  }\n  antigen-add-hook -antigen-load-source -antigen-load-source-cached replace\n  \n  return 0\n}\n\n# Generate static-cache file at $ANTIGEN_CACHE using currently loaded\n# bundles from $_ANTIGEN_BUNDLE_RECORD\n#\n# Usage\n#   antigen-cache-gen\n#\n# Returns\n#   Nothing\nantigen-cache-gen () {\n  -antigen-cache-generate\n}\n"
  },
  {
    "path": "src/ext/defer.zsh",
    "content": "# Initialize defer lib\n-antigen-defer-init () {\n  typeset -ga _DEFERRED_BUNDLE; _DEFERRED_BUNDLE=()\n  if -antigen-interactive-mode; then\n    return 1\n  fi\n}\n\n-antigen-defer-execute () {\n  # Hooks antigen-bundle in order to defer its execution.\n  antigen-bundle-defer () {\n    _DEFERRED_BUNDLE+=(\"${(j: :)${@}}\")\n    return -1 # Stop right there\n  }\n  antigen-add-hook antigen-bundle antigen-bundle-defer replace\n  \n  # Hooks antigen-apply in order to release hooked functions\n  antigen-apply-defer () {\n    WARN \"Defer pre-apply\" DEFER PRE-APPLY\n    antigen-remove-hook antigen-bundle-defer\n\n    # Process all deferred bundles.\n    local bundle\n    for bundle in ${_DEFERRED_BUNDLE[@]}; do\n      LOG \"Processing deferred bundle: ${bundle}\" DEFER\n      antigen-bundle $bundle\n    done\n\n    unset _DEFERRED_BUNDLE\n  }\n  antigen-add-hook antigen-apply antigen-apply-defer pre once\n}\n"
  },
  {
    "path": "src/ext/ext.zsh",
    "content": "typeset -Ag _ANTIGEN_HOOKS; _ANTIGEN_HOOKS=()\ntypeset -Ag _ANTIGEN_HOOKS_META; _ANTIGEN_HOOKS_META=()\ntypeset -g _ANTIGEN_HOOK_PREFIX=\"-antigen-hook-\"\ntypeset -g _ANTIGEN_EXTENSIONS; _ANTIGEN_EXTENSIONS=()\n\n# -antigen-add-hook antigen-apply antigen-apply-hook replace\n#   - Replaces hooked function with hook, do not call hooked function\n#   - Return -1 to stop calling further hooks\n# -antigen-add-hook antigen-apply antigen-apply-hook pre (pre-call)\n#   - By default it will call hooked function\n# -antigen-add-hook antigen-pply antigen-apply-hook post (post-call)\n#   - Calls antigen-apply and then calls hook function\n# Usage:\n#  -antigen-add-hook antigen-apply antigen-apply-hook [\"replace\"|\"pre\"|\"post\"] [\"once\"|\"repeat\"]\nantigen-add-hook () {\n  local target=\"$1\" hook=\"$2\" type=\"$3\" mode=\"${4:-repeat}\"\n  \n  if (( ! $+functions[$target] )); then\n    printf \"Antigen: Function %s doesn't exist.\\n\" $target\n    return 1\n  fi\n\n  if (( ! $+functions[$hook] )); then\n    printf \"Antigen: Function %s doesn't exist.\\n\" $hook\n    return 1\n  fi\n\n  if [[ \"${_ANTIGEN_HOOKS[$target]}\" == \"\" ]]; then\n    _ANTIGEN_HOOKS[$target]=\"${hook}\"\n  else\n    _ANTIGEN_HOOKS[$target]=\"${_ANTIGEN_HOOKS[$target]}:${hook}\"\n  fi\n\n  _ANTIGEN_HOOKS_META[$hook]=\"target $target type $type mode $mode called 0\"\n  \n  # Do shadow for this function if there is none already\n  local hook_function=\"${_ANTIGEN_HOOK_PREFIX}$target\"\n  if (( ! $+functions[$hook_function] )); then\n    # Preserve hooked function\n    eval \"function ${_ANTIGEN_HOOK_PREFIX}$(functions -- $target)\"\n\n    # Create hook, call hook-handler to further process hook functions\n    eval \"function $target () {\n      noglob -antigen-hook-handler $target \\$@\n      return \\$?\n    }\"\n  fi\n  \n  return 0\n}\n\n# Private function to handle multiple hooks in a central point.\n-antigen-hook-handler () {\n  local target=\"$1\" args hook called\n  local hooks meta\n  shift\n  typeset -a args; args=(${@})\n\n  typeset -a pre_hooks replace_hooks post_hooks;\n  typeset -a hooks; hooks=(${(s|:|)_ANTIGEN_HOOKS[$target]})\n  \n  typeset -A meta;\n  for hook in $hooks; do\n    meta=(${(s: :)_ANTIGEN_HOOKS_META[$hook]})\n    if [[ ${meta[mode]} == \"once\" && ${meta[called]} == 1 ]]; then\n      WARN \"Ignoring hook due to mode ${meta[mode]}: $hook\"\n      continue\n    fi\n\n    let called=${meta[called]}+1\n    meta[called]=$called\n    _ANTIGEN_HOOKS_META[$hook]=\"${(kv)meta}\"\n    WARN \"Updated meta: \"${(kv)meta}\n\n    case \"${meta[type]}\" in\n      \"pre\")\n      pre_hooks+=($hook)\n      ;;\n      \"replace\")\n      replace_hooks+=($hook)\n      ;;\n      \"post\")\n      post_hooks+=($hook)\n      ;;\n    esac\n  done\n\n  WARN \"Processing hooks: ${hooks}\"\n\n  for hook in $pre_hooks; do\n    WARN \"Pre hook:\" $hook $args\n    noglob $hook $args\n    [[ $? == -1 ]] && WARN \"$hook shortcircuited\" && return $ret\n  done\n\n  # A replace hook will return inmediately\n  local replace_hook=0 ret=0\n  for hook in $replace_hooks; do\n    replace_hook=1\n    # Should not be needed if `antigen-remove-hook` removed unneeded hooks.\n    if (( $+functions[$hook] )); then\n      WARN \"Replace hook:\" $hook $args\n      noglob $hook $args\n      [[ $? == -1 ]] && WARN \"$hook shortcircuited\" && return $ret\n    fi\n  done\n  \n  if [[ $replace_hook == 0 ]]; then\n    WARN \"${_ANTIGEN_HOOK_PREFIX}$target $args\"\n    noglob ${_ANTIGEN_HOOK_PREFIX}$target $args\n    ret=$?\n  else\n    WARN \"Replaced hooked function.\"\n  fi\n\n  for hook in $post_hooks; do\n    WARN \"Post hook:\" $hook $args\n    noglob $hook $args\n    [[ $? == -1 ]] && WARN \"$hook shortcircuited\" && return $ret\n  done\n  \n  LOG \"Return from hook ${target} with ${ret}\"\n\n  return $ret\n}\n\n# Usage:\n#  -antigen-remove-hook antigen-apply-hook\nantigen-remove-hook () {\n  local hook=\"$1\"\n  typeset -A meta; meta=(${(s: :)_ANTIGEN_HOOKS_META[$hook]})\n  local target=\"${meta[target]}\"\n  local -a hooks; hooks=(${(s|:|)_ANTIGEN_HOOKS[$target]})\n\n  # Remove registered hook\n  if [[ $#hooks > 0 ]]; then\n    hooks[$hooks[(I)$hook]]=()\n  fi\n  _ANTIGEN_HOOKS[${target}]=\"${(j|:|)hooks}\"\n  \n  if [[ $#hooks == 0 ]]; then\n    # Destroy base hook\n    eval \"function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)\"\n    if (( $+functions[${_ANTIGEN_HOOK_PREFIX}$target] )); then\n      unfunction -- \"${_ANTIGEN_HOOK_PREFIX}$target\"\n    fi\n  fi\n\n  unfunction -- $hook 2> /dev/null\n}\n\n# Remove all defined hooks.\n-antigen-reset-hooks () {\n  local target\n\n  for target in ${(k)_ANTIGEN_HOOKS}; do\n    # Release all hooked functions\n    eval \"function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)\"\n    unfunction -- \"${_ANTIGEN_HOOK_PREFIX}$target\" 2> /dev/null\n  done\n  \n  _ANTIGEN_HOOKS=()\n  _ANTIGEN_HOOKS_META=()\n  _ANTIGEN_EXTENSIONS=()\n}\n\n# Initializes an extension\n# Usage:\n#  antigen-ext ext-name\nantigen-ext () {\n  local ext=$1\n  local func=\"-antigen-$ext-init\"\n  if (( $+functions[$func] && $_ANTIGEN_EXTENSIONS[(I)$ext] == 0 )); then\n    eval $func\n    local ret=$?\n    WARN \"$func return code was $ret\"\n    if (( $ret == 0 )); then \n      LOG \"LOADED EXTENSION $ext\" EXT\n      -antigen-$ext-execute && _ANTIGEN_EXTENSIONS+=($ext)\n    else\n      WARN \"IGNORING EXTENSION $func\" EXT\n      return 1\n    fi\n    \n  else\n    printf \"Antigen: No extension defined or already loaded: %s\\n\" $func >&2\n    return 1\n  fi\n}\n\n# List installed extensions\n# Usage:\n#   antigen ext-list\nantigen-ext-list () {\n  echo $_ANTIGEN_EXTENSIONS\n}\n\n# Initializes built-in extensions\n# Usage:\n#   antigen-ext-init\nantigen-ext-init () {\n  # Initialize extensions. unless in interactive mode.\n  local ext\n  for ext in ${(s/ /)_ANTIGEN_BUILTIN_EXTENSIONS}; do\n    # Check if extension is loaded before intializing it\n    (( $+functions[-antigen-$ext-init] )) && antigen-ext $ext\n  done\n}\n"
  },
  {
    "path": "src/ext/lock.zsh",
    "content": "# Initialize lock lib\n-antigen-lock-init () {\n  # Default lock path.\n  -antigen-set-default ANTIGEN_LOCK $ADOTDIR/.lock\n  typeset -g _ANTIGEN_LOCK_PROCESS=false\n  \n  # Use env variable to determine if we should load this extension\n  -antigen-set-default ANTIGEN_MUTEX true\n  # Set ANTIGEN_MUTEX to false to avoid loading this extension\n  if [[ $ANTIGEN_MUTEX == true ]]; then\n    return 0;\n  fi\n  \n  # Do not use mutex\n  return 1;\n}\n\n-antigen-lock-execute () {\n  # Hook antigen command in order to check/create a lock file.\n  # This hook is only run once then releases itself.\n  antigen-lock () {\n    LOG \"antigen-lock called\"\n    # If there is a lock set up then we won't process anything.\n    if [[ -f $ANTIGEN_LOCK ]]; then\n      # Set up flag do the message is not repeated for each antigen-* command\n      [[ $_ANTIGEN_LOCK_PROCESS == false ]] && printf \"Antigen: Another process in running.\\n\"\n      _ANTIGEN_LOCK_PROCESS=true\n      # Do not further process hooks. For this hook to properly work it\n      # should be registered first.\n      return -1\n    fi\n\n    WARN \"Creating antigen-lock file at $ANTIGEN_LOCK\"\n    touch $ANTIGEN_LOCK\n  }\n  antigen-add-hook antigen antigen-lock pre once\n\n  # Hook antigen-apply in order to release .lock file.\n  antigen-apply-lock () {\n    WARN \"Freeing antigen-lock file at $ANTIGEN_LOCK\"\n    unset _ANTIGEN_LOCK_PROCESS\n    rm -f $ANTIGEN_LOCK &> /dev/null\n  }\n  antigen-add-hook antigen-apply antigen-apply-lock post once\n}\n"
  },
  {
    "path": "src/ext/parallel.zsh",
    "content": "# Initialize parallel lib\n-antigen-parallel-init () {\n  WARN \"Init parallel extension\" PARALLEL\n  typeset -ga _PARALLEL_BUNDLE; _PARALLEL_BUNDLE=()\n  if -antigen-interactive-mode; then\n    return 1\n  fi\n}\n\n-antigen-parallel-execute() {\n  WARN \"Exec parallel extension\" PARALLEL\n  # Install bundles in parallel\n  antigen-bundle-parallel-execute () {\n    WARN \"Parallel antigen-bundle-parallel-execute\" PARALLEL\n    typeset -a pids; pids=()\n    local args pid\n\n    WARN \"Gonna install in parallel ${#_PARALLEL_BUNDLE} bundles.\" PARALLEL\n    # Do ensure-repo in parallel\n    WARN \"${_PARALLEL_BUNDLE}\" PARALLEL\n    typeset -Ua repositories # Used to keep track of cloned repositories to avoid\n                             # trying to clone it multiple times.\n    for args in ${_PARALLEL_BUNDLE}; do\n      typeset -A bundle; -antigen-parse-args 'bundle' ${=args}\n\n      if [[ ! -d ${bundle[dir]} && $repositories[(I)${bundle[url]}] == 0 ]]; then\n        WARN \"Install in parallel ${bundle[name]}.\" PARALLEL\n        echo \"Installing ${bundle[name]}!...\"\n        # $bundle[url]'s format is \"url|branch\" as to create \"$ANTIGEN_BUNDLES/bundle/name-branch\",\n        # this way you may require multiple branches from the same repository.\n        -antigen-ensure-repo \"${bundle[url]}\" > /dev/null &!\n        pids+=($!)\n      else\n        WARN \"Bundle ${bundle[name]} already cloned locally.\" PARALLEL\n      fi\n      \n      repositories+=(${bundle[url]})\n    done\n\n    # Wait for all background processes to end\n    while [[ $#pids > 0 ]]; do\n      for pid in $pids; do\n        # `ps` may diplay an error message such \"Signal 18 (CONT) caught by ps\n        # (procps-ng version 3.3.9).\", see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732410\n        if [[ $(ps -o pid= -p $pid 2>/dev/null) == \"\" ]]; then\n          pids[$pids[(I)$pid]]=()\n        fi\n      done\n      sleep .5\n    done\n\n    builtin local bundle &> /dev/null\n    for bundle in ${_PARALLEL_BUNDLE[@]}; do\n      antigen-bundle $bundle\n    done\n    \n\n    WARN \"Parallel install done\" PARALLEL\n  }\n\n  # Hooks antigen-apply in order to release hooked functions\n  antigen-apply-parallel () {\n    WARN \"Parallel pre-apply\" PARALLEL PRE-APPLY\n    #antigen-remove-hook antigen-pre-apply-parallel\n    # Hooks antigen-bundle in order to parallel its execution.\n    antigen-bundle-parallel () {\n      TRACE \"antigen-bundle-parallel: $@\" PARALLEL\n      _PARALLEL_BUNDLE+=(\"${(j: :)${@}}\")\n    }\n    antigen-add-hook antigen-bundle antigen-bundle-parallel replace\n  }\n  antigen-add-hook antigen-apply antigen-apply-parallel pre once\n  \n  antigen-apply-parallel-execute () {\n      WARN \"Parallel replace-apply\" PARALLEL REPLACE-APPLY\n      antigen-remove-hook antigen-bundle-parallel\n      # Process all parallel bundles.\n      antigen-bundle-parallel-execute\n\n      unset _PARALLEL_BUNDLE\n      antigen-remove-hook antigen-apply-parallel-execute\n      antigen-apply\n  }\n  antigen-add-hook antigen-apply antigen-apply-parallel-execute replace once\n}\n"
  },
  {
    "path": "src/helpers/bundle-rev.zsh",
    "content": "# Returns the bundle's git revision\n#\n# Usage\n#   -antigen-bundle-rev bundle-name [is_local_clone]\n#\n# Returns\n#   Bundle rev-parse output (branch name or short ref name)\n-antigen-bundle-rev () {\n  local bundle=$1\n  local is_local_clone=$2\n\n  local bundle_path=$bundle\n  # Get bunde path inside $ADOTDIR if bundle was effectively cloned\n  if [[ \"$is_local_clone\" == \"true\" ]]; then\n    bundle_path=$(-antigen-get-clone-dir $bundle)\n  fi\n\n  local ref\n  ref=$(git --git-dir=\"$bundle_path/.git\" rev-parse --abbrev-ref '@' 2>/dev/null)\n\n  # Avoid 'HEAD' when in detached mode\n  if [[ $ref == \"HEAD\" ]]; then\n    ref=$(git --git-dir=\"$bundle_path/.git\" describe --tags --exact-match 2>/dev/null \\\n\t    || git --git-dir=\"$bundle_path/.git\" rev-parse --short '@' 2>/dev/null || \"-\")\n  fi\n  echo $ref\n}\n"
  },
  {
    "path": "src/helpers/bundle-short-name.zsh",
    "content": "# Usage:\n#   -antigen-bundle-short-name \"https://github.com/user/repo.git[|*]\" \"[branch/name]\"\n# Returns:\n#   user/repo@branch/name\n-antigen-bundle-short-name () {\n  local bundle_name=\"${1%|*}\"\n  local bundle_branch=\"$2\"\n  local match mbegin mend MATCH MBEGIN MEND\n\n  [[ \"$bundle_name\" =~ '.*/(.*/.*).*$' ]] && bundle_name=$match[1]\n  bundle_name=\"${bundle_name%.git*}\"\n\n  if [[ -n $bundle_branch ]]; then\n    bundle_name=\"$bundle_name@$bundle_branch\"\n  fi\n\n  echo $bundle_name\n}\n"
  },
  {
    "path": "src/helpers/echo-record.zsh",
    "content": "# Echo the bundle specs as in the record. The first line is not echoed since it\n# is a blank line.\n-antigen-echo-record () {\n  echo ${(j:\\n:)_ANTIGEN_BUNDLE_RECORD}\n}\n"
  },
  {
    "path": "src/helpers/find-bundle.zsh",
    "content": "# Filters _ANTIGEN_BUNDLE_RECORD for $1\n#\n# Usage\n#   -antigen-find-bundle example/bundle\n#\n# Returns\n#   String if bundle is found\n-antigen-find-bundle () {\n  echo $(-antigen-find-record $1 | cut -d' ' -f1)\n}\n\n"
  },
  {
    "path": "src/helpers/find-record.zsh",
    "content": "# Filters _ANTIGEN_BUNDLE_RECORD for $1\n#\n# Usage\n#   -antigen-find-record example/bundle\n#\n# Returns\n#   String if record is found\n-antigen-find-record () {\n  local bundle=$1\n  \n  if [[ $# -eq 0 ]]; then\n    return 1\n  fi\n\n  local record=${bundle/\\|/\\\\\\|}\n  echo \"${_ANTIGEN_BUNDLE_RECORD[(r)*$record*]}\"\n}\n"
  },
  {
    "path": "src/helpers/get-bundles.zsh",
    "content": "# Returns bundle names from _ANTIGEN_BUNDLE_RECORD\n#\n# Usage\n#   -antigen-get-bundles [--short|--simple|--long]\n#\n# Returns\n#   List of bundles installed\n-antigen-get-bundles () {\n  local mode revision url bundle_name bundle_entry loc no_local_clone\n  local record bundle make_local_clone\n  mode=${1:-\"--short\"}\n\n  for record in $_ANTIGEN_BUNDLE_RECORD; do\n    bundle=(${(@s/ /)record})\n    url=$bundle[1]\n    loc=$bundle[2]\n    make_local_clone=$bundle[4]\n\n    bundle_name=$(-antigen-bundle-short-name $url)\n\n    case \"$mode\" in\n        --short)\n          # Only check revision for bundle with a requested branch\n          if [[ $url == *\\|* ]]; then\n            revision=$(-antigen-bundle-rev $url $make_local_clone)\n          else\n            revision=\"master\"\n          fi\n\n          if [[ $loc != '/' ]]; then\n            bundle_name=\"$bundle_name ~ $loc\"\n          fi\n          echo \"$bundle_name @ $revision\"\n        ;;\n        --simple)\n          echo \"$bundle_name\"\n        ;;\n        --long)\n          echo \"$record\"\n        ;;\n     esac\n  done\n}\n"
  },
  {
    "path": "src/helpers/get-clone-dir.zsh",
    "content": "# Usage:\n#  -antigen-get-clone-dir \"https://github.com/zsh-users/zsh-syntax-highlighting.git[|feature/branch]\"\n# Returns:\n#  $ANTIGEN_BUNDLES/zsh-users/zsh-syntax-highlighting[-feature-branch]\n-antigen-get-clone-dir () {\n  local bundle=\"$1\"\n  local url=\"${bundle%|*}\"\n  local branch match mbegin mend MATCH MBEGIN MEND\n  [[ \"$bundle\" =~ \"\\|\" ]] && branch=\"${bundle#*|}\"\n\n  # Takes a repo url and mangles it, giving the path that this url will be\n  # cloned to. Doesn't actually clone anything.\n  local clone_dir=\"$ANTIGEN_BUNDLES\"\n\n  url=$(-antigen-bundle-short-name $url)\n\n  # Suffix with branch/tag name\n  [[ -n \"$branch\" ]] && url=\"$url-${branch//\\//-}\"\n  url=${url//\\*/x}\n\n  echo \"$clone_dir/$url\"\n}\n"
  },
  {
    "path": "src/helpers/get-cloned-bundles.zsh",
    "content": "# Returns bundles flagged as make_local_clone\n#\n# Usage\n#    -antigen-cloned-bundles\n#\n# Returns\n#    Bundle metadata\n-antigen-get-cloned-bundles() {\n  -antigen-echo-record |\n      awk '$4 == \"true\" {print $1}' |\n      sort -u\n}\n"
  },
  {
    "path": "src/helpers/get-themes.zsh",
    "content": "# Returns a list of themes from a default library (omz)\n#\n# Usage\n#   -antigen-get-themes\n#\n# Returns\n#   List of themes by name\n-antigen-get-themes () {\n  local library='robbyrussell/oh-my-zsh'\n  local bundle=$(-antigen-find-bundle $library)\n\n  if [[ -n \"$bundle\" ]]; then\n    local dir=$(-antigen-get-clone-dir $ANTIGEN_DEFAULT_REPO_URL)\n    echo $(ls $dir/themes/ | eval \"$_ANTIGEN_GREP_COMMAND '.zsh-theme$'\" | sed 's/.zsh-theme//')\n  fi\n\n  return 0\n}\n\n"
  },
  {
    "path": "src/helpers/interactive-mode.zsh",
    "content": "# This function check ZSH_EVAL_CONTEXT to determine if running in interactive shell. \n#\n# Usage\n#   -antigen-interactive-mode\n#\n# Returns\n#   Either true or false depending if we are running in interactive mode\n-antigen-interactive-mode () {\n  WARN \"-antigen-interactive-mode: $ZSH_EVAL_CONTEXT \\$_ANTIGEN_INTERACTIVE = $_ANTIGEN_INTERACTIVE\"\n  if [[ $_ANTIGEN_INTERACTIVE != \"\" ]]; then\n    [[ $_ANTIGEN_INTERACTIVE == true ]];\n    return\n  fi\n\n  [[ \"$ZSH_EVAL_CONTEXT\" == toplevel* || \"$ZSH_EVAL_CONTEXT\" == cmdarg* ]];\n}\n"
  },
  {
    "path": "src/helpers/parse-branch.zsh",
    "content": "# Parses and retrieves a remote branch given a branch name.\n#\n# If the branch name contains '*' it will retrieve remote branches\n# and try to match against tags and heads, returning the latest matching.\n#\n# Usage\n#     -antigen-parse-branch https://github.com/user/repo.git x.y.z\n#\n# Returns\n#     Branch name\n-antigen-parse-branch () {\n  local url=\"$1\" branch=\"$2\" branches\n  \n  local match mbegin mend MATCH MBEGIN MEND\n\n  if [[ \"$branch\" =~ '\\*' ]]; then\n    branches=$(git ls-remote --tags -q \"$url\" \"$branch\"|cut -d'/' -f3|sort -n|tail -1)\n    # There is no --refs flag in git 1.8 and below, this way we\n    # emulate this flag -- also git 1.8 ref order is undefined.\n    branch=${${branches#*/*/}%^*} # Why you are like this?\n  fi\n\n  echo $branch\n}\n"
  },
  {
    "path": "src/helpers/update-repos.zsh",
    "content": "-antigen-update-repos () {\n  local repo bundle url target\n  local log=/tmp/antigen-v2-migrate.log\n\n  echo \"It seems you have bundles cloned with Antigen v1.x.\"\n  echo \"We'll try to convert directory structure to v2.\"\n  echo\n\n  echo -n \"Moving bundles to '\\$ADOTDIR/bundles'... \"\n\n  # Migrate old repos -> bundles\n  local errors=0\n  for repo in $ADOTDIR/repos/*; do\n    bundle=${repo/$ADOTDIR\\/repos\\//}\n    bundle=${bundle//-SLASH-/\\/}\n    bundle=${bundle//-COLON-/\\:}\n    bundle=${bundle//-STAR-/\\*}\n    url=${bundle//-PIPE-/\\|}\n    target=$(-antigen-get-clone-dir $url)\n    mkdir -p \"${target:A:h}\"\n    echo \" ---> ${repo/$ADOTDIR\\/} -> ${target/$ADOTDIR\\/}\" | tee > $log\n    mv \"$repo\" \"$target\" &> $log\n    if [[ $? != 0 ]]; then\n      echo \"Failed to migrate '$repo'!.\"\n      errors+=1\n    fi\n  done\n\n  if [[ $errors == 0 ]]; then\n    echo \"Done.\"\n  else\n    echo \"An error ocurred!\"\n  fi\n  echo\n\n  if [[ \"$(ls -A $ADOTDIR/repos | wc -l | xargs)\" == 0 ]]; then\n    echo \"You can safely remove \\$ADOTDIR/repos.\"\n  else\n    echo \"Some bundles couldn't be migrated. See \\$ADOTDIR/repos.\"\n  fi\n\n  echo\n  if [[ $errors == 0 ]]; then\n    echo \"Bundles migrated successfuly.\"\n    rm $log\n  else\n    echo \"Some errors occured. Review migration log in '$log'.\"\n  fi\n  antigen-reset\n}\n"
  },
  {
    "path": "src/lib/ensure-repo.zsh",
    "content": "# Ensure that a clone exists for the given repo url and branch. If the first\n# argument is `update` and if a clone already exists for the given repo\n# and branch, it is pull-ed, i.e., updated.\n#\n# This function expects three arguments in order:\n# - 'url=<url>'\n# - 'update=true|false'\n# - 'verbose=true|false'\n#\n# Returns true|false Whether cloning/pulling was succesful\n-antigen-ensure-repo () {\n  # Argument defaults. Previously using ${1:?\"missing url argument\"} format\n  # but it seems to mess up with cram\n  if (( $# < 1 )); then\n    echo \"Antigen: Missing url argument.\"\n    return 1\n  fi\n\n  # The url. No sane default for this, so just empty.\n  local url=$1\n  # Check if we have to update.\n  local update=${2:-false}\n  # Verbose output.\n  local verbose=${3:-false}\n\n  shift $#\n\n  # Get the clone's directory as per the given repo url and branch.\n  local clone_dir=$(-antigen-get-clone-dir $url)\n  if [[ -d \"$clone_dir\" && $update == false ]]; then\n    return true\n  fi\n\n  # A temporary function wrapping the `git` command with repeated arguments.\n  --plugin-git () {\n    (\\cd -q \"$clone_dir\" && eval ${ANTIGEN_CLONE_ENV} git --git-dir=\"$clone_dir/.git\" --no-pager \"$@\" &>>! $ANTIGEN_LOG)\n  }\n\n  local success=false\n\n  # If its a specific branch that we want, checkout that branch.\n  local branch=\"master\" # TODO FIX THIS\n  if [[ $url == *\\|* ]]; then\n    branch=\"$(-antigen-parse-branch ${url%|*} ${url#*|})\"\n  fi\n\n  if [[ ! -d $clone_dir ]]; then\n    eval ${ANTIGEN_CLONE_ENV} git clone ${=ANTIGEN_CLONE_OPTS} --branch \"$branch\" -- \"${url%|*}\" \"$clone_dir\" &>> $ANTIGEN_LOG\n    success=$?\n  elif $update; then\n    # Save current revision.\n    local old_rev=\"$(--plugin-git rev-parse HEAD)\"\n    # Pull changes if update requested.\n    --plugin-git checkout \"$branch\"\n    --plugin-git pull origin \"$branch\"\n    success=$?\n\n    # Update submodules.\n    --plugin-git submodule update ${=ANTIGEN_SUBMODULE_OPTS}\n    # Get the new revision.\n    local new_rev=\"$(--plugin-git rev-parse HEAD)\"\n  fi\n\n  if [[ -n $old_rev && $old_rev != $new_rev ]]; then\n    echo Updated from $old_rev[0,7] to $new_rev[0,7].\n    if $verbose; then\n      --plugin-git log --oneline --reverse --no-merges --stat '@{1}..'\n    fi\n  fi\n\n  # Remove the temporary git wrapper function.\n  unfunction -- --plugin-git\n\n  return $success\n}\n"
  },
  {
    "path": "src/lib/env-setup.zsh",
    "content": "# Helper function: Same as `$1=$2`, but will only happen if the name\n# specified by `$1` is not already set.\n-antigen-set-default () {\n  local arg_name=\"$1\"\n  local arg_value=\"$2\"\n  eval \"test -z \\\"\\$$arg_name\\\" && typeset -g $arg_name='$arg_value'\"\n}\n\n-antigen-env-setup () {\n  typeset -gU fpath path\n\n  # Pre-startup initializations.\n  -antigen-set-default ANTIGEN_OMZ_REPO_URL \\\n    https://github.com/robbyrussell/oh-my-zsh.git\n  -antigen-set-default ANTIGEN_PREZTO_REPO_URL \\\n    https://github.com/sorin-ionescu/prezto.git\n  -antigen-set-default ANTIGEN_DEFAULT_REPO_URL $ANTIGEN_OMZ_REPO_URL\n\n  # Default Antigen directory.\n  -antigen-set-default ADOTDIR $HOME/.antigen\n  [[ ! -d $ADOTDIR ]] && mkdir -p $ADOTDIR\n\n  # Defaults bundles directory.\n  -antigen-set-default ANTIGEN_BUNDLES $ADOTDIR/bundles\n\n  # If there is no bundles directory, create it.\n  if [[ ! -d $ANTIGEN_BUNDLES ]]; then\n    mkdir -p $ANTIGEN_BUNDLES\n    # Check for v1 repos directory, transform it to v2 format.\n    [[ -d $ADOTDIR/repos ]] && -antigen-update-repos\n  fi\n\n  -antigen-set-default ANTIGEN_COMPDUMP \"${ADOTDIR:-$HOME}/.zcompdump\"\n  -antigen-set-default ANTIGEN_COMPINIT_OPTS \"-i\"\n  -antigen-set-default ANTIGEN_LOG /dev/null\n\n  # CLONE_OPTS uses ${=CLONE_OPTS} expansion so don't use spaces\n  # for arguments that can be passed as `--key=value`.\n  -antigen-set-default ANTIGEN_CLONE_ENV \"GIT_TERMINAL_PROMPT=0\"\n  -antigen-set-default ANTIGEN_CLONE_OPTS \"--single-branch --recursive --depth=1\"\n  -antigen-set-default ANTIGEN_SUBMODULE_OPTS \"--recursive --depth=1\"\n\n  # Complain when a bundle is already installed.\n  -antigen-set-default _ANTIGEN_WARN_DUPLICATES true\n\n  # Compatibility with oh-my-zsh themes.\n  -antigen-set-default _ANTIGEN_THEME_COMPAT true\n\n  -antigen-set-default _ANTIGEN_GREP_COMMAND 'GREP_OPTIONS= command grep '\n\n  # Add default built-in extensions to load at start up\n  -antigen-set-default _ANTIGEN_BUILTIN_EXTENSIONS 'lock parallel defer cache'\n  \n  # Set up configured theme\n  -antigen-set-default _ANTIGEN_THEME ''\n\n  # Setup antigen's own completion.\n  if -antigen-interactive-mode; then\n    TRACE \"Gonna create compdump file @ env-setup\" COMPDUMP\n    autoload -Uz compinit\n    compinit $ANTIGEN_COMPINIT_OPTS -d \"$ANTIGEN_COMPDUMP\"\n    compdef _antigen antigen\n  else\n    (( $+functions[antigen-ext-init] )) && antigen-ext-init\n  fi\n}\n"
  },
  {
    "path": "src/lib/load.zsh",
    "content": "# Load a given bundle by sourcing it.\n#\n# The function also modifies fpath to add the bundle path.\n#\n# Usage\n#   -antigen-load \"bundle-url\" [\"location\"] [\"make_local_clone\"] [\"btype\"]\n#\n# Returns\n#   Integer. 0 if success 1 if an error ocurred.\n-antigen-load () {\n  local bundle list\n  typeset -A bundle; bundle=($@)\n\n  typeset -Ua list; list=()\n  local location=\"${bundle[dir]}/${bundle[loc]}\"\n\n  # Prioritize location when given.\n  if [[ -f \"${location}\" ]]; then\n    list=(${location})\n  else\n    # Directory locations must be suffixed with slash\n    location=\"$location/\"\n\n    # Prioritize theme with antigen-theme\n    if [[ ${bundle[btype]} == \"theme\" ]]; then\n      list=(${location}*.zsh-theme(N[1]))\n    fi\n\n    # Common frameworks\n    if [[ $#list == 0 ]]; then\n      # dot-plugin, init and functions support (omz, prezto)\n      # Support prezto function loading. See https://github.com/zsh-users/antigen/pull/428\n      list=(${location}*.plugin.zsh(N[1]) ${location}init.zsh(N[1]) ${location}/functions(N[1]))\n    fi\n\n    # Default to zsh and sh\n    if [[ $#list == 0 ]]; then\n      list=(${location}*.zsh(N) ${location}*.sh(N))\n    fi\n  fi\n\n  -antigen-load-env ${(kv)bundle}\n\n  # If there is any sourceable try to load it\n  if ! -antigen-load-source \"${list[@]}\" && [[ ! -d ${location} ]]; then\n    return 1\n  fi\n\n  return 0\n}\n\n-antigen-load-env () {\n  typeset -A bundle; bundle=($@)\n  local location=${bundle[dir]}/${bundle[loc]}\n\n  # Load to path if there is no sourceable\n  if [[ -d ${location} ]]; then\n    PATH=\"$PATH:${location:A}\"\n    fpath+=(\"${location:A}\")\n    return\n  fi\n\n  PATH=\"$PATH:${location:A:h}\"\n  fpath+=(\"${location:A:h}\")\n}\n\n-antigen-load-source () {\n  typeset -a list\n  list=($@)\n  local src match mbegin mend MATCH MBEGIN MEND\n\n  # Return error when we're given an empty list\n  if [[ $#list == 0 ]]; then\n    return 1\n  fi\n  \n  # Using a for rather than `source $list` as we need to check for zsh-themes\n  # In order to create antigen-compat file. This is only needed for interactive-mode\n  # theme switching, for static loading (cache) there is no need.\n  for src in $list; do\n    if [[ $_ANTIGEN_THEME_COMPAT == true  && -f \"$src\" && \"$src\" == *.zsh-theme* ]]; then\n      local compat=\"${src:A}.antigen-compat\"\n      echo \"# Generated by Antigen. Do not edit!\" >! \"$compat\"\n      cat $src | sed -Ee '/\\{$/,/^\\}/!{\n             s/^local //\n         }' >>! \"$compat\"\n      src=\"$compat\"\n    fi\n\n    if ! source \"$src\" 2>/dev/null; then\n      return 1\n    fi\n  done\n}\n"
  },
  {
    "path": "src/lib/log.zsh",
    "content": "zmodload zsh/datetime\nANTIGEN_DEBUG_LOG=${ANTIGEN_DEBUG_LOG:-${ADOTDIR:-$HOME/.antigen}/debug.log}\nLOG () {\n  local PREFIX=\"[LOG][${EPOCHREALTIME}]\"\n  echo \"${PREFIX} ${funcfiletrace[1]}\\n${PREFIX} $@\" >> $ANTIGEN_DEBUG_LOG\n}\n\nERR () {\n  local PREFIX=\"[ERR][${EPOCHREALTIME}]\"\n  echo \"${PREFIX} ${funcfiletrace[1]}\\n${PREFIX} $@\" >> $ANTIGEN_DEBUG_LOG\n}\n\nWARN () {\n  local PREFIX=\"[WRN][${EPOCHREALTIME}]\"\n  echo \"${PREFIX} ${funcfiletrace[1]}\\n${PREFIX} $@\" >> $ANTIGEN_DEBUG_LOG\n}\n\nTRACE () {\n  local PREFIX=\"[TRA][${EPOCHREALTIME}]\"\n  echo \"${PREFIX} ${funcfiletrace[1]}\\n${PREFIX} $@\\n${PREFIX} ${(j:\\n:)funcstack}\" >> $ANTIGEN_DEBUG_LOG\n}\n"
  },
  {
    "path": "src/lib/parse-args.zsh",
    "content": "# Usage:\n#   -antigen-parse-args output_assoc_arr <args...>\n-antigen-parse-args () {\n  local argkey key value index=0 args\n  local match mbegin mend MATCH MBEGIN MEND\n\n  local var=$1\n  shift\n\n  # Bundle spec arguments' default values.\n  #setopt XTRACE VERBOSE\n  builtin typeset -A args\n  args[url]=\"$ANTIGEN_DEFAULT_REPO_URL\"\n  #unsetopt XTRACE VERBOSE\n  args[loc]=/\n  args[make_local_clone]=true\n  args[btype]=plugin\n  #args[branch]= # commented out as it may cause assoc array kv mismatch\n\n  while [[ $# -gt 0 ]]; do\n    argkey=\"${1%\\=*}\"\n    key=\"${argkey//--/}\"\n    value=\"${1#*=}\"\n\n    case \"$argkey\" in\n      --url|--loc|--branch|--btype)\n        if [[ \"$value\" == \"$argkey\" ]]; then\n          printf \"Required argument for '%s' not provided.\\n\" $key >&2\n        else\n          args[$key]=\"$value\"\n        fi\n      ;;\n      --no-local-clone)\n        args[make_local_clone]=false\n      ;;\n      --*)\n        printf \"Unknown argument '%s'.\\n\" $key >&2\n      ;;\n      *)\n        value=$key\n        case $index in\n          0)\n            key=url\n            local domain=\"\"\n            local url_path=$value\n            # Full url with protocol or ssh github url (github.com:org/repo)\n            if [[ \"$value\" =~ \"://\" || \"$value\" =~ \":\" ]]; then\n              if [[ \"$value\" =~ [@.][^/:]+[:]?[0-9]*[:/]?(.*)@?$ ]]; then\n                url_path=$match[1]\n                domain=${value/$url_path/}\n              fi\n            fi\n\n            if [[ \"$url_path\" =~ '@' ]]; then\n              args[branch]=\"${url_path#*@}\"\n              value=\"$domain${url_path%@*}\"\n            else\n              value=\"$domain$url_path\"\n            fi\n          ;;\n          1) key=loc ;;\n        esac\n        let index+=1\n        args[$key]=\"$value\"\n      ;;\n    esac\n\n    shift\n  done\n  \n  # Check if url is just the plugin name. Super short syntax.\n  if [[ \"${args[url]}\" != */* ]]; then\n    case \"$ANTIGEN_DEFAULT_REPO_URL\" in\n      \"$ANTIGEN_OMZ_REPO_URL\")\n        args[loc]=\"plugins/${args[url]}\"\n      ;;\n      \"$ANTIGEN_PREZTO_REPO_URL\")\n        args[loc]=\"modules/${args[url]}\"\n      ;;\n      *)\n        args[loc]=\"${args[url]}\"\n      ;;\n    esac\n    args[url]=\"$ANTIGEN_DEFAULT_REPO_URL\"\n  fi\n\n  # Resolve the url.\n  # Expand short github url syntax: `username/reponame`.\n  local url=\"${args[url]}\"\n  if [[ $url != git://* &&\n          $url != https://* &&\n          $url != http://* &&\n          $url != ssh://* &&\n          $url != /* &&\n          $url != *github.com:*/*\n          ]]; then\n    url=\"https://github.com/${url%.git}.git\"\n  fi\n  args[url]=\"$url\"\n\n  # Ignore local clone if url given is not a git directory\n  if [[ ${args[url]} == /* && ! -d ${args[url]}/.git ]]; then\n    args[make_local_clone]=false\n  fi\n\n  # Add the branch information to the url if we need to create a local clone.\n  # Format url in bundle-metadata format: url[|branch]\n  if [[ ! -z \"${args[branch]}\" && ${args[make_local_clone]} == true ]]; then\n    args[url]=\"${args[url]}|${args[branch]}\"\n  fi\n\n  # Add the theme extension to `loc`, if this is a theme, but only\n  # if it's especified, ie, --loc=theme-name, in case when it's not\n  # specified antige-load-list will look for *.zsh-theme files\n  if [[ ${args[btype]} == \"theme\" &&\n      ${args[loc]} != \"/\" && ${args[loc]} != *.zsh-theme ]]; then\n      args[loc]=\"${args[loc]}.zsh-theme\"\n  fi\n\n  local name=\"${args[url]%|*}\"\n  local branch=\"${args[branch]}\"\n\n  # Extract bundle name.\n  if [[ \"$name\" =~ '.*/(.*/.*).*$' ]]; then\n    name=\"${match[1]}\"\n  fi\n  name=\"${name%.git*}\"\n\n  # Format bundle name with optional branch.\n  if [[ -n \"${branch}\" ]]; then\n    args[name]=\"${name}@${branch}\"\n  else\n    args[name]=\"${name}\"\n  fi\n\n  # Format bundle path.\n  if [[ ${args[make_local_clone]} == true ]]; then\n    local bpath=\"$name\"\n    # Suffix with branch/tag name\n    if [[ -n \"$branch\" ]]; then\n      # bpath is in the form of repo/name@version => repo/name-version\n      # Replace / with - in bundle branch.\n      local bbranch=${branch//\\//-}\n      # If branch/tag is semver-like do replace * by x.\n      bbranch=${bbranch//\\*/x}\n      bpath=\"${name}-${bbranch}\"\n    fi\n\n    bpath=\"$ANTIGEN_BUNDLES/$bpath\"\n    args[dir]=\"${(qq)bpath}\"\n  else\n    # if it's local then path is just the \"url\" argument, loc remains the same\n    args[dir]=${args[url]}\n  fi\n  \n  # Escape url and branch (may contain semver-like and pipe characters)\n  args[url]=\"${(qq)args[url]}\"\n  if [[ -n \"${args[branch]}\" ]]; then\n    args[branch]=\"${(qq)args[branch]}\"\n  fi\n  \n  # Escape bundle name (may contain semver-like characters)\n  args[name]=\"${(qq)args[name]}\"\n\n  eval \"${var}=(${(kv)args})\"\n\n  return 0\n}\n"
  },
  {
    "path": "src/lib/revert-info.zsh",
    "content": "# Updates revert-info data with git hash.\n#\n# This does process only cloned bundles.\n#\n# Usage\n#    -antigen-revert-info\n#\n# Returns\n#    Nothing. Generates/updates $ADOTDIR/revert-info.\n-antigen-revert-info() {\n  local url\n  # Update your bundles, i.e., `git pull` in all the plugin repos.\n  date >! $ADOTDIR/revert-info\n\n  -antigen-get-cloned-bundles | while read url; do\n    local clone_dir=\"$(-antigen-get-clone-dir \"$url\")\"\n    if [[ -d \"$clone_dir\" ]]; then\n      (echo -n \"$clone_dir:\"\n        \\cd -q \"$clone_dir\"\n        git rev-parse HEAD) >> $ADOTDIR/revert-info\n    fi\n  done\n}\n"
  },
  {
    "path": "src/lib/use-oh-my-zsh.zsh",
    "content": "-antigen-use-oh-my-zsh () {\n  typeset -g ZSH ZSH_CACHE_DIR\n  ANTIGEN_DEFAULT_REPO_URL=$ANTIGEN_OMZ_REPO_URL\n  if [[ -z \"$ZSH\" ]]; then\n    ZSH=\"$(-antigen-get-clone-dir \"$ANTIGEN_DEFAULT_REPO_URL\")\"\n  fi\n  if [[ -z \"$ZSH_CACHE_DIR\" ]]; then\n    ZSH_CACHE_DIR=\"$ZSH/cache/\"\n  fi\n  antigen-bundle --loc=lib\n}\n"
  },
  {
    "path": "src/lib/use-prezto.zsh",
    "content": "-antigen-use-prezto () {\n  ANTIGEN_DEFAULT_REPO_URL=$ANTIGEN_PREZTO_REPO_URL\n  antigen-bundle \"$ANTIGEN_PREZTO_REPO_URL\"\n}\n"
  },
  {
    "path": "tests/.gitconfig",
    "content": "[user]\n\tname=test\n\temail=test@test.test\n"
  },
  {
    "path": "tests/.zshenv",
    "content": "# Display all globally defined variables from functions\nsetopt localoptions warncreateglobal\n\n# zshrc file written for antigen's tests. Might not be a good one for daily use.\n# See cram's documentation for some of the variables used below.\nexport ADOTDIR=$(mktemp -du \"/tmp/dot-antigen-tmp-XXXXX\")\n[[ ! -d \"$ADOTDIR\" ]] && mkdir -p \"$ADOTDIR\"\n\nexport ANTIGEN=${ANTIGEN:-\"/antigen\"}\nexport ANTIGEN_AUTO_CONFIG=false\n# Commented out due to tests/cache.t\n#export ANTIGEN_CACHE=false\nexport ANTIGEN_RSRC=$ADOTDIR/.resources\nexport _ANTIGEN_WARN_DUPLICATES=false\nexport _ANTIGEN_INTERACTIVE=true\n\n# Comment/uncomment this line to be able to see detailed debug logs on\n# the tests output (tests naturally will fail)\n# export ANTIGEN_DEBUG_LOG=/dev/stdout\n\nexport TESTDIR=$(mktemp -d \"/tmp/cram-testdir-XXXXX\" || /tmp/cram-testdir)\ntest -f \"$TESTDIR/.zcompdump\" && rm \"$TESTDIR/.zcompdump\"\nsource \"$ANTIGEN/antigen.zsh\"\n\n# A test plugin repository to test out antigen with.\n\nPLUGIN_DIR=\"$TESTDIR/test-plugin\"\n# {\n  mkdir \"$PLUGIN_DIR\"\n\n  # A wrapper function over `git` to work with the test plugin repo.\n  alias pg='git --git-dir \"$PLUGIN_DIR/.git\" --work-tree \"$PLUGIN_DIR\"'\n\n  echo 'alias hehe=\"echo hehe\"' > \"$PLUGIN_DIR\"/aliases.zsh\n  echo 'PS1=\"prompt>\"' > \"$PLUGIN_DIR\"/silly.zsh-theme\n  echo 'PS1=\">\"' > \"$PLUGIN_DIR\"/arrow.zsh-theme\n\n  {\n      pg init\n      pg config user.name 'test'\n      pg config user.email 'test@test.test'\n      pg add .\n      pg commit -m 'Initial commit'\n  } > /dev/null\n# }\n\n# Another test plugin.\n\nPLUGIN_DIR2=\"$TESTDIR/test-plugin2\"\n# {\n  mkdir \"$PLUGIN_DIR2\"\n\n  # A wrapper function over `git` to work with the test plugin repo.\n  alias pg2='git --git-dir \"$PLUGIN_DIR2/.git\" --work-tree \"$PLUGIN_DIR2\"'\n\n  echo 'alias hehe2=\"echo hehe2\"' > \"$PLUGIN_DIR2\"/init.zsh\n  echo -E 'alias prompt=\"\\e]$ >\\a\\n\"' >> \"$PLUGIN_DIR2\"/init.zsh\n  echo 'local root=${0}' >> \"$PLUGIN_DIR2\"/init.zsh\n  echo 'function root_source () {\n          echo $root/$0\n      }' >> \"$PLUGIN_DIR2\"/init.zsh\n  echo 'alias unsourced-alias=\"echo unsourced-alias\"' > \"$PLUGIN_DIR2\"/aliases.zsh\n\n  {\n      pg2 init\n      pg2 config user.name 'test'\n      pg2 config user.email 'test@test.test'\n      pg2 add .\n      pg2 commit -m 'Initial commit'\n  } > /dev/null\n# }\n\n# Another test plugin.\n\nPLUGIN_DIR3=\"$TESTDIR/test-plugin3\"\n# {\n  mkdir \"$PLUGIN_DIR3\"\n\n  # A wrapper function over `git` to work with the test plugin repo.\n  alias pg3='git --git-dir \"$PLUGIN_DIR3/.git\" --work-tree \"$PLUGIN_DIR3\"'\n\n  echo \"echo '######'\" > \"$PLUGIN_DIR3\"/hr-plugin\n  chmod u+x \"$PLUGIN_DIR3\"/hr-plugin\n\n  {\n      pg3 init\n      pg3 config user.name 'test'\n      pg3 config user.email 'test@test.test'\n      pg3 add .\n      pg3 commit -m 'Initial commit'\n  } > /dev/null\n# }\n\nPLUGIN_DIR4=\"$TESTDIR/test-plugin4\"\n# {\n  mkdir \"$PLUGIN_DIR4\"\n  echo \"echo hello world\" > \"$PLUGIN_DIR4/hello-world\"\n  chmod u+x \"$PLUGIN_DIR4/hello-world\"\n# }\n\n# Another test plugin.\n\nPLUGIN_DIR5=\"$TESTDIR/test-plugin5\"\n# {\n  mkdir \"$PLUGIN_DIR5\"\n\n  # A wrapper function over `git` to work with the test plugin repo.\n  alias pg3='git --git-dir \"$PLUGIN_DIR5/.git\" --work-tree \"$PLUGIN_DIR5\"'\n\n  {\n      pg3 init\n      pg3 config user.name 'test'\n      pg3 config user.email 'test@test.test'\n      \n      echo \"export VERSION='initial'\" > \"$PLUGIN_DIR5/version.zsh\"\n      pg3 add .\n      pg3 commit -m 'Initial commit'\n      pg3 branch stable\n      \n      echo \"export VERSION='v0.0.1'\" > \"$PLUGIN_DIR5/version.zsh\"\n      pg3 add .\n      pg3 commit -m 'v0.0.1'\n      pg3 tag v0.0.1\n\n      echo \"export VERSION='v0.0.2'\" > \"$PLUGIN_DIR5/version.zsh\"\n      pg3 add .\n      pg3 commit -m 'v0.0.2'\n      pg3 tag v0.0.2\n      \n      echo \"export VERSION='v1.0.3'\" > \"$PLUGIN_DIR5/version.zsh\"\n      pg3 add .\n      pg3 commit -m 'v1.0.3'\n      pg3 tag v1.0.3\n      \n      echo \"export VERSION='v1.1.4'\" > \"$PLUGIN_DIR5/version.zsh\"\n      pg3 add .\n      pg3 commit -m 'v1.1.4'\n      pg3 tag v1.1.4\n      \n      echo \"export VERSION='v3'\" > \"$PLUGIN_DIR5/version.zsh\"\n      pg3 add .\n      pg3 commit -m 'v3'\n      pg3 tag v3\n  } > /dev/null\n# }\n\n# Wrapper around \\wc command to handle wc format differences between GNU and BSD\n# GNU:\n#  echo 1 | wc -l\n#  1\n# BSD:\n#  echo 1 | wc -l\n#       1\n#\n# Using this wrapper output from both implementations resembles GNU's.\nfunction wc () {\n    command wc \"$@\" | xargs\n}\n"
  },
  {
    "path": "tests/antigen-wrapper.t",
    "content": "Create a dummy antigen command.\n\n  $ antigen-dummy () {\n  >   echo me dummy\n  > }\n\nCheck the normal way of calling it\n\n  $ antigen-dummy\n  me dummy\n\nCall with the wrapper syntax.\n\n  $ antigen dummy\n  me dummy\n\nCall with an alias\n\n  $ alias a=antigen\n  $ a dummy\n  me dummy\n\nCall without arguments should exit with error.\n\n  $ antigen 2>/dev/null\n  [1]\n\nCall without arguments should display help message.\n\n  $ antigen 2>&1 | head -n 4\n  Antigen .* (re)\n  Revision .* (re)\n  \n  Antigen is a .* (re)\n"
  },
  {
    "path": "tests/apply.t",
    "content": "Can use antigen-apply and antigen apply interchangably.\n\n  $ hehe &> /dev/null\n  [127]\n\n  $ antigen bundle $PLUGIN_DIR &> /dev/null\n  $ antigen theme $PLUGIN_DIR silly\n  $ antigen apply &> /dev/null\n\n  $ hehe\n  hehe\n\n  $ echo \"$PS1\"\n  prompt>\n"
  },
  {
    "path": "tests/arg-parser.t",
    "content": "Helper alias.\n\n  $ typeset -A bundle\n  $ parse () {\n  >    bundle=()\n  >   -antigen-parse-args bundle \"$@\"\n  > }\n\nNo arguments (since all are specified as optional).\n\n  $ parse\n\nOne positional argument.\n\n  $ parse plugin/url\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url.git\n\nTwo arguments.\n\n  $ parse plugin/url location\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url.git\n  $ echo ${bundle[loc]}\n  location\n\nThree arguments.\n\n  $ parse plugin/url location crap\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url.git\n  $ echo ${bundle[loc]}\n  location\n\nKeywordo magic.\n\n  $ parse plugin/url location --btype=1 --no-local-clone\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url.git\n  $ echo ${bundle[loc]}\n  location\n  $ echo ${bundle[btype]}\n  1\n  $ echo ${bundle[make_local_clone]}\n  false\n\nUnknown keyword argument.\n\n  $ parse --me=genius\n  Unknown argument 'me'.\n\nMissed value for keyword argument.\n\n  $ parse --btype\n  Required argument for 'btype' not provided.\n\nProvide value for keyword argument, but it's ignored.\n\n  $ parse --no-local-clone=yes\n  $ echo ${bundle[make_local_clone]}\n  false\n\nPositional argument as a keyword argument.\n\n  $ parse --url=plugin/url\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url.git\n\nRepeated keyword arguments.\n\n  $ parse --url=plugin/url --url=plugin/url2\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url2.git\n\nRepeated, once as positional and once more as keyword.\n\n  $ parse plugin/url --url=plugin/url2\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url2.git\n\nSupports bundle name with branch/version.\n\n  $ parse plugin/url@version\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url.git|version\n  $ echo ${bundle[branch]}\n  version\n\nSupports branch/version flag\n\n  $ parse plugin/url --branch=version\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url.git|version\n  $ echo ${bundle[branch]}\n  version\n\nFlag `--branch` overwrites `@`-name.\n\n  $ parse plugin/url@b1 --branch=b2\n  $ echo ${bundle[url]}\n  https://github.com/plugin/url.git|b2\n  $ echo ${bundle[branch]}\n  b2\n\nPrivate git urls.\n\n  $ parse ssh://git@domain.local:1234/repository/name.git\n  $ echo ${bundle[url]}\n  ssh://git@domain.local:1234/repository/name.git\n\nPrivate git urls with branch short format.\n\n  $ parse ssh://git@domain.local:1234/repository/name.git@example-branch/name\n  $ echo ${bundle[url]}\n  ssh://git@domain.local:1234/repository/name.git|example-branch/name\n  $ echo ${bundle[branch]}\n  example-branch/name\n\nPrivate git urls with branch argument format.\n\n  $ parse ssh://git@domain.local:1234/repository/name.git --branch=example-branch/name\n  $ echo ${bundle[url]}\n  ssh://git@domain.local:1234/repository/name.git|example-branch/name\n  $ echo ${bundle[branch]}\n  example-branch/name\n\nSSH github url.\n\n  $ parse github.com:reem/watch.git\n  $ echo ${bundle[url]}\n  github.com:reem/watch.git\n\nLong SSH github url.\n\n  $ parse git@github.com:zsh-users/antigen.git\n  $ echo ${bundle[url]}\n  git@github.com:zsh-users/antigen.git\n"
  },
  {
    "path": "tests/branch-bundle.t",
    "content": "Branch b1.\n\n  $ pg branch b1\n  $ pg checkout b1\n  Switched to branch 'b1'\n  $ cat > $PLUGIN_DIR/aliases.zsh <<EOF\n  > alias hehe='echo hehe from b1'\n  > EOF\n  $ pg commit -am 'Change for b1'\n  \\[b1 [a-f0-9]{7}\\] Change for b1 (re)\n   1 file changed, 1 insertion(+), 1 deletion(-)\n\nGo back to master.\n\n  $ pg checkout master\n  Switched to branch 'master'\n\nLoad plugin from b1.\n\n  $ antigen bundle $PLUGIN_DIR --branch=b1 &> /dev/null\n  $ hehe\n  hehe from b1\n\nDoes not say 'Already on b1' on each session startup.\n\n  $ antigen-bundle $PLUGIN_DIR --branch=b1\n\nLoad plugin from master.\n\n  $ antigen-bundle $PLUGIN_DIR &> /dev/null\n  $ hehe\n  hehe\n"
  },
  {
    "path": "tests/bundle-syntaxes.t",
    "content": "Test helper and mock functions.\n\n  $ ANTIGEN_DEFAULT_REPO_URL=gh-user/repo\n  $ ANTIGEN_WARN_DUPLICATES=false\n\n  $ b () {\n  >     antigen-bundle \"$@\" | tail -3\n  > }\n\n  $ -antigen-ensure-repo () {}\n\n  $ -antigen-load () {\n  >   typeset -A bundle; bundle=($@)\n  >     echo \"url:    ${bundle[url]}\"\n  >     echo \"dir:    ${bundle[loc]}\"\n  >     echo \"clone?: ${bundle[make_local_clone]}\"\n  > }\n\nShort and sweet.\n\n  $ b lol\n  url:    https://github.com/gh-user/repo.git\n  dir:    lol\n  clone?: true\n\nShort repo url.\n\n  $ b github-username/repo-name\n  url:    https://github.com/github-username/repo-name.git\n  dir:    /\n  clone?: true\n\nShort repo url with `.git` suffix.\n\n  $ b github-username/repo-name.git\n  url:    https://github.com/github-username/repo-name.git\n  dir:    /\n  clone?: true\n\nLong repo url.\n\n  $ b https://github.com/user/repo.git\n  url:    https://github.com/user/repo.git\n  dir:    /\n  clone?: true\n\nLong repo url with missing `.git` suffix (should'nt add the suffix).\n\n  $ b https://github.com/user/repo\n  url:    https://github.com/user/repo\n  dir:    /\n  clone?: true\n\nShort repo with location.\n\n  $ b user/plugin path/to/plugin\n  url:    https://github.com/user/plugin.git\n  dir:    path/to/plugin\n  clone?: true\n\nKeyword arguments, in respective places.\n\n  $ b --url=user/repo --loc=path/of/plugin\n  url:    https://github.com/user/repo.git\n  dir:    path/of/plugin\n  clone?: true\n\nKeyword arguments, in respective places, with full repo url.\n\n  $ b --url=https://github.com/user/repo.git --loc=plugin/path\n  url:    https://github.com/user/repo.git\n  dir:    plugin/path\n  clone?: true\n\nKeyword arguments, in reversed order.\n\n  $ b --loc=path/of/plugin --url=user/repo\n  url:    https://github.com/user/repo.git\n  dir:    path/of/plugin\n  clone?: true\n\nMixed positional and keyword arguments, and skip `loc`.\n\n  $ b user/repo --loc=plugin/loc\n  url:    https://github.com/user/repo.git\n  dir:    plugin/loc\n  clone?: true\n\nJust `loc`, using keyword arguments.\n\n  $ b --loc=plugin/path\n  url:    https://github.com/gh-user/repo.git\n  dir:    plugin/path\n  clone?: true\n\nTODO: Error reporting with erroneous arguments or usage with incorrect syntax.\n"
  },
  {
    "path": "tests/bundle.t",
    "content": "Should get a complain if no bundle is given as argument.\n\n  $ antigen-bundle\n  Antigen: Must provide a bundle url or name.\n  [1]\n\nLoad plugin from master.\n\n  $ antigen-bundle $PLUGIN_DIR &> /dev/null\n  $ hehe\n  hehe\n\nLoad the plugin again. Just to see nothing happens.\n\n  $ antigen-bundle $PLUGIN_DIR\n  $ hehe\n  hehe\n\nTry to load an unexisting plugin from a cloned bundle.\n\n  $ antigen-bundle $PLUGIN_DIR wrong\n  Antigen: Failed to load plugin.\n  [1]\n\nTry to install an unexisting bundle.\n\n  $ antigen-bundle https://127.0.0.1/bundle/unexisting.git\n  Installing bundle/unexisting... Error! Activate logging and try again.\n  [1]\n  $ echo $fpath | grep -co test-plugin\n  1\n\nConfirm bundle/unexisting does not exists (parent directory will not be removed).\n\n  $ ls $ANTIGEN_BUNDLES/bundle/ | wc -l\n  0\n\nLoad a prezto style module. Should only source the `init.zsh` present in the\nmodule.\n\n  $ antigen-bundle $PLUGIN_DIR2 &> /dev/null\n  $ hehe2\n  hehe2\n\nThe alias defined in the other zsh file should not be available.\n\n  $ unsourced-alias\n  zsh: command not found: unsourced-alias\n  [127]\n\nFpath should be updated correctly.\n\n  $ echo ${(j:\\n:)fpath}\n  .*/site-functions (re)\n  .*/functions (re)\n  .*/test-plugin (re)\n  .*/test-plugin2 (re)\n\nLoad plugin multiple times, doesn't cluters _ANTIGEN_BUNDLE_RECORD\n\n  $ antigen-bundle $PLUGIN_DIR\n  $ echo ${(j:\\n:)_ANTIGEN_BUNDLE_RECORD} | wc -l\n  2\n  $ antigen-bundle $PLUGIN_DIR\n  $ echo ${(j:\\n:)_ANTIGEN_BUNDLE_RECORD} | wc -l\n  2\n\nBundle short names.\n\n  $ -antigen-bundle-short-name \"https://github.com/example/bundle.git\"\n  example/bundle\n\nBranch name is not display with short names.\n\n  $ -antigen-bundle-short-name \"https://github.com/example/bundle.git|branch\"\n  example/bundle\n\n  $ -antigen-bundle-short-name \"https://github.com/example/bundle.git|feature/branch/git\"\n  example/bundle\n\n  $ -antigen-bundle-short-name \"https://github.com/example/bundle.git\" \"feature/branch/git\"\n  example/bundle@feature/branch/git\n\n  $ -antigen-bundle-short-name \"example/bundle.git\" \"feature/branch.git\"\n  example/bundle@feature/branch.git\n\n  $ -antigen-bundle-short-name \"example/bundle\" \"feature/branch.git\"\n  example/bundle@feature/branch.git\n\nHandle shorter syntax.\n\n  $ -antigen-bundle-short-name \"github.com/example/bundle\"\n  example/bundle\n\nHandle local bundles (--no-local-clone).\n\n  $ -antigen-bundle-short-name \"/home/user/local-bundle\"\n  user/local-bundle\n\nLoad a binary bundle.\n\n  $ antigen-bundle $PLUGIN_DIR3 &> /dev/null\n  $ hr-plugin\n  ######\n\n  $ echo $PATH | grep test-plugin3\n  *plugin3* (glob)\n\nWarns about duplicate bundle.\n\n  $ antigen-bundle $PLUGIN_DIR3 &> /dev/null\n  $ _ANTIGEN_WARN_DUPLICATES=true\n  $ antigen-bundle $PLUGIN_DIR3\n  Seems .* is already installed! (re)\n  [1]\n"
  },
  {
    "path": "tests/bundles.t",
    "content": "Save env variables to test for leaks.\n\n  $ prev=$(env)\n\nAdd multiple bundles.\n\n  $ echo \"$PLUGIN_DIR\\n$PLUGIN_DIR2\" | antigen-bundles &> /dev/null\n\nCheck if they are both applied.\n\n  $ hehe\n  hehe\n  $ hehe2\n  hehe2\n\nShould not leak Antigen or OMZ environment variables.\n\n  $ diff <(env) <(echo $prev) | sed -e 's/\\=.*//' | grep -i antigen | wc -l\n  0\n\n  $ diff <(env) <(echo $prev) | sed -e 's/\\=.*//' | grep -i zsh | wc -l\n  0\n\nClean it all up.\n\n  $ _ANTIGEN_BUNDLE_RECORD=()\n  $ antigen-cleanup --force &> /dev/null\n\nSpecify with indentation.\n\n  $ echo \"  $PLUGIN_DIR\\n  $PLUGIN_DIR2\" | antigen-bundles &> /dev/null\n\nAgain, check if they are both applied.\n\n  $ hehe\n  hehe\n  $ hehe2\n  hehe2\n\nHandle GREP_OPTIONS gracefully.\n\n  $ GREP_OPTIONS=\"--color=always \"\n  $ echo \"  $PLUGIN_DIR\\n  $PLUGIN_DIR2\" | antigen-bundles\n\nCheck if they are both applied.\n\n  $ hehe\n  hehe\n  $ hehe2\n  hehe2\n"
  },
  {
    "path": "tests/cache.t",
    "content": "Enable extension.\n\n  $ export _ANTIGEN_INTERACTIVE=false\n  $ antigen ext cache\n  $ antigen ext-list\n  cache\n  $ ANTIGEN_CACHE=$ADOTDIR/init.zsh\n\n  $ prev=$(env)\n  $ antigen reset\n  Done. Please open a new shell to see the changes.\n\n  $ antigen list\n  You don't have any bundles.\n  [1]\n\nCan programatically generate cache.\n\n  $ antigen reset &> /dev/null\n  $ antigen cache-gen\n  $ ls $ADOTDIR/init*\n  .*init.zsh.* (re)\n  .*init.zsh.zwc* (re)\n"
  },
  {
    "path": "tests/cleanup.t",
    "content": "Firstly, no plugins, nothing to cleanup.\n\n  $ antigen-cleanup --force\n  You don't have any bundles.\n\nLoad the plugins.\n\n  $ antigen-bundle $PLUGIN_DIR &> /dev/null\n  $ antigen-bundle $PLUGIN_DIR2 &> /dev/null\n\nCheck the listing.\n\n  $ antigen-list\n  .*/test-plugin @ master (re)\n  .*/test-plugin2 @ master (re)\n\nNothing should be available for cleanup.\n\n  $ antigen-cleanup --force\n  You don't have any unidentified bundles.\n\nClear out the bundles record.\n\n  $ _ANTIGEN_BUNDLE_RECORD=()\n\nCheck the listing, after clearing the record.\n\n  $ antigen-list\n  You don't have any bundles.\n  [1]\n\nConfirm the plugin directory exists.\n\n  $ ls $ANTIGEN_BUNDLES | wc -l\n  1\n\nDo the cleanup.\n\n  $ antigen-cleanup --force\n  You have clones for the following repos, but are not used.\n  \n  .*/test-plugin (re)\n  .*/test-plugin2 (re)\n  \n  \n  Deleting clone \"*/test-plugin\"... done. (glob)\n  Deleting clone \"*/test-plugin2\"... done. (glob)\n\nCheck the listing, after cleanup.\n\n  $ antigen-list\n  You don't have any bundles.\n  [1]\n\nConfirm the plugin directory does not exist after cleanup.\n\n  $ ls $ANTIGEN_BUNDLES/cram-testdir-* | wc -l\n  0\n# TODO\n# Do not remove local bundles (--no-local-clone).\n# \n#   $ ls $ANTIGEN_BUNDLES\n# \n#   $ _ANTIGEN_BUNDLE_RECORD=()\n#   $ antigen list &> /dev/null\n#   [1]\n#   $ antigen bundle $PLUGIN_DIR --no-local-clone\n#   $ antigen apply &> /dev/null\n#   $ antigen list --long\n#   .*cleanup.t/test-plugin / plugin false (re)\n# \n#   $ antigen cleanup --force\n#   You don't have any bundles.\n"
  },
  {
    "path": "tests/clone-dir.t",
    "content": "Set up functions and env variables:\n\n  $ ANTIGEN_LOG=/dev/stdout # We wanna see debug output\n  $ function git() { echo \"\\ngit $@\\n\" } # Wrap git to avoid the network\n\nBundles branches are stored in their own paths.\n\n  $ -antigen-load () {}\n  $ antigen bundle zsh-users/zsh-syntax-highlighting@example/branch\n  Installing zsh-users/zsh-syntax-highlighting@example/branch... \n  git clone .* --branch example/branch -- https://github.com/zsh-users/zsh-syntax-highlighting.git .*/bundles/zsh-users/zsh-syntax-highlighting-example-branch (re)\n  \n  Done. Took *s. (glob)\n\nThere may be a dot-git suffix in branches names.\n\n  $ antigen bundle https://github.com/user-name/zsh-bundle.git@feature/make-it-work.git\n  Installing user-name/zsh-bundle@feature/make-it-work.git... \n  git clone .* --branch feature/make-it-work.git -- https://github.com/user-name/zsh-bundle.git .*/bundles/user-name/zsh-bundle-feature-make-it-work.git (re)\n  \n  Done. Took *s. (glob)\n\nYou may use a plugin from a library on an specific tag/branch.\n\n  $ antigen bundle git@v1.2.3-1\n  Installing robbyrussell/oh-my-zsh@v1.2.3-1... \n  git clone .* --branch v1.2.3-1 -- https://github.com/robbyrussell/oh-my-zsh.git .*/bundles/robbyrussell/oh-my-zsh-v1.2.3-1 (re)\n  \n  Done. Took *s. (glob)\n\nNaturally handle --branch flag.\n\n  $ antigen bundle rupa/z --branch=0.0-1.x\n  Installing rupa/z@0.0-1.x... \n  git clone .* --branch 0.0-1.x -- https://github.com/rupa/z.git .*/bundles/rupa/z-0.0-1.x (re)\n  \n  Done. Took *s. (glob)\n\nThere may be a dot-git suffix in bundle name.\n\n  $ antigen bundle zsh/git-completions.git@git/v1.8.git\n  Installing zsh/git-completions@git/v1.8.git... \n  git clone .* --branch git/v1.8.git -- https://github.com/zsh/git-completions.git .*/bundles/zsh/git-completions-git-v1.8.git (re)\n  \n  Done. Took *s. (glob)\n"
  },
  {
    "path": "tests/ensure-repo.t",
    "content": "Set up functions and env variables:\n\n  $ ANTIGEN_LOG=/dev/stdout # We wanna see debug output\n  $ function git() { echo \"git $@\" } # Wrap git to avoid the network\n  $ REPO_NAME=user/repo\n  $ REPO_URL=https://github.com/$REPO_NAME.git\n\nEnsure repo default args missing url:\n\n  $ -antigen-ensure-repo 2>&1\n  Antigen: Missing url argument.\n  [1]\n\nClones a repository if it's not cloned already:\n\n  $ -antigen-ensure-repo $REPO_URL\n  git clone .* --branch master -- https://github.com/user/repo.git .*user/repo (re)\n\nIgnore update argument if there is no repo cloned:\n\n  $ -antigen-ensure-repo $REPO_URL true\n  git clone .* --branch master -- https://github.com/user/repo.git .*user/repo (re)\n\nEffectively update a repository already cloned:\n\n  $ mkdir -p $(-antigen-get-clone-dir $REPO_URL) # Fake repository clone\n  $ -antigen-ensure-repo $REPO_URL true\n  git --git-dir=.*/user/repo/.git .* checkout master (re)\n  git --git-dir=.*/user/repo/.git .* pull origin master (re)\n  git --git-dir=.*/user/repo/.git .* submodule update .* (re)\n\nClone especific branch if required:\n\n  $ rm -r $ANTIGEN_BUNDLES\n  $ -antigen-ensure-repo \"$REPO_URL|v5.0\"\n  git clone .* --branch v5.0 -- https://github.com/user/repo.git .*user/repo-v5.0 (re)\n"
  },
  {
    "path": "tests/ext.t",
    "content": "Set up\n\n  $ alias hook=antigen-add-hook\n\nCall hook any function.\n\n  $ hello () {\n  >   echo Hello.\n  > }\n  $ hello-fr () {\n  >   echo Bonjour.\n  > }\n  $ hook hello hello-fr replace\n  $ hello\n  Bonjour.\n\nFail to create hook function if hooked function doesn't exists.\n\n  $ help-fr () {\n  >   echo Help.\n  > }\n  $ hook help help-fr replace\n  Antigen: Function help doesn't exist.\n  [1]\n  $ help\n  zsh: command not found: help\n  [127]\n\nFail to create hook function if hook function doesn't exists.\n\n  $ help () {\n  >   echo Help.\n  > }\n  $ hook help help-de replace\n  Antigen: Function help-de doesn't exist.\n  [1]\n  $ help\n  Help.\n\nCan create pre hook functions.\n\n  $ hola () {\n  >   echo Hola.\n  > }\n  $ hola-en () {\n  >   echo Hello.\n  > }\n  $ hook hola hola-en pre\n  $ hola\n  Hello.\n  Hola.\n\nCan create post hook functions.\n\n  $ hola-pr () {\n  >   echo Olá.\n  > }\n  $ hook hola hola-pr post\n  $ hola\n  Hello.\n  Hola.\n  Olá.\n\nCan reset all hooks functions.\n\n  $ -antigen-reset-hooks\n  $ hola\n  Hola.\n\n  $ hook hola hola-en pre\n  $ hola\n  Hello.\n  Hola.\n\nCan add multiple pre/post hook functions.\n\n  $ -antigen-reset-hooks\n  $ antigen-bundle () {\n  >   echo called antigen-bundle with $@\n  > }\n  $ antigen-bundle desyncr/zsh-ctrlp --no-local-clone\n  called antigen-bundle with desyncr/zsh-ctrlp --no-local-clone\n  $ antigen-bundle-hook () {\n  >   echo \"pre-hook: $@\"\n  > }\n  $ hook antigen-bundle antigen-bundle-hook pre\n  $ antigen-bundle-hook2 () {\n  >   echo \"pre-hook2: $@\"\n  > }\n  $ hook antigen-bundle antigen-bundle-hook2 pre\n  $ antigen-bundle-hook-post () {\n  >   echo \"post-hook: $@\"\n  > }\n  $ hook antigen-bundle antigen-bundle-hook-post post\n  $ antigen-bundle-hook-post2 () {\n  >   echo \"post-hook2: $@\"\n  > }\n  $ hook antigen-bundle antigen-bundle-hook-post2 post\n  $ antigen-bundle example/bundle\n  pre-hook: example/bundle\n  pre-hook2: example/bundle\n  called antigen-bundle with example/bundle\n  post-hook: example/bundle\n  post-hook2: example/bundle\n\nExample deferred function with hook.\n\n  $ -antigen-reset-hooks\n  $ typeset -a _bundle_deferred; _bundle_deferred=()\n  $ antigen-bundle-deferred () {\n  >   _bundle_deferred+=($@)\n  > }\n  $ hook antigen-bundle antigen-bundle-deferred replace\n  $ antigen-bundle zsh-users/zsh-syntax-highlighting\n  $ antigen-bundle zsh-users/zsh-autocompletions\n  $ echo $_bundle_deferred\n  zsh-users/zsh-syntax-highlighting zsh-users/zsh-autocompletions\n  $ antigen-remove-hook antigen-bundle-deferred\n  $ antigen-bundle zsh-users/zsh-completions\n  called antigen-bundle with zsh-users/zsh-completions\n"
  },
  {
    "path": "tests/find-record.t",
    "content": "Finds a given record with branch name.\n\n  $ _ANTIGEN_BUNDLE_RECORD=('https://github.com/rupa/z.git|952f01375a2e28463a8abbaa54b4a038c74c8d82 / plugin true'\n  > 'https://github.com/desyncr/watch.git|develop / plugin true'\n  > 'https://github.com/zsh-users/zsh-autosuggestions.git / plugin true'\n  > 'https://github.com/zsh-users/zsh-syntax-highlighting.git|0.5.* / plugin true 0.5.*')\n  $ -antigen-find-record 'https://github.com/zsh-users/zsh-syntax-highlighting.git|0.5.*'\n  https://github.com/zsh-users/zsh-syntax-highlighting.git|0.5.* / plugin true 0.5.*\n\n  $ -antigen-find-record zsh-syntax-highlighting\n  https://github.com/zsh-users/zsh-syntax-highlighting.git|0.5.* / plugin true 0.5.*\n\n  $ -antigen-find-record 'syntax'\n  https://github.com/zsh-users/zsh-syntax-highlighting.git|0.5.* / plugin true 0.5.*\n\n  $ -antigen-find-record '0.5.*'\n  https://github.com/zsh-users/zsh-syntax-highlighting.git|0.5.* / plugin true 0.5.*\n\n  $ -antigen-find-record 'zsh-users'\n  https://github.com/zsh-users/zsh-autosuggestions.git / plugin true\n\n  $ -antigen-find-record 'true'\n  https://github.com/rupa/z.git|952f01375a2e28463a8abbaa54b4a038c74c8d82 / plugin true\n"
  },
  {
    "path": "tests/init.t",
    "content": "Can source an dot-antigenrc file:\n\n  $ zcache-cache-exists () { false }\n  $ source () { echo $1 }\n  $ antigen-init $ANTIGEN/tests/.antigenrc\n  .*/.antigenrc (re)\n\nReturns error if non-existing file is given:\n\n  $ zcache-cache-exists () { false }\n  $ antigen-init /non-existing/file.zsh\n  Antigen: invalid argument provided.\n  [1]\n\nCan handle heredocs:\n\n  $ zcache-cache-exists () { false }\n  $ antigen () { echo $@ }\n  $ antigen-init <<EOB\n  > antigen use library\n  > antigen bundle bundle/name\n  > antigen apply\n  > EOB\n  use library\n  bundle bundle/name\n  apply\n"
  },
  {
    "path": "tests/list.t",
    "content": "Empty initial listing.\n\n  $ antigen-list\n  You don't have any bundles.\n  [1]\n\nAdd a bundle.\n\n  $ antigen-bundle $PLUGIN_DIR &> /dev/null\n  $ antigen-list\n  .*/test-plugin @ master (re)\n\nAdd same bundle and check uniqueness.\n\n  $ antigen-bundle $PLUGIN_DIR\n  $ antigen-list\n  .*/test-plugin @ .* (re)\n\nAdd another bundle.\n\n  $ antigen-bundle $PLUGIN_DIR2 &> /dev/null\n  $ antigen-list\n  .*/test-plugin @ master (re)\n  .*/test-plugin2 @ master (re)\n\nList command supports short format flag.\n\n  $ antigen-list\n  .*/test-plugin @ master (re)\n  .*/test-plugin2 @ master (re)\n\n  $ antigen-list --short\n  .*/test-plugin @ master (re)\n  .*/test-plugin2 @ master (re)\n\n  $ antigen-list --long\n  .*/test-plugin / plugin true (re)\n  .*/test-plugin2 / plugin true (re)\n\nCan display feature branches.\n\n  $ cd $PLUGIN_DIR2\n  $ git checkout -b feature-branch &> /dev/null\n  $ git rev-parse --abbrev-ref '@'\n  feature-branch\n  $ antigen-list --short\n  .*/test-plugin @ master (re)\n  .*/test-plugin2 @ .* (re)\n\n  $ antigen-list --long\n  .*/test-plugin / plugin true (re)\n  .*/test-plugin2 / plugin true (re)\n\nFind bundle/record internal function.\n\n  $ -antigen-find-record\n  [1]\n\n  $ -antigen-find-record nonexisting\n  \n\n  $ -antigen-find-record test\n  *test-plugin* (glob)\n\n  $ -antigen-find-record test-plugin\n  *test-plugin* (glob)\n\n  $ -antigen-find-record test-plugin2\n  *test-plugin2* (glob)\n\n  $ -antigen-find-record plugin2\n  *test-plugin2* (glob)\n\n  $ -antigen-find-record test-plugin\n  *test-plugin* (glob)\n\n  $ -antigen-find-record test-plugin2\n  *test-plugin2* (glob)\n\n  $ -antigen-find-record 'cram-testdir-*/test-plugin2'\n  *cram-testdir-*/test-plugin2* (glob)\n\nList bundle no git repo.\n\n  $ antigen bundle $PLUGIN_DIR4\n  $ antigen list\n  *test-plugin @ master (glob)\n  *test-plugin2 @ master (glob)\n  *test-plugin4 @ master (glob)\n  $ hello-world\n  hello world\n\n"
  },
  {
    "path": "tests/load.t",
    "content": "Should respect load spec.\n\n  $ -antigen-load-source () {\n  >  echo ${(j:\\n:)list}\n  > }\n\nMust load all .zsh found:\n\n  $ antigen bundle $PLUGIN_DIR\n  Installing .*/test-plugin... Done. Took .*s. (re)\n  *aliases.zsh (glob)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin (re)\n\nMust load all single .zsh:\n\n  $ antigen bundle $PLUGIN_DIR aliases.zsh\n  *aliases.zsh (glob)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin (re)\n\n\nMust load single theme:\n\n  $ antigen bundle $PLUGIN_DIR silly.zsh-theme\n  *silly.zsh-theme (glob)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin (re)\n\nMust load single init.zsh:\n\n  $ antigen bundle $PLUGIN_DIR2\n  Installing .*/test-plugin2... Done. Took .*s. (re)\n  *init.zsh (glob)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin2 (re)\n\nMust add plugin directory to PATH:\n\n  $ antigen bundle $PLUGIN_DIR3\n  Installing .*/test-plugin3... Done. Took .*s. (re)\n  \n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin3 (re)\n\nHandle non-git plugin:\n\n  $ antigen bundle $PLUGIN_DIR4\n  \n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin4 (re)\n\nCan load from version:\n\n  $ -antigen-load-source () {\n  >  echo ${(j:\\n:)list}\n  >  source ${list}\n  > }\n\n  $ antigen bundle \"$PLUGIN_DIR5@v1.*\"\n  Installing .*/test-plugin5@v1.*... Done. Took .*s. (re)\n  .*test-plugin5-v1.x///version.zsh (re)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin5-v1.* (re)\n\n  $ echo $VERSION\n  v1.1.4\n\n  $ antigen bundle \"$PLUGIN_DIR5@v0.0.*\"\n  Installing .*/test-plugin5@v0.0.*... Done. Took .*s. (re)\n  .*test-plugin5-v0.0.x///version.zsh (re)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin5-v0.0.x (re)\n\n  $ echo $VERSION\n  v0.0.2\n\n  $ antigen bundle \"$PLUGIN_DIR5@v*\"\n  Installing .*/test-plugin5@v.*... Done. Took .*s. (re)\n  .*test-plugin5-vx///version.zsh (re)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin5-vx (re)\n\n  $ echo $VERSION\n  v3\n\n  $ antigen bundle \"$PLUGIN_DIR5@v0.0.1\"\n  Installing .*/test-plugin5@v0.0.1... Done. Took .*s. (re)\n  .*test-plugin5-v0.0.1///version.zsh (re)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin5-v0.0.1 (re)\n\n  $ echo $VERSION\n  v0.0.1\n\n  $ antigen bundle \"$PLUGIN_DIR5@stable\"\n  Installing .*/test-plugin5@stable... Done. Took .*s. (re)\n  .*test-plugin5-stable///version.zsh (re)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin5-stable (re)\n\n  $ echo $VERSION\n  initial\n\n  $ antigen bundle \"$PLUGIN_DIR5\"\n  Installing .*/test-plugin5... Done. Took .*s. (re)\n  .*test-plugin5///version.zsh (re)\n  $ echo ${(j:\\n:)PATH}\n  .*/test-plugin5 (re)\n\n  $ echo $VERSION\n  v3\n"
  },
  {
    "path": "tests/no_local_clone.t",
    "content": "Load the plugin with no local clone.\n\n  $ antigen-bundle $PLUGIN_DIR --no-local-clone\n\nCheck if the plugin is loaded correctly.\n\n  $ hehe\n  hehe\n\nConfirm no clone is made.\n\n  $ ls $ANTIGEN_BUNDLES\n\nLoad the plugin with a clone.\n\n  $ antigen-bundle $PLUGIN_DIR &> /dev/null\n  $ ls $ANTIGEN_BUNDLES\n  cram-testdir-* (glob)\n\nEmpty the record.\n\n  $ _ANTIGEN_BUNDLE_RECORD=()\n  $ antigen-list\n  You don't have any bundles.\n  [1]\n\nLoad the plugin again with no local clone.\n\n  $ antigen-bundle $PLUGIN_DIR --no-local-clone\n  $ antigen list\n  cram-testdir-*/test-plugin @ master (glob)\n  $ ls $ANTIGEN_BUNDLES\n  cram-testdir-* (glob)\n\nThe cleanup should list the bundle's clone.\n\n  $ _ANTIGEN_BUNDLE_RECORD=()\n  $ antigen-cache-gen\n  $ antigen-cleanup --force\n  You have clones for the following repos, but are not used.\n  \n  .*/test-plugin (re)\n  \n  \n  Deleting clone \".*/test-plugin\"... done. (re)\n\n  $ ls $ANTIGEN_BUNDLES/cram-testdir-*\n"
  },
  {
    "path": "tests/purge.t",
    "content": "Purge command removes a bundle from filesystem.\n  $ antigen-bundle $PLUGIN_DIR &> /dev/null\n  $ antigen-list | grep test-plugin\n  *test-plugin* (glob)\n\n  $ antigen-purge test-plugin --force\n  Removing '*test-plugin'. (glob)\n  Done. Please open a new shell to see the changes.\n\nPurge command without arguments returns an error message.\n\n  $ antigen-purge\n  Antigen: Missing argument.\n  [1]\n\nPurge command return an error if bundle is not found.\n\n  $ antigen-purge unexisting-bundle\n  Bundle not found in record. Try 'antigen bundle unexisting-bundle' first.\n  [1]\n"
  },
  {
    "path": "tests/revert-update.t",
    "content": "Load and test plugin.\n\n  $ antigen-bundle $PLUGIN_DIR &> /dev/null\n  $ hehe\n  hehe\n\nSave the current HEAD of the plugin.\n\n  $ old_version=\"$(pg rev-parse HEAD)\"\n\nModify the plugin.\n\n  $ cat > $PLUGIN_DIR/aliases.zsh <<EOF\n  > alias hehe='echo hehe, updated'\n  > EOF\n  $ pg commit -am 'Updated message'\n  \\[master [a-f0-9]{7}\\] Updated message (re)\n   1 file changed, 1 insertion(+), 1 deletion(-)\n\nSave the new HEAD of the plugin.\n\n  $ new_version=\"$(pg rev-parse HEAD)\"\n\nDefine a convenience function to get the current version.\n\n  $ current-version () {(cd $ANTIGEN_BUNDLES/*/* && git rev-parse HEAD)}\n\nConfirm we currently have the old version.\n\n  $ [[ $(current-version) == $old_version ]]\n\nRun antigen's update.\n\n  $ antigen-update\n  Updating */test-plugin@master... Done. Took *s. (glob)\n\nConfirm we have the new version.\n\n  $ [[ $(current-version) == $new_version ]]\n\nRun update again, with no changes in the origin repo.\n\n  $ antigen-revert\n  Reverted to state before running -update on *. (glob)\n\nConfirm we have the old version again.\n\n  $ [[ $(current-version) == $old_version ]]\n"
  },
  {
    "path": "tests/selfupdate.t",
    "content": "Set environment variables for this test case\n\n  $ TEST_DIR=$PWD\n  $ TEST_HOST=$TEST_DIR/host\n  $ TEST_NORMAL=$TEST_DIR/client\n  $ TEST_SUBMODULE=$TEST_DIR/submodule\n\nCreate fake host repository\n\n  $ mkdir -p $TEST_HOST\n  $ cd $TEST_HOST\n  $ git init\n  Initialized empty Git repository in * (glob)\n  $ git config user.name 'test'\n  $ git config user.email 'test@test.test'\n  $ echo 1 > ver\n  $ git add ver\n  $ git commit -m \"1\"\n  [master (root-commit) ???????] 1 (glob)\n   1 file changed, 1 insertion(+)\n   create mode 100644 ver\n\nCreate a normal repository cloning from host\n\n  $ git clone $TEST_HOST $TEST_NORMAL &> /dev/null\n\nCreate a submodule repository cloning from host\n\n  $ mkdir -p $TEST_SUBMODULE\n  $ cd $TEST_SUBMODULE\n  $ git init\n  Initialized empty Git repository in * (glob)\n  $ git config user.name 'test'\n  $ git config user.email 'test@test.test'\n  $ git submodule add $TEST_HOST antigen &> /dev/null\n  $ git commit -m \"1\"\n  [master (root-commit) ???????] 1 (glob)\n   2 files changed, 4 insertions(+)\n   create mode 100644 .gitmodules\n   create mode 160000 antigen\n\nUpdate host repository\n\n  $ cd $TEST_HOST\n  $ echo 2 > ver\n  $ git add ver\n  $ git commit -m \"2\"\n  [master ???????] 2 (glob)\n   1 file changed, 1 insertion(+), 1 deletion(-)\n\nUse selfupdate from normal repository\n\n  $ _ANTIGEN_INSTALL_DIR=$TEST_NORMAL antigen-selfupdate\n  From * (glob)\n     ???????..???????  master     -> origin/master (glob)\n  Updating ???????..??????? (glob)\n  Fast-forward\n   ver |*2 +- (glob)\n   1 file changed, 1 insertion(+), 1 deletion(-)\n  $ _ANTIGEN_INSTALL_DIR=$TEST_NORMAL antigen-selfupdate\n  Already up-to-date.\n\nUse selfupdate from submodule repository\n\n  $ _ANTIGEN_INSTALL_DIR=$TEST_SUBMODULE/antigen antigen-selfupdate\n  From * (glob)\n     ???????..???????  master     -> origin/master (glob)\n  Updating ???????..??????? (glob)\n  Fast-forward\n   ver |*2 +- (glob)\n   1 file changed, 1 insertion(+), 1 deletion(-)\n  $ _ANTIGEN_INSTALL_DIR=$TEST_SUBMODULE/antigen antigen-selfupdate\n  Already up-to-date.\n"
  },
  {
    "path": "tests/snapshots.t",
    "content": "Load a couple of plugins.\n\n  $ antigen-bundle $PLUGIN_DIR &> /dev/null\n  $ antigen-bundle $PLUGIN_DIR2 &> /dev/null\n\nCreate a snapshot file.\n\n  $ test -f snapshot-file\n  [1]\n  $ antigen-snapshot snapshot-file\n  $ test -f snapshot-file\n\nSee the contents of the snapshot file.\n\n  $ cat snapshot-file\n  version='1'; created_on='*'; checksum='*'; (glob)\n  .{40} .*/test-plugin (re)\n  .{40} .*/test-plugin2 (re)\n\nReset the antigen's bundle record and run cleanup.\n\n  $ unset _ANTIGEN_BUNDLE_RECORD\n  $ antigen-cleanup --force | grep '^Deleting' | wc -l\n  2\n\nRestore from the snapshot.\n\n  $ ls $ANTIGEN_BUNDLES/cram-testdir-* | wc -l\n  0\n  $ antigen-restore snapshot-file\n  Restoring from snapshot-file... done.\n  Please open a new shell to get the restored changes.\n\n  $ ls $ANTIGEN_BUNDLES/* | wc -l\n  2\n"
  },
  {
    "path": "tests/theme.t",
    "content": "Load the theme explicitly.\n\n  $ antigen-theme $PLUGIN_DIR silly &> /dev/null\n  $ echo \"$PS1\"\n  prompt>\n\n  $ antigen-theme $PLUGIN_DIR wrong\n  Antigen: Failed to load theme.\n  [1]\n\nTheme should be listed correctly in antigen-list.\n\n  $ antigen-list | wc -l\n  1\n\nShould be registered correctly in BUNDLE_RECORD.\n\n  $ echo ${(j:\\n:)_ANTIGEN_BUNDLE_RECORD} | grep theme | wc -l\n  1\n\n  $ echo ${(j:\\n:)_ANTIGEN_BUNDLE_RECORD} | grep theme\n  *silly.zsh-theme* (glob)\n\nLoad a second theme in the same session.\n\n  $ antigen-theme $PLUGIN_DIR arrow &> /dev/null\n  $ echo \"$PS1\"\n  >\n\nSecond theme is listed as expected in antigen-list.\n\n  $ antigen-list | wc -l\n  1\n\n  $ echo ${(j:\\n:)_ANTIGEN_BUNDLE_RECORD} | grep theme\n  *arrow* (glob)\n\nShould be registered correctly in BUNDLE_RECORD.\n\n  $ echo ${(j:\\n:)_ANTIGEN_BUNDLE_RECORD} | grep theme | wc -l\n  1\n\n  $ echo ${(j:\\n:)_ANTIGEN_BUNDLE_RECORD} | grep theme\n  *arrow.zsh-theme* (glob)\n\nUsing the same theme does not re-install theme.\n\n  $ antigen-theme $PLUGIN_DIR silly\n  $ antigen-list --long\n  *silly* (glob)\n\n  $ antigen-theme $PLUGIN_DIR silly &> /dev/null\n  [1]\n  $ antigen-list --long | grep silly\n  *silly* (glob)\n\nCan load a theme without specifying a theme name:\n\n  $ antigen-theme $PLUGIN_DIR\n  $ antigen-list --long | grep test-plugin\n  *test-plugin* (glob)\n\nDo not change current directory.\n\n  $ cd /tmp/ \n  $ antigen-theme $PLUGIN_DIR silly\n  $ antigen-list --long | grep silly\n  *silly* (glob)\n  $ pwd\n  /tmp\n\nDo not provide a default theme name value.\n\n  $ antigen-theme\n  Antigen: Must provide a theme url or name.\n  [1]\n\nWarm about theme already active.\n\n  $ antigen-theme $PLUGIN_DIR arrow\n  $ antigen-list --long | grep arrow\n  *arrow* (glob)\n  $ antigen-theme $PLUGIN_DIR arrow\n  Antigen: Theme \"*\" is already active. (glob)\n  [1]\n"
  },
  {
    "path": "tests/update.t",
    "content": "Load plugin.\n\n  $ antigen-bundle $PLUGIN_DIR &> /dev/null\n  $ hehe\n  hehe\n\nUpdate the plugin.\n\n  $ cat > $PLUGIN_DIR/aliases.zsh <<EOF\n  > alias hehe='echo hehe, updated'\n  > EOF\n  $ pg commit -am 'Updated message'\n  \\[master [a-f0-9]{7}\\] Updated message (re)\n   1 file changed, 1 insertion(+), 1 deletion(-)\n\nRun antigen's update.\n\n  $ antigen-update\n  Updating */test-plugin@master... Done. Took *s. (glob)\n\n\nConfirm there is still only one repository.\n\n  $ ls $ANTIGEN_BUNDLES | wc -l\n  1\n\nThe new alias should not activate.\n\n  $ hehe\n  hehe\n\nRun update again, with no changes in the origin repo.\n\n  $ antigen-update\n  Updating */test-plugin@master... Done. Took *s. (glob)\n\nLoad another bundle.\n  $ antigen-bundle $PLUGIN_DIR2 &> /dev/null\n\nRun antigen's update for the bundle.\n\n  $ antigen-update $PLUGIN_DIR\n  Updating */test-plugin@master... Done. Took *s. (glob)\n\n  $ antigen-update $PLUGIN_DIR2\n  Updating */test-plugin2@master... Done. Took *s. (glob)\n\nRun update again, should update both bundles.\n\n  $ antigen-update\n  Updating */test-plugin@master... Done. Took *s. (glob)\n  Updating */test-plugin2@master... Done. Took *s. (glob)\n\nTrying to update an unexisting bundle gives an error.\n\n  $ antigen-update /tmp/example/non-existing-bundle\n  Bundle not found in record. Try 'antigen bundle *' first. (glob)\n  [1]\n\n"
  },
  {
    "path": "tests/url-resolver.t",
    "content": "Helper alias.\n\n  $ resolve () {typeset -A response; -antigen-parse-args 'response' $1; echo \"${response[url]}\" }\n\nComplete urls.\n\n  $ resolve https://github.com/zsh-users/antigen.git\n  https://github.com/zsh-users/antigen.git\n  $ resolve git://github.com/zsh-users/antigen.git\n  git://github.com/zsh-users/antigen.git\n  $ resolve git@github.com:zsh-users/antigen.git\n  git@github.com:zsh-users/antigen.git\n\nComplete github urls, missing the `.git` suffix.\n\n  $ resolve https://github.com/zsh-users/antigen\n  https://github.com/zsh-users/antigen\n  $ resolve git://github.com/zsh-users/antigen\n  git://github.com/zsh-users/antigen\n  $ resolve git@github.com:zsh-users/antigen\n  git@github.com:zsh-users/antigen\n\nJust username and repo name.\n\n  $ resolve zsh-users/antigen\n  https://github.com/zsh-users/antigen.git\n  $ resolve zsh-users/antigen.git\n  https://github.com/zsh-users/antigen.git\n\nLocal absolute file path.\n\n  $ resolve /path/to/a/local/git/repo\n  /path/to/a/local/git/repo\n"
  },
  {
    "path": "tests/use.t",
    "content": "Use url library.\n  $ antigen-bundle () { echo $@ }\n  $ antigen-use https://github.com/zsh-users/prezto.git\n  https://github.com/zsh-users/prezto.git\n  $ echo $ANTIGEN_DEFAULT_REPO_URL\n  https://github.com/zsh-users/prezto.git\n\nAccept antigen-bundle semantics.\n  $ antigen-bundle () { echo $@ }\n  $ antigen-use https://github.com/zsh-users/prezto.git --loc=lib\n  https://github.com/zsh-users/prezto.git --loc=lib\n\nMissing argument.\n\n  $ antigen-use\n  Usage: antigen-use <library-name|url>\n  Where <library-name> is any one of the following:\n   * oh-my-zsh\n   * prezto\n  <url> is the full url.\n  [1]\n\nMock out the library loading functions.\n\n  $ -antigen-use-oh-my-zsh () { echo Using oh-my-zsh. }\n  $ -antigen-use-prezto () { echo Using prezto. }\n\nNote: We lack tests for these internal functions. I'm not sure how feasible\ntesting them is given they most certainly use the network.\n\nUse oh-my-zsh library.\n\n  $ prev=$(env)\n  $ antigen-use oh-my-zsh\n  Using oh-my-zsh.\n\nShould not leak Antigen or OMZ environment variables.\n\n  $ diff <(env) <(echo $prev) | sed -e 's/\\=.*//' | grep -i antigen | wc -l\n  0\n\n  $ diff <(env) <(echo $prev) | sed -e 's/\\=.*//' | grep -i zsh | wc -l\n  0\n\nUse prezto library.\n\n  $ antigen-use prezto\n  Using prezto.\n\nTest load from oh-my-zsh:\n\n  $ unset ANTIGEN_DEFAULT_REPO_URL\n  $ source $ANTIGEN/antigen.zsh\n\n  $ -antigen-bundle-install () {}\n  $ -antigen-load () {}\n  $ antigen use oh-my-zsh\n  $ antigen bundle wd\n  $ antigen bundle other/plugin\n  $ antigen apply\n  $ antigen list --long\n  https://github.com/robbyrussell/oh-my-zsh.git lib plugin true\n  https://github.com/robbyrussell/oh-my-zsh.git plugins/wd plugin true\n  https://github.com/other/plugin.git / plugin true\n\nTest load from prezto:\n\n  $ _ANTIGEN_BUNDLE_RECORD=()\n  $ antigen use prezto\n  $ antigen bundle editor\n  $ antigen bundle other/plugin\n  $ antigen apply\n  $ antigen list --long\n  https://github.com/sorin-ionescu/prezto.git / plugin true\n  https://github.com/sorin-ionescu/prezto.git modules/editor plugin true\n  https://github.com/other/plugin.git / plugin true\n\nTest load from custom library:\n\n  $ _ANTIGEN_BUNDLE_RECORD=()\n  $ antigen use https://github.com/custom/library.git\n  $ antigen bundle editor\n  $ antigen bundle other/plugin\n  $ antigen apply\n  $ antigen list --long\n  https://github.com/custom/library.git / plugin true\n  https://github.com/custom/library.git editor plugin true\n  https://github.com/other/plugin.git / plugin true\n"
  },
  {
    "path": "tests/version.t",
    "content": "Antigen version command.\n\n  $ antigen-version\n  Antigen * (glob)\n  Revision date: * (glob)\n\n  $ antigen version\n  Antigen * (glob)\n  Revision date: * (glob)\n"
  },
  {
    "path": "tools/builder",
    "content": "#!/usr/bin/env zsh\n# vim: ts=2 sw=2 et\ntypeset -g ZSH_REMOTE_URL; ZSH_REMOTE_URL=https://github.com/zsh-users/zsh.git\ntypeset -g ZSH_SOURCE_LOCATION; ZSH_SOURCE_LOCATION=/usr/local/share/zsh\ntypeset -g ZSH_BIN_LOCATION; ZSH_BIN_LOCATION=/usr/local/bin/zsh\n\n# Build and install zsh version from source\nfunction builder/usage () {\n  echo \"Usage: $0 --source /path/to/source --target /path/to/target --version ZSH_VERSION\" \n}\n\nfunction builder/main () {\n  zparseopts -A opts s:=src -source:=src \\\n  v:=version -version:=version t=target -target=target || builder/usage\n\n  local src=$src[2]\n  if [[ -z $src ]]; then\n    src=\"${ZSH_SOURCE_LOCATION}\"\n  fi\n\n  local version=$version[2]\n\n  local target=$target[2]\n  if [[ -z $target ]]; then\n    target=\"${ZSH_BIN_LOCATION}-$version\"\n  fi\n\n  builder/exec $src $target $version\n}\n\nfunction builder/exec () {\n  local src=$1\n  local target=$2\n  local version=$3\n\n  # zsh source already exists\n  if [[ ! -d $src/.git ]]; then\n    echo \"No zsh source found. Cloning from $ZSH_REMOTE_URL\"\n    git clone $ZSH_REMOTE_URL $src\n  fi\n\n  # Get the code. Should cache it.\n  builder/compile $src $target $version\n}\n\nfunction builder/compile () {\n  local src=$1\n  local target=$2\n  local version=$3\n\n  echo \"Compiling zsh version: $version from $src to $target\"\n\n  cd $src || exit 1\n\n  # Build version\n  # Be sure to clean everything\n  make clean\n  git clean -fd\n  git checkout -- .\n\n  # Check out with branch to build, ie: master, zsh-5.0.1, etc\n  git checkout $version || exit 1\n\n  # Make configure\n  ./Util/preconfig\n\n  if [[ ! -d $target ]]; then\n    mkdir -p $target\n  fi\n\n  # Configure bindir for this branch\n  ./configure --bindir=\"$target/$version\" --prefix=\"$target/$version\"--without-tcsetpgrp\n\n  # Make\n  make -j5\n\n  make install\n\n  cd -\n}\n\nbuilder/main $@\n"
  },
  {
    "path": "tools/jail",
    "content": "#!/usr/bin/env zsh\n# vim: sw=2 ts=2 et\nJAIL=${1:-/tmp/jail-gen}\nJAIL_WRAPPER='chroot $jail sh -c \"%s\"'\n\nfunction jail/configure () {\n  if [[ -n $(unshare -V 2>/dev/null | grep '2.28.*') ]]; then\n    JAIL_WRAPPER=\"unshare -r sh -c 'chroot $jail sh -c \\\"%s\\\"'\"\n  fi\n}\n\nfunction jail/usage () {\n  echo \"Usage: $0 [-j|--jail] /path/to/jail [-i|--install|-c|--create|-k|--kill] [-e|--exec] exec\"\n}\n\nfunction jail/main () {\n  zparseopts -A opts j:=jail -jail:=jail \\\n  e:=exec -exec:=exec c=create -create=create k=kill -kill=kill \\\n  i=install -install=install\n\n  local jail=$jail[2]\n  local exec=$exec[2]\n  local create=$create\n  local kill=$kill\n  local install=$install\n\n  jail/configure\n\n  if [[ -n $create ]]; then\n    jail/create $jail\n\n  elif [[ -n $kill ]]; then\n    jail/kill $jail\n\n  elif [[ -n $exec ]]; then\n    jail/exec $jail \"$exec\"\n\n  elif [[ -n $install ]]; then\n    jail/install\n\n  else\n    echo Missing arguments.\n    jail/usage\n    exit 1\n  fi\n\n  return 0\n}\n\nfunction jail/create () {\n  local jail=$1\n\n  if [[ -d $jail ]]; then\n    echo Jail directory already exists. Abort.\n    exit 1\n  fi\n\n  # Create jail if there is none available\n  jailing --root $jail --bind /usr/local\n  if (( $? != 0 )); then\n    echo Failed to create jail.\n    exit 1\n  fi\n\n  # add zsh builds on travis\n  if [[ -d /home/travis/.zsh-builds ]]; then\n    echo Custom zsh-build found. Binding.\n    jailing --root $jail --bind /home/travis/.zsh-builds:/builds\n    jailing --root $jail --bind /home/travis/.zsh-builds\n  else\n    echo No custom zsh-build found. Ignoring.\n  fi\n\n  echo Fix access to dev/null.\n  echo --\\> rm $jail/dev/null\n  rm $jail/dev/null && cp /dev/null $jail/dev/null\n  chmod a+rwx $jail/dev/null\n  \n  echo Mount missing /proc\n  echo --\\> mkdir -p $jail/proc\n  mkdir -p $jail/proc && mount -t proc proc $jail/proc\n\n  echo Add root user configs\n  mkdir -p $jail/root && cp ${0:A:h:h}/tests/.gitconfig $jail/root/\n\n  echo Creating antigen dir\n  echo --\\> chmod a+rwx $jail/antigen/\n  mkdir $jail/antigen/ && chmod a+rwx $jail/antigen/\n\n  echo Done!\n  exit 0\n}\n\nfunction jail/kill () {\n  local jail=$1\n  jailing --root $jail --umount\n}\n\n\nfunction jail/exec () {\n  local jail=$1\n  eval $(printf $JAIL_WRAPPER \"export HOME=/root; export ZDOTDIR=/antigen/tests; $2\")\n}\n\nfunction jail/install () {\n  if [[ ! -f /usr/bin/jailing ]]; then\n    sudo git clone https://github.com/kazuho/jailing /usr/local/share/jailing || echo \"Error creating jailing clone.\"\n    cd /usr/local/share/jailing || exit 1\n\n    perl Makefile.PL\n    make && make install\n    echo Jailing installed.\n  else\n    echo Jailing bin already exists. Abort.\n  fi\n}\n\njail/main \"$@\"\n\n\n"
  },
  {
    "path": "tools/stats",
    "content": "#!/usr/bin/env zsh\n# vim: sw=2 ts=2 et\n#set -x\ntypeset -g ITERATIONS; ITERATIONS=20\n\nfunction stats/usage () {\n  echo \"Usage: $0 --zsh /path/to/zsh --antigen /path/to/antigen\"\n}\n\n# Usage:\n#   stats/main $@\nfunction stats/main () {\n  zparseopts -A opts z:=zsh -zsh:=zsh \\\n  a:=antigen -antigen:=antigen || stats/usage\n\n  local zsh=$zsh[2]\n  local antigen=$antigen[2]\n\n  if [[ ! -f \"$zsh\" ]]; then\n    if (( ! $+commands[zsh] )); then\n      echo \"Define the path to ZSH binary with '--zsh' argument. Given: $zsh\"\n      exit 1\n    fi\n  fi\n\n  if [[ ! -d \"$antigen\" ]]; then\n    echo \"Define a path to Antigen with '--antigen' argument. Given: $antigen\"\n    exit 1\n  fi\n  \n  echo \"Using zsh: $zsh ($($zsh --version))\"\n  echo \"Using Antigen from: $antigen ($(cat $antigen/VERSION || echo unknown))\"\n\n  local antigenrc=$(mktemp -d /tmp/dot-antigen-stats-XXXXXX)\n  local mtime=$antigenrc/stats-time.log\n\n  stats/configure $antigenrc $antigen\n  stats/exec $zsh $mtime $ITERATIONS\n  stats/parse $mtime\n}\n\n# Usage\n#   stats/configure $ADOTDIR /path/to/zshrc_antigenrc\nfunction stats/configure () {\n  export ADOTDIR=$1\n  local configs=$2\n\n  export ZDOTDIR=$ADOTDIR\n  mkdir -p $ADOTDIR\n  cp $configs/tests/.antigenrc $ADOTDIR\n\n  # Fix path for non-container based stats\n  sed -e \"s|/antigen/tests|$ADOTDIR|\" -e \"s|/antigen|$configs|\" $configs/tests/.zshrc > $ADOTDIR/.zshrc\n\n  echo \"Antigen configuration path: $ADOTDIR\"\n  echo \"Using zsh configuration from: $ADOTDIR/.zshrc\"\n\n  echo \"System information:\"\n  uname -a\n  lscpu\n  echo\n\n  echo \"Configuration:\"\n  echo \">>>>\"\n  cat $ADOTDIR/.zshrc\n  echo \"<<<<\"\n  echo\n\n  echo \"Antigen configuration:\"\n  echo \">>>>\"\n  cat $ADOTDIR/.antigenrc\n  echo \"<<<<\"\n  echo\n}\n\n# Usage:\n#   stats/exec $path_to_zsh $path_to_output_file $iterations_count\nfunction stats/exec() {\n  local zsh=$1\n  local output=$2\n  local iterations=${3:-20}\n  export ANTIGEN=$ADOTDIR\n\n  echo Installing bundles...\n  if [[ -d $ADOTDIR/bundles || -d $ADOTDIR/repos ]]; then\n    echo Bundles present in ADOTDIR.\n  fi\n  $zsh -ic 'exit'\n  if [[ $? != 0 ]]; then\n    exit 1\n  fi\n  echo\n\n  echo Installed bundles:\n  $zsh -ic 'antigen list'\n  if [[ $? != 0 ]]; then\n    exit 1\n  fi\n  echo\n\n  echo Performance testing...\n  :> $output\n\n  for x in $(seq 1 $iterations); do\n    (time $zsh -ic exit) 2>&1 | tr \"\\n\" ' ' &>> $output\n    echo &>> $output\n\n    tail -1 $output\n  done\n}\n\n# Usage:\n#   stats/parse $path_to_output_file\nfunction stats/parse() {\n  local data=$1\n  awk '{\n    sub(\"m\",\"\",$7); total += $7;\n    sub(\"m\",\"\", $1); user += $1;\n    sub(\"m\", \"\", $3); sys += $3;\n    count++\n  } END {\n    printf \"\\nAverage:\\ntotal %.3fs user %.3fs sys %.3fs\\n\", total/count, user/count, sys/count\n  }' $data\n}\n\nstats/main $@\n"
  }
]