Skip to content

Commit

Permalink
browse
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaylor89 committed Aug 18, 2024
1 parent 8e6f921 commit f297108
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
37 changes: 37 additions & 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fancy-regex = "0.13.0"
clap = { version = "4.5.16", features = ["derive"] }
colored = "2.1.0"
rust_xlsxwriter = { version = "0.73.0", optional = true }
open = "5.3.0"

[features]
xlsx = ["dep:rust_xlsxwriter"]
5 changes: 1 addition & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ struct Cli {
#[clap(long, alias = "print-found", default_value_t = true)]
print_found: bool,

/// Don't color terminal output.
#[clap(short, long, alias = "no-color")]
no_color: bool,

/// Browse to all results on default browser.
#[clap(short, long, alias = "browse")]
browse: bool,
Expand Down Expand Up @@ -121,6 +117,7 @@ async fn main() -> Result<()> {
cli.print_all,
cli.print_found,
cli.dump_response,
cli.browse,
)
.await?;
save_results(
Expand Down
5 changes: 5 additions & 0 deletions src/sherlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub async fn check_username(
print_all: bool,
print_found: bool,
dump_response: bool,
browse: bool,
) -> color_eyre::Result<Vec<QueryResult>> {
let num_of_sites = site_data.keys().len();
if num_of_sites == 0 {
Expand Down Expand Up @@ -167,6 +168,10 @@ pub async fn check_username(
println!("+++++++++++++++++++++");
}

if browse && status == QueryStatus::Claimed {
open::that(&url).inspect_err(|e| eprintln!("Failed to open browser: {}", e))?;
}

QueryResult {
username: username.clone(),
site_name: site,
Expand Down

0 comments on commit f297108

Please sign in to comment.