fromString static method

PubspecVersionCommand fromString(
  1. String command
)

Returns the PubspecVersionCommand from the given command.

Throws an exception if the command is not valid.

Implementation

static PubspecVersionCommand fromString(String command) {
  switch (command) {
    case 'major':
      return PubspecVersionCommand.major;
    case 'minor':
      return PubspecVersionCommand.minor;
    case 'patch':
      return PubspecVersionCommand.patch;
    case 'build':
      return PubspecVersionCommand.build;
    case 'show':
      return PubspecVersionCommand.show;
    case 'show-build':
      return PubspecVersionCommand.showBuild;
    default:
      throw Exception('Invalid command: $command');
  }
}