confirmVersion function
Ask the user to confirm the selected version no.
Implementation
Version confirmVersion(Version version) {
var confirmedVersion = version;
print('');
print(green('The new version is: $confirmedVersion'));
print('');
if (!confirm('Is this the correct version')) {
var valid = false;
do {
try {
final versionString = ask('Enter the new version: ');
if (!confirm('Is $versionString the correct version')) {
exit(1);
}
confirmedVersion = Version.parse(versionString);
valid = true;
} on FormatException catch (e) {
print(e);
}
} while (!valid);
}
return confirmedVersion;
}