summaryrefslogtreecommitdiff
path: root/commands/src/ls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'commands/src/ls.rs')
-rw-r--r--commands/src/ls.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/commands/src/ls.rs b/commands/src/ls.rs
index 4ecf596..7c0464c 100644
--- a/commands/src/ls.rs
+++ b/commands/src/ls.rs
@@ -2,10 +2,20 @@ use alloc::format;
use alloc::string::{String, ToString};
use uefi::proto::console::text::Color;
use uefi::proto::media::file::FileAttribute;
+use toolkit::error::{display_error, Error};
use toolkit::Toolkit;
+use crate::parser::Command;
-pub fn run(tk: &mut Toolkit, _arguments: &str) {
- let result = tk.scandir(&format!("{}", tk.get_cwd().replace("/", "\\")));
+pub fn run(mut tk: &mut Toolkit, command: Command) {
+ let mut path = tk.get_cwd().replace("/", "\\");
+
+ if command.names.len() == 1 {
+ path = tk.resolve_path(&command.names[0]);
+ } else if command.names.len() > 1 {
+ display_error(&mut tk, Error::E08);
+ }
+
+ let result = tk.scandir(&format!("{}", path));
tk.color(Color::Cyan, Color::Black);
tk.print("\nAttrib");
tk.color(Color::Yellow, Color::Black);