# command.CommandChain.then

- **Module:** command.CommandChain
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/command.rs#L361
- **Page:** https://libtmux.org/en/rs/latest/reference/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);
```
