gnuplot_wrapper/commands/
cd.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::{command::Command, script::Script};

/// http://gnuplot.info/docs_5.5/loc6516.html
pub struct CD {
    path: String
}

impl CD {
    pub fn new(path: &str) -> Self {
        return CD { path: path.to_owned() };
    }
}

impl Command for CD {
    fn to_raw(&self) -> String {
        return format!("cd {}", self.path);
    }
}

impl Script {
    pub fn cd(&mut self, path: &str) {
        self.add_command(CD::new(path));
    }
}