From 02399fecdb76e5d548830b5a8c01f85ec80d4f8b Mon Sep 17 00:00:00 2001 From: Valerie Wolfe Date: Mon, 10 Jun 2024 13:22:14 -0400 Subject: [PATCH] qdls: fixed skip cases not skipping and order is more like ls --- qdls/Program.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/qdls/Program.cs b/qdls/Program.cs index 6c1aa17..5f60b61 100644 --- a/qdls/Program.cs +++ b/qdls/Program.cs @@ -12,10 +12,14 @@ if(arguments.Count == 0) // run on targets foreach(var arg in arguments) { // don't try to list nonexistent entries or files - if(!Path.Exists(arg)) - Console.WriteLine($"'{arg}: does not exist"); - if(File.Exists(arg)) - Console.WriteLine($"'{arg}: is file"); + if(!Path.Exists(arg)) { + Console.WriteLine($"'{arg}': does not exist"); + continue; + } + if(File.Exists(arg)) { + Console.WriteLine($"'{arg}': is file"); + continue; + } // fetch children var children = Directory.GetFileSystemEntries(arg); @@ -33,7 +37,7 @@ foreach(var arg in arguments) { if(args.Length > 1) Console.WriteLine($"{arg}:"); // iterate over children; build buffer and output when full - foreach(var child in children) { + foreach(var child in children.OrderBy(f => (int)(Path.GetFileName(f)[0]))) { var name = Path.GetFileName(child); // format hidden files