Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Disable Tier 2 shell support (#19)

Maximilian Roos2478c3662f62
diff --git a/Cargo.toml b/Cargo.toml
index ca07e8a3e..570c5d30e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,8 +17,8 @@ allow-branch = ["*"]
consolidate-commits = true
[features]
-# Enable testing for shells that require extra installation steps (nushell, powershell, elvish, xonsh, oil)
-tier-2-integration-tests = []
+# Disabled: Enable testing for shells that require extra installation steps (nushell, powershell, elvish, xonsh, oil)
+# tier-2-integration-tests = []
# Enable syntax highlighting for bash commands in output (requires tree-sitter)
# This is optional to avoid C compilation issues on some platforms
default = ["syntax-highlighting"]
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index c682fef8c..fa99ceb82 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -84,16 +84,12 @@ fn scan_shell_configs(
let shells = if let Some(shell) = shell_filter {
vec![shell]
} else {
- // Try all shells in consistent order
+ // Try all supported shells in consistent order
vec![
Shell::Bash,
Shell::Zsh,
Shell::Fish,
- Shell::Nushell,
- Shell::Powershell,
- Shell::Oil,
- Shell::Elvish,
- Shell::Xonsh,
+ // Disabled shells: Nushell, Powershell, Oil, Elvish, Xonsh
]
};
diff --git a/src/commands/init.rs b/src/commands/init.rs
index fd8637211..a34d60260 100644
--- a/src/commands/init.rs
+++ b/src/commands/init.rs
@@ -30,12 +30,10 @@ pub fn handle_init(
// Generate completions to a string so we can filter out hidden commands
let mut completion_output = Vec::new();
let completion_shell = match shell {
- shell::Shell::Bash | shell::Shell::Oil => CompletionShell::Bash,
+ shell::Shell::Bash => CompletionShell::Bash,
shell::Shell::Fish => CompletionShell::Fish,
shell::Shell::Zsh => CompletionShell::Zsh,
- _ => unreachable!(
- "supports_completion() check above ensures we only reach this for supported shells"
- ),
+ // Disabled shells would be handled here
};
generate(
completion_shell,
diff --git a/src/shell.rs b/src/shell.rs
index dc441bd28..d4e65b28e 100644
--- a/src/shell.rs
+++ b/src/shell.rs
@@ -3,36 +3,36 @@ use std::path::PathBuf;
/// Supported shells
///
-/// Tier 1 shells (bash, fish, zsh) are fully supported and tested.
-/// Tier 2 shells (elvish, nushell, oil, powershell, xonsh) are works in progress.
-/// TODO: Get tier-2 shells working - currently have test failures and compatibility issues
+/// Currently supported: bash, fish, zsh
#[derive(Debug, Clone, Copy, clap::ValueEnum, strum::Display, strum::EnumString)]
#[strum(serialize_all = "lowercase", ascii_case_insensitive)]
pub enum Shell {
Bash,
- /// TODO: Elvish support - currently disabled due to test failures
- #[value(skip)]
- Elvish,
+ // Disabled shells (elvish, nushell, oil, powershell, xonsh)
+ // Uncomment when ready to support additional shells
+ // /// TODO: Elvish support - currently disabled due to test failures
+ // #[value(skip)]
+ // Elvish,
Fish,
- /// TODO: Nushell support - currently disabled due to test failures
- #[value(skip)]
- Nushell,
- /// TODO: Oil support - currently disabled due to test failures
- #[value(skip)]
- Oil,
- /// TODO: PowerShell support - currently disabled due to test failures
- #[value(skip)]
- Powershell,
- /// TODO: Xonsh support - currently disabled due to test failures
- #[value(skip)]
- Xonsh,
+ // /// TODO: Nushell support - currently disabled due to test failures
+ // #[value(skip)]
+ // Nushell,
+ // /// TODO: Oil support - currently disabled due to test failures
+ // #[value(skip)]
+ // Oil,
+ // /// TODO: PowerShell support - currently disabled due to test failures
+ // #[value(skip)]
+ // Powershell,
+ // /// TODO: Xonsh support - currently disabled due to test failures
+ // #[value(skip)]
+ // Xonsh,
Zsh,
}
impl Shell {
/// Returns true if this shell supports completion generation
pub fn supports_completion(&self) -> bool {
- matches!(self, Self::Bash | Self::Fish | Self::Zsh | Self::Oil)
+ matches!(self, Self::Bash | Self::Fish | Self::Zsh)
}
/// Returns the standard config file paths for this shell
@@ -66,38 +66,38 @@ impl Shell {
.join("conf.d")
.join(format!("{}.fish", cmd_prefix)),
]
- }
- Self::Nushell => {
- vec![home.join(".config").join("nushell").join("config.nu")]
- }
- Self::Powershell => {
- if cfg!(target_os = "windows") {
- let userprofile = PathBuf::from(
- std::env::var("USERPROFILE").unwrap_or_else(|_| ".".to_string()),
- );
- vec![
- userprofile
- .join("Documents")
- .join("PowerShell")
- .join("Microsoft.PowerShell_profile.ps1"),
- ]
- } else {
- vec![
- home.join(".config")
- .join("powershell")
- .join("Microsoft.PowerShell_profile.ps1"),
- ]
- }
- }
- Self::Oil => {
- vec![home.join(".config").join("oil").join("oshrc")]
- }
- Self::Elvish => {
- vec![home.join(".config").join("elvish").join("rc.elv")]
- }
- Self::Xonsh => {
- vec![home.join(".xonshrc")]
- }
+ } // Disabled shells - uncomment when ready to support
+ // Self::Nushell => {
+ // vec![home.join(".config").join("nushell").join("config.nu")]
+ // }
+ // Self::Powershell => {
+ // if cfg!(target_os = "windows") {
+ // let userprofile = PathBuf::from(
+ // std::env::var("USERPROFILE").unwrap_or_else(|_| ".".to_string()),
+ // );
+ // vec![
+ // userprofile
+ // .join("Documents")
+ // .join("PowerShell")
+ // .join("Microsoft.PowerShell_profile.ps1"),
+ // ]
+ // } else {
+ // vec![
+ // home.join(".config")
+ // .join("powershell")
+ // .join("Microsoft.PowerShell_profile.ps1"),
+ // ]
+ // }
+ // }
+ // Self::Oil => {
+ // vec![home.join(".config").join("oil").join("oshrc")]
+ // }
+ // Self::Elvish => {
+ // vec![home.join(".config").join("elvish").join("rc.elv")]
+ // }
+ // Self::Xonsh => {
+ // vec![home.join(".xonshrc")]
+ // }
}
}
@@ -106,7 +106,7 @@ impl Shell {
/// All shells use a conditional wrapper to avoid errors when the command doesn't exist.
pub fn config_line(&self, cmd_prefix: &str) -> String {
match self {
- Self::Bash | Self::Zsh | Self::Oil => {
+ Self::Bash | Self::Zsh => {
format!(
"if command -v {} >/dev/null 2>&1; then eval \"$(command {} init {})\"; fi",
cmd_prefix, cmd_prefix, self
@@ -117,32 +117,38 @@ impl Shell {
"if type -q {}; command {} init {} | source; end",
cmd_prefix, cmd_prefix, self
)
- }
- Self::Nushell => {
- // Use user's home directory cache instead of shared /tmp for security
- format!(
- "if (which {} | is-not-empty) {{ let tmpfile = ($env.HOME | path join \".cache\" \"nushell-{}-init.nu\"); ^{} init {} | save --force $tmpfile; source $tmpfile }}",
- cmd_prefix, cmd_prefix, cmd_prefix, self
- )
- }
- Self::Powershell => {
- format!(
- "if (Get-Command {} -ErrorAction SilentlyContinue) {{ Invoke-Expression (& {} init {}) }}",
- cmd_prefix, cmd_prefix, self
- )
- }
- Self::Elvish => {
- format!(
- "if (has-external {}) {{ eval (e:{} init {}) }}",
- cmd_prefix, cmd_prefix, self
- )
- }
- Self::Xonsh => {
- format!(
- "import shutil; exec(shutil.which('{}') and $({} init {}).strip() or '')",
- cmd_prefix, cmd_prefix, self
- )
- }
+ } // Disabled shells - uncomment when ready to support
+ // Self::Oil => {
+ // format!(
+ // "if command -v {} >/dev/null 2>&1; then eval \"$(command {} init {})\"; fi",
+ // cmd_prefix, cmd_prefix, self
+ // )
+ // }
+ // Self::Nushell => {
+ // // Use user's home directory cache instead of shared /tmp for security
+ // format!(
+ // "if (which {} | is-not-empty) {{ let tmpfile = ($env.HOME | path join \".cache\" \"nushell-{}-init.nu\"); ^{} init {} | save --force $tmpfile; source $tmpfile }}",
+ // cmd_prefix, cmd_prefix, cmd_prefix, self
+ // )
+ // }
+ // Self::Powershell => {
+ // format!(
+ // "if (Get-Command {} -ErrorAction SilentlyContinue) {{ Invoke-Expression (& {} init {}) }}",
+ // cmd_prefix, cmd_prefix, self
+ // )
+ // }
+ // Self::Elvish => {
+ // format!(
+ // "if (has-external {}) {{ eval (e:{} init {}) }}",
+ // cmd_prefix, cmd_prefix, self
+ // )
+ // }
+ // Self::Xonsh => {
+ // format!(
+ // "import shutil; exec(shutil.which('{}') and $({} init {}).strip() or '')",
+ // cmd_prefix, cmd_prefix, self
+ // )
+ // }
}
}
@@ -171,14 +177,15 @@ impl Shell {
.map(PathBuf::from)
.unwrap_or_else(|_| home.clone())
.join(".zshrc"),
- // Nushell
- home.join(".config/nushell/config.nu"),
- // Elvish
- home.join(".config/elvish/rc.elv"),
- // Xonsh
- home.join(".xonshrc"),
- // Powershell
- home.join(".config/powershell/Microsoft.PowerShell_profile.ps1"),
+ // Disabled shells
+ // // Nushell
+ // home.join(".config/nushell/config.nu"),
+ // // Elvish
+ // home.join(".config/elvish/rc.elv"),
+ // // Xonsh
+ // home.join(".xonshrc"),
+ // // Powershell
+ // home.join(".config/powershell/Microsoft.PowerShell_profile.ps1"),
];
// Check standard config files for eval pattern (any prefix)
@@ -248,7 +255,7 @@ impl ShellInit {
/// Generate shell integration code
pub fn generate(&self) -> Result<String, askama::Error> {
match self.shell {
- Shell::Bash | Shell::Oil => {
+ Shell::Bash => {
let posix_shim = PosixDirectivesTemplate {
cmd_prefix: &self.cmd_prefix,
}
@@ -276,31 +283,43 @@ impl ShellInit {
cmd_prefix: &self.cmd_prefix,
};
template.render()
- }
- Shell::Nushell => {
- let template = NushellTemplate {
- cmd_prefix: &self.cmd_prefix,
- };
- template.render()
- }
- Shell::Powershell => {
- let template = PowershellTemplate {
- cmd_prefix: &self.cmd_prefix,
- };
- template.render()
- }
- Shell::Elvish => {
- let template = ElvishTemplate {
- cmd_prefix: &self.cmd_prefix,
- };
- template.render()
- }
- Shell::Xonsh => {
- let template = XonshTemplate {
- cmd_prefix: &self.cmd_prefix,
- };
- template.render()
- }
+ } // Disabled shells - uncomment when ready to support
+ // Shell::Oil => {
+ // let posix_shim = PosixDirectivesTemplate {
+ // cmd_prefix: &self.cmd_prefix,
+ // }
+ // .render()?;
+ // let template = BashTemplate {
+ // shell_name: self.shell.to_string(),
+ // cmd_prefix: &self.cmd_prefix,
+ // posix_shim: &posix_shim,
+ // };
+ // template.render()
+ // }
+ // Shell::Nushell => {
+ // let template = NushellTemplate {
+ // cmd_prefix: &self.cmd_prefix,
+ // };
+ // template.render()
+ // }
+ // Shell::Powershell => {
+ // let template = PowershellTemplate {
+ // cmd_prefix: &self.cmd_prefix,
+ // };
+ // template.render()
+ // }
+ // Shell::Elvish => {
+ // let template = ElvishTemplate {
+ // cmd_prefix: &self.cmd_prefix,
+ // };
+ // template.render()
+ // }
+ // Shell::Xonsh => {
+ // let template = XonshTemplate {
+ // cmd_prefix: &self.cmd_prefix,
+ // };
+ // template.render()
+ // }
}
}
}
@@ -336,33 +355,34 @@ struct FishTemplate<'a> {
cmd_prefix: &'a str,
}
-/// Nushell shell template
-#[derive(Template)]
-#[template(path = "nushell.nu", escape = "none")]
-struct NushellTemplate<'a> {
- cmd_prefix: &'a str,
-}
-
-/// PowerShell template
-#[derive(Template)]
-#[template(path = "powershell.ps1", escape = "none")]
-struct PowershellTemplate<'a> {
- cmd_prefix: &'a str,
-}
-
-/// Elvish shell template
-#[derive(Template)]
-#[template(path = "elvish.elv", escape = "none")]
-struct ElvishTemplate<'a> {
- cmd_prefix: &'a str,
-}
-
-/// Xonsh shell template
-#[derive(Template)]
-#[template(path = "xonsh.xsh", escape = "none")]
-struct XonshTemplate<'a> {
- cmd_prefix: &'a str,
-}
+// Disabled shell templates - uncomment when ready to support
+// /// Nushell shell template
+// #[derive(Template)]
+// #[template(path = "nushell.nu", escape = "none")]
+// struct NushellTemplate<'a> {
+// cmd_prefix: &'a str,
+// }
+//
+// /// PowerShell template
+// #[derive(Template)]
+// #[template(path = "powershell.ps1", escape = "none")]
+// struct PowershellTemplate<'a> {
+// cmd_prefix: &'a str,
+// }
+//
+// /// Elvish shell template
+// #[derive(Template)]
+// #[template(path = "elvish.elv", escape = "none")]
+// struct ElvishTemplate<'a> {
+// cmd_prefix: &'a str,
+// }
+//
+// /// Xonsh shell template
+// #[derive(Template)]
+// #[template(path = "xonsh.xsh", escape = "none")]
+// struct XonshTemplate<'a> {
+// cmd_prefix: &'a str,
+// }
#[cfg(test)]
mod tests {
diff --git a/tests/integration_tests/completion.rs b/tests/integration_tests/completion.rs
index a5b76214b..5555823b3 100644
--- a/tests/integration_tests/completion.rs
+++ b/tests/integration_tests/completion.rs
@@ -781,8 +781,7 @@ fn test_complete_init_shows_shells() {
let stdout = String::from_utf8_lossy(&output.stdout);
let shells = value_suggestions(&stdout);
- // Should show tier 1 shell types (bash, fish, zsh)
- // Tier 2 shells (elvish, nushell, oil, powershell, xonsh) are hidden until fully working
+ // Should show supported shells (bash, fish, zsh)
assert!(shells.contains(&"bash"));
assert!(shells.contains(&"fish"));
assert!(shells.contains(&"zsh"));
@@ -826,7 +825,7 @@ fn test_complete_init_with_source_flag() {
let stdout = String::from_utf8_lossy(&output.stdout);
let shells = value_suggestions(&stdout);
- // Should show tier 1 shell types, same as without --source
+ // Should show supported shells, same as without --source
assert!(shells.contains(&"bash"));
assert!(shells.contains(&"fish"));
assert!(shells.contains(&"zsh"));
@@ -870,7 +869,7 @@ fn test_complete_config_shell_flag_with_source() {
let stdout = String::from_utf8_lossy(&output.stdout);
let shells = value_suggestions(&stdout);
- // Should show tier 1 shell types, same as without --source
+ // Should show supported shells, same as without --source
assert!(shells.contains(&"bash"));
assert!(shells.contains(&"fish"));
assert!(shells.contains(&"zsh"));
diff --git a/tests/integration_tests/e2e_shell.rs b/tests/integration_tests/e2e_shell.rs
index a8d9fee46..3cb04add8 100644
--- a/tests/integration_tests/e2e_shell.rs
+++ b/tests/integration_tests/e2e_shell.rs
@@ -5,14 +5,11 @@ use crate::common::{
use rstest::rstest;
#[rstest]
-// bash is baseline, fish exercises alternate syntax
+// Test with bash (baseline) and fish (alternate syntax)
#[case("bash")]
#[case("fish")]
#[case("zsh")]
-// TODO: Tier 2 shells (elvish, nushell, oil, powershell, xonsh) - would like to get these working
-// Currently disabled due to test failures and platform compatibility issues
-// #[cfg_attr(feature = "tier-2-integration-tests", case("oil"))]
-fn test_e2e_switch_and_remove_roundtrip(#[case] shell: &str) {
+fn test_shell_integration_switch_and_remove(#[case] shell: &str) {
let mut repo = TestRepo::new();
repo.commit("Initial commit");
repo.setup_remote("main");
@@ -70,7 +67,7 @@ fn test_e2e_switch_and_remove_roundtrip(#[case] shell: &str) {
}
#[test]
-fn test_bash_e2e_error_handling() {
+fn test_bash_shell_integration_error_handling() {
let repo = TestRepo::new();
repo.commit("Initial commit");
@@ -111,7 +108,7 @@ fn test_bash_e2e_error_handling() {
}
#[test]
-fn test_bash_e2e_switch_existing_worktree() {
+fn test_bash_shell_integration_switch_existing_worktree() {
let repo = TestRepo::new();
repo.commit("Initial commit");
diff --git a/tests/integration_tests/e2e_shell_post_start.rs b/tests/integration_tests/e2e_shell_post_start.rs
index 85e0e45b3..9dd11f5d7 100644
--- a/tests/integration_tests/e2e_shell_post_start.rs
+++ b/tests/integration_tests/e2e_shell_post_start.rs
@@ -24,17 +24,10 @@ fn wait_for_file(path: &std::path::Path, timeout: Duration) {
/// Test that post-start background commands work with shell integration
#[rstest]
-// Test with bash (POSIX baseline) and fish (different syntax)
-// zsh removed - too similar to bash
+// Test with bash and fish
#[case("bash")]
#[case("fish")]
-// TODO: Tier 2 shells (elvish, nushell, oil, powershell, xonsh) - would like to get these working
-// Currently disabled due to test failures and platform compatibility issues
-// #[cfg_attr(feature = "tier-2-integration-tests", case("elvish"))]
-// #[cfg_attr(feature = "tier-2-integration-tests", case("nushell"))]
-// #[cfg_attr(feature = "tier-2-integration-tests", case("oil"))]
-// #[cfg_attr(feature = "tier-2-integration-tests", case("xonsh"))]
-fn test_e2e_post_start_background_command(#[case] shell: &str) {
+fn test_shell_integration_post_start_background(#[case] shell: &str) {
let repo = TestRepo::new();
repo.commit("Initial commit");
@@ -134,7 +127,7 @@ approved-commands = ["sleep 0.05 && echo 'Background task done' > bg_marker.txt"
/// Test that multiple post-start commands run in parallel with shell integration
#[test]
-fn test_bash_post_start_multiple_parallel_commands() {
+fn test_bash_shell_integration_post_start_parallel() {
let repo = TestRepo::new();
repo.commit("Initial commit");
@@ -209,7 +202,7 @@ approved-commands = [
/// Test that post-create commands block before shell returns
#[test]
-fn test_bash_post_create_blocks() {
+fn test_bash_shell_integration_post_create_blocks() {
let repo = TestRepo::new();
repo.commit("Initial commit");
@@ -281,7 +274,7 @@ approved-commands = ["echo 'Setup done' > setup.txt"]
/// Test fish shell specifically with background tasks
#[cfg(unix)]
#[test]
-fn test_fish_post_start_background() {
+fn test_fish_shell_integration_post_start_background() {
let repo = TestRepo::new();
repo.commit("Initial commit");
diff --git a/tests/integration_tests/init.rs b/tests/integration_tests/init.rs
index ba987a008..f8d3e092e 100644
--- a/tests/integration_tests/init.rs
+++ b/tests/integration_tests/init.rs
@@ -25,17 +25,10 @@ fn snapshot_init(test_name: &str, shell: &str, extra_args: &[&str]) {
}
#[rstest]
-// Tier 1: Shells available in standard Ubuntu repos
+// Test supported shells
#[case("bash")]
#[case("fish")]
#[case("zsh")]
-// Tier 2: Shells requiring extra setup
-// TODO: Fix non-core shells - all have snapshot mismatches in init output
-// #[cfg_attr(feature = "tier-2-integration-tests", case("elvish"))]
-// #[cfg_attr(feature = "tier-2-integration-tests", case("nushell"))]
-// #[cfg_attr(feature = "tier-2-integration-tests", case("oil"))]
-// #[cfg_attr(feature = "tier-2-integration-tests", case("powershell"))]
-// #[cfg_attr(feature = "tier-2-integration-tests", case("xonsh"))]
fn test_init(#[case] shell: &str) {
snapshot_init(&format!("init_{}", shell), shell, &[]);
}