validate method
validate command line arguments
Implementation
bool validate() {
if (GetCli.arguments.contains(commandName) ||
GetCli.arguments.contains('$commandName:$name')) {
var flagsNotAccepts = flags;
flagsNotAccepts.removeWhere((element) => acceptedFlags.contains(element));
if (flagsNotAccepts.isNotEmpty) {
LogService.info(LocaleKeys.info_unnecessary_flag.trArgsPlural(
LocaleKeys.info_unnecessary_flag_prural,
flagsNotAccepts.length,
[flagsNotAccepts.toString()],
)!);
}
if (args.length > maxParameters) {
List pars = args.skip(maxParameters).toList();
throw CliException(
LocaleKeys.error_unnecessary_parameter.trArgsPlural(
LocaleKeys.error_unnecessary_parameter_plural,
pars.length,
[pars.toString()],
),
codeSample: codeSample);
}
}
return true;
}