Update LibAC syntax for arguments system
This commit is contained in:
parent
0dc2f68034
commit
ef829c5c66
9 changed files with 87 additions and 78 deletions
|
@ -1,28 +1,34 @@
|
|||
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:simplehelpertools/constants.dart';
|
||||
|
||||
String get CH_VERSION => HelperConsts.CH_VERSION;
|
||||
|
||||
Future<int> main(List<String> args) async {
|
||||
print("Git Commit Helper\nVersion: ${CH_VERSION}\n\n");
|
||||
print("Git Commit Helper\nVersion: $CH_VERSION\n\n");
|
||||
|
||||
Arguments defaults = ArgumentsBuilder.builder()
|
||||
.withArgument(
|
||||
BoolArgument(name: "help", description: "Print out this help page"))
|
||||
.withArgument(BoolArgument(
|
||||
name: "commit",
|
||||
description: "Create a commit for the current working directory"))
|
||||
.withArgument(BoolArgument(name: "sign", description: "Sign the commit"))
|
||||
name: "help",
|
||||
))
|
||||
.withArgument(BoolArgument(
|
||||
name: "force", description: "Ignore gitignore rules for commits"))
|
||||
name: "commit",
|
||||
))
|
||||
.withArgument(BoolArgument(
|
||||
name: "sign",
|
||||
))
|
||||
.withArgument(BoolArgument(
|
||||
name: "force",
|
||||
))
|
||||
.build();
|
||||
|
||||
Arguments argx = await CLIHelper.parseArgs(args, Arguments());
|
||||
Arguments argx = ArgumentParser.parse(args);
|
||||
if (argx.hasArg("help") || argx.count == 0) {
|
||||
print(CLIHelper.makeArgCLIHelp(defaults));
|
||||
print(
|
||||
ArgumentHelpers.generateHelpMessage(defaults.getArgumentsList(), "ch"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue