aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--fatcat-cli/src/main.rs15
2 files changed, 14 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 84111c4..1a38372 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@
### Added
- basic search for reference index (refs, refs-in, refs-out)
+- `--entity-json` mode for scholar search, returning biblio (primary) release
+ entity
## [0.1.3] - 2021-05-25
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!(