partition_sim/commands/
fs.rs

1use super::{Command, Commands};
2
3/// Some file-system related commands for debugging/testing
4/// purposes so that we don't have to run `iptables` commands
5/// which are potentially destructive.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum FsCommands {
8    /// List the contents of the current directory.
9    Ls,
10}
11
12impl From<FsCommands> for Commands {
13    fn from(command: FsCommands) -> Self {
14        Self::Fs(command)
15    }
16}
17
18impl Command for FsCommands {
19    fn build<'session>(&self, session: &'session openssh::Session) -> openssh::Command<'session> {
20        match self {
21            Self::Ls => {
22                let mut command = session.command("ls");
23                command.arg("-l");
24                command.arg("-a");
25                command.arg("-h");
26                command
27            }
28        }
29    }
30}