| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 5 | |
| 6 | use claprust-analyzer cargo clap 4.6.6 crate/::ValueEnumrust-analyzer cargo clap_builder 4.6.6 derive/ValueEnum#; |
| 7 | use claprust-analyzer cargo clap 4.6.6 crate/::builderrust-analyzer cargo clap_builder 4.6.6 builder/::PossibleValuerust-analyzer cargo clap_builder 4.6.6 builder/possible_value/PossibleValue#; |
| 8 | |
| 9 | use craterust-analyzer cargo clap_complete 4.6.8 crate/::Generatorrust-analyzer cargo clap_complete 4.6.8 aot/generator/Generator#; |
| 10 | use craterust-analyzer cargo clap_complete 4.6.8 crate/::shellsrust-analyzer cargo clap_complete 4.6.8 shells/; |
| 11 | |
| 12 | /// Shell with auto-generated completion script available. |
| 13 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 14 | #[non_exhaustive] |
| 15 | pub enum Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell# { |
| 16 | /// Bourne Again `SHell` (bash) |
| 17 | Bashrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Bash#, |
| 18 | /// Elvish shell |
| 19 | Elvishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Elvish#, |
| 20 | /// Friendly Interactive `SHell` (fish) |
| 21 | Fishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Fish#, |
| 22 | /// `PowerShell` |
| 23 | PowerShellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#PowerShell#, |
| 24 | /// Z `SHell` (zsh) |
| 25 | Zshrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Zsh#, |
| 26 | } |
| 27 | |
| 28 | impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell# { |
| 29 | fn fmtrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][Display]fmt().(&self, f: &mut stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 30 | self.to_possible_valuerust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][ValueEnum]to_possible_value().() |
| 31 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("no values are skipped") |
| 32 | .get_namerust-analyzer cargo clap_builder 4.6.6 builder/possible_value/impl#[PossibleValue]get_name().() |
| 33 | .fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[str][Display]fmt().(f) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell# { |
| 38 | type Errrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][FromStr]Err# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#; |
| 39 | |
| 40 | fn from_strrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][FromStr], Selfrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 41 | for variant in Selfrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][FromStr]::value_variantsrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][ValueEnum]value_variants().() { |
| 42 | if variant.to_possible_valuerust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][ValueEnum]to_possible_value().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().matchesrust-analyzer cargo clap_builder 4.6.6 builder/possible_value/impl#[PossibleValue]matches().(s, false) { |
| 43 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().variant); |
| 44 | } |
| 45 | } |
| 46 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("invalid variant: {s}")) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | // Hand-rolled so it can work even when `derive` feature is disabled |
| 51 | impl ValueEnumrust-analyzer cargo clap_builder 4.6.6 derive/ValueEnum# for Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell# { |
| 52 | fn value_variantsrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][ValueEnum]value_variants().<'a>() -> &'a [Selfrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][ValueEnum]] { |
| 53 | &[ |
| 54 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Bashrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Bash#, |
| 55 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Elvishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Elvish#, |
| 56 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Fishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Fish#, |
| 57 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::PowerShellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#PowerShell#, |
| 58 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Zshrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Zsh#, |
| 59 | ] |
| 60 | } |
| 61 | |
| 62 | fn to_possible_valuerust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][ValueEnum]to_possible_value().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PossibleValuerust-analyzer cargo clap_builder 4.6.6 builder/possible_value/PossibleValue#> { |
| 63 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(match self { |
| 64 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Bashrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Bash# => PossibleValuerust-analyzer cargo clap_builder 4.6.6 builder/possible_value/PossibleValue#::newrust-analyzer cargo clap_builder 4.6.6 builder/possible_value/impl#[PossibleValue]new().("bash"), |
| 65 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Elvishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Elvish# => PossibleValuerust-analyzer cargo clap_builder 4.6.6 builder/possible_value/PossibleValue#::newrust-analyzer cargo clap_builder 4.6.6 builder/possible_value/impl#[PossibleValue]new().("elvish"), |
| 66 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Fishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Fish# => PossibleValuerust-analyzer cargo clap_builder 4.6.6 builder/possible_value/PossibleValue#::newrust-analyzer cargo clap_builder 4.6.6 builder/possible_value/impl#[PossibleValue]new().("fish"), |
| 67 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::PowerShellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#PowerShell# => PossibleValuerust-analyzer cargo clap_builder 4.6.6 builder/possible_value/PossibleValue#::newrust-analyzer cargo clap_builder 4.6.6 builder/possible_value/impl#[PossibleValue]new().("powershell"), |
| 68 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Zshrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Zsh# => PossibleValuerust-analyzer cargo clap_builder 4.6.6 builder/possible_value/PossibleValue#::newrust-analyzer cargo clap_builder 4.6.6 builder/possible_value/impl#[PossibleValue]new().("zsh"), |
| 69 | }) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | impl Generatorrust-analyzer cargo clap_complete 4.6.8 aot/generator/Generator# for Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell# { |
| 74 | fn file_namerust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][Generator]file_name().(&self, name: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 75 | match self { |
| 76 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Bashrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Bash# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::Bashrust-analyzer cargo clap_complete 4.6.8 aot/shells/bash/Bash#.file_namerust-analyzer cargo clap_complete 4.6.8 aot/shells/bash/impl#[Bash][Generator]file_name().(name), |
| 77 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Elvishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Elvish# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::Elvishrust-analyzer cargo clap_complete 4.6.8 aot/shells/elvish/Elvish#.file_namerust-analyzer cargo clap_complete 4.6.8 aot/shells/elvish/impl#[Elvish][Generator]file_name().(name), |
| 78 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Fishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Fish# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::Fishrust-analyzer cargo clap_complete 4.6.8 aot/shells/fish/Fish#.file_namerust-analyzer cargo clap_complete 4.6.8 aot/shells/fish/impl#[Fish][Generator]file_name().(name), |
| 79 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::PowerShellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#PowerShell# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::PowerShellrust-analyzer cargo clap_complete 4.6.8 aot/shells/powershell/PowerShell#.file_namerust-analyzer cargo clap_complete 4.6.8 aot/shells/powershell/impl#[PowerShell][Generator]file_name().(name), |
| 80 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Zshrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Zsh# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::Zshrust-analyzer cargo clap_complete 4.6.8 aot/shells/zsh/Zsh#.file_namerust-analyzer cargo clap_complete 4.6.8 aot/shells/zsh/impl#[Zsh][Generator]file_name().(name), |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | fn generaterust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][Generator]generate().(&self, cmd: &claprust-analyzer cargo clap 4.6.6 crate/::Commandrust-analyzer cargo clap_builder 4.6.6 builder/command/Command#, buf: &mut dyn stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#) { |
| 85 | self.try_generaterust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][Generator]try_generate().(cmd, buf) |
| 86 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("failed to write completion file"); |
| 87 | } |
| 88 | |
| 89 | fn try_generaterust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell][Generator]try_generate().(&self, cmd: &claprust-analyzer cargo clap 4.6.6 crate/::Commandrust-analyzer cargo clap_builder 4.6.6 builder/command/Command#, buf: &mut dyn stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 90 | match self { |
| 91 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Bashrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Bash# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::Bashrust-analyzer cargo clap_complete 4.6.8 aot/shells/bash/Bash#.try_generaterust-analyzer cargo clap_complete 4.6.8 aot/shells/bash/impl#[Bash][Generator]try_generate().(cmd, buf), |
| 92 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Elvishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Elvish# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::Elvishrust-analyzer cargo clap_complete 4.6.8 aot/shells/elvish/Elvish#.try_generaterust-analyzer cargo clap_complete 4.6.8 aot/shells/elvish/impl#[Elvish][Generator]try_generate().(cmd, buf), |
| 93 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Fishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Fish# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::Fishrust-analyzer cargo clap_complete 4.6.8 aot/shells/fish/Fish#.try_generaterust-analyzer cargo clap_complete 4.6.8 aot/shells/fish/impl#[Fish][Generator]try_generate().(cmd, buf), |
| 94 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::PowerShellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#PowerShell# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::PowerShellrust-analyzer cargo clap_complete 4.6.8 aot/shells/powershell/PowerShell#.try_generaterust-analyzer cargo clap_complete 4.6.8 aot/shells/powershell/impl#[PowerShell][Generator]try_generate().(cmd, buf), |
| 95 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Zshrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Zsh# => shellsrust-analyzer cargo clap_complete 4.6.8 shells/::Zshrust-analyzer cargo clap_complete 4.6.8 aot/shells/zsh/Zsh#.try_generaterust-analyzer cargo clap_complete 4.6.8 aot/shells/zsh/impl#[Zsh][Generator]try_generate().(cmd, buf), |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | impl Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell# { |
| 101 | /// Parse a shell from a path to the executable for the shell |
| 102 | /// |
| 103 | /// # Examples |
| 104 | /// |
| 105 | /// ``` |
| 106 | /// use clap_complete::shells::Shell; |
| 107 | /// |
| 108 | /// assert_eq!(Shell::from_shell_path("/bin/bash"), Some(Shell::Bash)); |
| 109 | /// assert_eq!(Shell::from_shell_path("/usr/bin/zsh"), Some(Shell::Zsh)); |
| 110 | /// assert_eq!(Shell::from_shell_path("/usr/bin/pwsh"), Some(Shell::PowerShell)); |
| 111 | /// assert_eq!(Shell::from_shell_path("/opt/my_custom_shell"), None); |
| 112 | /// ``` |
| 113 | pub fn from_shell_pathrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell]from_shell_path().<P: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>>(path: P) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#> { |
| 114 | parse_shell_from_pathrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/parse_shell_from_path().(path.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().()) |
| 115 | } |
| 116 | |
| 117 | /// Determine the user's current shell from the environment |
| 118 | /// |
| 119 | /// This will read the SHELL environment variable and try to determine which shell is in use |
| 120 | /// from that. |
| 121 | /// |
| 122 | /// If SHELL is not set, then on windows, it will default to powershell, and on |
| 123 | /// other operating systems it will return `None`. |
| 124 | /// |
| 125 | /// If SHELL is set, but contains a value that doesn't correspond to one of the supported shell |
| 126 | /// types, then return `None`. |
| 127 | /// |
| 128 | /// # Example: |
| 129 | /// |
| 130 | /// ```no_run |
| 131 | /// # use clap::Command; |
| 132 | /// use clap_complete::{generate, shells::Shell}; |
| 133 | /// # fn build_cli() -> Command { |
| 134 | /// # Command::new("compl") |
| 135 | /// # } |
| 136 | /// let mut cmd = build_cli(); |
| 137 | /// generate(Shell::from_env().unwrap_or(Shell::Bash), &mut cmd, "myapp", &mut std::io::stdout()); |
| 138 | /// ``` |
| 139 | pub fn from_envrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell]from_env().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#> { |
| 140 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(env_shell) = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("SHELL") { |
| 141 | Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::from_shell_pathrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/impl#[Shell]from_shell_path().(env_shell) |
| 142 | } else if cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(windows) { |
| 143 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::PowerShellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#PowerShell#) |
| 144 | } else { |
| 145 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | // use a separate function to avoid having to monomorphize the entire function due |
| 151 | // to from_shell_path being generic |
| 152 | fn parse_shell_from_pathrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/parse_shell_from_path().(path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#> { |
| 153 | let name = path.file_stemrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]file_stem().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_str().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 154 | match name { |
| 155 | "bash" => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Bashrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Bash#), |
| 156 | "zsh" => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Zshrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Zsh#), |
| 157 | "fish" => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Fishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Fish#), |
| 158 | "elvish" => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::Elvishrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#Elvish#), |
| 159 | // pwsh is the cross-platform executable. |
| 160 | "pwsh" | "powershell" | "powershell_ise" => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Shellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#::PowerShellrust-analyzer cargo clap_complete 4.6.8 aot/shells/shell/Shell#PowerShell#), |
| 161 | _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 162 | } |
| 163 | } |