cli: when attaching, always print the connection link (#178445)

Fixes #178090
This commit is contained in:
Connor Peet
2023-03-27 12:52:50 -07:00
committed by GitHub
parent b51e2f3613
commit dfbea0f578
7 changed files with 105 additions and 55 deletions

View File

@@ -73,6 +73,8 @@ pub fn get_default_user_agent() -> String {
)
}
const NO_COLOR_ENV: &str = "NO_COLOR";
lazy_static! {
pub static ref TUNNEL_SERVICE_USER_AGENT: String =
match std::env::var(TUNNEL_SERVICE_USER_AGENT_ENV_VAR) {
@@ -101,5 +103,11 @@ lazy_static! {
option_env!("VSCODE_CLI_SERVER_NAME_MAP").and_then(|s| serde_json::from_str(s).unwrap());
/// Whether i/o interactions are allowed in the current CLI.
pub static ref IS_INTERACTIVE_CLI: bool = atty::is(atty::Stream::Stdin) && std::env::var(NONINTERACTIVE_VAR).is_err();
pub static ref IS_A_TTY: bool = atty::is(atty::Stream::Stdin);
/// Whether i/o interactions are allowed in the current CLI.
pub static ref COLORS_ENABLED: bool = *IS_A_TTY && std::env::var(NO_COLOR_ENV).is_err();
/// Whether i/o interactions are allowed in the current CLI.
pub static ref IS_INTERACTIVE_CLI: bool = *IS_A_TTY && std::env::var(NONINTERACTIVE_VAR).is_err();
}