args icon indicating copy to clipboard operation
args copied to clipboard

Why is `CommandRunner._usageWithoutDescription` private?

Open bartekpacia opened this issue 3 years ago • 0 comments

I think it should be public. It makes testing unnecessarily harder.

Link to source code.

As a workaround, I've created the following extension which lets me test UsageExceptions thrown by the package:

import 'package:args/command_runner.dart';

extension CommandRunnerX on CommandRunner {
  /// Workaround for https://github.com/dart-lang/args/issues/221.
  String get usageWithoutDescription {
    final crop = description.length + 2;
    return usage.substring(crop);
  }
}

bartekpacia avatar Sep 30 '22 21:09 bartekpacia