|
@@ -180,13 +180,13 @@ impl<O: CLIObject> InterfaceVerb<O> {
|
|
|
relation,
|
|
|
remote_keys,
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
"create" => InterfaceVerb::Create(
|
|
|
<O::CreateParameters as clap::FromArgMatches>::from_arg_matches(matches)?,
|
|
|
),
|
|
|
"delete" => {
|
|
|
InterfaceVerb::Delete(collect_keys::<O, IC>(matches, ValueRole::BaseTarget))
|
|
|
- }
|
|
|
+ },
|
|
|
"detach" => {
|
|
|
let (local_keys, relation, remote_keys) = Self::parse_attachment::<IC>(matches)?;
|
|
|
InterfaceVerb::Detach {
|
|
@@ -194,18 +194,18 @@ impl<O: CLIObject> InterfaceVerb<O> {
|
|
|
relation,
|
|
|
remote_keys,
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
"list" => InterfaceVerb::ListAll,
|
|
|
"inspect" => {
|
|
|
InterfaceVerb::Inspect(collect_keys::<O, IC>(matches, ValueRole::BaseTarget))
|
|
|
- }
|
|
|
+ },
|
|
|
cmd => {
|
|
|
if <O::ExtraCommands>::has_subcommand(cmd) {
|
|
|
InterfaceVerb::Extra(<O::ExtraCommands>::from_arg_matches(parent_matches)?)
|
|
|
} else {
|
|
|
unreachable!()
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -235,7 +235,7 @@ impl<'l, Error: CLIError, OE: Entity> Attacher<'l, Error, OE> {
|
|
|
} else {
|
|
|
self.err = map.disconnect_from(obj.id()).err().map(Into::into);
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
Ok(None) => {
|
|
|
self.err = Some(Error::no_such_entity(
|
|
|
E::entity_name(),
|
|
@@ -246,10 +246,10 @@ impl<'l, Error: CLIError, OE: Entity> Attacher<'l, Error, OE> {
|
|
|
.unwrap()
|
|
|
.to_string(),
|
|
|
));
|
|
|
- }
|
|
|
+ },
|
|
|
Err(e) => {
|
|
|
self.err = Some(e.into());
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -371,10 +371,10 @@ impl<O: CLIObject, IC: InterfaceCustomization> ClapInterface<O, IC> {
|
|
|
if let Some(err) = attacher.err {
|
|
|
return Err(err);
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
InterfaceVerb::Create(params) => {
|
|
|
insert_ctx.insert(O::create_from_params(data, params)?)?;
|
|
|
- }
|
|
|
+ },
|
|
|
InterfaceVerb::Delete(keys) => {
|
|
|
let keys = EntityKey::to_string_vec(keys, ic);
|
|
|
query_ctx
|
|
@@ -382,7 +382,7 @@ impl<O: CLIObject, IC: InterfaceCustomization> ClapInterface<O, IC> {
|
|
|
UniqueList::<O>::build_equivalent(keys.iter().map(String::as_str)).unwrap(),
|
|
|
)
|
|
|
.delete()?;
|
|
|
- }
|
|
|
+ },
|
|
|
InterfaceVerb::Detach {
|
|
|
local_keys,
|
|
|
relation,
|
|
@@ -418,7 +418,7 @@ impl<O: CLIObject, IC: InterfaceCustomization> ClapInterface<O, IC> {
|
|
|
if let Some(err) = attacher.err {
|
|
|
return Err(err);
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
InterfaceVerb::ListAll => {
|
|
|
println!(
|
|
|
"Listing all {}(s): ({})",
|
|
@@ -428,7 +428,7 @@ impl<O: CLIObject, IC: InterfaceCustomization> ClapInterface<O, IC> {
|
|
|
for obj in query_ctx.get()?.into_iter() {
|
|
|
println!(" - {}", obj.shortname());
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
InterfaceVerb::Inspect(keys) => {
|
|
|
let keys = EntityKey::to_string_vec(keys, ic);
|
|
|
let obj = query_ctx
|
|
@@ -491,10 +491,10 @@ impl<O: CLIObject, IC: InterfaceCustomization> ClapInterface<O, IC> {
|
|
|
}
|
|
|
|
|
|
obj.accept_part_visitor_ref(&mut RelationFieldWalker(Default::default()));
|
|
|
- }
|
|
|
+ },
|
|
|
InterfaceVerb::Extra(extra) => {
|
|
|
O::run_extra_command(data, extra, query_ctx, insert_ctx)?;
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
Ok(())
|
|
|
}
|