better hidden file handling

This commit is contained in:
Valerie Wolfe 2024-06-07 15:17:18 -04:00
parent cf7c78569c
commit 6f61a98ebc

View file

@ -1,5 +1,4 @@
using System.IO;

using Qdls;
// collect args; no args becomes working directory
@ -10,7 +9,7 @@ else
arguments = args;
// flags
bool showHidden = true;
bool showHidden = false;
// run on targets
foreach(var arg in arguments) {
@ -22,6 +21,7 @@ foreach(var arg in arguments) {
// fetch children
var children = Directory.GetFileSystemEntries(arg);
if(!showHidden) { children = children.Where(f => !Util.IsHidden(f)).ToArray(); }
// state vars
var buffer = "";
@ -39,10 +39,7 @@ foreach(var arg in arguments) {
// skip or format hidden files
if(Util.IsHidden(child))
if(showHidden)
buffer += Format.Hidden;
else
continue;
buffer += Format.Hidden;
// format directories
if(Directory.Exists(child))