Make --example be the default (#3856)
diff --git a/lib/src/command/add.dart b/lib/src/command/add.dart
index bc4c652..7bb02a1 100644
--- a/lib/src/command/add.dart
+++ b/lib/src/command/add.dart
@@ -153,6 +153,7 @@
);
argParser.addFlag(
'example',
+ defaultsTo: true,
help:
'Also update dependencies in `example/` after modifying pubspec.yaml in the root package (if it exists).',
hide: true,
diff --git a/lib/src/command/downgrade.dart b/lib/src/command/downgrade.dart
index b7411e4..e92b894 100644
--- a/lib/src/command/downgrade.dart
+++ b/lib/src/command/downgrade.dart
@@ -40,6 +40,7 @@
argParser.addFlag(
'example',
+ defaultsTo: true,
help: 'Also run in `example/` (if it exists).',
hide: true,
);
diff --git a/lib/src/command/get.dart b/lib/src/command/get.dart
index bdcc387..51419c1 100644
--- a/lib/src/command/get.dart
+++ b/lib/src/command/get.dart
@@ -50,6 +50,7 @@
argParser.addFlag(
'example',
+ defaultsTo: true,
help: 'Also run in `example/` (if it exists).',
hide: true,
);
diff --git a/lib/src/command/remove.dart b/lib/src/command/remove.dart
index c993cd0..a367588 100644
--- a/lib/src/command/remove.dart
+++ b/lib/src/command/remove.dart
@@ -57,6 +57,7 @@
argParser.addFlag(
'example',
+ defaultsTo: true,
help: 'Also update dependencies in `example/` (if it exists).',
hide: true,
);
diff --git a/lib/src/command/upgrade.dart b/lib/src/command/upgrade.dart
index 7efa66e..84fe11e 100644
--- a/lib/src/command/upgrade.dart
+++ b/lib/src/command/upgrade.dart
@@ -72,6 +72,7 @@
argParser.addFlag(
'example',
+ defaultsTo: true,
help: 'Also run in `example/` (if it exists).',
hide: true,
);
diff --git a/test/get/gets_in_example_folder_test.dart b/test/get/gets_in_example_folder_test.dart
index c823303..f18daae 100644
--- a/test/get/gets_in_example_folder_test.dart
+++ b/test/get/gets_in_example_folder_test.dart
@@ -31,7 +31,7 @@
])
]).create();
- await pubCommand(command, args: []);
+ await pubCommand(command, args: ['--no-example']);
final lockFile = File(p.join(d.sandbox, appPath, 'pubspec.lock'));
final exampleLockFile = File(
p.join(d.sandbox, appPath, 'example', 'pubspec.lock'),
diff --git a/test/testdata/goldens/directory_option_test/commands taking a --directory~-C parameter work.txt b/test/testdata/goldens/directory_option_test/commands taking a --directory~-C parameter work.txt
index 5d45f56..2729283 100644
--- a/test/testdata/goldens/directory_option_test/commands taking a --directory~-C parameter work.txt
+++ b/test/testdata/goldens/directory_option_test/commands taking a --directory~-C parameter work.txt
@@ -5,6 +5,8 @@
Resolving dependencies in myapp...
+ foo 1.0.0
Changed 1 dependency in myapp!
+Resolving dependencies in myapp/example...
+Got dependencies in myapp/example.
-------------------------------- END OF OUTPUT ---------------------------------
@@ -13,6 +15,8 @@
Resolving dependencies in myapp...
+ bar 1.2.3
Changed 1 dependency in myapp!
+Resolving dependencies in myapp/example...
+Got dependencies in myapp/example.
-------------------------------- END OF OUTPUT ---------------------------------
@@ -20,6 +24,8 @@
$ pub -C 'myapp/example' get --directory=myapp bar
Resolving dependencies in myapp...
Got dependencies in myapp!
+Resolving dependencies in myapp/example...
+Got dependencies in myapp/example.
-------------------------------- END OF OUTPUT ---------------------------------
@@ -29,6 +35,8 @@
These packages are no longer being depended on:
- bar 1.2.3
Changed 1 dependency in myapp!
+Resolving dependencies in myapp/example...
+Got dependencies in myapp/example.
-------------------------------- END OF OUTPUT ---------------------------------
@@ -36,15 +44,15 @@
$ pub get bar -C myapp
Resolving dependencies in myapp...
Got dependencies in myapp!
+Resolving dependencies in myapp/example...
+Got dependencies in myapp/example.
-------------------------------- END OF OUTPUT ---------------------------------
## Section 5
$ pub get bar -C 'myapp/example'
Resolving dependencies in myapp/example...
-+ foo 1.0.0
-+ test_pkg 1.0.0 from path myapp
-Changed 2 dependencies in myapp/example!
+Got dependencies in myapp/example!
-------------------------------- END OF OUTPUT ---------------------------------
@@ -72,6 +80,8 @@
Resolving dependencies in myapp...
foo 1.0.0
No dependencies changed in myapp.
+Resolving dependencies in myapp/example...
+Got dependencies in myapp/example.
-------------------------------- END OF OUTPUT ---------------------------------
@@ -80,6 +90,8 @@
Resolving dependencies in myapp...
foo 1.0.0
No dependencies changed in myapp.
+Resolving dependencies in myapp/example...
+Got dependencies in myapp/example.
-------------------------------- END OF OUTPUT ---------------------------------