qdls: fixed skip cases not skipping and order is more like ls

This commit is contained in:
Valerie Wolfe 2024-06-10 13:22:14 -04:00
parent 763ccb3291
commit 02399fecdb

View file

@ -12,10 +12,14 @@ if(arguments.Count == 0)
// run on targets // run on targets
foreach(var arg in arguments) { foreach(var arg in arguments) {
// don't try to list nonexistent entries or files // don't try to list nonexistent entries or files
if(!Path.Exists(arg)) if(!Path.Exists(arg)) {
Console.WriteLine($"'{arg}: does not exist"); Console.WriteLine($"'{arg}': does not exist");
if(File.Exists(arg)) continue;
Console.WriteLine($"'{arg}: is file"); }
if(File.Exists(arg)) {
Console.WriteLine($"'{arg}': is file");
continue;
}
// fetch children // fetch children
var children = Directory.GetFileSystemEntries(arg); var children = Directory.GetFileSystemEntries(arg);
@ -33,7 +37,7 @@ foreach(var arg in arguments) {
if(args.Length > 1) if(args.Length > 1)
Console.WriteLine($"{arg}:"); Console.WriteLine($"{arg}:");
// iterate over children; build buffer and output when full // 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); var name = Path.GetFileName(child);
// format hidden files // format hidden files