- Turn %placeholders% into private markers when a template is read and
strip the marker from every value, so text inserted from user input
(e.g. -d '%name%') is never rescanned as a placeholder.
- When --enable is used for a name already in $plugins (a custom
override of an enabled built-in), report it and reload instead of
failing in _omz::plugin::enable.
- Make the completion note accurate whether or not a _<cmd> file was
generated.
- Test the write-phase cleanup with a template set missing a later
template, and test that placeholder-looking values come out literally.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Adds a rails-style generator that creates a custom plugin in
$ZSH_CUSTOM/plugins/<name> from commented templates: the plugin file,
a README in the usual shape and, for plugins that wrap a command-line
tool, a completion skeleton (or the cached-completion block when the
tool generates its own). Anything not passed as an option is asked
for interactively; non-interactive shells use defaults.
`omz generate` is a new top-level command so that other generators
(e.g. `omz generate theme`) can follow the same shape.
Templates live in templates/generators/plugin and are syntax-checked
by CI. lib/tests/generate-plugin.test.zsh covers the non-interactive
path, name validation and the prompt helper.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
In BSD awk, \s is not a valid sequence interchangeable with "space or tab characters"
as it is in GNU awk. This fix uses [ \t] instead, which is all the possibilities that
we need to contemplate when reading the .zshrc file.
Fixes#11146
Since `set -e` is enabled, when `commit.gpgsign` is not set the
`git config` command would show an error. Given that it is technically
not ignored, the subshell would exit.
With this change, the `commit.gpgsign` setting is properly tested
by doing the fallback test if the command fails, so no exit status
code ends up quiting the subshell.
The commands `omz plugin {enable,disable}` and `omz theme set`
automatically reload the zsh session on success. With this
change, the CLI checks whether the commands are run in an
interactive session before reloading the zsh session.
This change also conditionally sets the completion function
for `omz` so that it's not done in a non-interactive session.
BREAKING CHANGE: the `zsh_reload` plugin is deprecated. Instead of using its `src`
function, use `omz reload` or `exec zsh` to reload zsh after making changes to
your `.zshrc` file.
Closes#9078
* Don't error on upgrade no-op
No error code is required for a non failure scenario.
* Manually check whether changes were pulled in `omz update`
Co-authored-by: Marc Cornellà <hello@mcornella.com>