Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions bin/fix_imports.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,15 @@ void main(List<String> args) {

final bool verbose = argResults['verbose'] as bool;
final bool recursive = argResults['recursive'] as bool;
final bool checkMode = argResults['check'] as bool ||
argResults['dry-run'] as bool ||
argResults['set-exit-if-changed'] as bool;
final bool isCheck = argResults['check'] as bool;
final bool isDryRun = argResults['dry-run'] as bool;
final bool isSetExitIfChanged = argResults['set-exit-if-changed'] as bool;
final bool checkMode = isCheck || isDryRun || isSetExitIfChanged;
final String checkFlag = isCheck
? '--check'
: isDryRun
? '--dry-run'
: '--set-exit-if-changed';
final String? explicitProjectName = argResults['project-name'] as String?;
final List<String> filePaths = argResults.rest;

Expand Down Expand Up @@ -150,7 +156,7 @@ void main(List<String> args) {
print(
'\n📝 Summary: Found import ordering issues in ${errors.length} file(s).');
print(
'💡 To fix these issues, run the same command without --set-exit-if-changed');
'💡 To fix these issues, run the same command without $checkFlag');
exit(1);
} else {
print(
Expand Down
8 changes: 5 additions & 3 deletions bin/import_order.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ void main(List<String> args) {
final newArgs = <String>[];

if (argResults['verbose'] as bool) newArgs.add('--verbose');
if (argResults['set-exit-if-changed'] as bool ||
argResults['check'] as bool ||
argResults['dry-run'] as bool) {
if (argResults['check'] as bool) {
newArgs.add('--check');
} else if (argResults['dry-run'] as bool) {
newArgs.add('--dry-run');
} else if (argResults['set-exit-if-changed'] as bool) {
newArgs.add('--set-exit-if-changed');
}
if (projectName.isNotEmpty) {
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: '>=3.0.0 <4.0.0'
sdk: '>=3.9.0 <4.0.0'

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand Down
Loading