mirror of
https://github.com/Start9Labs/rpc-toolkit.git
synced 2026-03-26 02:11:56 +00:00
allow chaining mutate_command
This commit is contained in:
@@ -47,7 +47,11 @@ impl<Context: crate::Context + Clone, Config: CommandFactory + FromArgMatches>
|
||||
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<Item = OsString>) -> Result<(), RpcError> {
|
||||
|
||||
Reference in New Issue
Block a user