# command.CommandChain.then

- **Module:** command.CommandChain
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/command.rs#L361
- **Page:** https://libtmux.org/reference/rs/command-commandchain-then/

```
command.CommandChain.then(mut, command: Command) -> Self
```

Append one command, to run after the previous one succeeds.

## Example

```rust
use libtmux::{Command, CommandChain};

let chain = CommandChain::new(Command::new("select-pane").arg("-m"))
    .then(Command::new("select-pane").arg("-M"));
assert_eq!(chain.command_count(), 2);
```
