update docs for running 'pub token' (#3602)
diff --git a/lib/src/command/lish.dart b/lib/src/command/lish.dart index e516168..115f6a9 100644 --- a/lib/src/command/lish.dart +++ b/lib/src/command/lish.dart
@@ -10,6 +10,7 @@ import '../ascii_tree.dart' as tree; import '../authentication/client.dart'; import '../command.dart'; +import '../command_runner.dart'; import '../exceptions.dart' show DataException; import '../exit_codes.dart' as exit_codes; import '../http.dart'; @@ -126,12 +127,12 @@ if (error.statusCode == 401) { msg += '$host package repository requested authentication!\n' 'You can provide credentials using:\n' - ' pub token add $host\n'; + ' $topLevelProgram pub token add $host\n'; } if (error.statusCode == 403) { msg += 'Insufficient permissions to the resource at the $host ' 'package repository.\nYou can modify credentials using:\n' - ' pub token add $host\n'; + ' $topLevelProgram pub token add $host\n'; } if (error.serverMessage != null) { msg += '\n${error.serverMessage!}\n';
diff --git a/lib/src/source/hosted.dart b/lib/src/source/hosted.dart index 0def1ed..4c366d5 100644 --- a/lib/src/source/hosted.dart +++ b/lib/src/source/hosted.dart
@@ -1137,12 +1137,12 @@ if (error.statusCode == 401) { hint = '$hostedUrl package repository requested authentication!\n' 'You can provide credentials using:\n' - ' pub token add $hostedUrl'; + ' dart pub token add $hostedUrl'; } if (error.statusCode == 403) { hint = 'Insufficient permissions to the resource at the $hostedUrl ' 'package repository.\nYou can modify credentials using:\n' - ' pub token add $hostedUrl'; + ' dart pub token add $hostedUrl'; message = 'authorization failed'; }
diff --git a/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/401-with-message.txt b/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/401-with-message.txt index 8dcaaf5..61985a1 100644 --- a/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/401-with-message.txt +++ b/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/401-with-message.txt
@@ -7,7 +7,7 @@ [STDERR] [STDERR] http://localhost:$PORT package repository requested authentication! [STDERR] You can provide credentials using: -[STDERR] pub token add http://localhost:$PORT +[STDERR] dart pub token add http://localhost:$PORT [STDERR] <message> [EXIT CODE] 69
diff --git a/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/401.txt b/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/401.txt index 68d5bd0..d6f0005 100644 --- a/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/401.txt +++ b/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/401.txt
@@ -7,6 +7,6 @@ [STDERR] [STDERR] http://localhost:$PORT package repository requested authentication! [STDERR] You can provide credentials using: -[STDERR] pub token add http://localhost:$PORT +[STDERR] dart pub token add http://localhost:$PORT [EXIT CODE] 69
diff --git a/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/403-with-message.txt b/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/403-with-message.txt index 882660c..55363f5 100644 --- a/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/403-with-message.txt +++ b/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/403-with-message.txt
@@ -7,7 +7,7 @@ [STDERR] [STDERR] Insufficient permissions to the resource at the http://localhost:$PORT package repository. [STDERR] You can modify credentials using: -[STDERR] pub token add http://localhost:$PORT +[STDERR] dart pub token add http://localhost:$PORT [STDERR] <message> [EXIT CODE] 69
diff --git a/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/403.txt b/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/403.txt index f8a5af9..67ff232 100644 --- a/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/403.txt +++ b/test/testdata/goldens/hosted/fail_gracefully_on_bad_version_listing_response_test/403.txt
@@ -7,6 +7,6 @@ [STDERR] [STDERR] Insufficient permissions to the resource at the http://localhost:$PORT package repository. [STDERR] You can modify credentials using: -[STDERR] pub token add http://localhost:$PORT +[STDERR] dart pub token add http://localhost:$PORT [EXIT CODE] 69