Begin to add a CLI editor tool
This commit is contained in:
parent
2257c37283
commit
ceb70cac20
3 changed files with 44 additions and 0 deletions
33
cli/nbtcli.dart
Normal file
33
cli/nbtcli.dart
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
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/Parser.dart';
|
||||||
|
import 'package:libac_dart/argparse/types/Bool.dart';
|
||||||
|
import 'package:libac_dart/argparse/types/String.dart';
|
||||||
|
import 'package:nbteditor/Consts2.dart';
|
||||||
|
|
||||||
|
Future<int> main(List<String> args) async {
|
||||||
|
Arguments parsed = ArgumentParser.parse(args);
|
||||||
|
|
||||||
|
if (parsed.hasArg("help") || parsed.count == 0) {
|
||||||
|
// Print help information
|
||||||
|
print(
|
||||||
|
"NBT Editor Command Line Interface\nCopyright 2025 Piccari Creations\nLicensed under the GPL\nVersion: ${VERSION}\n\n");
|
||||||
|
|
||||||
|
var defaults = ArgumentsBuilder.builder()
|
||||||
|
.withArgument(BoolArgument(name: "help", value: null))
|
||||||
|
.withArgument(StringArgument(name: "path", value: "/"))
|
||||||
|
.withArgument(StringArgument(name: "value", value: null))
|
||||||
|
.withArgument(BoolArgument(name: "add", value: null))
|
||||||
|
.withArgument(BoolArgument(name: "remove", value: null))
|
||||||
|
.withArgument(BoolArgument(name: "update", value: null))
|
||||||
|
.withArgument(BoolArgument(name: "dryrun", value: null))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
print(ArgumentHelpers.generateHelpMessage(
|
||||||
|
defaults.getArgumentsList(), "nbteditor-cli"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -3,4 +3,8 @@
|
||||||
call flutter pub get
|
call flutter pub get
|
||||||
call flutter build windows
|
call flutter build windows
|
||||||
|
|
||||||
|
mkdir out
|
||||||
|
|
||||||
|
call dart compile exe -o out\nbteditor-cli.exe cli/nbtcli.dart
|
||||||
|
|
||||||
iscc wininst.iss
|
iscc wininst.iss
|
|
@ -2,3 +2,10 @@
|
||||||
|
|
||||||
flutter build linux
|
flutter build linux
|
||||||
flutter build apk
|
flutter build apk
|
||||||
|
|
||||||
|
if [ ! -d out ]
|
||||||
|
then
|
||||||
|
mkdir out
|
||||||
|
fi
|
||||||
|
|
||||||
|
dart compile exe -o out/nbteditor-cli cli/nbtcli.dart
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue