MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / build_env_state

Function build_env_state

crates/chat-cli/src/cli/chat/message.rs:542–559  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

540}
541
542pub fn build_env_state() -> EnvState {
543 let mut env_state = EnvState {
544 operating_system: Some(env::consts::OS.into()),
545 ..Default::default()
546 };
547
548 match env::current_dir() {
549 Ok(current_dir) => {
550 env_state.current_working_directory =
551 Some(truncate_safe(&current_dir.to_string_lossy(), MAX_CURRENT_WORKING_DIRECTORY_LEN).into());
552 },
553 Err(err) => {
554 error!(?err, "Attempted to fetch the CWD but it did not exist.");
555 },
556 }
557
558 env_state
559}
560
561#[cfg(test)]
562mod tests {

Callers 2

generate_newMethod · 0.85
test_env_stateFunction · 0.85

Calls 1

truncate_safeFunction · 0.50

Tested by 1

test_env_stateFunction · 0.68