aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/asset/comp/flags.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-04-09 15:12:11 +0800
committer魏曹先生 <1992414357@qq.com>2026-04-09 15:12:11 +0800
commit4764c3c818e3da16a3cba3b9877d9beb635e4237 (patch)
tree3adc438ca9b56f0fcd95354af4bd8329640ecce4 /mingling_core/src/asset/comp/flags.rs
parent240361b240d638363346013160b0943b47769c37 (diff)
Add basic completion module with shell integration
Diffstat (limited to 'mingling_core/src/asset/comp/flags.rs')
-rw-r--r--mingling_core/src/asset/comp/flags.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/mingling_core/src/asset/comp/flags.rs b/mingling_core/src/asset/comp/flags.rs
new file mode 100644
index 0000000..b432b08
--- /dev/null
+++ b/mingling_core/src/asset/comp/flags.rs
@@ -0,0 +1,35 @@
+use just_fmt::snake_case;
+
+#[derive(Default, Debug, Clone)]
+pub enum ShellFlag {
+ #[default]
+ Bash,
+ Zsh,
+ Fish,
+ Powershell,
+ Other(String),
+}
+
+impl From<String> for ShellFlag {
+ fn from(s: String) -> Self {
+ match s.trim().to_lowercase().as_str() {
+ "zsh" => ShellFlag::Zsh,
+ "bash" => ShellFlag::Bash,
+ "fish" => ShellFlag::Fish,
+ "pwsl" | "ps1" | "powershell" => ShellFlag::Powershell,
+ other => ShellFlag::Other(snake_case!(other)),
+ }
+ }
+}
+
+impl From<ShellFlag> for String {
+ fn from(flag: ShellFlag) -> Self {
+ match flag {
+ ShellFlag::Zsh => "zsh".to_string(),
+ ShellFlag::Bash => "bash".to_string(),
+ ShellFlag::Fish => "fish".to_string(),
+ ShellFlag::Powershell => "powershell".to_string(),
+ ShellFlag::Other(s) => s,
+ }
+ }
+}