mirror of
https://github.com/Start9Labs/rpc-toolkit.git
synced 2026-03-30 12:21:58 +00:00
fix CustomDisplayFn
This commit is contained in:
@@ -454,19 +454,26 @@ where
|
|||||||
impl<Context, F, H> CliBindings for CustomDisplayFn<Context, F, H>
|
impl<Context, F, H> CliBindings for CustomDisplayFn<Context, F, H>
|
||||||
where
|
where
|
||||||
Context: IntoContext,
|
Context: IntoContext,
|
||||||
H: CliBindings,
|
H: HandlerTypes,
|
||||||
|
H::Params: FromArgMatches + CommandFactory + Serialize,
|
||||||
F: Fn(HandleArgs<Context, H>, H::Ok) -> Result<(), H::Err> + Send + Sync + Clone + 'static,
|
F: Fn(HandleArgs<Context, H>, H::Ok) -> Result<(), H::Err> + Send + Sync + Clone + 'static,
|
||||||
{
|
{
|
||||||
type Context = Context;
|
type Context = Context;
|
||||||
fn cli_command(&self, ctx_ty: TypeId) -> clap::Command {
|
fn cli_command(&self, _: TypeId) -> clap::Command {
|
||||||
self.handler.cli_command(ctx_ty)
|
H::Params::command()
|
||||||
}
|
}
|
||||||
fn cli_parse(
|
fn cli_parse(
|
||||||
&self,
|
&self,
|
||||||
matches: &clap::ArgMatches,
|
matches: &clap::ArgMatches,
|
||||||
ctx_ty: TypeId,
|
_: TypeId,
|
||||||
) -> Result<(VecDeque<&'static str>, Value), clap::Error> {
|
) -> Result<(VecDeque<&'static str>, Value), clap::Error> {
|
||||||
self.handler.cli_parse(matches, ctx_ty)
|
Self::Params::from_arg_matches(matches).and_then(|a| {
|
||||||
|
Ok((
|
||||||
|
VecDeque::new(),
|
||||||
|
imbl_value::to_value(&a)
|
||||||
|
.map_err(|e| clap::Error::raw(clap::error::ErrorKind::ValueValidation, e))?,
|
||||||
|
))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
fn cli_display(
|
fn cli_display(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
Reference in New Issue
Block a user