diff --git a/bin/fix_imports.dart b/bin/fix_imports.dart index 98ef60b..14d10c3 100644 --- a/bin/fix_imports.dart +++ b/bin/fix_imports.dart @@ -91,9 +91,15 @@ void main(List 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 filePaths = argResults.rest; @@ -150,7 +156,7 @@ void main(List 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( diff --git a/bin/import_order.dart b/bin/import_order.dart index e77228a..cfc9e6a 100644 --- a/bin/import_order.dart +++ b/bin/import_order.dart @@ -84,9 +84,11 @@ void main(List args) { final newArgs = []; 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) { diff --git a/example/pubspec.yaml b/example/pubspec.yaml index e2bd3a5..22ea62b 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -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