Skip to content

Commit

Permalink
Hide geo json by default
Browse files Browse the repository at this point in the history
  • Loading branch information
bubelov committed Oct 12, 2024
1 parent cf7563d commit 26bdf40
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/command/area.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::{rpc, Result};
use crate::{
rpc::{self, RpcResponse},
Result,
};
use clap::Args;
use serde_json::{json, Value};

Expand All @@ -8,7 +11,15 @@ pub struct GetAreaArgs {
}

pub fn get_area(args: &GetAreaArgs) -> Result<()> {
rpc::call("get_area", json!({"id": args.id}))?.print()
rpc::call("get_area", json!({"id": args.id}))
.map(|it| RpcResponse {
result: it.result.map(|mut it| {
it["tags"].as_object_mut().unwrap().remove("geo_json");
it
}),
error: it.error,
})?
.print()
}

#[derive(Args)]
Expand Down
3 changes: 2 additions & 1 deletion src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ use crate::settings;
use crate::Result;
use colored_json::ToColoredJson;
use serde::Deserialize;
use serde_json::Map;
use serde_json::{json, Value};

#[derive(Deserialize)]
pub struct RpcResponse {
pub result: Option<Value>,
pub result: Option<Map<String, Value>>,
pub error: Option<Value>,
}

Expand Down

0 comments on commit 26bdf40

Please sign in to comment.