run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
void run() {
String? version = argResults?['version'];
String pubspecPath = argResults?['file-path'] ?? 'pubspec.yaml';
_isValidate(version: version, pubspecPath: pubspecPath);
final oldVersion = _extractVersionFromPubspecFile(pubspecPath);
final newVersion = _getNewVersion(
oldVersion: oldVersion,
version: version!,
);
// ignore: avoid_print
print('Update the version from $oldVersion to $newVersion...');
_updateVersionInPubspecFile(
oldVersion: oldVersion,
newVersion: newVersion,
pubspecPath: pubspecPath,
);
}