# declare-zsh **Repository Path**: zdharma/declare-zsh ## Basic Information - **Project Name**: declare-zsh - **Description**: Declare-zsh is a parser for ZI commands in .zshrc. It allows performing the following actions on .zshrc from the command line. - **Primary Language**: Shell - **License**: GPL-3.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-02-05 - **Last Updated**: 2024-06-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

Declare Zsh

## Introduction [**declare-zsh**](https://github.com/z-shell/declare-zsh) is a parser for `zi` commands in `.zshrc`. It allows to perform the following actions on `.zshrc` **from the command-line**: - enable and disable selected plugins and snippets, - add plugins and snippets, - delete plugins and snippets, - it currently supports the classic ZI syntax only, i.e.: the one with two (`zi ice …`, `zi load/snippet …`) commands. In other words, by issuing a `declzsh` command the user deploys a task of: 1. Reading and parsing of the `~/.zshrc`. 2. Making changes (like removal of a plugin, i.e. of `zi load {the-removed-plugin}` command together with the possible associated `zi ice …` command) and then… 3. Writing the result back to the `zshrc` (by default, the result is stored to `~/.zshrc_gen` file for safety, but the author wants to emhasize very strongly, that **breaking something within the parsed `zshrc` is nearly impossible** and the tool can be safely used with option `-o ~/.zshrc` which points `declzsh` to the original `zshrc` as the destination output file). ## Examples & Screenshots 1. Example **disabling** of a plugin via the **toggle** option **-TT** – this works because the commands preceded by `:` are ignored by the shell: ![screenshot](https://raw.githubusercontent.com/z-shell/declare-zsh/main/img/toggle.png) 2. Example **addition** of a plugin via the option **-AA** – in order to also set up ice modifiers enclose them in a preceding square-bracket block, i.e. `declzsh -AA '[ wait"1" lucid ] z-shell/null'`: ![screenshot](https://raw.githubusercontent.com/z-shell/declare-zsh/main/img/add.png) 3. Example **deletion** of a plugin via the **purge** option **-PP** – the argument is treated as pattern, pass `*` to delete all plugins and snippets!: ![screenshot](https://raw.githubusercontent.com/z-shell/declare-zsh/main/img/purge.png) # Usage Multiple actions, i.e. multiple options like `-AA`, `-PP`, `-DD`, etc. are possible in a single `declzsh` run. ![usage screenshot](https://raw.githubusercontent.com/z-shell/declare-zsh/main/img/usage.png)