Update `add` helping messages (#4472)
diff --git a/lib/src/command/add.dart b/lib/src/command/add.dart index 5fe7f04..eb0c5b0 100644 --- a/lib/src/command/add.dart +++ b/lib/src/command/add.dart
@@ -58,7 +58,7 @@ Add packages with specific constraints or other sources by giving a descriptor after a colon. -For example: +For example (follow the same format including spaces): * Add a hosted dependency at newest compatible stable version: `$topLevelProgram pub add foo` * Add a hosted dev dependency at newest compatible stable version: @@ -67,19 +67,19 @@ `$topLevelProgram pub add foo:^1.2.3` * Add multiple dependencies: `$topLevelProgram pub add foo dev:bar` - * Add a path dependency: - `$topLevelProgram pub add 'foo:{"path":"../foo"}'` - * Add a hosted dependency: - `$topLevelProgram pub add 'foo:{"hosted":"my-pub.dev"}'` - * Add an sdk dependency: - `$topLevelProgram pub add 'foo:{"sdk":"flutter"}'` - * Add a git dependency: - `$topLevelProgram pub add 'foo:{"git":"https://github.com/foo/foo"}'` * Add a dependency override: - `$topLevelProgram pub add 'override:foo:1.0.0'` + `$topLevelProgram pub add override:foo:1.0.0` + * Add a path dependency: + `$topLevelProgram pub add "foo:{path: ../foo}"` + * Add a hosted dependency: + `$topLevelProgram pub add "foo:{hosted: https://my-pub.dev}"` + * Add an sdk dependency: + `$topLevelProgram pub add "foo:{sdk: flutter}"` + * Add a git dependency: + `$topLevelProgram pub add "foo:{git: https://github.com/foo/foo}"` * Add a git dependency with a path and ref specified: `$topLevelProgram pub add \\ - 'foo:{"git":{"url":"../foo.git","ref":"<branch>","path":"<subdir>"}}'`'''; + "foo:{git:{url: ../foo.git, ref: <branch>, path: <subdir>}}"`'''; @override String get argumentsDescription =>
diff --git a/test/testdata/goldens/help_test/pub add --help.txt b/test/testdata/goldens/help_test/pub add --help.txt index 5c4f71b..f6f73fb 100644 --- a/test/testdata/goldens/help_test/pub add --help.txt +++ b/test/testdata/goldens/help_test/pub add --help.txt
@@ -14,7 +14,7 @@ Add packages with specific constraints or other sources by giving a descriptor after a colon. -For example: +For example (follow the same format including spaces): * Add a hosted dependency at newest compatible stable version: `dart pub add foo` * Add a hosted dev dependency at newest compatible stable version: @@ -23,19 +23,19 @@ `dart pub add foo:^1.2.3` * Add multiple dependencies: `dart pub add foo dev:bar` - * Add a path dependency: - `dart pub add 'foo:{"path":"../foo"}'` - * Add a hosted dependency: - `dart pub add 'foo:{"hosted":"my-pub.dev"}'` - * Add an sdk dependency: - `dart pub add 'foo:{"sdk":"flutter"}'` - * Add a git dependency: - `dart pub add 'foo:{"git":"https://github.com/foo/foo"}'` * Add a dependency override: - `dart pub add 'override:foo:1.0.0'` + `dart pub add override:foo:1.0.0` + * Add a path dependency: + `dart pub add "foo:{path: ../foo}"` + * Add a hosted dependency: + `dart pub add "foo:{hosted: https://my-pub.dev}"` + * Add an sdk dependency: + `dart pub add "foo:{sdk: flutter}"` + * Add a git dependency: + `dart pub add "foo:{git: https://github.com/foo/foo}"` * Add a git dependency with a path and ref specified: `dart pub add \ - 'foo:{"git":{"url":"../foo.git","ref":"<branch>","path":"<subdir>"}}'` + "foo:{git:{url: ../foo.git, ref: <branch>, path: <subdir>}}"` Usage: pub add [options] [<section>:]<package>[:descriptor] [<section>:]<package2>[:descriptor] ...] -h, --help Print this usage information.