{"id":13680415,"url":"https://github.com/NICHOLAS85/z-a-eval","last_synced_at":"2025-04-29T23:31:25.614Z","repository":{"id":39373715,"uuid":"344799363","full_name":"NICHOLAS85/z-a-eval","owner":"NICHOLAS85","description":"A Zsh-Zinit annex (i.e. an extension), which caches arbitrarily slow command output to speed up shell startup.","archived":false,"fork":false,"pushed_at":"2025-02-02T03:56:33.000Z","size":52,"stargazers_count":24,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-02T04:24:34.253Z","etag":null,"topics":["shell-plugin","shell-script","terminal","zinit","zinit-annex","zsh","zsh-plugin"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NICHOLAS85.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-03-05T12:09:02.000Z","updated_at":"2025-02-02T03:56:37.000Z","dependencies_parsed_at":"2024-01-14T15:20:57.855Z","dependency_job_id":null,"html_url":"https://github.com/NICHOLAS85/z-a-eval","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NICHOLAS85%2Fz-a-eval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NICHOLAS85%2Fz-a-eval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NICHOLAS85%2Fz-a-eval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NICHOLAS85%2Fz-a-eval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NICHOLAS85","download_url":"https://codeload.github.com/NICHOLAS85/z-a-eval/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251600038,"owners_count":21615626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["shell-plugin","shell-script","terminal","zinit","zinit-annex","zsh","zsh-plugin"],"created_at":"2024-08-02T13:01:16.859Z","updated_at":"2025-04-29T23:31:20.603Z","avatar_url":"https://github.com/NICHOLAS85.png","language":"Shell","readme":"\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*\n\n- [z-a-eval](#z-a-eval)\n  - [Introduction](#introduction)\n  - [Installation](#installation)\n  - [How it works](#how-it-works)\n  - [Ice Modifiers Provided By The Annex](#ice-modifiers-provided-by-the-annex)\n    - [1. **`eval'[!]{command}…'`**](#1-evalcommand)\n  - [Example Invocations](#example-invocations)\n- [Additional Zinit commands](#additional-zinit-commands)\n- [Zinit tab completion support](#zinit-tab-completion-support)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n# z-a-eval\n\n## Introduction\n\nA Zsh-Zinit annex (i.e. an extension) that provides functionality, which\nallows to:\n\n  1. Cache the output of arbitrarily slow initialization command to speed up shell startup time.\n\n## Installation\n\nSimply load like a regular plugin, i.e.:\n\n```zsh\nzinit light NICHOLAS85/z-a-eval\n```\n\nAfter executing this command you can then use the new ice-mods provided by\nthe annex.\n\n## How it works\n\nThe output of a slow initialization command is redirected to a file located within the plugin/snippets directory and sourced while loading. The next time the plugin/snippet is loaded, this file will be sourced skipping the need to run the initialization command.\n\n## Ice Modifiers Provided By The Annex\n\nThere is 1 ice-modifier provided and handled by this annex. They are:\n  1. `eval''` – creates a `cache` containing the output of a command.\n\n**The ice-modifier in detail:**\n\n---\n\n### 1. **`eval'[!]{command}…'`**\n\nIt creates a `cache` in the plugin/snippets root directory which stores the commands output. This cache is regenerated when:\n- The plugin/snippet is updated.\n- The cache file is removed.\n- With the new Zinit subcommand `recache`.\n\nThe optional preceding `!` flag means to store command output regardless of exit code. Otherwise `eval''` will avoid caching ouput of code which returns a non-zero exit code.\n\n## Example Invocations\n\n```zsh\n## Without z-a-eval\nzinit ice as\"command\" from\"gh-r\" mv\"zoxide* -\u003e zoxide\"  \\\n      atclone\"./zoxide init zsh \u003e init.zsh\"  atpull\"%atclone\" src\"init.zsh\" nocompile'!'\nzinit light ajeetdsouza/zoxide\n\n## With z-a-eval\nzinit ice as\"command\" from\"gh-r\" mv\"zoxide* -\u003e zoxide\" \\\n      eval\"./zoxide init zsh\"\nzinit light ajeetdsouza/zoxide\n```\n\n```zsh\n## Without z-a-eval\nzinit ice atclone\"dircolors -b LS_COLORS \u003e init.zsh\" \\\n    atpull\"%atclone\" pick\"init.zsh\" nocompile'!' \\\n    atload'zstyle \":completion:*\" list-colors “${(s.:.)LS_COLORS}”'\nzinit light trapd00r/LS_COLORS\n\n## With z-a-eval\nzinit ice eval\"dircolors -b LS_COLORS\" \\\n    atload'zstyle \":completion:*\" list-colors “${(s.:.)LS_COLORS}”'\nzinit light trapd00r/LS_COLORS\n```\n\n```zsh\n## Without Zinit\nif [[ \"${+commands[kubectl]}\" == 1 ]]; then\n    eval $(kubectl completion zsh)\nfi\n\n## With Zinit and z-a-eval\n## Updated during `zinit update`\nzinit ice id-as\"kubectl_completion\" has\"kubectl\" \\\n      eval\"kubectl completion zsh\" run-atpull\nzinit light zdharma/null\n```\n\nSee https://github.com/NICHOLAS85/z-a-eval/issues/2#issuecomment-793374468 for more examples.\n\n# Additional Zinit commands\n\nThere's an additional Zinit command that's provided by this annex\n–`recache`. It recaches all your plugins/snippets eval outputs on demand. Useful for when you change the value of the `eval''` ice but do not want to redownload the plugin/snippet to update its ices, or rm the cache manually:\n\n![recache-invocation](https://raw.githubusercontent.com/NICHOLAS85/z-a-eval/master/images/recache.png)\n\nAvailable options are:\n\n```zsh\nzinit recache [plugin/snippet]\n```\n\nWhen run without an argument, it will iterate through all plugin/snippets who have caches and regenerate them based on the current value of `eval''`. If `eval''` is missing, it will simply delete the cache file.\n\nWhen run with a plugin/snippet argument, it will only regenerate that single plugin/snippets cache based on the current value of `eval''`.\n\n# Zinit tab completion support\nZinit currently does not support extending the subcommands available via tab completion. I however, have implemented experimental support for this which should be duplicable across any annex.\n\nIn order to enable tab completion for the new subcommand set the value `Z_A_USECOMP=1` somewhere **before** loading this plugin. For example:\n```zsh\nzinit atinit'Z_A_USECOMP=1' light-mode for NICHOLAS85/z-a-eval\n```\n\nIf you're interested in seeing how it works some more detail can be seen at the bottom of `z-a-eval.plugin.zsh`. I'd love to hear feedback on its implementation.\n","funding_links":[],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNICHOLAS85%2Fz-a-eval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNICHOLAS85%2Fz-a-eval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNICHOLAS85%2Fz-a-eval/lists"}