Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit 0e24dd2

Browse files
committed
feat: export cli runner and add documentation for use-case
1 parent 73e6f34 commit 0e24dd2

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
* feat: make CliRunner a part of public API in order to support transitive executable calls use-case.
6+
37
## 4.21.2
48

59
* fix: correctly handle FutureOr functions for [`avoid-passing-async-when-sync-expected`](https://dartcodemetrics.dev/docs/rules/common/avoid-passing-async-when-sync-expected).

lib/cli_runner.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export 'package:dart_code_metrics/src/cli/cli_runner.dart';

website/docs/cli/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,17 @@ metrics:
6060
Run `dart_code_metrics` in all packages.
6161
- Note: you can also rely on your IDEs Dart Analysis / Issues window.
6262
```
63+
64+
## Calling the cli from your own package with the linter configuration
65+
66+
If you have a separate package with all the linter and DCM configurations which is used by your other packages and you want to call DCM transitively add a `bin` folder with a Dart file, for example
67+
68+
```dart metrics.dart
69+
import 'package:dart_code_metrics/cli_runner.dart';
70+
71+
Future<void> main(List<String> args) async {
72+
await CliRunner().run(args);
73+
}
74+
```
75+
76+
After that you will be able to run DCM by calling your package executable.

0 commit comments

Comments
 (0)