Shell package guidelines
Install
For users to change shells, the shell must appear in /etc/shells
. Most shell packages have install scripts like below:
''shellname''.install
post_install() { grep -Fqx /bin/''shellname'' /etc/shells || echo /bin/''shellname'' >>/etc/shells grep -Fqx /usr/bin/''shellname'' /etc/shells || echo /usr/bin/''shellname'' >>/etc/shells } post_upgrade() { post_install } post_remove() { sed -i -r '/^(\/usr)?\/bin\/''shellname''$/d' etc/shells }
Shell completions
Most shells provide a built in set of completions for a few common commands while also scanning at least one system directory for functions that may be supplied by other packages. The following table is a summary of where packages may place completion files and what the files should be named.
Shell | Directory | File |
---|---|---|
Bash | /usr/share/bash-completion/completions | binary_name |
fish | /usr/share/fish/vendor_completions.d | binary_name.fish |
Zsh |
Other shells:
- Elvish provides some default completions, but does not have a system-wide directory where completions can be provided yet. For packages that generate Elvish shell completion functions, one solution would be to package them and use a function to print a tip for users to symlink it to their directory.
Tip: As a general rule, packages should have neither depends nor optdepends on shells. Just because they happen to supply completions for them does not imply a package dependency relationship any way. The exception is packages that do not supply their own completions; the completions do not exist in the default shell package, but they are provided by the supplemental collection packages bash-completion or zsh-completions. When completion files exist in these packages, add them to
optdepends
.gollark: Oh, I thought he made a proposal for it.
gollark: How?
gollark: Why is everyone g?
gollark: I would download more RAM, but I ran out of internet and I can't download more internet.
gollark: This *is* a lot slower, I think, so try and avoid it in general.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.