Skip to content

Commit

Permalink
feat: --output flag
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacharrisholt committed Jan 31, 2025
1 parent b05c711 commit 1bbfd66
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion bin/scip_dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import 'package:scip_dart/src/version.dart';

Future<void> main(List<String> args) async {
final result = (ArgParser()
..addOption(
'output',
abbr: 'o',
defaultsTo: 'index.scip',
help:
'The output file to write the index to. Use "-" to write to stdout',
)
..addFlag(
'performance',
aliases: ['perf'],
Expand Down Expand Up @@ -71,5 +78,11 @@ Future<void> main(List<String> args) async {

final index = await indexPackage(packageRoot, packageConfig, pubspec);

File('index.scip').writeAsBytesSync(index.writeToBuffer());
print(result['output']);
if (result['output'] as String == '-') {
stdout.add(index.writeToBuffer());
stdout.flush();
} else {
File(result['output'] as String).writeAsBytesSync(index.writeToBuffer());
}
}

0 comments on commit 1bbfd66

Please sign in to comment.