Fix carriage return
This commit is contained in:
parent
efa039b64b
commit
676684397e
5 changed files with 103 additions and 78 deletions
|
@ -16,7 +16,9 @@ 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.0001";
|
||||
String VERSION = "1.0.082424.0524";
|
||||
String HEADER =
|
||||
"Make File System Report\nVersion: $VERSION\nUsing LibAC Version: ${Constants.VERSION}\nAuthor: Tara Piccari\n\n";
|
||||
|
||||
Arguments defaults = ArgumentsBuilder.builder()
|
||||
.withArgument(BoolArgument(
|
||||
|
@ -36,14 +38,15 @@ Future<int> main(List<String> args) async {
|
|||
.build();
|
||||
|
||||
Arguments parsed = await CLIHelper.parseArgs(args, Arguments());
|
||||
String helpTest =
|
||||
"Make File System Report\nVersion: $VERSION\nUsing LibAC Version: ${Constants.VERSION}\nAuthor: Tara Piccari\n\n${CLIHelper.makeArgCLIHelp(defaults)}";
|
||||
String helpTest = "$HEADER${CLIHelper.makeArgCLIHelp(defaults)}";
|
||||
|
||||
if (parsed.count == 0 || !parsed.hasArg("path") || parsed.hasArg("help")) {
|
||||
print(helpTest);
|
||||
return 0;
|
||||
}
|
||||
|
||||
print(HEADER);
|
||||
|
||||
bool ascending = false;
|
||||
if (parsed.hasArg("asc")) ascending = true;
|
||||
StringArgument pathArg = parsed.getArg("path") as StringArgument;
|
||||
|
@ -52,7 +55,7 @@ Future<int> main(List<String> args) async {
|
|||
cacheSize: true, recursive: true, verbose: parsed.hasArg("o"));
|
||||
FileInformationCache FIC = FileInformationCache.obtain();
|
||||
String report =
|
||||
await FIC.generateHTMLReport(ascending: ascending, VERSION: VERSION);
|
||||
await generateHTMLReport(FIC, ascending: ascending, VERSION: VERSION);
|
||||
|
||||
if (parsed.hasArg("o")) {
|
||||
prnt("> Generating report...\r");
|
||||
|
@ -65,3 +68,52 @@ Future<int> main(List<String> args) async {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Future<String> generateHTMLReport(FileInformationCache FIC,
|
||||
{bool ascending = false, String VERSION = ""}) async {
|
||||
String header = '''
|
||||
<html>
|
||||
<title>MKFSReport</title>
|
||||
<body style="background-color: black;color: #00D2FA">
|
||||
<h2>File System Report</h2><br/>
|
||||
<b>Generated by mkfsreport v${VERSION}</b><br/>
|
||||
<b>Bundled <a href="https://git.zontreck.com/AriasCreations/LibAC-dart">LibAC</a> Version: ${Constants.VERSION}</b><br/>
|
||||
<pre style="color: #7a0c17">
|
||||
MKFSREPORT and LibAC are provided free of charge with no implied warranties. The software is provided as-is.
|
||||
|
||||
This program was created by Tara Piccari, as a part of the Aria's Creations common code library as a helper utility.
|
||||
Aria's Creations is a alias for online-only works. Aria is an anagram derived from my name. piccARI, tarA. You place my last name first, take the last 3, skip the first 3 in my first name and take the remaining character(s) and you have my alias.
|
||||
|
||||
This utility analyzed the specified folder path to generate a detailed report of directory and file sizes as seen below.
|
||||
</pre><br/>
|
||||
''';
|
||||
|
||||
header += '''
|
||||
<table>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Path</th>
|
||||
<th>Size</th>
|
||||
</tr>
|
||||
''';
|
||||
|
||||
for (var entry in (await FIC.getOrderedList(ascending: ascending))) {
|
||||
header += '''
|
||||
<tr>
|
||||
<td>${entry.isFile ? "FILE" : "DIR"}</td>
|
||||
<td>${entry.path}</td>
|
||||
<td>${entry.toString()}</td>
|
||||
</tr>
|
||||
''';
|
||||
}
|
||||
|
||||
header += '''
|
||||
</table>
|
||||
''';
|
||||
|
||||
header += '''
|
||||
</body>
|
||||
</html>
|
||||
''';
|
||||
return header;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue