chore(shorebird_cli): rename to --platforms (#2056)
This commit is contained in:
@@ -28,7 +28,7 @@ class PatchCommand extends ShorebirdCommand {
|
||||
_resolvePatcher = resolvePatcher ?? getPatcher;
|
||||
argParser
|
||||
..addMultiOption(
|
||||
'platform',
|
||||
'platforms',
|
||||
abbr: 'p',
|
||||
help: 'The platform(s) to to build this release for.',
|
||||
allowed: ReleaseType.values.map((e) => e.cliName).toList(),
|
||||
|
||||
@@ -79,7 +79,7 @@ On Xcode builds it is used as "CFBundleVersion".''',
|
||||
},
|
||||
)
|
||||
..addMultiOption(
|
||||
'platform',
|
||||
'platforms',
|
||||
abbr: 'p',
|
||||
help: 'The platform(s) to to build this release for.',
|
||||
allowed: ReleaseType.values.map((e) => e.cliName).toList(),
|
||||
|
||||
@@ -48,8 +48,8 @@ enum ReleaseType {
|
||||
extension ReleaseTypeArgs on ArgResults {
|
||||
Iterable<ReleaseType> get releaseTypes {
|
||||
final List<String> releaseTypeCliNames;
|
||||
if (wasParsed('platform')) {
|
||||
releaseTypeCliNames = this['platform'] as List<String>;
|
||||
if (wasParsed('platforms')) {
|
||||
releaseTypeCliNames = this['platforms'] as List<String>;
|
||||
} else {
|
||||
final platformCliName = arguments.first;
|
||||
if (ReleaseType.values
|
||||
|
||||
@@ -27,7 +27,7 @@ import '../../matchers.dart';
|
||||
import '../../mocks.dart';
|
||||
|
||||
void main() {
|
||||
group('PatchNewCommand', () {
|
||||
group(PatchCommand, () {
|
||||
const appId = 'test-app-id';
|
||||
const appDisplayName = 'Test App';
|
||||
const arch = 'aarch64';
|
||||
@@ -132,7 +132,7 @@ void main() {
|
||||
shorebirdFlutter = MockShorebirdFlutter();
|
||||
|
||||
when(() => argResults['dry-run']).thenReturn(false);
|
||||
when(() => argResults['platform']).thenReturn(['android']);
|
||||
when(() => argResults['platforms']).thenReturn(['android']);
|
||||
when(() => argResults['release-version']).thenReturn(releaseVersion);
|
||||
when(() => argResults.wasParsed(any())).thenReturn(true);
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ void main() {
|
||||
shorebirdFlutter = MockShorebirdFlutter();
|
||||
|
||||
when(() => argResults['dry-run']).thenReturn(false);
|
||||
when(() => argResults['platform']).thenReturn(['android']);
|
||||
when(() => argResults['platforms']).thenReturn(['android']);
|
||||
when(() => argResults.wasParsed(any())).thenReturn(true);
|
||||
|
||||
when(cache.updateAll).thenAnswer((_) async => {});
|
||||
|
||||
@@ -24,32 +24,35 @@ void main() {
|
||||
setUp(() {
|
||||
parser = ArgParser()
|
||||
..addMultiOption(
|
||||
'platform',
|
||||
'platforms',
|
||||
allowed: ReleaseType.values.map((e) => e.cliName),
|
||||
);
|
||||
});
|
||||
|
||||
group('when the platform argument is provided', () {
|
||||
group('when the platforms argument is provided', () {
|
||||
test('parses the release types', () {
|
||||
expect(
|
||||
parser.parse(['--platform', 'android']).releaseTypes.toList(),
|
||||
parser.parse(['--platforms', 'android']).releaseTypes.toList(),
|
||||
[ReleaseType.android],
|
||||
);
|
||||
expect(
|
||||
parser.parse(['--platform', 'ios']).releaseTypes.toList(),
|
||||
parser.parse(['--platforms', 'ios']).releaseTypes.toList(),
|
||||
[ReleaseType.ios],
|
||||
);
|
||||
expect(
|
||||
parser.parse(['--platform', 'ios-framework']).releaseTypes.toList(),
|
||||
parser
|
||||
.parse(['--platforms', 'ios-framework'])
|
||||
.releaseTypes
|
||||
.toList(),
|
||||
[ReleaseType.iosFramework],
|
||||
);
|
||||
expect(
|
||||
parser.parse(['--platform', 'aar']).releaseTypes.toList(),
|
||||
parser.parse(['--platforms', 'aar']).releaseTypes.toList(),
|
||||
[ReleaseType.aar],
|
||||
);
|
||||
});
|
||||
|
||||
group('when the platform is provided as a raw arg', () {
|
||||
group('when the platforms is provided as a raw arg', () {
|
||||
test('throws an ArgumentError if the platform is invalid', () {
|
||||
expect(
|
||||
() => parser.parse(['foo']).releaseTypes.toList(),
|
||||
|
||||
Reference in New Issue
Block a user