yes 0.1.0 copy "yes: ^0.1.0" to clipboard
yes: ^0.1.0 copied to clipboard

A package that constantly writes a string to an IOSink, simillarly to the UNIX yes utility.

example/yes_example.dart

import 'dart:async';
import 'dart:io';

import 'package:yes/yes.dart';

/// A clone of the unix `yes` utility.
void main(List<String> arguments) {
  // Parse the message to output, or use the default `y`.
  final String message;
  if (arguments.isEmpty) {
    message = 'y';
  } else {
    message = arguments[0];
  }

  // Start the yes operation.
  final controller = yes(stdout, message);

  // Stop on SIGINT.
  late final StreamSubscription sigintSubscription;
  sigintSubscription = ProcessSignal.sigint.watch().listen((_) {
    sigintSubscription.cancel();
    controller.cancel();
  });
}
1
likes
140
pub points
0%
popularity

Publisher

verified publisherhacker1024.tk

A package that constantly writes a string to an IOSink, simillarly to the UNIX yes utility.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on yes