validate method

bool validate()

validate command line arguments

Implementation

bool validate() {
  if (GmoCli.arguments.contains(commandName) ||
      GmoCli.arguments.contains('$commandName:$name')) {
    var flagsNotAceppts = flags;
    flagsNotAceppts.removeWhere((element) => acceptedFlags.contains(element));
    if (flagsNotAceppts.isNotEmpty) {
      LogService.info('The %s is not necessary'.trArgsPlural(
        'The %s are not necessary',
        flagsNotAceppts.length,
        [flagsNotAceppts.toString()],
      )!);
    }

    if (args.length > maxParameters) {
      List pars = args.skip(maxParameters).toList();
      throw CliException(
          'the %s parameter is not necessary'.trArgsPlural(
            'the %s parameters are not necessary',
            pars.length,
            [pars.toString()],
          ),
          codeSample: codeSample);
    }
  }
  return true;
}