mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-09-27 13:36:07 +02:00
feat(cli): add omz generate plugin to scaffold custom plugins
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>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
593e8ed6c8
commit
46aee25f27
@@ -0,0 +1,32 @@
|
||||
#compdef %command%
|
||||
#
|
||||
# Completion for %command%.
|
||||
#
|
||||
# This is a starting point. Delete what you don't need. Two references:
|
||||
# https://zsh.sourceforge.io/Doc/Release/Completion-System.html
|
||||
# https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'status:Show the current status'
|
||||
'run:Run something'
|
||||
'help:Show help for a command'
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'(-h --help)'{-h,--help}'[show help]' \
|
||||
'(-v --version)'{-v,--version}'[show the version]' \
|
||||
'1: :->subcommand' \
|
||||
'*:: :->args'
|
||||
|
||||
case $state in
|
||||
subcommand)
|
||||
_describe -t commands '%command% subcommand' subcommands
|
||||
;;
|
||||
args)
|
||||
case $words[1] in
|
||||
status) _arguments '--short[one-line output]' ;;
|
||||
run) _files ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user