Repository: VeryGoodOpenSource/very_good_cli
Pull request #855 (2023-10-16 11:27:07)

feat: modified collection progress message on `check license`
<!--
  Thanks for contributing!

  Provide a description of your changes below and a general summary in the title

  Please look at the following checklist to ensure that your PR can be accepted quickly:
-->

> Should be merged after #854 

## Description

Updates the progress message when collecting licenses.

## Demonstration

https://github.com/VeryGoodOpenSource/very_good_cli/assets/44524995/f280d729-27c8-46ef-b954-84774278fd30

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [X] ✨ New feature (non-breaking change which adds functionality)
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
- [ ] 🧹 Code refactor
- [ ] ✅ Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore



Patch:
diff --git a/lib/src/commands/packages/commands/check/commands/licenses.dart b/lib/src/commands/packages/commands/check/commands/licenses.dart
index 50c7c54..9aa6054 100644
--- a/lib/src/commands/packages/commands/check/commands/licenses.dart
+++ b/lib/src/commands/packages/commands/check/commands/licenses.dart
@@ -162,7 +162,7 @@ class PackagesCheckLicensesCommand extends Command<int> {
     final licenses = <String, Set<String>?>{};
     for (final dependency in filteredDependencies) {
       progress.update(
-        'Collecting licenses of ${licenses.length}/${filteredDependencies.length} packages.',
+        '''Collecting licenses from ${licenses.length + 1} out of ${filteredDependencies.length} ${filteredDependencies.length == 1 ? 'package' : 'packages'}''',
       );
 
       final dependencyName = dependency.package();


Test patch:
diff --git a/test/src/commands/packages/commands/check/commands/licenses_test.dart b/test/src/commands/packages/commands/check/commands/licenses_test.dart
index d33c25e..940a674 100644
--- a/test/src/commands/packages/commands/check/commands/licenses_test.dart
+++ b/test/src/commands/packages/commands/check/commands/licenses_test.dart
@@ -113,7 +113,9 @@ void main() {
             );
 
             verify(
-              () => progress.update('Collecting licenses of 0/1 packages.'),
+              () => progress.update(
+                'Collecting licenses from 1 out of 1 package',
+              ),
             ).called(1);
             verify(
               () => progress.complete(
@@ -145,10 +147,14 @@ void main() {
             );
 
             verify(
-              () => progress.update('Collecting licenses of 0/2 packages.'),
+              () => progress.update(
+                'Collecting licenses from 1 out of 2 packages',
+              ),
             ).called(1);
             verify(
-              () => progress.update('Collecting licenses of 1/2 packages.'),
+              () => progress.update(
+                'Collecting licenses from 2 out of 2 packages',
+              ),
             ).called(1);
             verify(
               () => progress.complete(
@@ -196,10 +202,14 @@ void main() {
             verify(() => logger.err(errorMessage)).called(1);
 
             verify(
-              () => progress.update('Collecting licenses of 0/2 packages.'),
+              () => progress.update(
+                'Collecting licenses from 1 out of 2 packages',
+              ),
             ).called(1);
             verify(
-              () => progress.update('Collecting licenses of 1/2 packages.'),
+              () => progress.update(
+                'Collecting licenses from 2 out of 2 packages',
+              ),
             ).called(1);
             verify(
               () => progress.complete(
@@ -241,10 +251,14 @@ void main() {
             verify(() => logger.err(errorMessage)).called(1);
 
             verify(
-              () => progress.update('Collecting licenses of 0/2 packages.'),
+              () => progress.update(
+                'Collecting licenses from 1 out of 2 packages',
+              ),
             ).called(1);
             verify(
-              () => progress.update('Collecting licenses of 1/2 packages.'),
+              () => progress.update(
+                'Collecting licenses from 2 out of 2 packages',
+              ),
             ).called(1);
             verify(
               () => progress.complete(
@@ -296,10 +310,14 @@ void main() {
           ).called(1);
 
           verify(
-            () => progress.update('Collecting licenses of 0/2 packages.'),
+            () => progress.update(
+              'Collecting licenses from 1 out of 2 packages',
+            ),
           ).called(1);
           verify(
-            () => progress.update('Collecting licenses of 1/2 packages.'),
+            () => progress.update(
+              'Collecting licenses from 2 out of 2 packages',
+            ),
           ).called(1);
           verify(
             () => progress.complete(
@@ -382,7 +400,9 @@ void main() {
                 );
 
                 verify(
-                  () => progress.update('Collecting licenses of 0/1 packages.'),
+                  () => progress.update(
+                    'Collecting licenses from 1 out of 1 package',
+                  ),
                 ).called(1);
                 verify(
                   () => progress.complete(
@@ -431,7 +451,9 @@ void main() {
                 );
 
                 verify(
-                  () => progress.update('Collecting licenses of 0/1 packages.'),
+                  () => progress.update(
+                    'Collecting licenses from 1 out of 1 package',
+                  ),
                 ).called(1);
                 verify(
                   () => progress.complete(
@@ -481,7 +503,9 @@ void main() {
               );
 
               verify(
-                () => progress.update('Collecting licenses of 0/1 packages.'),
+                () => progress.update(
+                  'Collecting licenses from 1 out of 1 package',
+                ),
               ).called(1);
               verify(
                 () => progress.complete(
@@ -530,7 +554,9 @@ void main() {
               );
 
               verify(
-                () => progress.update('Collecting licenses of 0/1 packages.'),
+                () => progress.update(
+                  'Collecting licenses from 1 out of 1 package',
+                ),
               ).called(1);
               verify(
                 () => progress.complete(
@@ -583,13 +609,19 @@ void main() {
               );
 
               verify(
-                () => progress.update('Collecting licenses of 0/3 packages.'),
+                () => progress.update(
+                  'Collecting licenses from 1 out of 3 packages',
+                ),
               ).called(1);
               verify(
-                () => progress.update('Collecting licenses of 1/3 packages.'),
+                () => progress.update(
+                  'Collecting licenses from 2 out of 3 packages',
+                ),
               ).called(1);
               verify(
-                () => progress.update('Collecting licenses of 2/3 packages.'),
+                () => progress.update(
+                  'Collecting licenses from 3 out of 3 packages',
+                ),
               ).called(1);
               verify(
                 () => progress.complete(
@@ -936,7 +968,9 @@ void main() {
             );
 
             verify(
-              () => progress.update('Collecting licenses of 0/1 packages.'),
+              () => progress.update(
+                'Collecting licenses from 1 out of 1 package',
+              ),
             ).called(1);
             verify(
               () => progress.complete(