createDir method
Ensures that a directory exists, creating it if it doesn't.
Implementation
Directory createDir(String path) {
try {
final dir = Directory(path);
if (!dir.existsSync()) {
dir.createSync(recursive: true);
}
return dir;
} catch (e) {
throw CliException('Failed to create directory at $path', e);
}
}