Skip to content

Commit

Permalink
Merge pull request #169 from DocumaticAI/output_flag
Browse files Browse the repository at this point in the history
feat: --output flag
  • Loading branch information
btr-rmconsole-1[bot] authored Jan 31, 2025
2 parents b05c711 + b4d7e73 commit aa470bb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 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,10 @@ Future<void> main(List<String> args) async {

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

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

0 comments on commit aa470bb

Please sign in to comment.