Skip to content

Commit

Permalink
Make --example be the default (#3856)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigurdm authored Mar 31, 2023
1 parent b615e9e commit 196e89e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/src/command/add.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions lib/src/command/downgrade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class DowngradeCommand extends PubCommand {

argParser.addFlag(
'example',
defaultsTo: true,
help: 'Also run in `example/` (if it exists).',
hide: true,
);
Expand Down
1 change: 1 addition & 0 deletions lib/src/command/get.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class GetCommand extends PubCommand {

argParser.addFlag(
'example',
defaultsTo: true,
help: 'Also run in `example/` (if it exists).',
hide: true,
);
Expand Down
1 change: 1 addition & 0 deletions lib/src/command/remove.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down
1 change: 1 addition & 0 deletions lib/src/command/upgrade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class UpgradeCommand extends PubCommand {

argParser.addFlag(
'example',
defaultsTo: true,
help: 'Also run in `example/` (if it exists).',
hide: true,
);
Expand Down
2 changes: 1 addition & 1 deletion test/get/gets_in_example_folder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------

Expand All @@ -13,13 +15,17 @@ $ 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 ---------------------------------

## Section 2
$ 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 ---------------------------------

Expand All @@ -29,22 +35,24 @@ 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 ---------------------------------

## Section 4
$ 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 ---------------------------------

Expand Down Expand Up @@ -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 ---------------------------------

Expand All @@ -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 ---------------------------------

Expand Down

0 comments on commit 196e89e

Please sign in to comment.