-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #401 from jewlexx/help-hook
sfsu: Add ability to rename hooks or commands
- Loading branch information
Showing
7 changed files
with
167 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ pub mod git; | |
pub mod output; | ||
pub mod packages; | ||
pub mod progress; | ||
pub mod shell; | ||
|
||
mod opt; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use clap::ValueEnum; | ||
use strum::Display; | ||
|
||
#[derive(Debug, Default, ValueEnum, Copy, Clone, Display, PartialEq, Eq)] | ||
#[strum(serialize_all = "snake_case")] | ||
pub enum Shell { | ||
#[default] | ||
Powershell, | ||
Bash, | ||
Zsh, | ||
Nu, | ||
} | ||
|
||
impl Shell { | ||
#[must_use] | ||
pub fn config(self) -> ShellConfig { | ||
ShellConfig::new(self) | ||
} | ||
} | ||
|
||
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] | ||
pub struct ShellConfig(Shell); | ||
|
||
impl ShellConfig { | ||
#[must_use] | ||
pub fn new(shell: Shell) -> Self { | ||
Self(shell) | ||
} | ||
|
||
#[must_use] | ||
pub fn path(self) -> &'static str { | ||
match self.0 { | ||
Shell::Powershell => "$PROFILE", | ||
Shell::Bash => "bashrc", | ||
Shell::Zsh => "zshrc", | ||
Shell::Nu => "$nu.config-path", | ||
} | ||
} | ||
} | ||
|
||
impl std::fmt::Display for ShellConfig { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "{}", self.path()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters