3 config
::tree
::{keys, Key, Section, Ssh}
,
7 /// The `ssh.variant` key
8 pub const VARIANT
: Variant
= Variant
::new_with_validate("variant", &config
::Tree
::SSH
, validate
::Variant
)
9 .with_environment_override("GIT_SSH_VARIANT")
10 .with_deviation("We error if a variant is chosen that we don't know, as opposed to defaulting to 'ssh'");
13 /// The `ssh.variant` key.
14 pub type Variant
= keys
::Any
<validate
::Variant
>;
16 #[cfg(feature = "blocking-network-client")]
20 use crate::{bstr::BStr, config, config::tree::ssh::Variant}
;
23 pub fn try_into_variant(
26 ) -> Result
<Option
<gix_protocol
::transport
::client
::ssh
::ProgramKind
>, config
::key
::GenericErrorWithValue
>
28 use gix_protocol
::transport
::client
::ssh
::ProgramKind
;
30 use crate::bstr
::ByteSlice
;
31 Ok(Some(match value
.as_ref().as_bytes() {
32 b
"auto" => return Ok(None
),
33 b
"ssh" => ProgramKind
::Ssh
,
34 b
"plink" => ProgramKind
::Plink
,
35 b
"putty" => ProgramKind
::Putty
,
36 b
"tortoiseplink" => ProgramKind
::TortoisePlink
,
37 b
"simple" => ProgramKind
::Simple
,
38 _
=> return Err(config
::key
::GenericErrorWithValue
::from_value(self, value
.into_owned())),
44 impl Section
for Ssh
{
45 fn name(&self) -> &str {
49 fn keys(&self) -> &[&dyn Key
] {
55 use crate::{bstr::BStr, config::tree::keys}
;
58 impl keys
::Validate
for Variant
{
59 fn validate(&self, _value
: &BStr
) -> Result
<(), Box
<dyn std
::error
::Error
+ Send
+ Sync
+ '
static>> {
60 #[cfg(feature = "blocking-network-client")]
61 super::Ssh
::VARIANT
.try_into_variant(_value
.into())?
;