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