run method

  1. @override
String run(
  1. ParsedInputs inputs,
  2. List<String> args
)
override

Implementation

@override
String run(ParsedInputs inputs, List<String> args) {
  final name = inputs.valueOf(binaryName);
  final file = File(
    '${_parentDirectory.path}${Platform.pathSeparator}bin'
    '${Platform.pathSeparator}$name.dart',
  );

  if (file.existsSync()) {
    throw MambaException('Cannot create $name: the file already exists.');
  }

  file.parent.createSync(recursive: true);
  file.writeAsStringSync(
    _executableSource(name, 'A command-line application.'),
  );
  _sourceFormatter.formatSource(file.path);

  return 'Created executable in ${file.path}.';
}