From 199563550dd41c3dfb703bd3747604a8a03cdbc5 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 11 Jun 2026 14:20:49 +0200 Subject: chore: Remove all `pub`s They will not be marked by rustc/cargo as unused, and as atuin doesn't expose an API all of them _should_ be `pub(crate)` --- crates/turtle/src/atuin_common/shell.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'crates/turtle/src/atuin_common/shell.rs') diff --git a/crates/turtle/src/atuin_common/shell.rs b/crates/turtle/src/atuin_common/shell.rs index 7f9a7b8f..dbd9b982 100644 --- a/crates/turtle/src/atuin_common/shell.rs +++ b/crates/turtle/src/atuin_common/shell.rs @@ -5,7 +5,7 @@ use sysinfo::{Process, System, get_current_pid}; use thiserror::Error; #[derive(PartialEq)] -pub enum Shell { +pub(crate) enum Shell { Sh, Bash, Fish, @@ -36,7 +36,7 @@ impl std::fmt::Display for Shell { } #[derive(Debug, Error, Serialize)] -pub enum ShellError { +pub(crate) enum ShellError { #[error("shell not supported")] NotSupported, @@ -45,7 +45,7 @@ pub enum ShellError { } impl Shell { - pub fn current() -> Shell { + pub(crate) fn current() -> Shell { let sys = System::new_all(); let process = sys @@ -62,13 +62,13 @@ impl Shell { Shell::from_string(shell.to_string()) } - pub fn from_env() -> Shell { + pub(crate) fn from_env() -> Shell { std::env::var("ATUIN_SHELL").map_or(Shell::Unknown, |shell| { Shell::from_string(shell.trim().to_lowercase()) }) } - pub fn config_file(&self) -> Option { + pub(crate) fn config_file(&self) -> Option { let mut path = if let Some(base) = directories::BaseDirs::new() { base.home_dir().to_owned() } else { @@ -90,7 +90,7 @@ impl Shell { /// Best-effort attempt to determine the default shell /// This implementation will be different across different platforms /// Caller should ensure to handle Shell::Unknown correctly - pub fn default_shell() -> Result { + pub(crate) fn default_shell() -> Result { let sys = System::name().unwrap_or("".to_string()).to_lowercase(); // TODO: Support Linux @@ -118,7 +118,7 @@ impl Shell { )) } - pub fn from_string(name: String) -> Shell { + pub(crate) fn from_string(name: String) -> Shell { match name.as_str() { "bash" => Shell::Bash, "fish" => Shell::Fish, @@ -135,11 +135,11 @@ impl Shell { /// Returns true if the shell is posix-like /// Note that while fish is not posix compliant, it behaves well enough for our current /// featureset that this does not matter. - pub fn is_posixish(&self) -> bool { + pub(crate) fn is_posixish(&self) -> bool { matches!(self, Shell::Bash | Shell::Fish | Shell::Zsh) } - pub fn run_interactive(&self, args: I) -> Result + pub(crate) fn run_interactive(&self, args: I) -> Result where I: IntoIterator, S: AsRef, @@ -162,7 +162,7 @@ impl Shell { } } -pub fn shell_name(parent: Option<&Process>) -> String { +pub(crate) fn shell_name(parent: Option<&Process>) -> String { let sys = System::new_all(); let parent = if let Some(parent) = parent { -- cgit v1.3.1