assertNoPositionalArgsNorArgsAfterSeparator function

void assertNoPositionalArgsNorArgsAfterSeparator(
  1. ArgResults argResults,
  2. void usageException(
    1. String msg
    ), {
  3. String? commandName,
  4. String? usageFooter,
  5. bool allowRest = false,
})

Implementation

void assertNoPositionalArgsNorArgsAfterSeparator(
    ArgResults argResults, void Function(String msg) usageException,
    {String? commandName, String? usageFooter, bool allowRest = false}) {
  if ((argResults.rest.isNotEmpty && !allowRest) ||
      hasArgsAfterSeparator(argResults)) {
    usageException('${commandName != null ? 'The "$commandName"' : 'This'} '
        'command does not support positional args nor args after a separator.'
        '${usageFooter != null ? '\n$usageFooter' : ''}');
  }
}