summaryrefslogtreecommitdiff
path: root/src/operations.rs
blob: 54ce8c7f66c8fcb2a2a82b335b938423e290f205 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::*;
use std::path::Path;

mod ls;
pub use ls::*;

mod cp;
pub use cp::*;

mod rm;
pub use rm::*;

mod mkdir;
pub use mkdir::*;

pub fn append_to_file<P>(_path: P, _content: &str) -> Result<(), EntryWriteError>
where
    P: AsRef<Path>,
{
    unimplemented!()
}

pub fn write_to_file<P>(path: P, content: &str) -> Result<(), EntryWriteError>
where
    P: AsRef<Path>,
{
    make_parent_directory(&path)?;
    std::fs::write(&path, content)?;
    Ok(())
}