1
use crate::commands::{
2
    Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
3
    ResponseParserError,
4
};
5

            
6
pub struct ListFiles;
7

            
8
// TODO: fix this type
9
pub type ListFilesResponse = Vec<String>;
10

            
11
impl Command for ListFiles {
12
    type Response = ListFilesResponse;
13
    const COMMAND: &'static str = "listfiles";
14

            
15
    fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> {
16
        let uri = parts
17
            .next()
18
            .map(|s| {
19
                s.parse()
20
                    .map_err(|_| RequestParserError::SyntaxError(1, s.to_owned()))
21
            })
22
            .transpose()?;
23

            
24
        debug_assert!(parts.next().is_none());
25

            
26
        Ok((Request::ListFiles(uri), ""))
27
    }
28

            
29
    fn parse_response(
30
        parts: ResponseAttributes<'_>,
31
    ) -> Result<Self::Response, ResponseParserError> {
32
        unimplemented!()
33
    }
34
}