aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-05-25 17:09:39 -0700
committerBryan Newbold <bnewbold@archive.org>2021-05-25 17:09:39 -0700
commite4ef625255f2d4130c5387085f9d5555691f3afe (patch)
treee7f6a8223aee1efb173bf38daf11fb2af616fb7c
parentdaef08aec3f2297b972feef0cfc84ffd52e313e5 (diff)
downloadfatcat-cli-e4ef625255f2d4130c5387085f9d5555691f3afe.tar.gz
fatcat-cli-e4ef625255f2d4130c5387085f9d5555691f3afe.zip
cargo fmt
-rw-r--r--fatcat-cli/src/commands.rs2
-rw-r--r--fatcat-cli/src/download.rs20
-rw-r--r--fatcat-cli/src/main.rs4
3 files changed, 16 insertions, 10 deletions
diff --git a/fatcat-cli/src/commands.rs b/fatcat-cli/src/commands.rs
index 6f52614..8ef6bb0 100644
--- a/fatcat-cli/src/commands.rs
+++ b/fatcat-cli/src/commands.rs
@@ -292,7 +292,7 @@ pub fn print_search_table(results: SearchResults, entity_type: SearchEntityType)
SearchEntityType::File => {
writeln!(tw, "ident\tsha1\tsize_bytes\tmimetype")?;
}
- SearchEntityType::Scholar=> {
+ SearchEntityType::Scholar => {
writeln!(tw, "key\ttype\tstage\tyear\tcontainer_name\ttitle")?;
}
}
diff --git a/fatcat-cli/src/download.rs b/fatcat-cli/src/download.rs
index d415e58..4cb3143 100644
--- a/fatcat-cli/src/download.rs
+++ b/fatcat-cli/src/download.rs
@@ -154,19 +154,23 @@ pub fn download_file(
// TODO: remove clone (?)
Some(url_list) => {
// prefer an IA_hosted URL, but fallback to any URL
- let public_url_list: Vec<&fatcat_openapi::models::FileUrl> = url_list.iter().filter(|v| {
- if let Ok(url) = Url::parse(&v.url) {
- url.host_str() == Some("web.archive.org") || url.host_str() == Some("archive.org")
- } else {
- false
- }
- }).collect();
+ let public_url_list: Vec<&fatcat_openapi::models::FileUrl> = url_list
+ .iter()
+ .filter(|v| {
+ if let Ok(url) = Url::parse(&v.url) {
+ url.host_str() == Some("web.archive.org")
+ || url.host_str() == Some("archive.org")
+ } else {
+ false
+ }
+ })
+ .collect();
if !public_url_list.is_empty() {
public_url_list[0].url.clone()
} else {
url_list[0].url.clone()
}
- },
+ }
};
let mut url = Url::parse(&raw_url)?;
diff --git a/fatcat-cli/src/main.rs b/fatcat-cli/src/main.rs
index 317a7c3..de62d9c 100644
--- a/fatcat-cli/src/main.rs
+++ b/fatcat-cli/src/main.rs
@@ -660,7 +660,9 @@ fn run(opt: Opt) -> Result<()> {
writeln!(&mut std::io::stdout(), "{}", entity.to_json_string()?)?
}
(false, true, SearchEntityType::Scholar) => {
- return Err(anyhow!("entity schema output not supported for scholar index"));
+ return Err(anyhow!(
+ "entity schema output not supported for scholar index"
+ ));
}
}
}