Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to change environment from a module

Mark Hessling wrote:
>One last question; naming standards for modules. Are third-party modules
>allowed to start with "z" ? eg. I've called mine "zregina", so that the
>"regina" executable will still be available as an external program.

You seem to be confusing two namespaces here: modules and builtin
commands.  Each module provides zero or more builtin commands; there is
no necessary relationship between the name of a builtin and the name of
the module that provides it.

For the builtin command that you're providing, I suggest using the same
name as the external program if and only if you are providing the same
behaviour (as the builtins such as "rm" in the "zsh/files" module do).
In this case the external program is still available by using the
"command" builtin, but it shouldn't be necessary to use that.  If you
are providing different behaviour, such as having the command modify
zsh's environment, then use a different name; a "z" prefix to indicate
such a variation of behaviour seems entirely appropriate, and I see no
reason for us to disapprove of third-party use of such names.

Modules have a hierarchical namespace, with the first component of the
name identifying the entity publishing the module.  Modules from the
Zsh Development Group have names starting "zsh/", such as "zsh/zle"
(the zsh line editor) and "zsh/files" (file manipulation builtins).
You should name your modules in a similar fashion; e.g., you could use
module names starting "hessling/" if you're publishing them yourself.

In the common case of a module providing only a single builtin, usually
the builtin's name is also a good way to identify the functionality of
the module (e.g., "zsh/sched" providing the "sched" command).  So you
might want to use the module name "hessling/zregina", if my guesses
about the appropriate command name and module publisher were correct.


Messages sorted by: Reverse Date, Date, Thread, Author