pub struct GhAuthTokenCommand {
pub program: PathBuf,
pub args: Vec<String>,
pub env_remove: Vec<&'static str>,
}Expand description
The deliberately narrow process description used to obtain the current GitHub CLI OAuth token. Keeping it data makes the subprocess boundary inspectable in tests and prevents a shell from entering this path.
Fields§
§program: PathBuf§args: Vec<String>Owned rather than [&'static str; 2] because a named account appends
--user <login>. The shape stays fixed: auth token always, plus that
one pair and nothing else. user is validated against GitHub’s login
grammar first, so a config value can never arrive here as a flag.
env_remove: Vec<&'static str>Implementations§
Source§impl GhAuthTokenCommand
impl GhAuthTokenCommand
Sourcepub fn standard(gh_binary: Option<&Path>) -> Self
pub fn standard(gh_binary: Option<&Path>) -> Self
gh has no canonical install path across distributions, so unlike
grok it is looked up on PATH by default. That makes the binary an
ambient choice, which is why [copilot] gh_binary exists: point it at
the trusted executable and the lookup stops being ambient.
Sourcepub fn for_user(gh_binary: Option<&Path>, login: &str) -> Result<Self>
pub fn for_user(gh_binary: Option<&Path>, login: &str) -> Result<Self>
The same command for one named account: gh auth token --user <login>.
login is validated before it reaches argv. That check is the security
boundary this type exists for — gh is spawned without a shell, so the
risk is not quoting but a config value that looks like a flag
(--hostname, -h) and silently re-points the command at another
account or option. Rejecting anything outside GitHub’s login grammar
closes that off by construction.
Trait Implementations§
Source§impl Clone for GhAuthTokenCommand
impl Clone for GhAuthTokenCommand
Source§impl Debug for GhAuthTokenCommand
impl Debug for GhAuthTokenCommand
impl Eq for GhAuthTokenCommand
Source§impl PartialEq for GhAuthTokenCommand
impl PartialEq for GhAuthTokenCommand
impl StructuralPartialEq for GhAuthTokenCommand
Auto Trait Implementations§
impl Freeze for GhAuthTokenCommand
impl RefUnwindSafe for GhAuthTokenCommand
impl Send for GhAuthTokenCommand
impl Sync for GhAuthTokenCommand
impl Unpin for GhAuthTokenCommand
impl UnsafeUnpin for GhAuthTokenCommand
impl UnwindSafe for GhAuthTokenCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more