diff --git a/lib/src/command/add.dart b/lib/src/command/add.dart index bc4c652cc..7bb02a1cc 100644 --- a/lib/src/command/add.dart +++ b/lib/src/command/add.dart @@ -153,6 +153,7 @@ For example: ); 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 b7411e4a0..e92b89462 100644 --- a/lib/src/command/downgrade.dart +++ b/lib/src/command/downgrade.dart @@ -40,6 +40,7 @@ class DowngradeCommand extends PubCommand { 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 bdcc387c4..51419c139 100644 --- a/lib/src/command/get.dart +++ b/lib/src/command/get.dart @@ -50,6 +50,7 @@ class GetCommand extends PubCommand { 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 c993cd003..a367588f6 100644 --- a/lib/src/command/remove.dart +++ b/lib/src/command/remove.dart @@ -57,6 +57,7 @@ To remove a dependency override of a package prefix the package name with 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 7efa66e7b..84fe11ef2 100644 --- a/lib/src/command/upgrade.dart +++ b/lib/src/command/upgrade.dart @@ -72,6 +72,7 @@ class UpgradeCommand extends PubCommand { 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 c823303b9..f18daaeb5 100644 --- a/test/get/gets_in_example_folder_test.dart +++ b/test/get/gets_in_example_folder_test.dart @@ -31,7 +31,7 @@ void main() { ]) ]).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 5d45f56bb..272928397 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 @@ $ pub add --directory=myapp foo 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 @@ $ pub -C myapp add bar 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 @@ Changed 1 dependency in myapp! $ 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 @@ Resolving dependencies in myapp... 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 @@ Changed 1 dependency in myapp! $ 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 @@ $ pub downgrade -C myapp 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 @@ $ pub upgrade bar -C myapp 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 ---------------------------------