This repository has been archived by the owner on Aug 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
58 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//use crate::login; | ||
|
||
pub fn run() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//use crate::terminal::{interactive::confirm, open_browser}; | ||
|
||
//use openssl::base64; | ||
use openssl::rsa::Rsa; | ||
|
||
pub fn run() -> Result<(), failure::Error> { | ||
let rsa = Rsa::generate(1024)?; | ||
let _ = rsa.public_key_to_pem_pkcs1()?; | ||
|
||
Ok(()) | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use openssl::rsa::Rsa; | ||
|
||
#[test] | ||
fn test_rsa() { | ||
let rsa = Rsa::generate(1024).unwrap(); | ||
rsa.public_key_to_pem_pkcs1().unwrap(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::process::Command; | ||
|
||
pub fn open_browser(url: &str) -> Result<(), failure::Error> { | ||
let _output = if cfg!(target_os = "windows") { | ||
let url_escaped = url.replace("&", "^&"); | ||
let windows_cmd = format!("start {}", url_escaped); | ||
Command::new("cmd").args(&["/C", &windows_cmd]).output()? | ||
} else if cfg!(target_os = "linux") { | ||
let linux_cmd = format!(r#"xdg-open "{}""#, url); | ||
Command::new("sh").arg("-c").arg(&linux_cmd).output()? | ||
} else { | ||
let mac_cmd = format!(r#"open "{}""#, url); | ||
Command::new("sh").arg("-c").arg(&mac_cmd).output()? | ||
}; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
mod browser; | ||
pub mod emoji; | ||
pub mod interactive; | ||
pub mod message; | ||
pub mod styles; | ||
pub use browser::open_browser; |