run method
Implementation
@override
String? run(ParsedInputs inputs, List<String> args) {
final shell = inputs.valueOf(shellInput);
final path = inputs.valueOf(pathInput) ?? '';
final extension = _extensionFor(shell);
if (path.isNotEmpty && !_isValidPath(path, extension)) {
throw MambaException(
'When shell is ${shell.name} the path must end in $extension and must have ${registryRecord.name} in the file name',
);
}
// The generated script is built before the destination is touched, so a
// rejected invocation never leaves a half-written artifact behind.
final contents = _completionFor(shell);
if (path.isEmpty && identical(createFile, _writeToFile)) {
throw MambaException(
'A destination path is required to write ${shell.name} completions.',
);
}
createFile(path, contents);
return 'Created completion ${shell.name} in $path';
}