diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-08-10 16:38:43 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-08-10 16:38:43 -0700 |
commit | 808e39e09591b8b69fe542ab3110f761c88a7182 (patch) | |
tree | ee1e874f0edced208eb291d81f5f27bd5e2d0c95 /fatcat-cli/src/main.rs | |
parent | f1d2e16df3b04d216df28904dc53822bf430c3fb (diff) | |
download | fatcat-cli-808e39e09591b8b69fe542ab3110f761c88a7182.tar.gz fatcat-cli-808e39e09591b8b69fe542ab3110f761c88a7182.zip |
entity JSON fetch mode for scholar searches
Diffstat (limited to 'fatcat-cli/src/main.rs')
-rw-r--r-- | fatcat-cli/src/main.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fatcat-cli/src/main.rs b/fatcat-cli/src/main.rs index af22f85..091d073 100644 --- a/fatcat-cli/src/main.rs +++ b/fatcat-cli/src/main.rs @@ -661,9 +661,18 @@ 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" - )); + if !hit["biblio"]["release_ident"].is_string() { + continue; + } + let specifier = Specifier::Release( + hit["biblio"]["release_ident"].as_str().unwrap().to_string(), + ); + let entity = specifier.get_from_api( + &mut api_client, + expand.clone(), + hide.clone(), + )?; + writeln!(&mut std::io::stdout(), "{}", entity.to_json_string()?)? } (false, true, SearchEntityType::Reference) => { return Err(anyhow!( |