• Home
  • Raw
  • Download

Lines Matching full:shell

11 /// Shell with auto-generated completion script available.
14 pub enum Shell { enum
15 /// Bourne Again SHell (bash)
17 /// Elvish shell
19 /// Friendly Interactive SHell (fish)
23 /// Z SHell (zsh)
27 impl Display for Shell { implementation
36 impl FromStr for Shell { implementation
50 impl ValueEnum for Shell { implementation
53 Shell::Bash, in value_variants()
54 Shell::Elvish, in value_variants()
55 Shell::Fish, in value_variants()
56 Shell::PowerShell, in value_variants()
57 Shell::Zsh, in value_variants()
63 Shell::Bash => PossibleValue::new("bash"), in to_possible_value()
64 Shell::Elvish => PossibleValue::new("elvish"), in to_possible_value()
65 Shell::Fish => PossibleValue::new("fish"), in to_possible_value()
66 Shell::PowerShell => PossibleValue::new("powershell"), in to_possible_value()
67 Shell::Zsh => PossibleValue::new("zsh"), in to_possible_value()
72 impl Generator for Shell { implementation
75 Shell::Bash => shells::Bash.file_name(name), in file_name()
76 Shell::Elvish => shells::Elvish.file_name(name), in file_name()
77 Shell::Fish => shells::Fish.file_name(name), in file_name()
78 Shell::PowerShell => shells::PowerShell.file_name(name), in file_name()
79 Shell::Zsh => shells::Zsh.file_name(name), in file_name()
85 Shell::Bash => shells::Bash.generate(cmd, buf), in generate()
86 Shell::Elvish => shells::Elvish.generate(cmd, buf), in generate()
87 Shell::Fish => shells::Fish.generate(cmd, buf), in generate()
88 Shell::PowerShell => shells::PowerShell.generate(cmd, buf), in generate()
89 Shell::Zsh => shells::Zsh.generate(cmd, buf), in generate()
94 impl Shell { implementation
95 /// Parse a shell from a path to the executable for the shell
100 /// use clap_complete::shells::Shell;
102 /// assert_eq!(Shell::from_shell_path("/bin/bash"), Some(Shell::Bash));
103 /// assert_eq!(Shell::from_shell_path("/usr/bin/zsh"), Some(Shell::Zsh));
104 /// assert_eq!(Shell::from_shell_path("/opt/my_custom_shell"), None);
106 pub fn from_shell_path<P: AsRef<Path>>(path: P) -> Option<Shell> { in from_shell_path() argument
110 /// Determine the user's current shell from the environment
112 /// This will read the SHELL environment variable and try to determine which shell is in use
115 /// If SHELL is not set, then on windows, it will default to powershell, and on
118 /// If SHELL is set, but contains a value that doesn't correspond to one of the supported shell
125 /// use clap_complete::{generate, shells::Shell};
130 … /// generate(Shell::from_env().unwrap_or(Shell::Bash), &mut cmd, "myapp", &mut std::io::stdout());
132 pub fn from_env() -> Option<Shell> { in from_env()
133 if let Some(env_shell) = std::env::var_os("SHELL") { in from_env()
134 Shell::from_shell_path(env_shell) in from_env()
136 Some(Shell::PowerShell) in from_env()
145 fn parse_shell_from_path(path: &Path) -> Option<Shell> { in parse_shell_from_path() argument
148 "bash" => Some(Shell::Bash), in parse_shell_from_path()
149 "zsh" => Some(Shell::Zsh), in parse_shell_from_path()
150 "fish" => Some(Shell::Fish), in parse_shell_from_path()
151 "elvish" => Some(Shell::Elvish), in parse_shell_from_path()
152 "powershell" | "powershell_ise" => Some(Shell::PowerShell), in parse_shell_from_path()