You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// `very_good packages check licenses` command for checking packages licenses.
17
32
/// {@endtemplate}
@@ -42,6 +57,10 @@ class PackagesCheckLicensesCommand extends Command<int> {
42
57
'transitive':'Check for transitive dependencies.',
43
58
},
44
59
defaultsTo: ['direct-main'],
60
+
)
61
+
..addMultiOption(
62
+
'allowed',
63
+
help:'Whitelist of allowed licenses.',
45
64
);
46
65
}
47
66
@@ -69,6 +88,14 @@ class PackagesCheckLicensesCommand extends Command<int> {
69
88
70
89
final ignoreFailures = _argResults['ignore-failures'] asbool;
71
90
final dependencyTypes = _argResults['dependency-type'] asList<String>;
91
+
final allowedLicenses = _argResults['allowed'] asList<String>;
92
+
93
+
final invalidLicenses =_invalidLicenses(allowedLicenses);
94
+
if (invalidLicenses.isNotEmpty) {
95
+
_logger.warn(
96
+
'''Some ${styleItalic.wrap('allowed')} licenses failed to be recognized: ${invalidLicenses.stringify()}. Refer to the documentation for a list of valid licenses.''',
97
+
);
98
+
}
72
99
73
100
final target = _argResults.rest.length ==1? _argResults.rest[0] :'.';
74
101
final targetPath = path.normalize(Directory(target).absolute.path);
@@ -114,7 +141,7 @@ class PackagesCheckLicensesCommand extends Command<int> {
114
141
final licenses =<String, Set<String>?>{};
115
142
for (final dependency in filteredDependencies) {
116
143
progress.update(
117
-
'Collecting licenses of ${licenses.length}/${filteredDependencies.length} packages',
144
+
'Collecting licenses of ${licenses.length}/${filteredDependencies.length} packages.',
118
145
);
119
146
120
147
final dependencyName = dependency.package();
@@ -145,7 +172,21 @@ class PackagesCheckLicensesCommand extends Command<int> {
145
172
}
146
173
}
147
174
148
-
progress.complete(_composeReport(licenses));
175
+
final bannedDependencies = allowedLicenses.isNotEmpty
0 commit comments