From edb073105579bdff6952820fa34facc573dc5cef Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Wed, 18 Mar 2026 13:57:14 -0600 Subject: [PATCH] allow chaining mutate_command --- src/cli.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index 17b8cd4..2377f90 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -47,7 +47,11 @@ impl mut self, f: impl FnOnce(clap::Command) -> clap::Command + Send + Sync + 'static, ) -> Self { - self.mut_cmd = Some(Box::new(f)); + self.mut_cmd = if let Some(prev) = self.mut_cmd.take() { + Some(Box::new(|cmd| f(prev(cmd)))) + } else { + Some(Box::new(f)) + }; self } pub fn run(self, args: impl IntoIterator) -> Result<(), RpcError> {