Removal of the CLI Tools being migrated
This commit is contained in:
parent
7da8dbef33
commit
05cee1da36
2 changed files with 0 additions and 196 deletions
|
@ -1,31 +0,0 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:libac_dart/argparse/Args.dart';
|
|
||||||
import 'package:libac_dart/argparse/Builder.dart';
|
|
||||||
import 'package:libac_dart/argparse/CLIHelper.dart';
|
|
||||||
import 'package:libac_dart/argparse/types/Bool.dart';
|
|
||||||
import 'package:libac_dart/argparse/types/String.dart';
|
|
||||||
import 'package:libac_dart/utils/DBIKC.dart';
|
|
||||||
|
|
||||||
Future<int> main(List<String> args) async {
|
|
||||||
Arguments defaults = ArgumentsBuilder.builder()
|
|
||||||
.withArgument(StringArgument(
|
|
||||||
name: "value", value: "", description: "Text to encode/decode"))
|
|
||||||
.withArgument(BoolArgument(name: "help", description: "This help text"))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
var helpText = CLIHelper.makeArgCLIHelp(defaults);
|
|
||||||
var HEADER = "Double Breasted Interrupted Key Cipher\nVersion: 1.0\n\n";
|
|
||||||
|
|
||||||
Arguments parsed = await CLIHelper.parseArgs(args, Arguments());
|
|
||||||
if (parsed.hasArg("help") || !parsed.hasArg("value")) {
|
|
||||||
print("${HEADER}${helpText}");
|
|
||||||
exit(0);
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
print(DoubleBreastedInterruptedKeyCipher.encode(
|
|
||||||
parsed.getArg("value")!.getValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,165 +0,0 @@
|
||||||
/*
|
|
||||||
Make File System Report
|
|
||||||
|
|
||||||
This tool will generate a HTML report for the base path specified.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:libac_dart/argparse/Args.dart';
|
|
||||||
import 'package:libac_dart/argparse/Builder.dart';
|
|
||||||
import 'package:libac_dart/argparse/CLIHelper.dart';
|
|
||||||
import 'package:libac_dart/argparse/types/Bool.dart';
|
|
||||||
import 'package:libac_dart/argparse/types/String.dart';
|
|
||||||
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.0758";
|
|
||||||
bool verbose = false;
|
|
||||||
String HEADER =
|
|
||||||
"Make File System Report\nVersion: $VERSION\nUsing LibAC Version: ${Constants.VERSION}\nAuthor: Tara Piccari\n\n";
|
|
||||||
|
|
||||||
Arguments defaults = ArgumentsBuilder.builder()
|
|
||||||
.withArgument(BoolArgument(
|
|
||||||
name: "asc",
|
|
||||||
description: "Operate in ascending mode, smallest size listed first"))
|
|
||||||
.withArgument(StringArgument(
|
|
||||||
name: "path",
|
|
||||||
value: "/",
|
|
||||||
description: "The path to generate a report for"))
|
|
||||||
.withArgument(
|
|
||||||
BoolArgument(name: "help", description: "Hey look! It's me!"))
|
|
||||||
.withArgument(StringArgument(
|
|
||||||
name: "out",
|
|
||||||
value: "file.html",
|
|
||||||
description:
|
|
||||||
"Where to place the report. If not specified, stdout is used"))
|
|
||||||
.withArgument(BoolArgument(
|
|
||||||
name: "nohtml",
|
|
||||||
description:
|
|
||||||
"Disables HTML generation and uses a plain text report instead."))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Arguments parsed = await CLIHelper.parseArgs(args, Arguments());
|
|
||||||
String helpTest = "$HEADER${CLIHelper.makeArgCLIHelp(defaults)}";
|
|
||||||
|
|
||||||
if (parsed.count == 0 || !parsed.hasArg("path") || parsed.hasArg("help")) {
|
|
||||||
print(helpTest);
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
if (parsed.hasArg("out"))
|
|
||||||
verbose = true;
|
|
||||||
else
|
|
||||||
verbose = false;
|
|
||||||
}
|
|
||||||
print(HEADER);
|
|
||||||
|
|
||||||
bool ascending = false;
|
|
||||||
if (parsed.hasArg("asc")) ascending = true;
|
|
||||||
StringArgument pathArg = parsed.getArg("path") as StringArgument;
|
|
||||||
if (verbose) print("> Analyzing files...");
|
|
||||||
|
|
||||||
await getDirectorySize(pathArg.value,
|
|
||||||
cacheSize: true, recursive: true, verbose: parsed.hasArg("o"));
|
|
||||||
FileInformationCache FIC = FileInformationCache.obtain();
|
|
||||||
|
|
||||||
if (verbose) await prnt("\r> Generating report...");
|
|
||||||
|
|
||||||
String report = "";
|
|
||||||
if (!parsed.hasArg("nohtml"))
|
|
||||||
report =
|
|
||||||
await generateHTMLReport(FIC, ascending: ascending, VERSION: VERSION);
|
|
||||||
else
|
|
||||||
report =
|
|
||||||
await generateTextReport(FIC, ascending: ascending, VERSION: VERSION);
|
|
||||||
|
|
||||||
if (verbose) {
|
|
||||||
StringArgument outputPath = parsed.getArg("out") as StringArgument;
|
|
||||||
await prnt("\n> Saving report...");
|
|
||||||
await File(outputPath.value).writeAsString(report);
|
|
||||||
await prnt("\n> Task Completed\n");
|
|
||||||
|
|
||||||
var size = await File(outputPath.value).length();
|
|
||||||
FileInfo savedFile =
|
|
||||||
FileInfo(path: outputPath.value, size: size, isFile: true);
|
|
||||||
await prnt("> Report file size: ${savedFile.toString()}\n\n");
|
|
||||||
} else {
|
|
||||||
print(report);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> generateTextReport(FileInformationCache FIC,
|
|
||||||
{bool ascending = false, String VERSION = ""}) async {
|
|
||||||
String header = '''
|
|
||||||
MKFSReport
|
|
||||||
{File System Report}
|
|
||||||
Generated by mkfsreport v${VERSION}
|
|
||||||
Bundled LibAC Version: ${Constants.VERSION} [https://git.zontreck.com/AriasCreations/LibAC-dart]
|
|
||||||
|
|
||||||
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.\n
|
|
||||||
''';
|
|
||||||
|
|
||||||
for (var entry in (await FIC.getOrderedList(ascending: ascending))) {
|
|
||||||
header +=
|
|
||||||
" ${entry.isFile ? "FILE" : "DIR"} ${entry.toString()} ${entry.path}\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return header;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue