Adds verbose checks and moves the message for generating report

This commit is contained in:
zontreck 2024-08-24 07:14:27 -07:00
parent 86070dc8b9
commit e7726f10d2

View file

@ -16,7 +16,8 @@ import 'package:libac_dart/consts.dart';
import 'package:libac_dart/utils/IOTools.dart';
Future<int> main(List<String> args) async {
String VERSION = "1.0.082424.0706";
String VERSION = "1.0.082424.0713";
bool verbose = false;
String HEADER =
"Make File System Report\nVersion: $VERSION\nUsing LibAC Version: ${Constants.VERSION}\nAuthor: Tara Piccari\n\n";
@ -43,22 +44,26 @@ Future<int> main(List<String> args) async {
if (parsed.count == 0 || !parsed.hasArg("path") || parsed.hasArg("help")) {
print(helpTest);
return 0;
}
} else
verbose = true;
print(HEADER);
bool ascending = false;
if (parsed.hasArg("asc")) ascending = true;
StringArgument pathArg = parsed.getArg("path") as StringArgument;
print("> Analyzing files...");
if (verbose) print("> Analyzing files...");
await getDirectorySize(pathArg.value,
cacheSize: true, recursive: true, verbose: parsed.hasArg("o"));
FileInformationCache FIC = FileInformationCache.obtain();
if (verbose) prnt("\r> Generating report...");
String report =
await generateHTMLReport(FIC, ascending: ascending, VERSION: VERSION);
if (parsed.hasArg("o")) {
prnt("\r> Generating report...");
if (verbose) {
StringArgument outputPath = parsed.getArg("o") as StringArgument;
prnt("\n> Saving report...");
await File(outputPath.value).writeAsString(report);