cmd_plus 1.3.2 copy "cmd_plus: ^1.3.2" to clipboard
cmd_plus: ^1.3.2 copied to clipboard

A wrapper around dart:io Process, package:io and mason_logger to make it easier to run commands in dart scripts.

example/lib/main.dart

import 'package:cmd_plus/cmd_plus.dart';

Future<void> main() async {
  final cmdPlus = CmdPlus();

  final progress = cmdPlus.logger.progress('Running example');

  /// CmdPlus exposes mason_logger
  cmdPlus.logger.write('Hello World!');

  /// Do some long calculation (just to demonstrate the progress animations)
  await Future.delayed(
    Duration(seconds: 10),
  );

  /// Run any commands
  final result = await cmdPlus.run(
    'pwd',
    [],

    /// Running in detached mode, so the process will not automatically print
    /// the output.
    mode: CmdPlusMode.detached(),
  );

  /// Print the output of the process.
  cmdPlus.logger.write(result.output);

  progress.complete();

  await cmdPlus.close();
}
3
likes
140
pub points
64%
popularity

Publisher

verified publishermankeli.co

A wrapper around dart:io Process, package:io and mason_logger to make it easier to run commands in dart scripts.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

freezed, freezed_annotation, io, mason_logger, path

More

Packages that depend on cmd_plus