diff options
Diffstat (limited to 'commands/src/cat.rs')
-rw-r--r-- | commands/src/cat.rs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/commands/src/cat.rs b/commands/src/cat.rs deleted file mode 100644 index 17d31b8..0000000 --- a/commands/src/cat.rs +++ /dev/null @@ -1,30 +0,0 @@ -use toolkit::Toolkit; -use toolkit::error::*; -use crate::parser::Command; - -pub fn run(tk: &mut Toolkit, command: Command) { - if command.names.len() == 1 { - let path = tk.resolve_path(&command.names[0]); - - if tk.file_exists(&path) { - if tk.is_file(&path) { - match tk.read_file(&path) { - None => { - display_error(tk, Error::E13); - } - Some(str) => { - tk.println(&str.replace('\n', "\r\n").replace("\r\r\n", "\r\n")); - } - } - } else { - display_error(tk, Error::E12); - } - } else { - display_error(tk, Error::E04); - } - } else if command.names.is_empty() { - display_error(tk, Error::E03); - } else if command.names.len() > 1 { - display_error(tk, Error::E08); - } -}
\ No newline at end of file |