google / google/grinder.dart

I can not get stdin to work with `grind`

Open
#309 8 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Dart
Stars
266
Forks
36
Avg merge
23h 25m
Merged PRs (30d)
2

Description

I have this task:

``` dart
#!/usr/bin/env dart
import 'package:git/git.dart';
import 'package:grinder/grinder.dart';

...

@Task()
Future createComponent() async {
await stdin
.map(SYSTEM_ENCODING.decode)
.map((s) => s.trim())
.forEach((component) async {
new File('lib/components/$component.scss')..createSync();
new File('lib/components/$component.html')..createSync();
new File('lib/components/$component.dart')
..createSync()
..writeAsStringSync('''
import 'package:angular2/core.dart';

@Component(
selector: '${component.replaceAll('_', '-')}',
templateUrl: '$component.html',
styleUrls: const ['$component.css']
)
class ${component.split('_').map((s) => s[0].toUpperCase() + s.substring(1)).join('')} {}
''');
await runGit(['add', '--all']);
});
}
```

For some reason this only works I have run the task like:
`tool/grind.dart create-component`
and not if I run it like:
`grind create-component`

Not sure if this is a `pub` bug or a grinder bug.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.