Fix order of operations, rename output flag

This commit is contained in:
zontreck 2024-08-24 07:16:02 -07:00
parent e7726f10d2
commit 317d6930f9

View file

@ -16,7 +16,7 @@ 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.0713";
String VERSION = "1.0.082424.0715";
bool verbose = false;
String HEADER =
"Make File System Report\nVersion: $VERSION\nUsing LibAC Version: ${Constants.VERSION}\nAuthor: Tara Piccari\n\n";
@ -32,7 +32,7 @@ Future<int> main(List<String> args) async {
.withArgument(
BoolArgument(name: "help", description: "Hey look! It's me!"))
.withArgument(StringArgument(
name: "o",
name: "out",
value: "file.html",
description:
"Where to place the report. If not specified, stdout is used"))
@ -44,9 +44,12 @@ Future<int> main(List<String> args) async {
if (parsed.count == 0 || !parsed.hasArg("path") || parsed.hasArg("help")) {
print(helpTest);
return 0;
} else
verbose = true;
} else {
if (parsed.hasArg("out"))
verbose = true;
else
verbose = false;
}
print(HEADER);
bool ascending = false;
@ -64,7 +67,7 @@ Future<int> main(List<String> args) async {
await generateHTMLReport(FIC, ascending: ascending, VERSION: VERSION);
if (verbose) {
StringArgument outputPath = parsed.getArg("o") as StringArgument;
StringArgument outputPath = parsed.getArg("out") as StringArgument;
prnt("\n> Saving report...");
await File(outputPath.value).writeAsString(report);
prnt("\n> Task Completed\n");