# command.CommandChain.new

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

```
command.CommandChain.new(command: Command) -> Self
```

Start a chain from its first command.

Taking the first command here keeps a chain non-empty by construction:
an empty argv would make tmux act as a client rather than run anything.

## Example

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

let chain = CommandChain::new(Command::new("list-sessions"));
assert_eq!(chain.command_count(), 1);
```
