Skip to content

Commit

Permalink
[ssh] update log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Jun 10, 2023
1 parent c31c430 commit c4883f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/ssh/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ version = "0.1.0"

[dependencies]
anyhow = "1.0.71"
owo-colors = "3.5.0"
ssh2 = { version = "0.9.4", features = ["vendored-openssl"] }
7 changes: 7 additions & 0 deletions crates/ssh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{
};

use anyhow::Error;
use owo_colors::OwoColorize;
use ssh2::Session;

pub fn exec(sess: Session, command: &str) -> Result<(), Error> {
Expand Down Expand Up @@ -40,6 +41,7 @@ pub fn exec(sess: Session, command: &str) -> Result<(), Error> {
}

pub fn setup_ssh_agent_var() -> Result<(), Error> {
println!("-> Setting up ssh-agent {}", "ssh-agent -s".bright_green());
let child = Command::new("ssh-agent").arg("-s").output()?;
let output = String::from_utf8(child.stdout)?;

Expand All @@ -58,6 +60,11 @@ pub fn setup_ssh_agent_var() -> Result<(), Error> {
}
}

println!(
"-> Adding ssh key {}",
"ssh-add ~/.ssh/id_rsa".bright_green()
);

let mut child = Command::new("sh")
.arg("-c")
.arg("ssh-add ~/.ssh/id_rsa")
Expand Down

0 comments on commit c4883f7

Please sign in to comment.