diff --git a/Assets/Scripts/UI/ScriptableCommands/ListDirectoryCommand.cs b/Assets/Scripts/UI/ScriptableCommands/ListDirectoryCommand.cs index 08910985..ed9bc767 100644 --- a/Assets/Scripts/UI/ScriptableCommands/ListDirectoryCommand.cs +++ b/Assets/Scripts/UI/ScriptableCommands/ListDirectoryCommand.cs @@ -2,6 +2,7 @@ using Architecture; using UnityEngine; +using Utility; namespace UI.ScriptableCommands { @@ -11,7 +12,27 @@ namespace UI.ScriptableCommands /// protected override void OnExecute() { - Console.WriteLine("TBD"); + // TODO: Listing directories specified in arguments + // TODO: Colorful output + // TODO: Different output styles + // error out if the current directory doesn't exist + if (!FileSystem.DirectoryExists(CurrentWorkingDirectory)) + { + Console.WriteLine($"ls: {CurrentWorkingDirectory}: Directory not found."); + return; + } + + foreach (string directory in FileSystem.GetDirectories(CurrentWorkingDirectory)) + { + string filename = PathUtility.GetFileName(directory); + Console.WriteLine(filename); + } + + foreach (string directory in FileSystem.GetFiles(CurrentWorkingDirectory)) + { + string filename = PathUtility.GetFileName(directory); + Console.WriteLine(filename); + } } } } \ No newline at end of file