Skip to content

Commit

Permalink
docs: add explanatory comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hampuslavin committed Nov 18, 2024
1 parent b0825f2 commit 80fe405
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/src/better_command_runner/better_command_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ class BetterCommandRunner extends CommandRunner {
return;
}

// Checks if the command is valid (i.e. no unexpected arguments).
// If there are unexpected arguments this will trigger a [UsageException]
// which will be caught in the try catch around the super.runCommand call.
// Therefore, this ensures that the help event is not sent for
// commands that are invalid.
var noUnexpectedArgs = topLevelResults.rest.isEmpty;
if (noUnexpectedArgs) {
_onAnalyticsEvent?.call(BetterCommandRunnerAnalyticsEvents.help);
Expand Down

0 comments on commit 80fe405

Please sign in to comment.