checkHaveOnlyOneArg function

void checkHaveOnlyOneArg({
  1. required List<String> restArgs,
  2. required String usage,
})

Implementation

void checkHaveOnlyOneArg({
  required List<String> restArgs,
  required String usage,
}) {
  if (restArgs.isEmpty) {
    throw UsageException('Command must have an argument', usage);
  } else if (restArgs.length > 1) {
    throw UsageException('Command must have only one argument', usage);
  }
}