validate method

bool validate()

validate command line arguments

Implementation

bool validate() {
  if (GetCli.arguments.contains(commandName) ||
      GetCli.arguments.contains('$commandName:$name')) {
    var flagsNotAceppts = flags;
    flagsNotAceppts.removeWhere((element) => acceptedFlags.contains(element));
    if (flagsNotAceppts.isNotEmpty) {
      LogService.info(LocaleKeys.info_unnecessary_flag.trArgsPlural(
        LocaleKeys.info_unnecessary_flag_prural,
        flagsNotAceppts.length,
        [flagsNotAceppts.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;
}