pub struct Cx {
pub out: Stream,
pub err: Stream,
pub env: Env,
pub cwd: PathBuf,
pub git: Arc<dyn GitCli + Send + Sync>,
pub gh: Arc<dyn GhClient + Send + Sync>,
pub agent: Arc<dyn AgentClient + Send + Sync>,
pub input: Box<dyn Input + Send>,
pub color_flag: Option<ColorChoice>,
pub no_pager: bool,
pub verbose: u8,
}Expand description
The runtime context threaded through command dispatch.
Fields§
§out: StreamStandard output: navigation paths, JSON, and data-command results only.
err: StreamStandard error: all human-facing text, prompts, logs, and errors.
env: EnvA snapshot of the process environment.
cwd: PathBufThe effective working directory (after any -C).
git: Arc<dyn GitCli + Send + Sync>The git subprocess handle (real, or a fake in tests). Shared via Arc
so the TUI can clone it into async tasks.
gh: Arc<dyn GhClient + Send + Sync>The gh subprocess handle (real, or a fake in tests).
agent: Arc<dyn AgentClient + Send + Sync>The code-agent subprocess handle (real, or a fake in tests). Drives a
code agent (e.g. claude) to draft PR content; see AgentClient.
input: Box<dyn Input + Send>Interactive input source for confirmation prompts.
color_flag: Option<ColorChoice>The --color flag value, if given (set during dispatch).
no_pager: boolThe --no-pager flag (set during dispatch).
verbose: u8The -v/--verbose count: extra diagnostics to stderr (set during
dispatch). 0 is the default (quiet).
Implementations§
Source§impl Cx
impl Cx
Sourcepub fn new(
out: Stream,
err: Stream,
env: Env,
cwd: PathBuf,
git: Arc<dyn GitCli + Send + Sync>,
gh: Arc<dyn GhClient + Send + Sync>,
agent: Arc<dyn AgentClient + Send + Sync>,
input: Box<dyn Input + Send>,
) -> Self
pub fn new( out: Stream, err: Stream, env: Env, cwd: PathBuf, git: Arc<dyn GitCli + Send + Sync>, gh: Arc<dyn GhClient + Send + Sync>, agent: Arc<dyn AgentClient + Send + Sync>, input: Box<dyn Input + Send>, ) -> Self
Builds a context from injected streams, environment, working dir, the
git/gh/agent handles, and the input source. The global flag fields
(color_flag, no_pager) default off and are set during dispatch.
Sourcepub fn color_enabled(&self, ui_color: ColorChoice) -> bool
pub fn color_enabled(&self, ui_color: ColorChoice) -> bool
Resolves whether to emit color for stdout, given the resolved config’s
ui.color (spec §11 precedence).
Sourcepub fn color_enabled_err(&self, ui_color: ColorChoice) -> bool
pub fn color_enabled_err(&self, ui_color: ColorChoice) -> bool
Resolves whether to emit color for the TUI, which draws to the alternate
screen on stderr. The precedence (--color, NO_COLOR, ui.color) is
the same as Cx::color_enabled, but auto follows stderr’s TTY status
rather than stdout’s (stdout is reserved for the chosen path and is
usually piped, e.g. cd "$(wt)").
Auto Trait Implementations§
impl !RefUnwindSafe for Cx
impl !Sync for Cx
impl !UnwindSafe for Cx
impl Freeze for Cx
impl Send for Cx
impl Unpin for Cx
impl UnsafeUnpin for Cx
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> 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