Is your feature request related to a problem? Please describe.
As a user of alien-minimal
, I am an indirect user of this library. When certain packages are not installed (ie. git
), promptlib
raises command not found
errors. This request hopefully raises a meaningful discussion point - it is not meant to point fingers in any particular direction.
Describe the solution you'd like
In this call stack, someone should be responsible for ensuring that a required package is installed, or the call tree should fail gracefully in the case that it isn't. Should that be the theme (ie. alien-minimal
)? This library? Or the end user?
Describe alternatives you've considered
My working solution has been 2-fold:
- Fork & patch
promptlib
to check whether the dependent command is available: low-fidelity patch I've been using for over a year
- Fork & patch
alien-minimal
to submodule fork of promptlib
Additional context
Thoughts about "who should check for availability":
Within prooptlib
Library functions may be called quite often. Perhaps a cached status per shell instance would be a better solution than running command -v
before every call to git
, etc. Does the commands
list already behave this way? If so, perhaps the patch can be extended appropriately to all am_*
calls. I believe this is the "right" solution it it can be introduced with minimal runtime overhead.
Theme repository (ie. alien-minimal
)
The theme implementer needs to be aware that promptlib
does not perform checks for command availability. This may be a simple docs update, and this issue can be moved to alien-minimal
, for example. To me, I think this is rather a topic of promptlib
's robustness as opposed to a theme's usage, so this seems like the "easy but lazy" solution.
End User
The user does not always have control of the environment and may not be allowed to install certain packages. Further, the user may not be able (in skill or time) to:
- Remove / error-check certain calls to
promptlib
in the theme repository by maintaining a personal fork
- alias certain/all calls to
promotlib
to apply a rather hacky patch in their .zshrc
When I first started using zsh
, I knew very little about the unix shell, let alone bash
. I believe leaving this to the user is the least "community friendly" way of handling it.