From d2bfda82eff4d51eeb25d2b06c417cf74229cda1 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Fri, 24 Mar 2023 17:15:29 -0500 Subject: [PATCH] fix(shorebird_cli): improve `shorebird init` missing `pubspec.yaml` error (#169) --- .../shorebird_cli/lib/src/commands/init_command.dart | 5 ++++- .../test/src/commands/init_command_test.dart | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/shorebird_cli/lib/src/commands/init_command.dart b/packages/shorebird_cli/lib/src/commands/init_command.dart index f8b59723..753551ee 100644 --- a/packages/shorebird_cli/lib/src/commands/init_command.dart +++ b/packages/shorebird_cli/lib/src/commands/init_command.dart @@ -30,7 +30,10 @@ class InitCommand extends ShorebirdCommand final progress = logger.progress('Initializing Shorebird'); try { if (!hasPubspecYaml) { - progress.fail('Could not find a "pubspec.yaml".'); + progress.fail(''' +Could not find a "pubspec.yaml". +Please make sure you are running "shorebird init" from the root of your Flutter project. +'''); return ExitCode.noInput.code; } } catch (error) { diff --git a/packages/shorebird_cli/test/src/commands/init_command_test.dart b/packages/shorebird_cli/test/src/commands/init_command_test.dart index fdce1db8..cefaef05 100644 --- a/packages/shorebird_cli/test/src/commands/init_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/init_command_test.dart @@ -72,7 +72,14 @@ environment: command.run, getCurrentDirectory: () => tempDir, ); - verify(() => progress.fail('Could not find a "pubspec.yaml".')).called(1); + verify( + () => progress.fail( + ''' +Could not find a "pubspec.yaml". +Please make sure you are running "shorebird init" from the root of your Flutter project. +''', + ), + ).called(1); expect(exitCode, ExitCode.noInput.code); });