We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9356b5b commit d5545bdCopy full SHA for d5545bd
src/command/common.rs
@@ -1,6 +1,6 @@
1
use crate::{rpc, Result};
2
use clap::Args;
3
-use serde_json::json;
+use serde_json::{json, Map, Value};
4
5
#[derive(Args)]
6
pub struct SearchArgs {
@@ -14,9 +14,13 @@ pub fn search(args: &SearchArgs) -> Result<()> {
14
15
pub struct CustomArgs {
16
pub method: String,
17
- pub params: String,
+ pub params: Option<String>,
18
}
19
20
pub fn rpc(args: &CustomArgs) -> Result<()> {
21
- rpc::call(&args.method, serde_json::from_str(&args.params)?)?.print()
+ let params: Value = match &args.params {
22
+ Some(params) => serde_json::from_str(¶ms)?,
23
+ None => Value::Object(Map::new()),
24
+ };
25
+ rpc::call(&args.method, params)?.print()
26
0 commit comments