Skip to content

Commit

Permalink
improve output, make it pub global activatable
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Jan 8, 2025
1 parent 82ea46b commit 2d94fe5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
21 changes: 13 additions & 8 deletions pkgs/puppy/bin/for_all_package_dirs.dart
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
#!/usr/bin/env dart
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:io';

import 'package:io/ansi.dart';
import 'package:io/io.dart';

Future<void> main(List<String> args) async {
if (args.isEmpty) {
print('Need something to execute!');
exitCode = 1;
exitCode = ExitCode.usage.code;
return;
}

final exe = args.first;
final extraArgs = args.skip(1).toList();

Future<void> inspectDirectory(
Directory dir,
) async {
final exits = <String, int>{};

Future<void> inspectDirectory(Directory dir) async {
final pubspecs = dir
.listSync()
.whereType<File>()
.where((element) => element.uri.pathSegments.last == 'pubspec.yaml')
.toList();

if (pubspecs.isNotEmpty) {
print(dir.path);
print(green.wrap(dir.path));
final proc = await Process.start(
exe,
extraArgs,
mode: ProcessStartMode.inheritStdio,
workingDirectory: dir.path,
runInShell: true,
);

await proc.exitCode;
// TODO(kevmoo): display a summary of results on completion
exits[dir.path] = await proc.exitCode;
}

for (var subDir in dir.listSync().whereType<Directory>().where((element) =>
Expand Down
6 changes: 6 additions & 0 deletions pkgs/puppy/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ publish_to: none
environment:
sdk: ^3.6.0

dependencies:
io: ^1.0.5

dev_dependencies:
dart_flutter_team_lints: ^3.0.0

executables:
for_all_package_dirs:

0 comments on commit 2d94fe5

Please sign in to comment.