pub enum Shell {
Bash,
Zsh,
}Expand description
Which shell we’re targeting. Detected from $SHELL for the
bare show/install flow; the user can override with --shell
at the CLI layer.
Variants§
Implementations§
Source§impl Shell
impl Shell
Sourcepub fn detect() -> Option<Self>
pub fn detect() -> Option<Self>
Detect from $SHELL. Returns None when $SHELL is unset
or names a shell we don’t support — the caller (typically
resolve_shell) surfaces a clear error rather than
silently writing a bashrc snippet for a fish/nu user.
Why fail explicitly: silently falling back to Bash means
dodot git-install-alias happily writes ~/.bashrc for a
fish user, who then never sees the alias take effect.
Better to refuse with a message that points at --shell.
Sourcepub fn from_str_opt(s: &str) -> Option<Self>
pub fn from_str_opt(s: &str) -> Option<Self>
Parse a CLI --shell value. Returns None for unknown
shells; the CLI layer surfaces a clear error.
Sourcepub fn rc_relative_path(self) -> &'static str
pub fn rc_relative_path(self) -> &'static str
Path to the rc file we write to for this shell, relative to
$HOME. Used by install_alias to compute the absolute
path. We pick the most universally-sourced file: .bashrc
on bash, .zshrc on zsh. Users with non-standard setups can
run git-show-alias and paste manually.
Sourcepub fn alias_line(self) -> &'static str
pub fn alias_line(self) -> &'static str
The alias line for this shell. Both bash and zsh accept the
same alias syntax; we pin them per-shell anyway because
future shells (fish, nu) will need different forms and
keeping the dispatch on a single match is the cleanest
extension point.
Trait Implementations§
impl Copy for Shell
impl Eq for Shell
impl StructuralPartialEq for Shell
Auto Trait Implementations§
impl Freeze for Shell
impl RefUnwindSafe for Shell
impl Send for Shell
impl Sync for Shell
impl Unpin for Shell
impl UnsafeUnpin for Shell
impl UnwindSafe for Shell
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.