Skip to content

Commit f61905a

Browse files
committed
fix error not appearing when using wrong name command
1 parent 275f56e commit f61905a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

bin/raygun_cli.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ void main(List<String> arguments) {
5858
try {
5959
final ArgResults results = argParser.parse(arguments);
6060
bool verbose = false;
61+
if (results.wasParsed('verbose')) {
62+
verbose = true;
63+
}
64+
65+
if (verbose) {
66+
print('[VERBOSE] All arguments: ${results.arguments}');
67+
}
6168

6269
if (results.wasParsed('help') || arguments.isEmpty) {
6370
printUsage(argParser);
@@ -67,9 +74,6 @@ void main(List<String> arguments) {
6774
print('raygun-cli version: $version');
6875
return;
6976
}
70-
if (results.wasParsed('verbose')) {
71-
verbose = true;
72-
}
7377

7478
if (results.command?.name == sourcemapCommand.name) {
7579
sourcemapCommand.execute(results.command!, verbose);
@@ -91,12 +95,10 @@ void main(List<String> arguments) {
9195
return;
9296
}
9397

94-
if (verbose) {
95-
print('[VERBOSE] All arguments: ${results.arguments}');
96-
}
98+
throw FormatException('Unknown or missing command.');
9799
} on FormatException catch (e) {
98100
// Print usage information if an invalid argument was provided.
99-
print(e.message);
101+
print('Error: ${e.message}');
100102
print('');
101103
printUsage(argParser);
102104
}

0 commit comments

Comments
 (0)