feat: guess entryvalue in cli
parent
1dfa08c955
commit
d109809ad9
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue