session.Session.getEnvironment
TypeScript
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript
- Rust
- Go
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- session
- Declared in
- Session
- Package
- libtmux
- Source
- packages/libtmux/src/session.ts
- Other languages
- Python Ruby Lua RustGo Java .NET C++ Swift
-
One variable from this session's environment, or
undefinedwhen tmux carries no entry.In other ports Read one variable from a session's environment
- Python no single-variable read; the whole table is returned
- Ruby No source-verified Ruby equivalent is recorded for this operation.
- Lua No source-verified Lua equivalent is recorded for this operation.
- Rust
session.Session.environment - Go
tmux.Session.GetEnvironment - Java no single-variable read; the whole table is returned
- .NET no single-variable read; the whole table is returned
- C++ no single-variable read; the whole table is returned
- Swift no single-variable read; the whole table is returned
Examples
await session.getEnvironment("EDITOR"); // "vim", null, or undefineduse libtmux::EnvironmentEntry;
let guard = libtmux::test::TestServer::new().await?;let session = guard.server().new_session("read").await?;
assert_eq!(session.environment("EDITOR").await?, None);
session.set_environment("EDITOR", "hx").await?;assert!(matches!( session.environment("EDITOR").await?, Some(EnvironmentEntry::Set(value)) if value.as_bytes() == b"hx",));
session.hide_environment("EDITOR").await?;assert_eq!( session.environment("EDITOR").await?, Some(EnvironmentEntry::Removed),);
guard.shutdown().await?;0 declared, 0 inherited