Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is CommandRunner._usageWithoutDescription private? #221

Open
bartekpacia opened this issue Sep 30, 2022 · 0 comments
Open

Why is CommandRunner._usageWithoutDescription private? #221

bartekpacia opened this issue Sep 30, 2022 · 0 comments
Labels
type-enhancement A request for a change that isn't a bug

Comments

@bartekpacia
Copy link

bartekpacia commented Sep 30, 2022

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);
  }
}
@devoncarew devoncarew added the type-enhancement A request for a change that isn't a bug label Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants