From d109809ad9902281a66e8fa2e62ba94b8eca32a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Thu, 4 May 2023 18:54:17 +0200 Subject: [PATCH] feat: guess entryvalue in cli --- cli/src/main.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index 01d899f..96ff4b8 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -68,7 +68,7 @@ enum Commands { // The attribute. attribute: String, // The value. - value: EntryValue, + value: String, /// Output format #[arg(short, long, default_value = "tsv")] format: OutputFormat, @@ -201,16 +201,14 @@ fn main() -> Result<()> { let url = url.unwrap_or("http://localhost:8093".parse().unwrap()); let api_url = url.join("/api/obj")?; - if let EntryValue::Invalid = value { - return Err(anyhow!("Invalid entry value.")); - } - let entity = match entity { entity if entity.starts_with('=') => hash_path(&entity[1..])?.to_string(), entity if entity.starts_with("http") => Address::Url(entity).to_string(), _ => entity, }; + let value = EntryValue::guess_from(value); + let body = json!({ "entity": entity, "attribute": attribute,