Skip to content

Commit

Permalink
Remove experimental Fish shell support
Browse files Browse the repository at this point in the history
I don't think it is worth investing time in supporting the Fish shell.
Most people who use Fish use fisher and I don't see a compelling reason
to use Sheldon if you are using Fish.

Sheldon is shell agnostic enough that you can still get support for Fish
by overriding the default `match`, `apply`, and `templates` values in
the config file.
  • Loading branch information
rossmacarthur committed Aug 25, 2024
1 parent 0582580 commit a804ff2
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 72 deletions.
21 changes: 0 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -704,12 +704,6 @@ or
shell = "zsh"
```

as well as the experimental

```toml
shell = "fish"
```

#### `match`

A list of glob patterns to match against a plugin’s contents. The first pattern
Expand Down Expand Up @@ -744,21 +738,6 @@ match = [
]
```

If the shell is Fish then this defaults to

```toml
match = [
"conf.d/{{ name }}.fish",
"conf.d/{!_*,*}.fish",
"{completions,functions}/{{ name }}.fish",
"{completions,functions}/{!_*,*}.fish",
"{completions,functions}/*.fish",
"{{ name }}.fish",
"{!_*,*}.fish",
"*.fish"
]
```

#### `apply`

A list of template names to apply to all plugins by default (see
Expand Down
2 changes: 1 addition & 1 deletion completions/sheldon.bash
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ _sheldon() {
fi
case "${prev}" in
--shell)
COMPREPLY=($(compgen -W "bash fish zsh" -- "${cur}"))
COMPREPLY=($(compgen -W "bash zsh" -- "${cur}"))
return 0
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion completions/sheldon.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ _sheldon() {
case $line[1] in
(init)
_arguments "${_arguments_options[@]}" : \
'--shell=[The type of shell]:SHELL:(bash fish zsh)' \
'--shell=[The type of shell]:SHELL:(bash zsh)' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
Expand Down
21 changes: 0 additions & 21 deletions docs/src/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,6 @@ or
shell = "zsh"
```

as well as the experimental

```toml
shell = "fish"
```

### `match`

A list of glob patterns to match against a plugin's contents. The first pattern
Expand Down Expand Up @@ -351,21 +345,6 @@ match = [
]
```

If the shell is Fish then this defaults to

```toml
match = [
"conf.d/{{ name }}.fish",
"conf.d/{!_*,*}.fish",
"{completions,functions}/{{ name }}.fish",
"{completions,functions}/{!_*,*}.fish",
"{completions,functions}/*.fish",
"{{ name }}.fish",
"{!_*,*}.fish",
"*.fish"
]
```

### `apply`

A list of template names to apply to all plugins by default (see
Expand Down
3 changes: 1 addition & 2 deletions src/cli/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,12 @@ impl clap::ValueEnum for ColorChoice {

impl clap::ValueEnum for Shell {
fn value_variants<'a>() -> &'a [Self] {
&[Shell::Bash, Shell::Fish, Shell::Zsh]
&[Shell::Bash, Shell::Zsh]
}

fn to_possible_value(&self) -> Option<PossibleValue> {
Some(match self {
Shell::Bash => PossibleValue::new("bash"),
Shell::Fish => PossibleValue::new("fish"),
Shell::Zsh => PossibleValue::new("zsh"),
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/testdata/raw_opt_init_help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Initialize a new config file
Usage: sheldon init [OPTIONS]

Options:
--shell <SHELL> The type of shell [possible values: bash, fish, zsh]
--shell <SHELL> The type of shell [possible values: bash, zsh]
-h, --help Print help
6 changes: 2 additions & 4 deletions src/config/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ impl fmt::Display for Shell {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Bash => f.write_str("bash"),
Self::Fish => f.write_str("fish"),
Self::Zsh => f.write_str("zsh"),
}
}
Expand Down Expand Up @@ -184,7 +183,7 @@ impl Default for Shell {

/// Produced when we fail to parse the shell type.
#[derive(Debug, Error)]
#[error("expected one of `bash`, `fish`, or `zsh`, got `{}`", self.0)]
#[error("expected one of `bash` or `zsh`, got `{}`", self.0)]
pub struct ParseShellError(String);

impl FromStr for Shell {
Expand All @@ -193,7 +192,6 @@ impl FromStr for Shell {
fn from_str(s: &str) -> result::Result<Self, Self::Err> {
match &*s.to_lowercase() {
"bash" => Ok(Self::Bash),
"fish" => Ok(Self::Fish),
"zsh" => Ok(Self::Zsh),
s => Err(ParseShellError(s.to_string())),
}
Expand Down Expand Up @@ -374,7 +372,7 @@ mod tests {
|
1 | s = 'ksh'
| ^^^^^
expected one of `bash`, `fish`, or `zsh`, got `ksh`
expected one of `bash` or `zsh`, got `ksh`
"
);
}
Expand Down
1 change: 0 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pub struct Config {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Shell {
Bash,
Fish,
Zsh,
}

Expand Down
20 changes: 0 additions & 20 deletions src/lock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,6 @@ impl Shell {
"*.sh"
]
});
static DEFAULT_MATCHES_FISH: Lazy<Vec<String>> = Lazy::new(|| {
vec_into![
"conf.d/{{ name }}.fish",
"conf.d/{!_*,*}.fish",
"{completions,functions}/{{ name }}.fish",
"{completions,functions}/{!_*,*}.fish",
"{completions,functions}/*.fish",
"{{ name }}.fish",
"{!_*,*}.fish",
"*.fish"
]
});
static DEFAULT_MATCHES_ZSH: Lazy<Vec<String>> = Lazy::new(|| {
vec_into![
"{{ name }}.plugin.zsh",
Expand All @@ -210,7 +198,6 @@ impl Shell {
});
match self {
Self::Bash => &DEFAULT_MATCHES_BASH,
Self::Fish => &DEFAULT_MATCHES_FISH,
Self::Zsh => &DEFAULT_MATCHES_ZSH,
}
}
Expand All @@ -223,12 +210,6 @@ impl Shell {
"source" => "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
}
});
static DEFAULT_TEMPLATES_FISH: Lazy<IndexMap<String, String>> = Lazy::new(|| {
indexmap_into! {
"add_path" => "fish_add_path \"{{ dir }}\"",
"source" => "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
}
});
static DEFAULT_TEMPLATES_ZSH: Lazy<IndexMap<String, String>> = Lazy::new(|| {
indexmap_into! {
"PATH" => "export PATH=\"{{ dir }}:$PATH\"",
Expand All @@ -239,7 +220,6 @@ impl Shell {
});
match self {
Self::Bash => &DEFAULT_TEMPLATES_BASH,
Self::Fish => &DEFAULT_TEMPLATES_FISH,
Self::Zsh => &DEFAULT_TEMPLATES_ZSH,
}
}
Expand Down

0 comments on commit a804ff2

Please sign in to comment.