shell_cmd 0.2.7 copy "shell_cmd: ^0.2.7" to clipboard
shell_cmd: ^0.2.7 copied to clipboard

A library for running programs either explicitly or in shell

example/shell_cmd_example.dart

import 'dart:io';

import 'package:shell_cmd/shell_cmd.dart';

/// A showcase for the use of the package
///
Future<void> main() async {
  print('\nOS: ${Platform.operatingSystemVersion}');
  print('\nIsWindows: ${ShellCmd.isWindows}');
  print('\nDefShell: ${ShellCmd.resetShell()}');

  final cmdWin = 'echo. & echo %CD%';
  final cmdPsx = 'echo "" && echo `pwd`';
  final cmd = ShellCmd(ShellCmd.isWindows ? cmdWin : cmdPsx);
  final result = await cmd.run(runInShell: true);
  final status =
      (result.exitCode == 0 ? 'Success' : 'Error ${result.exitCode}');

  print('\nSplit - Exe: ${cmd.program}, Args: ${cmd.args}');
  print('\nCurDir:\n$status\n${result.stdout.toString()}***');
}
0
likes
160
pub points
57%
popularity

Publisher

verified publisheraiurovet.com

A library for running programs either explicitly or in shell

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

charcode, path, string_scanner

More

Packages that depend on shell_cmd