diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-13 06:16:26 +0800 |
|---|---|---|
| committer | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-13 06:16:26 +0800 |
| commit | fef888b75b2544765aa06808c14490a2af827313 (patch) | |
| tree | 7de457b45192abade9a0a05a59970b64f6a70c4f | |
| parent | e42567b25093907cfd939edc92ace94a5d59b398 (diff) | |
Remove installation module behind builds feature
| -rw-r--r-- | mingling_core/src/comp.rs | 6 | ||||
| -rw-r--r-- | mingling_core/src/comp/installation.rs | 72 |
2 files changed, 0 insertions, 78 deletions
diff --git a/mingling_core/src/comp.rs b/mingling_core/src/comp.rs index fd26e1b..4fb17c7 100644 --- a/mingling_core/src/comp.rs +++ b/mingling_core/src/comp.rs @@ -2,17 +2,11 @@ mod flags; mod shell_ctx; mod suggest; -#[cfg(feature = "builds")] -mod installation; - use std::collections::BTreeSet; use std::fmt::Display; #[doc(hidden)] pub use flags::*; -#[cfg(feature = "builds")] -#[doc(hidden)] -pub use installation::*; #[doc(hidden)] pub use shell_ctx::*; #[doc(hidden)] diff --git a/mingling_core/src/comp/installation.rs b/mingling_core/src/comp/installation.rs deleted file mode 100644 index d3d31d6..0000000 --- a/mingling_core/src/comp/installation.rs +++ /dev/null @@ -1,72 +0,0 @@ -use crate::{build::build_comp_script_to_file, ShellFlag}; - -pub fn install_comp_script( - flag: ShellFlag, - bin_name: impl AsRef<str>, -) -> Result<(), std::io::Error> { - match flag { - // ~/.local/share/bash-completion/completions/ - ShellFlag::Bash => { - let Some(data_dir) = dirs::data_dir() else { - return Err(std::io::Error::new( - std::io::ErrorKind::Unsupported, - "Data directory not found!", - )); - }; - - let bin_name = bin_name.as_ref(); - - let comp_script_path = data_dir - .join("bash-completion") - .join("completions") - .join(format!("{}.sh", bin_name)); - - build_comp_script_to_file(&ShellFlag::Bash, bin_name, comp_script_path)?; - Ok(()) - } - - // ~/.zsh/completions/ - ShellFlag::Zsh => { - let Some(home_dir) = dirs::home_dir() else { - return Err(std::io::Error::new( - std::io::ErrorKind::Unsupported, - "Home directory not found!", - )); - }; - - let bin_name = bin_name.as_ref(); - - let comp_script_path = home_dir - .join(".zsh") - .join("completions") - .join(format!("{}.zsh", bin_name)); - - build_comp_script_to_file(&ShellFlag::Zsh, bin_name, comp_script_path)?; - Ok(()) - } - - // ~/.config/fish/completions/ - ShellFlag::Fish => { - let Some(config_dir) = dirs::config_dir() else { - return Err(std::io::Error::new( - std::io::ErrorKind::Unsupported, - "Config directory not found!", - )); - }; - - let bin_name = bin_name.as_ref(); - - let comp_script_path = config_dir - .join("fish") - .join("completions") - .join(format!("{}.fish", bin_name)); - - build_comp_script_to_file(&ShellFlag::Fish, bin_name, comp_script_path)?; - Ok(()) - } - _ => Err(std::io::Error::new( - std::io::ErrorKind::Unsupported, - "unsupported shell flag", - )), - } -} |
